@atlaskit/select 18.8.1 → 18.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/codemods/18.3.0-select-props.tsx +0 -1
  3. package/codemods/__tests__/next-select-props.tsx +0 -7
  4. package/dist/cjs/PopupSelect/PopupSelect.js +32 -35
  5. package/dist/cjs/PopupSelect/components.js +0 -4
  6. package/dist/cjs/Select.js +1 -1
  7. package/dist/cjs/components/input-options.js +9 -12
  8. package/dist/cjs/createSelect.js +7 -37
  9. package/dist/cjs/utils/grouped-options-announcement.js +4 -0
  10. package/dist/es2019/PopupSelect/PopupSelect.js +4 -4
  11. package/dist/es2019/PopupSelect/components.js +0 -2
  12. package/dist/es2019/Select.js +1 -1
  13. package/dist/es2019/createSelect.js +7 -36
  14. package/dist/es2019/utils/grouped-options-announcement.js +4 -0
  15. package/dist/esm/PopupSelect/PopupSelect.js +32 -35
  16. package/dist/esm/PopupSelect/components.js +0 -4
  17. package/dist/esm/Select.js +1 -1
  18. package/dist/esm/components/input-options.js +9 -12
  19. package/dist/esm/createSelect.js +8 -38
  20. package/dist/esm/utils/grouped-options-announcement.js +4 -0
  21. package/dist/types/PopupSelect/PopupSelect.d.ts +0 -1
  22. package/dist/types/PopupSelect/components.d.ts +1 -2
  23. package/dist/types/index.d.ts +1 -1
  24. package/dist/types/types.d.ts +2 -2
  25. package/dist/types-ts4.5/PopupSelect/PopupSelect.d.ts +0 -1
  26. package/dist/types-ts4.5/PopupSelect/components.d.ts +1 -2
  27. package/dist/types-ts4.5/index.d.ts +1 -1
  28. package/dist/types-ts4.5/types.d.ts +2 -2
  29. package/package.json +5 -4
  30. package/types/package.json +17 -0
  31. package/dist/cjs/components/index.js +0 -96
  32. package/dist/cjs/components/indicators.js +0 -82
  33. package/dist/cjs/components/input-aria-describedby.js +0 -23
  34. package/dist/cjs/components/no-options.js +0 -18
  35. package/dist/es2019/components/index.js +0 -71
  36. package/dist/es2019/components/indicators.js +0 -68
  37. package/dist/es2019/components/input-aria-describedby.js +0 -16
  38. package/dist/es2019/components/no-options.js +0 -11
  39. package/dist/esm/components/index.js +0 -69
  40. package/dist/esm/components/indicators.js +0 -75
  41. package/dist/esm/components/input-aria-describedby.js +0 -16
  42. package/dist/esm/components/no-options.js +0 -11
  43. package/dist/types/components/index.d.ts +0 -15
  44. package/dist/types/components/indicators.d.ts +0 -9
  45. package/dist/types/components/input-aria-describedby.d.ts +0 -4
  46. package/dist/types/components/no-options.d.ts +0 -6
  47. package/dist/types-ts4.5/components/index.d.ts +0 -15
  48. package/dist/types-ts4.5/components/indicators.d.ts +0 -9
  49. package/dist/types-ts4.5/components/input-aria-describedby.d.ts +0 -4
  50. package/dist/types-ts4.5/components/no-options.d.ts +0 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atlaskit/select
2
2
 
3
+ ## 18.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#177875](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/177875)
8
+ [`d0c3d27216b7c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d0c3d27216b7c) -
9
+ Remove theme prop and merge customized components for performance
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 18.8.2
16
+
17
+ ### Patch Changes
18
+
19
+ - [#174375](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/174375)
20
+ [`89790d380dd8c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/89790d380dd8c) -
21
+ Restore aria-live messages for PopupSelect
22
+
3
23
  ## 18.8.1
4
24
 
5
25
  ### Patch Changes
@@ -64,7 +64,6 @@ function updateSelectProps(j: core.JSCodeshift, source: ReturnType<typeof j>, va
64
64
  'isRTL',
65
65
  'menuShouldBlockScroll',
66
66
  'screenReaderStatus',
67
- 'theme',
68
67
  ];
69
68
 
70
69
  const propsToReplace = {
@@ -22,7 +22,6 @@ describe('Update Select props', () => {
22
22
  isRTL={true}
23
23
  menuShouldBlockScroll={true}
24
24
  screenReaderStatus={''}
25
- theme={{}}
26
25
  />
27
26
  );
28
27
  };
@@ -54,7 +53,6 @@ describe('Update Select props', () => {
54
53
  isRTL={true}
55
54
  menuShouldBlockScroll={true}
56
55
  screenReaderStatus={''}
57
- theme={{}}
58
56
  />
59
57
  );
60
58
  };
@@ -73,7 +71,6 @@ describe('Update Select props', () => {
73
71
  isRTL={true}
74
72
  menuShouldBlockScroll={true}
75
73
  screenReaderStatus={''}
76
- theme={{}}
77
74
  />
78
75
  );
79
76
  };
@@ -108,7 +105,6 @@ describe('Update Select props', () => {
108
105
  isRTL={true}
109
106
  menuShouldBlockScroll={true}
110
107
  screenReaderStatus={''}
111
- theme={{}}
112
108
  />
113
109
  );
114
110
  };
@@ -247,7 +243,6 @@ describe('Update Select props', () => {
247
243
  isRTL={true}
248
244
  menuShouldBlockScroll={true}
249
245
  screenReaderStatus={''}
250
- theme={{}}
251
246
  />
252
247
  );
253
248
  };
@@ -264,7 +259,6 @@ describe('Update Select props', () => {
264
259
  isRTL={true}
265
260
  menuShouldBlockScroll={true}
266
261
  screenReaderStatus={''}
267
- theme={{}}
268
262
  />
269
263
  );
270
264
  };
@@ -289,7 +283,6 @@ describe('Update Select props', () => {
289
283
  isRTL={true}
290
284
  menuShouldBlockScroll={true}
291
285
  screenReaderStatus={''}
292
- theme={{}}
293
286
  />
294
287
  );
295
288
  };
@@ -10,10 +10,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
14
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
16
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
18
17
  var _react = _interopRequireWildcard(require("react"));
19
18
  var _bindEventListener = require("bind-event-listener");
@@ -33,7 +32,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
33
32
  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; }
34
33
  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; }
35
34
  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; }
36
- 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); }; }
35
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
37
36
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
38
37
  /**
39
38
  * Are we rendering on the client or server?
@@ -75,8 +74,6 @@ var isEmpty = function isEmpty(obj) {
75
74
 
76
75
  // eslint-disable-next-line @repo/internal/react/no-class-components
77
76
  var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
78
- (0, _inherits2.default)(PopupSelect, _PureComponent);
79
- var _super = _createSuper(PopupSelect);
80
77
  function PopupSelect() {
81
78
  var _this$defaultOpenStat;
82
79
  var _this;
@@ -84,22 +81,22 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
84
81
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
85
82
  args[_key] = arguments[_key];
86
83
  }
87
- _this = _super.call.apply(_super, [this].concat(args));
88
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "menuRef", null);
89
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectRef", null);
90
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "targetRef", null);
91
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowClick", null);
92
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowKeydown", null);
93
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "defaultStyles", {
84
+ _this = _callSuper(this, PopupSelect, [].concat(args));
85
+ (0, _defineProperty2.default)(_this, "menuRef", null);
86
+ (0, _defineProperty2.default)(_this, "selectRef", null);
87
+ (0, _defineProperty2.default)(_this, "targetRef", null);
88
+ (0, _defineProperty2.default)(_this, "unbindWindowClick", null);
89
+ (0, _defineProperty2.default)(_this, "unbindWindowKeydown", null);
90
+ (0, _defineProperty2.default)(_this, "defaultStyles", {
94
91
  groupHeading: function groupHeading(provided) {
95
92
  return _objectSpread(_objectSpread({}, provided), {}, {
96
93
  color: "var(--ds-text-subtlest, ".concat(_colors.N80, ")")
97
94
  });
98
95
  }
99
96
  });
100
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isOpenControlled", _this.props.isOpen !== undefined);
101
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "defaultOpenState", _this.isOpenControlled ? _this.props.isOpen : _this.props.defaultIsOpen);
102
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
97
+ (0, _defineProperty2.default)(_this, "isOpenControlled", _this.props.isOpen !== undefined);
98
+ (0, _defineProperty2.default)(_this, "defaultOpenState", _this.isOpenControlled ? _this.props.isOpen : _this.props.defaultIsOpen);
99
+ (0, _defineProperty2.default)(_this, "state", {
103
100
  focusLockEnabled: false,
104
101
  isOpen: (_this$defaultOpenStat = _this.defaultOpenState) !== null && _this$defaultOpenStat !== void 0 ? _this$defaultOpenStat : false,
105
102
  mergedComponents: _components.defaultComponents,
@@ -107,7 +104,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
107
104
  });
108
105
  // Event Handlers
109
106
  // ==============================
110
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleTargetKeyDown", function (event) {
107
+ (0, _defineProperty2.default)(_this, "handleTargetKeyDown", function (event) {
111
108
  switch (event.key) {
112
109
  case 'ArrowDown':
113
110
  _this.open();
@@ -115,7 +112,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
115
112
  default:
116
113
  }
117
114
  });
118
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeyDown", function (event) {
115
+ (0, _defineProperty2.default)(_this, "handleKeyDown", function (event) {
119
116
  //We shouldn't close PopupSelect on tab event if there are custom interactive element.
120
117
  var tabEvent = event.key === 'Tab' && event.shiftKey || event.key === 'Tab';
121
118
  if (_this.props.shouldCloseMenuOnTab && tabEvent) {
@@ -135,7 +132,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
135
132
  _this.props.onKeyDown(event);
136
133
  }
137
134
  });
138
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function (_ref) {
135
+ (0, _defineProperty2.default)(_this, "handleClick", function (_ref) {
139
136
  var target = _ref.target;
140
137
  var isOpen = _this.state.isOpen;
141
138
  // appease flow
@@ -156,7 +153,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
156
153
  _this.open();
157
154
  }
158
155
  });
159
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleSelectChange", function (value, actionMeta) {
156
+ (0, _defineProperty2.default)(_this, "handleSelectChange", function (value, actionMeta) {
160
157
  var _this$props = _this.props,
161
158
  closeMenuOnSelect = _this$props.closeMenuOnSelect,
162
159
  onChange = _this$props.onChange;
@@ -167,7 +164,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
167
164
  onChange(value, actionMeta);
168
165
  }
169
166
  });
170
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleFirstPopperUpdate", function () {
167
+ (0, _defineProperty2.default)(_this, "handleFirstPopperUpdate", function () {
171
168
  // When the popup opens it's focused into. Since the popup is inside a portal, it's position is
172
169
  // initially set to 0,0 - this causes the window scroll position to jump to the top. To prevent
173
170
  // this we defer enabling the focus-lock until after Popper has positioned the popup the first time.
@@ -182,7 +179,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
182
179
  *
183
180
  * @param options.controlOverride - Force the popup to open when it's open state is being controlled
184
181
  */
185
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "open", function (options) {
182
+ (0, _defineProperty2.default)(_this, "open", function (options) {
186
183
  var _this$props2 = _this.props,
187
184
  onOpen = _this$props2.onOpen,
188
185
  onMenuOpen = _this$props2.onMenuOpen;
@@ -220,7 +217,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
220
217
  *
221
218
  * @param options.controlOverride - Force the popup to close when it's open state is being controlled
222
219
  */
223
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "close", function (options) {
220
+ (0, _defineProperty2.default)(_this, "close", function (options) {
224
221
  var _this$unbindWindowKey, _this2;
225
222
  //@ts-ignore react-select unsupported props
226
223
  var _this$props3 = _this.props,
@@ -253,7 +250,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
253
250
  });
254
251
  // Refs
255
252
  // ==============================
256
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resolveTargetRef", function (popperRef) {
253
+ (0, _defineProperty2.default)(_this, "resolveTargetRef", function (popperRef) {
257
254
  return function (ref) {
258
255
  // avoid thrashing fn calls
259
256
  if (!_this.targetRef && popperRef && ref) {
@@ -266,7 +263,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
266
263
  }
267
264
  };
268
265
  });
269
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resolveMenuRef", function (popperRef) {
266
+ (0, _defineProperty2.default)(_this, "resolveMenuRef", function (popperRef) {
270
267
  return function (ref) {
271
268
  _this.menuRef = ref;
272
269
  if (typeof popperRef === 'function') {
@@ -276,14 +273,14 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
276
273
  }
277
274
  };
278
275
  });
279
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSelectRef", function (ref) {
276
+ (0, _defineProperty2.default)(_this, "getSelectRef", function (ref) {
280
277
  _this.selectRef = ref;
281
278
  });
282
279
  // Utils
283
280
  // ==============================
284
281
  // account for groups when counting options
285
282
  // this may need to be recursive, right now it just counts one level
286
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getItemCount", function () {
283
+ (0, _defineProperty2.default)(_this, "getItemCount", function () {
287
284
  var options = _this.props.options;
288
285
  var count = 0;
289
286
  options.forEach(function (groupOrOption) {
@@ -297,7 +294,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
297
294
  });
298
295
  return count;
299
296
  });
300
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getMaxHeight", function () {
297
+ (0, _defineProperty2.default)(_this, "getMaxHeight", function () {
301
298
  var _this$selectRef$selec2;
302
299
  var maxMenuHeight = _this.props.maxMenuHeight;
303
300
  if (!_this.selectRef) {
@@ -312,7 +309,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
312
309
  return maxHeight;
313
310
  });
314
311
  // if the threshold is exceeded, AND isSearchable is true, then display the search control
315
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "showSearchControl", function () {
312
+ (0, _defineProperty2.default)(_this, "showSearchControl", function () {
316
313
  var _this$props4 = _this.props,
317
314
  searchThreshold = _this$props4.searchThreshold,
318
315
  isSearchable = _this$props4.isSearchable;
@@ -320,7 +317,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
320
317
  });
321
318
  // Renderers
322
319
  // ==============================
323
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderSelect", function (id) {
320
+ (0, _defineProperty2.default)(_this, "renderSelect", function (id) {
324
321
  var _this$props5 = _this.props,
325
322
  footer = _this$props5.footer,
326
323
  label = _this$props5.label,
@@ -373,7 +370,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
373
370
  return option === focused;
374
371
  })) !== null && _options$findIndex !== void 0 ? _options$findIndex : 0;
375
372
  var optionName = typeof (props === null || props === void 0 ? void 0 : props.getOptionLabel) === 'function' ? props.getOptionLabel(focused) : focused.label;
376
- var ariaLabelText = "Option ".concat(optionName, " focused, ").concat(optionIndex + 1, " of ").concat(totalLength, ".\n\t\t\t").concat(totalLength, " results available.\n\t\t\t").concat(ariaLabelSuffix, "\n\t\t\t");
373
+ var ariaLabelText = (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? "".concat(optionName) : "Option ".concat(optionName, " focused, ").concat(optionIndex + 1, " of ").concat(totalLength, ".\n\t\t\t").concat(totalLength, " results available.\n\t\t\t").concat(ariaLabelSuffix, "\n\t\t\t");
377
374
  // Option LABEL focused, 1 of 8. 8 results available.
378
375
  // Use Up and Down to choose options, press Enter to select the currently focused option,
379
376
  // press Escape to exit the menu.
@@ -381,7 +378,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
381
378
  };
382
379
  var onReactSelectFocus = function onReactSelectFocus(onFocusProps) {
383
380
  var _props$options;
384
- var ariaLabelSuffix = ' Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu.';
381
+ var ariaLabelSuffix = (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? '' : ' Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu.';
385
382
  var ariaLabelText = '';
386
383
  var ariaLiveMessage = '';
387
384
  if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
@@ -445,17 +442,18 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
445
442
  maxMenuHeight: _this.getMaxHeight(),
446
443
  components: selectComponents,
447
444
  onChange: _this.handleSelectChange,
448
- ariaLiveMessages: !showSearchControl ? _objectSpread({
445
+ ariaLiveMessages: _objectSpread({
449
446
  // Overwriting ariaLiveMessages builtin onFocus method to announce selected option when popup has been opened
450
447
  onFocus: onReactSelectFocus
451
- }, props.ariaLiveMessages) : props.ariaLiveMessages
448
+ }, props.ariaLiveMessages)
452
449
  })), footer));
453
450
  });
454
451
  return mergedPopperProps.strategy === 'fixed' ? popper : /*#__PURE__*/(0, _reactDom.createPortal)(popper, portalDestination);
455
452
  });
456
453
  return _this;
457
454
  }
458
- (0, _createClass2.default)(PopupSelect, [{
455
+ (0, _inherits2.default)(PopupSelect, _PureComponent);
456
+ return (0, _createClass2.default)(PopupSelect, [{
459
457
  key: "componentDidMount",
460
458
  value: function componentDidMount() {
461
459
  if (typeof window === 'undefined') {
@@ -542,7 +540,6 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
542
540
  return null;
543
541
  }
544
542
  }]);
545
- return PopupSelect;
546
543
  }(_react.PureComponent);
547
544
  (0, _defineProperty2.default)(PopupSelect, "defaultProps", {
548
545
  closeMenuOnSelect: true,
@@ -108,9 +108,6 @@ var Menu = function Menu(_ref3) {
108
108
  innerProps = _ref3.innerProps;
109
109
  return (0, _react2.jsx)("div", innerProps, children);
110
110
  };
111
- var IndicatorSeparator = function IndicatorSeparator(props) {
112
- return (0, _react2.jsx)(_reactSelect.components.IndicatorSeparator, props);
113
- };
114
111
  var ClearIndicator = function ClearIndicator(props) {
115
112
  return (0, _react2.jsx)(_reactSelect.components.ClearIndicator, props);
116
113
  };
@@ -121,7 +118,6 @@ var defaultComponents = exports.defaultComponents = {
121
118
  Control: Control,
122
119
  DropdownIndicator: DropdownIndicator,
123
120
  Menu: Menu,
124
- IndicatorSeparator: IndicatorSeparator,
125
121
  ClearIndicator: ClearIndicator,
126
122
  MultiValueRemove: MultiValueRemove
127
123
  };
@@ -11,7 +11,7 @@ var _createSelect = _interopRequireDefault(require("./createSelect"));
11
11
  /* eslint-disable @repo/internal/react/require-jsdoc */
12
12
 
13
13
  var packageName = "@atlaskit/select";
14
- var packageVersion = "18.8.1";
14
+ var packageVersion = "18.9.0";
15
15
  var SelectWithoutAnalytics = exports.SelectWithoutAnalytics = (0, _createSelect.default)(_async.default);
16
16
  var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
17
17
  var Select = (0, _analyticsNext.withAnalyticsContext)({
@@ -10,10 +10,9 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
14
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
16
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
18
17
  var _react = require("react");
19
18
  var _react2 = require("@emotion/react");
@@ -24,7 +23,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
23
  var _colors = require("@atlaskit/theme/colors");
25
24
  var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
26
25
  var _excluded = ["getStyles", "Icon", "children", "innerProps", "innerRef"];
27
- 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); }; }
26
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
28
27
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
29
28
  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; }
30
29
  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; } /**
@@ -151,36 +150,35 @@ var baseOptionStyles = (0, _react2.css)({
151
150
  });
152
151
  // eslint-disable-next-line @repo/internal/react/no-class-components
153
152
  var ControlOption = /*#__PURE__*/function (_Component) {
154
- (0, _inherits2.default)(ControlOption, _Component);
155
- var _super = _createSuper(ControlOption);
156
153
  function ControlOption() {
157
154
  var _this;
158
155
  (0, _classCallCheck2.default)(this, ControlOption);
159
156
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
160
157
  args[_key] = arguments[_key];
161
158
  }
162
- _this = _super.call.apply(_super, [this].concat(args));
163
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
159
+ _this = _callSuper(this, ControlOption, [].concat(args));
160
+ (0, _defineProperty2.default)(_this, "state", {
164
161
  isActive: false
165
162
  });
166
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseDown", function () {
163
+ (0, _defineProperty2.default)(_this, "onMouseDown", function () {
167
164
  return _this.setState({
168
165
  isActive: true
169
166
  });
170
167
  });
171
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseUp", function () {
168
+ (0, _defineProperty2.default)(_this, "onMouseUp", function () {
172
169
  return _this.setState({
173
170
  isActive: false
174
171
  });
175
172
  });
176
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseLeave", function () {
173
+ (0, _defineProperty2.default)(_this, "onMouseLeave", function () {
177
174
  return _this.setState({
178
175
  isActive: false
179
176
  });
180
177
  });
181
178
  return _this;
182
179
  }
183
- (0, _createClass2.default)(ControlOption, [{
180
+ (0, _inherits2.default)(ControlOption, _Component);
181
+ return (0, _createClass2.default)(ControlOption, [{
184
182
  key: "render",
185
183
  value: function render() {
186
184
  var _this$props = this.props,
@@ -246,7 +244,6 @@ var ControlOption = /*#__PURE__*/function (_Component) {
246
244
  );
247
245
  }
248
246
  }]);
249
- return ControlOption;
250
247
  }(_react.Component);
251
248
  var NewCheckboxIcon = function NewCheckboxIcon(props) {
252
249
  return (
@@ -11,11 +11,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
11
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
- var _components = require("./components");
15
- var _inputAriaDescribedby = require("./components/input-aria-describedby");
16
- var _noOptions = require("./components/no-options");
17
14
  var _groupedOptionsAnnouncement = require("./utils/grouped-options-announcement");
18
- var _excluded = ["ariaLiveMessages", "components", "isInvalid", "onClickPreventDefault", "tabSelectsValue", "validationState"];
15
+ var _excluded = ["ariaLiveMessages", "isInvalid", "onClickPreventDefault", "tabSelectsValue", "validationState"];
19
16
  /* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
20
17
  // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
21
18
  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); }
@@ -25,7 +22,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
25
22
  function createSelect(WrappedComponent) {
26
23
  var AtlaskitSelect = /*#__PURE__*/(0, _react.forwardRef)(function AtlaskitSelect(props, forwardedRef) {
27
24
  var ariaLiveMessages = props.ariaLiveMessages,
28
- componentsProp = props.components,
29
25
  isInvalid = props.isInvalid,
30
26
  _props$onClickPrevent = props.onClickPreventDefault,
31
27
  onClickPreventDefault = _props$onClickPrevent === void 0 ? true : _props$onClickPrevent,
@@ -35,31 +31,6 @@ function createSelect(WrappedComponent) {
35
31
  validationState = _props$validationStat === void 0 ? 'default' : _props$validationStat,
36
32
  restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
37
33
  var internalSelectRef = (0, _react.useRef)(null);
38
- var components = (0, _react.useMemo)(function () {
39
- return _objectSpread({
40
- ClearIndicator: _components.ClearIndicator,
41
- DropdownIndicator: _components.DropdownIndicator,
42
- LoadingIndicator: _components.LoadingIndicator,
43
- MultiValueRemove: _components.MultiValueRemove,
44
- IndicatorSeparator: _components.IndicatorSeparator,
45
- Input: _inputAriaDescribedby.Input,
46
- NoOptionsMessage: _noOptions.NoOptionsMessage
47
- }, componentsProp);
48
- }, [componentsProp]);
49
- var descriptionId = props['aria-describedby'] || props['descriptionId'];
50
- var isSearchable = props.isSearchable;
51
- (0, _react.useEffect)(function () {
52
- if (!isSearchable && descriptionId) {
53
- var _internalSelectRef$cu;
54
- // when isSearchable is false, react-select will create its own dummy input instead of using ours,
55
- // so we need to manually add the additional aria-describedby using ref.
56
- var input = (_internalSelectRef$cu = internalSelectRef.current) === null || _internalSelectRef$cu === void 0 ? void 0 : _internalSelectRef$cu.inputRef;
57
- var ariaDescribedby = input === null || input === void 0 ? void 0 : input.getAttribute('aria-describedby');
58
- if (!(ariaDescribedby !== null && ariaDescribedby !== void 0 && ariaDescribedby.includes(descriptionId))) {
59
- input === null || input === void 0 || input.setAttribute('aria-describedby', "".concat(ariaDescribedby, " ").concat(descriptionId));
60
- }
61
- }
62
- }, [descriptionId, isSearchable]);
63
34
 
64
35
  /**
65
36
  * The following `useImperativeHandle` hook exists for the sake of backwards compatibility.
@@ -72,12 +43,12 @@ function createSelect(WrappedComponent) {
72
43
  return {
73
44
  select: internalSelectRef.current,
74
45
  focus: function focus() {
75
- var _internalSelectRef$cu2;
76
- return (_internalSelectRef$cu2 = internalSelectRef.current) === null || _internalSelectRef$cu2 === void 0 ? void 0 : _internalSelectRef$cu2.focus();
46
+ var _internalSelectRef$cu;
47
+ return (_internalSelectRef$cu = internalSelectRef.current) === null || _internalSelectRef$cu === void 0 ? void 0 : _internalSelectRef$cu.focus();
77
48
  },
78
49
  blur: function blur() {
79
- var _internalSelectRef$cu3;
80
- return (_internalSelectRef$cu3 = internalSelectRef.current) === null || _internalSelectRef$cu3 === void 0 ? void 0 : _internalSelectRef$cu3.blur();
50
+ var _internalSelectRef$cu2;
51
+ return (_internalSelectRef$cu2 = internalSelectRef.current) === null || _internalSelectRef$cu2 === void 0 ? void 0 : _internalSelectRef$cu2.blur();
81
52
  }
82
53
  };
83
54
  }, []);
@@ -86,7 +57,8 @@ function createSelect(WrappedComponent) {
86
57
  "aria-live": (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? undefined : 'assertive',
87
58
  ariaLiveMessages:
88
59
  // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
89
- (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? undefined : (0, _groupedOptionsAnnouncement.isOptionsGrouped)(props.options) ? _objectSpread({
60
+ //TO DO: Still need live region for PopupSelect because of the menu being open by default
61
+ (0, _groupedOptionsAnnouncement.isOptionsGrouped)(props.options) ? _objectSpread({
90
62
  onFocus: function onFocus(data) {
91
63
  return (0, _groupedOptionsAnnouncement.onFocus)(data, props.options);
92
64
  }
@@ -95,10 +67,8 @@ function createSelect(WrappedComponent) {
95
67
  onClickPreventDefault: onClickPreventDefault,
96
68
  isInvalid: isInvalid || validationState === 'error'
97
69
  }, restProps, {
98
- components: components
99
70
  // indicates react-select to be async by default using the base Select component
100
71
  // so that makers can pass all async props on the base select to async load options.
101
- ,
102
72
  isAsync: true
103
73
  }));
104
74
  });
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isOptionsGrouped = exports.countAllOptions = void 0;
7
7
  exports.onFocus = onFocus;
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
9
  // Used for overwriting ariaLiveMessages builtin onFocus method.
9
10
  // Returns custom built string while focusing each group option. This string is used for screen reader announcement.
10
11
  function onFocus(onFocusProps, defaultOptions) {
@@ -18,6 +19,9 @@ function onFocus(onFocusProps, defaultOptions) {
18
19
  return (_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.some(isOptionFocused);
19
20
  });
20
21
  var groupOptionIndex = (_groupData$options$fi = groupData === null || groupData === void 0 ? void 0 : groupData.options.findIndex(isOptionFocused)) !== null && _groupData$options$fi !== void 0 ? _groupData$options$fi : 0;
22
+ if (focused.label && groupData !== null && groupData !== void 0 && groupData.label && (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement')) {
23
+ return "".concat(focused.label, ", ").concat(groupData === null || groupData === void 0 ? void 0 : groupData.label);
24
+ }
21
25
  return "Option ".concat(focused.label, ", ").concat(groupData === null || groupData === void 0 ? void 0 : groupData.label, " group, item ").concat(groupOptionIndex + 1, " out of ").concat(groupData === null || groupData === void 0 ? void 0 : groupData.options.length, ". All in all ");
22
26
  }
23
27
 
@@ -348,7 +348,7 @@ export default class PopupSelect extends PureComponent {
348
348
  const totalLength = options === null || options === void 0 ? void 0 : options.length;
349
349
  const optionIndex = (_options$findIndex = options === null || options === void 0 ? void 0 : options.findIndex(option => option === focused)) !== null && _options$findIndex !== void 0 ? _options$findIndex : 0;
350
350
  const optionName = typeof (props === null || props === void 0 ? void 0 : props.getOptionLabel) === 'function' ? props.getOptionLabel(focused) : focused.label;
351
- const ariaLabelText = `Option ${optionName} focused, ${optionIndex + 1} of ${totalLength}.
351
+ const ariaLabelText = fg('design_system_select-a11y-improvement') ? `${optionName}` : `Option ${optionName} focused, ${optionIndex + 1} of ${totalLength}.
352
352
  ${totalLength} results available.
353
353
  ${ariaLabelSuffix}
354
354
  `;
@@ -359,7 +359,7 @@ export default class PopupSelect extends PureComponent {
359
359
  };
360
360
  const onReactSelectFocus = onFocusProps => {
361
361
  var _props$options;
362
- const ariaLabelSuffix = ' Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu.';
362
+ const ariaLabelSuffix = fg('design_system_select-a11y-improvement') ? '' : ' Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu.';
363
363
  let ariaLabelText = '';
364
364
  let ariaLiveMessage = '';
365
365
  if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
@@ -423,11 +423,11 @@ export default class PopupSelect extends PureComponent {
423
423
  maxMenuHeight: this.getMaxHeight(),
424
424
  components: selectComponents,
425
425
  onChange: this.handleSelectChange,
426
- ariaLiveMessages: !showSearchControl ? {
426
+ ariaLiveMessages: {
427
427
  // Overwriting ariaLiveMessages builtin onFocus method to announce selected option when popup has been opened
428
428
  onFocus: onReactSelectFocus,
429
429
  ...props.ariaLiveMessages // priority to use user handlers if provided
430
- } : props.ariaLiveMessages
430
+ }
431
431
  })), footer)));
432
432
  return mergedPopperProps.strategy === 'fixed' ? popper : /*#__PURE__*/createPortal(popper, portalDestination);
433
433
  });
@@ -94,14 +94,12 @@ const Menu = ({
94
94
  children,
95
95
  innerProps
96
96
  }) => jsx("div", innerProps, children);
97
- const IndicatorSeparator = props => jsx(components.IndicatorSeparator, props);
98
97
  const ClearIndicator = props => jsx(components.ClearIndicator, props);
99
98
  const MultiValueRemove = props => jsx(components.MultiValueRemove, props);
100
99
  export const defaultComponents = {
101
100
  Control,
102
101
  DropdownIndicator,
103
102
  Menu,
104
- IndicatorSeparator,
105
103
  ClearIndicator,
106
104
  MultiValueRemove
107
105
  };
@@ -3,7 +3,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
3
3
  import AsyncSelect from '@atlaskit/react-select/async';
4
4
  import createSelect from './createSelect';
5
5
  const packageName = "@atlaskit/select";
6
- const packageVersion = "18.8.1";
6
+ const packageVersion = "18.9.0";
7
7
  export const SelectWithoutAnalytics = createSelect(AsyncSelect);
8
8
  const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
9
9
  const Select = withAnalyticsContext({