@atlaskit/user-picker 10.2.2 → 10.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/user-picker
2
2
 
3
+ ## 10.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`17aec239f54`](https://bitbucket.org/atlassian/atlassian-frontend/commits/17aec239f54) - [ux] aria-describedby and aria-labelledby proper association in between input and placeholder
8
+
9
+ ## 10.2.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`e8dbb0a281b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e8dbb0a281b) - add a11y support for alert messages
14
+
3
15
  ## 10.2.2
4
16
 
5
17
  ### Patch Changes
@@ -24,6 +24,8 @@ var _batch = require("./batch");
24
24
  var _i18n = require("./i18n");
25
25
  var _utils = require("./utils");
26
26
  var _ufoExperiences = require("../util/ufoExperiences");
27
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
28
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
27
29
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
28
30
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
29
31
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
@@ -412,6 +414,17 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
412
414
  this.optionsShownUfoExperienceInstance.success();
413
415
  }
414
416
  }
417
+ }, {
418
+ key: "ariaProps",
419
+ get: function get() {
420
+ var ariaLabels = Object.keys(this.props).filter(function (key) {
421
+ return key.startsWith('aria-');
422
+ });
423
+ var props = _objectSpread({}, this.props);
424
+ return ariaLabels.reduce(function (obj, key) {
425
+ return _objectSpread(_objectSpread({}, obj), {}, (0, _defineProperty2.default)({}, key, props[key]));
426
+ }, {});
427
+ }
415
428
  }, {
416
429
  key: "render",
417
430
  value: function render() {
@@ -499,7 +512,7 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
499
512
  onKeyDown: this.handleKeyDown,
500
513
  maxPickerHeight: maxPickerHeight,
501
514
  textFieldBackgroundColor: textFieldBackgroundColor
502
- }, pickerProps));
515
+ }, this.ariaProps, pickerProps));
503
516
  }
504
517
  }], [{
505
518
  key: "getDerivedStateFromProps",
@@ -41,9 +41,32 @@ var Input = /*#__PURE__*/function (_React$Component) {
41
41
  return _this;
42
42
  }
43
43
  (0, _createClass2.default)(Input, [{
44
+ key: "ariaLabelledBy",
45
+ get:
46
+ /**
47
+ * Overrides the default behaviour of react-select lib
48
+ *
49
+ * The getter is a workaround for original behaviour of the react-select lib.
50
+ * Placeholder and Input are linked not via label, aria-label or aria-labeledby, but through aria-describedby.
51
+ * Basically in the getter we reassign Placeholder ID from aria-describedby to aria-labelledby
52
+ * {@link https://github.com/JedWatson/react-select/issues/5651#issue-1731353197 GitHub}
53
+ */
54
+ function get() {
55
+ var _this$props$ariaDesc;
56
+ return (_this$props$ariaDesc = this.props['aria-describedby']) !== null && _this$props$ariaDesc !== void 0 ? _this$props$ariaDesc : this.props['aria-labelledby'];
57
+ }
58
+ }, {
59
+ key: "ariaDescribedBy",
60
+ get: function get() {
61
+ var _this$props$selectPro2, _this$props$selectPro3;
62
+ return (_this$props$selectPro2 = (_this$props$selectPro3 = this.props.selectProps) === null || _this$props$selectPro3 === void 0 ? void 0 : _this$props$selectPro3['aria-describedby']) !== null && _this$props$selectPro2 !== void 0 ? _this$props$selectPro2 : this.props['aria-describedby'];
63
+ }
64
+ }, {
44
65
  key: "render",
45
66
  value: function render() {
46
67
  return /*#__PURE__*/_react.default.createElement(_select.components.Input, (0, _extends2.default)({}, this.props, {
68
+ "aria-labelledby": this.ariaLabelledBy,
69
+ "aria-describedby": this.ariaDescribedBy,
47
70
  innerRef: this.props.innerRef,
48
71
  onKeyPress: this.handleKeyPress
49
72
  }));
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ /* prettier-ignore */
7
8
  /**
8
9
  * NOTE:
9
10
  *
@@ -15,6 +16,7 @@ var _default = {
15
16
  'fabric.elements.user-picker.email.add': '⁣⁢Add user⁠؜؜⁠؜؜⁠⁠‌⁠⁣⁤',
16
17
  'fabric.elements.user-picker.email.add.potential': '⁣⁢Enter an email address؜‍‍⁡⁡‍⁡‌⁡‍؜⁣⁤',
17
18
  'fabric.elements.user-picker.email.select.to.add': '⁣⁢Select an email address⁡‍⁠⁠⁠⁠⁠⁠⁡‍⁠؜⁠⁠‌‌⁣⁤',
19
+ 'fabric.elements.user-picker.error.message': '⁣⁢Something went wrong؜‍‍⁡⁠⁡⁡‍⁠؜⁣⁤',
18
20
  'fabric.elements.user-picker.external.sourced.error': "⁣⁢We can't connect you right now.‍⁡؜؜؜⁠؜⁡⁣⁤",
19
21
  'fabric.elements.user-picker.external.sourced.from': '⁣⁢Found in:‌⁡‌⁠؜⁡؜؜‌⁣⁤',
20
22
  'fabric.elements.user-picker.github.provider': '⁣⁢GitHub‍‍؜⁠؜؜⁡‍⁡⁣⁤',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "10.2.2",
3
+ "version": "10.2.4",
4
4
  "sideEffects": false
5
5
  }
@@ -397,6 +397,16 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
397
397
  this.optionsShownUfoExperienceInstance.success();
398
398
  }
399
399
  }
400
+ get ariaProps() {
401
+ const ariaLabels = Object.keys(this.props).filter(key => key.startsWith('aria-'));
402
+ const props = {
403
+ ...this.props
404
+ };
405
+ return ariaLabels.reduce((obj, key) => ({
406
+ ...obj,
407
+ [key]: props[key]
408
+ }), {});
409
+ }
400
410
  render() {
401
411
  const {
402
412
  isMulti,
@@ -484,7 +494,7 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
484
494
  onKeyDown: this.handleKeyDown,
485
495
  maxPickerHeight: maxPickerHeight,
486
496
  textFieldBackgroundColor: textFieldBackgroundColor
487
- }, pickerProps));
497
+ }, this.ariaProps, pickerProps));
488
498
  }
489
499
  }
490
500
  _defineProperty(BaseUserPickerWithoutAnalytics, "defaultProps", {
@@ -17,8 +17,26 @@ export class Input extends React.Component {
17
17
  }
18
18
  });
19
19
  }
20
+ /**
21
+ * Overrides the default behaviour of react-select lib
22
+ *
23
+ * The getter is a workaround for original behaviour of the react-select lib.
24
+ * Placeholder and Input are linked not via label, aria-label or aria-labeledby, but through aria-describedby.
25
+ * Basically in the getter we reassign Placeholder ID from aria-describedby to aria-labelledby
26
+ * {@link https://github.com/JedWatson/react-select/issues/5651#issue-1731353197 GitHub}
27
+ */
28
+ get ariaLabelledBy() {
29
+ var _this$props$ariaDesc;
30
+ return (_this$props$ariaDesc = this.props['aria-describedby']) !== null && _this$props$ariaDesc !== void 0 ? _this$props$ariaDesc : this.props['aria-labelledby'];
31
+ }
32
+ get ariaDescribedBy() {
33
+ var _this$props$selectPro2, _this$props$selectPro3;
34
+ return (_this$props$selectPro2 = (_this$props$selectPro3 = this.props.selectProps) === null || _this$props$selectPro3 === void 0 ? void 0 : _this$props$selectPro3['aria-describedby']) !== null && _this$props$selectPro2 !== void 0 ? _this$props$selectPro2 : this.props['aria-describedby'];
35
+ }
20
36
  render() {
21
37
  return /*#__PURE__*/React.createElement(components.Input, _extends({}, this.props, {
38
+ "aria-labelledby": this.ariaLabelledBy,
39
+ "aria-describedby": this.ariaDescribedBy,
22
40
  innerRef: this.props.innerRef,
23
41
  onKeyPress: this.handleKeyPress
24
42
  }));
@@ -1,3 +1,4 @@
1
+ /* prettier-ignore */
1
2
  /**
2
3
  * NOTE:
3
4
  *
@@ -9,6 +10,7 @@ export default {
9
10
  'fabric.elements.user-picker.email.add': '⁣⁢Add user⁠؜؜⁠؜؜⁠⁠‌⁠⁣⁤',
10
11
  'fabric.elements.user-picker.email.add.potential': '⁣⁢Enter an email address؜‍‍⁡⁡‍⁡‌⁡‍؜⁣⁤',
11
12
  'fabric.elements.user-picker.email.select.to.add': '⁣⁢Select an email address⁡‍⁠⁠⁠⁠⁠⁠⁡‍⁠؜⁠⁠‌‌⁣⁤',
13
+ 'fabric.elements.user-picker.error.message': '⁣⁢Something went wrong؜‍‍⁡⁠⁡⁡‍⁠؜⁣⁤',
12
14
  'fabric.elements.user-picker.external.sourced.error': "⁣⁢We can't connect you right now.‍⁡؜؜؜⁠؜⁡⁣⁤",
13
15
  'fabric.elements.user-picker.external.sourced.from': '⁣⁢Found in:‌⁡‌⁠؜⁡؜؜‌⁣⁤',
14
16
  'fabric.elements.user-picker.github.provider': '⁣⁢GitHub‍‍؜⁠؜؜⁡‍⁡⁣⁤',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "10.2.2",
3
+ "version": "10.2.4",
4
4
  "sideEffects": false
5
5
  }
@@ -6,6 +6,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
11
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
10
12
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
13
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
@@ -405,6 +407,17 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
405
407
  this.optionsShownUfoExperienceInstance.success();
406
408
  }
407
409
  }
410
+ }, {
411
+ key: "ariaProps",
412
+ get: function get() {
413
+ var ariaLabels = Object.keys(this.props).filter(function (key) {
414
+ return key.startsWith('aria-');
415
+ });
416
+ var props = _objectSpread({}, this.props);
417
+ return ariaLabels.reduce(function (obj, key) {
418
+ return _objectSpread(_objectSpread({}, obj), {}, _defineProperty({}, key, props[key]));
419
+ }, {});
420
+ }
408
421
  }, {
409
422
  key: "render",
410
423
  value: function render() {
@@ -492,7 +505,7 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
492
505
  onKeyDown: this.handleKeyDown,
493
506
  maxPickerHeight: maxPickerHeight,
494
507
  textFieldBackgroundColor: textFieldBackgroundColor
495
- }, pickerProps));
508
+ }, this.ariaProps, pickerProps));
496
509
  }
497
510
  }], [{
498
511
  key: "getDerivedStateFromProps",
@@ -34,9 +34,32 @@ export var Input = /*#__PURE__*/function (_React$Component) {
34
34
  return _this;
35
35
  }
36
36
  _createClass(Input, [{
37
+ key: "ariaLabelledBy",
38
+ get:
39
+ /**
40
+ * Overrides the default behaviour of react-select lib
41
+ *
42
+ * The getter is a workaround for original behaviour of the react-select lib.
43
+ * Placeholder and Input are linked not via label, aria-label or aria-labeledby, but through aria-describedby.
44
+ * Basically in the getter we reassign Placeholder ID from aria-describedby to aria-labelledby
45
+ * {@link https://github.com/JedWatson/react-select/issues/5651#issue-1731353197 GitHub}
46
+ */
47
+ function get() {
48
+ var _this$props$ariaDesc;
49
+ return (_this$props$ariaDesc = this.props['aria-describedby']) !== null && _this$props$ariaDesc !== void 0 ? _this$props$ariaDesc : this.props['aria-labelledby'];
50
+ }
51
+ }, {
52
+ key: "ariaDescribedBy",
53
+ get: function get() {
54
+ var _this$props$selectPro2, _this$props$selectPro3;
55
+ return (_this$props$selectPro2 = (_this$props$selectPro3 = this.props.selectProps) === null || _this$props$selectPro3 === void 0 ? void 0 : _this$props$selectPro3['aria-describedby']) !== null && _this$props$selectPro2 !== void 0 ? _this$props$selectPro2 : this.props['aria-describedby'];
56
+ }
57
+ }, {
37
58
  key: "render",
38
59
  value: function render() {
39
60
  return /*#__PURE__*/React.createElement(components.Input, _extends({}, this.props, {
61
+ "aria-labelledby": this.ariaLabelledBy,
62
+ "aria-describedby": this.ariaDescribedBy,
40
63
  innerRef: this.props.innerRef,
41
64
  onKeyPress: this.handleKeyPress
42
65
  }));
@@ -1,3 +1,4 @@
1
+ /* prettier-ignore */
1
2
  /**
2
3
  * NOTE:
3
4
  *
@@ -9,6 +10,7 @@ export default {
9
10
  'fabric.elements.user-picker.email.add': '⁣⁢Add user⁠؜؜⁠؜؜⁠⁠‌⁠⁣⁤',
10
11
  'fabric.elements.user-picker.email.add.potential': '⁣⁢Enter an email address؜‍‍⁡⁡‍⁡‌⁡‍؜⁣⁤',
11
12
  'fabric.elements.user-picker.email.select.to.add': '⁣⁢Select an email address⁡‍⁠⁠⁠⁠⁠⁠⁡‍⁠؜⁠⁠‌‌⁣⁤',
13
+ 'fabric.elements.user-picker.error.message': '⁣⁢Something went wrong؜‍‍⁡⁠⁡⁡‍⁠؜⁣⁤',
12
14
  'fabric.elements.user-picker.external.sourced.error': "⁣⁢We can't connect you right now.‍⁡؜؜؜⁠؜⁡⁣⁤",
13
15
  'fabric.elements.user-picker.external.sourced.from': '⁣⁢Found in:‌⁡‌⁠؜⁡؜؜‌⁣⁤',
14
16
  'fabric.elements.user-picker.github.provider': '⁣⁢GitHub‍‍؜⁠؜؜⁡‍⁡⁣⁤',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "10.2.2",
3
+ "version": "10.2.4",
4
4
  "sideEffects": false
5
5
  }
@@ -51,6 +51,7 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
51
51
  handleClearIndicatorHover: (hoveringClearIndicator: boolean) => void;
52
52
  private getOptions;
53
53
  private getAppearance;
54
+ get ariaProps(): {};
54
55
  render(): JSX.Element;
55
56
  }
56
57
  export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "noOptionsMessage" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "styles" | "value" | "defaultValue" | "fieldId" | "width" | "menuMinWidth" | "maxPickerHeight" | "loadOptions" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onClose" | "appearance" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabelledBy" | "ariaLive" | "SelectComponent" | "pickerProps"> & Partial<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isClearable" | "isMulti" | "textFieldBackgroundColor" | "loadOptionsErrorMessage" | "subtle" | "noBorder">> & Partial<Pick<{
@@ -1,11 +1,22 @@
1
- import React from 'react';
1
+ import React, { type AriaAttributes } from 'react';
2
+ import { type OptionType, type SelectProps } from '@atlaskit/select';
3
+ import { AriaAttributesType } from '../types';
2
4
  export type Props = {
3
- selectProps?: {
4
- disableInput?: boolean;
5
- };
5
+ selectProps?: SelectProps<OptionType, boolean>;
6
6
  innerRef: (ref: React.Ref<HTMLInputElement>) => void;
7
+ ariaDescribedBy?: AriaAttributesType;
7
8
  };
8
- export declare class Input extends React.Component<Props> {
9
+ export declare class Input extends React.Component<Props & AriaAttributes> {
9
10
  handleKeyPress: (e: KeyboardEvent) => void;
11
+ /**
12
+ * Overrides the default behaviour of react-select lib
13
+ *
14
+ * The getter is a workaround for original behaviour of the react-select lib.
15
+ * Placeholder and Input are linked not via label, aria-label or aria-labeledby, but through aria-describedby.
16
+ * Basically in the getter we reassign Placeholder ID from aria-describedby to aria-labelledby
17
+ * {@link https://github.com/JedWatson/react-select/issues/5651#issue-1731353197 GitHub}
18
+ */
19
+ get ariaLabelledBy(): AriaAttributesType;
20
+ get ariaDescribedBy(): AriaAttributesType;
10
21
  render(): JSX.Element;
11
22
  }
@@ -1,10 +1,5 @@
1
1
  import React from 'react';
2
- export type Props = {
3
- selectProps: {
4
- disableInput?: boolean;
5
- };
6
- innerRef: (ref: React.Ref<HTMLInputElement>) => void;
7
- };
2
+ import { type Props } from './Input';
8
3
  export declare class PopupInput extends React.Component<Props> {
9
4
  private ref;
10
5
  componentDidMount(): void;
@@ -8,6 +8,7 @@ declare const _default: {
8
8
  'fabric.elements.user-picker.email.add': string;
9
9
  'fabric.elements.user-picker.email.add.potential': string;
10
10
  'fabric.elements.user-picker.email.select.to.add': string;
11
+ 'fabric.elements.user-picker.error.message': string;
11
12
  'fabric.elements.user-picker.external.sourced.error': string;
12
13
  'fabric.elements.user-picker.external.sourced.from': string;
13
14
  'fabric.elements.user-picker.github.provider': string;
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import React, { type AriaAttributes, ReactNode } from 'react';
2
2
  import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
3
  import { Placement } from '@atlaskit/popper';
4
4
  import { EmailValidator } from './components/emailValidation';
@@ -176,6 +176,7 @@ export type PopupUserPickerProps = UserPickerProps & {
176
176
  */
177
177
  shouldFlip?: boolean;
178
178
  };
179
+ export type AriaAttributesType = AriaAttributes['aria-labelledby'] | AriaAttributes['aria-describedby'];
179
180
  export type BoundariesElement = 'scrollParent' | 'window' | 'viewport' | HTMLElement;
180
181
  export type RootBoundary = 'viewport' | 'document';
181
182
  export type UserPickerState = {
@@ -51,6 +51,7 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
51
51
  handleClearIndicatorHover: (hoveringClearIndicator: boolean) => void;
52
52
  private getOptions;
53
53
  private getAppearance;
54
+ get ariaProps(): {};
54
55
  render(): JSX.Element;
55
56
  }
56
57
  export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "noOptionsMessage" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "styles" | "value" | "defaultValue" | "fieldId" | "width" | "menuMinWidth" | "maxPickerHeight" | "loadOptions" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onClose" | "appearance" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabelledBy" | "ariaLive" | "SelectComponent" | "pickerProps"> & Partial<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isClearable" | "isMulti" | "textFieldBackgroundColor" | "loadOptionsErrorMessage" | "subtle" | "noBorder">> & Partial<Pick<{
@@ -1,11 +1,22 @@
1
- import React from 'react';
1
+ import React, { type AriaAttributes } from 'react';
2
+ import { type OptionType, type SelectProps } from '@atlaskit/select';
3
+ import { AriaAttributesType } from '../types';
2
4
  export type Props = {
3
- selectProps?: {
4
- disableInput?: boolean;
5
- };
5
+ selectProps?: SelectProps<OptionType, boolean>;
6
6
  innerRef: (ref: React.Ref<HTMLInputElement>) => void;
7
+ ariaDescribedBy?: AriaAttributesType;
7
8
  };
8
- export declare class Input extends React.Component<Props> {
9
+ export declare class Input extends React.Component<Props & AriaAttributes> {
9
10
  handleKeyPress: (e: KeyboardEvent) => void;
11
+ /**
12
+ * Overrides the default behaviour of react-select lib
13
+ *
14
+ * The getter is a workaround for original behaviour of the react-select lib.
15
+ * Placeholder and Input are linked not via label, aria-label or aria-labeledby, but through aria-describedby.
16
+ * Basically in the getter we reassign Placeholder ID from aria-describedby to aria-labelledby
17
+ * {@link https://github.com/JedWatson/react-select/issues/5651#issue-1731353197 GitHub}
18
+ */
19
+ get ariaLabelledBy(): AriaAttributesType;
20
+ get ariaDescribedBy(): AriaAttributesType;
10
21
  render(): JSX.Element;
11
22
  }
@@ -1,10 +1,5 @@
1
1
  import React from 'react';
2
- export type Props = {
3
- selectProps: {
4
- disableInput?: boolean;
5
- };
6
- innerRef: (ref: React.Ref<HTMLInputElement>) => void;
7
- };
2
+ import { type Props } from './Input';
8
3
  export declare class PopupInput extends React.Component<Props> {
9
4
  private ref;
10
5
  componentDidMount(): void;
@@ -8,6 +8,7 @@ declare const _default: {
8
8
  'fabric.elements.user-picker.email.add': string;
9
9
  'fabric.elements.user-picker.email.add.potential': string;
10
10
  'fabric.elements.user-picker.email.select.to.add': string;
11
+ 'fabric.elements.user-picker.error.message': string;
11
12
  'fabric.elements.user-picker.external.sourced.error': string;
12
13
  'fabric.elements.user-picker.external.sourced.from': string;
13
14
  'fabric.elements.user-picker.github.provider': string;
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import React, { type AriaAttributes, ReactNode } from 'react';
2
2
  import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
3
  import { Placement } from '@atlaskit/popper';
4
4
  import { EmailValidator } from './components/emailValidation';
@@ -179,6 +179,7 @@ export type PopupUserPickerProps = UserPickerProps & {
179
179
  */
180
180
  shouldFlip?: boolean;
181
181
  };
182
+ export type AriaAttributesType = AriaAttributes['aria-labelledby'] | AriaAttributes['aria-describedby'];
182
183
  export type BoundariesElement = 'scrollParent' | 'window' | 'viewport' | HTMLElement;
183
184
  export type RootBoundary = 'viewport' | 'document';
184
185
  export type UserPickerState = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "10.2.2",
3
+ "version": "10.2.4",
4
4
  "description": "Fabric component for display a dropdown to select a user from",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,10 +40,10 @@
40
40
  "@atlaskit/logo": "^13.14.0",
41
41
  "@atlaskit/lozenge": "^11.4.0",
42
42
  "@atlaskit/popper": "^5.5.0",
43
- "@atlaskit/select": "^16.2.0",
43
+ "@atlaskit/select": "^16.5.0",
44
44
  "@atlaskit/spinner": "^15.5.0",
45
45
  "@atlaskit/theme": "^12.5.0",
46
- "@atlaskit/tokens": "^1.4.0",
46
+ "@atlaskit/tokens": "^1.5.0",
47
47
  "@atlaskit/tooltip": "^17.8.0",
48
48
  "@atlaskit/ufo": "^0.2.0",
49
49
  "@babel/runtime": "^7.0.0",
@@ -63,10 +63,10 @@
63
63
  "@atlaskit/docs": "*",
64
64
  "@atlaskit/elements-test-helpers": "^0.7.0",
65
65
  "@atlaskit/modal-dialog": "^12.5.0",
66
- "@atlaskit/radio": "^5.5.0",
66
+ "@atlaskit/radio": "^5.6.0",
67
67
  "@atlaskit/range": "^7.1.0",
68
68
  "@atlaskit/section-message": "^6.4.0",
69
- "@atlaskit/textfield": "^5.4.0",
69
+ "@atlaskit/textfield": "^5.5.0",
70
70
  "@atlaskit/util-data-test": "^17.8.0",
71
71
  "@atlaskit/visual-regression": "*",
72
72
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",