@atlaskit/user-picker 10.18.0 → 10.19.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/user-picker
2
2
 
3
+ ## 10.19.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#69996](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69996) [`1b320a82df61`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1b320a82df61) - Add Team fallback avatar
8
+
9
+ ### Patch Changes
10
+
11
+ - [#74949](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/74949) [`ba44973e5e90`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ba44973e5e90) - openMenuOnClick prop added to support userpicker to work as select
12
+ - Updated dependencies
13
+
3
14
  ## 10.18.0
4
15
 
5
16
  ### Minor Changes
@@ -48,6 +48,9 @@
48
48
  {
49
49
  "path": "../../../design-system/spinner/afm-cc/tsconfig.json"
50
50
  },
51
+ {
52
+ "path": "../../../people-and-teams/teams-avatar/afm-cc/tsconfig.json"
53
+ },
51
54
  {
52
55
  "path": "../../../design-system/theme/afm-cc/tsconfig.json"
53
56
  },
@@ -12,7 +12,7 @@ var _utils = require("./components/utils");
12
12
  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; }
13
13
  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; }
14
14
  var packageName = "@atlaskit/user-picker";
15
- var packageVersion = "10.18.0";
15
+ var packageVersion = "10.19.0";
16
16
  var UUID_REGEXP_TEAMS_GROUPS = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
17
17
  var UUID_REGEXP_OLD_AAID = /^[a-fA-F0-9]{1,8}:[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
18
18
  var UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
@@ -329,17 +329,19 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
329
329
  // if it is node environment, focusedOptionObserver will be falsy value.
330
330
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "focusedOptionObserver", typeof MutationObserver === 'function' && new MutationObserver(_this.focusedOptionObserverCallback));
331
331
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeyDown", function (event) {
332
- // Escape
333
- if (event.keyCode === 27) {
334
- _this.blur();
335
- }
332
+ if (!_this.isMenuOpenOnClickForSingleSelect) {
333
+ // Escape
334
+ if (event.keyCode === 27) {
335
+ _this.blur();
336
+ }
336
337
 
337
- // Space
338
- if (event.keyCode === 32 && !_this.state.inputValue) {
339
- event.preventDefault();
340
- !_this.props.disableInput && _this.setState({
341
- inputValue: ' '
342
- });
338
+ // Space
339
+ if (event.keyCode === 32 && !_this.state.inputValue) {
340
+ event.preventDefault();
341
+ !_this.props.disableInput && _this.setState({
342
+ inputValue: ' '
343
+ });
344
+ }
343
345
  }
344
346
  if (_this.session) {
345
347
  _this.session.lastKey = event.keyCode;
@@ -425,6 +427,11 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
425
427
  return _this;
426
428
  }
427
429
  (0, _createClass2.default)(BaseUserPickerWithoutAnalytics, [{
430
+ key: "isMenuOpenOnClickForSingleSelect",
431
+ get: function get() {
432
+ return this.props.openMenuOnClick && !this.props.isMulti;
433
+ }
434
+ }, {
428
435
  key: "componentDidMount",
429
436
  value: function componentDidMount() {
430
437
  var _this$props3 = this.props,
@@ -529,7 +536,8 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
529
536
  name = _this$props4.name,
530
537
  header = _this$props4.header,
531
538
  required = _this$props4.required,
532
- UNSAFE_hasDraggableParentComponent = _this$props4.UNSAFE_hasDraggableParentComponent;
539
+ UNSAFE_hasDraggableParentComponent = _this$props4.UNSAFE_hasDraggableParentComponent,
540
+ placeholderAvatar = _this$props4.placeholderAvatar;
533
541
  var _this$state3 = this.state,
534
542
  count = _this$state3.count,
535
543
  hoveringClearIndicator = _this$state3.hoveringClearIndicator,
@@ -539,6 +547,13 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
539
547
  resolving = _this$state3.resolving,
540
548
  showError = _this$state3.showError;
541
549
  var appearance = this.getAppearance();
550
+ // these props override the default select menu open and close
551
+ var menuOpenDeciderProps = _objectSpread({}, !this.isMenuOpenOnClickForSingleSelect && {
552
+ menuIsOpen: menuIsOpen,
553
+ blurInputOnSelect: !isMulti,
554
+ openMenuOnFocus: true,
555
+ onFocus: this.handleFocus
556
+ });
542
557
  return /*#__PURE__*/_react.default.createElement(SelectComponent, (0, _extends2.default)({
543
558
  name: name,
544
559
  value: value,
@@ -556,7 +571,6 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
556
571
  enableAnimation: isMulti,
557
572
  components: components,
558
573
  inputValue: inputValue,
559
- menuIsOpen: menuIsOpen,
560
574
  isLoading: count > 0 || resolving || isLoading,
561
575
  loadingMessage: loadingMessage,
562
576
  menuPlacement: "auto",
@@ -568,13 +582,11 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
568
582
  isClearable: isClearable,
569
583
  noBorder: noBorder,
570
584
  subtle: subtle,
571
- blurInputOnSelect: !isMulti,
572
585
  closeMenuOnSelect: !isMulti,
573
586
  noOptionsMessage: showError ? loadOptionsErrorMessage : typeof noOptionsMessage === 'function' ? noOptionsMessage : function () {
574
587
  return noOptionsMessage;
575
588
  },
576
589
  footer: footer,
577
- openMenuOnFocus: true,
578
590
  isDisabled: isDisabled,
579
591
  isFocused: menuIsOpen,
580
592
  backspaceRemovesValue: isMulti,
@@ -588,7 +600,6 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
588
600
  inputId: inputId,
589
601
  onChange: this.handleChange,
590
602
  onMenuOpen: this.handleOpen,
591
- onFocus: this.handleFocus,
592
603
  onBlur: this.handleBlur,
593
604
  onMenuClose: this.handleClose,
594
605
  onInputChange: this.handleInputChange,
@@ -596,10 +607,11 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
596
607
  onKeyDown: this.handleKeyDown,
597
608
  maxPickerHeight: maxPickerHeight,
598
609
  textFieldBackgroundColor: textFieldBackgroundColor,
599
- header: header
610
+ header: header,
611
+ placeholderAvatar: placeholderAvatar
600
612
  }, this.ariaProps, pickerProps, UNSAFE_hasDraggableParentComponent && {
601
613
  onValueContainerClick: this.handleClickDraggableParentComponent
602
- }));
614
+ }, menuOpenDeciderProps));
603
615
  }
604
616
  }], [{
605
617
  key: "getDerivedStateFromProps",
@@ -638,6 +650,7 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
638
650
  isClearable: true,
639
651
  loadOptionsErrorMessage: function loadOptionsErrorMessage() {
640
652
  return /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _i18n.messages.errorMessage);
641
- }
653
+ },
654
+ openMenuOnClick: false
642
655
  });
643
656
  var BaseUserPicker = exports.BaseUserPicker = (0, _analyticsNext.withAnalyticsEvents)()(BaseUserPickerWithoutAnalytics);
@@ -47,10 +47,12 @@ var SingleValueContainer = exports.SingleValueContainer = /*#__PURE__*/function
47
47
  appearance = _this$props$selectPro.appearance,
48
48
  isFocused = _this$props$selectPro.isFocused,
49
49
  inputValue = _this$props$selectPro.inputValue,
50
- value = _this$props$selectPro.value;
50
+ value = _this$props$selectPro.value,
51
+ placeholderAvatar = _this$props$selectPro.placeholderAvatar;
51
52
  if (isFocused || !hasValue) {
52
53
  return (0, _react.jsx)(_SizeableAvatar.SizeableAvatar, {
53
54
  appearance: appearance,
55
+ type: placeholderAvatar,
54
56
  src: showUserAvatar(inputValue, value) ? value.data.avatarUrl : undefined
55
57
  });
56
58
  }
@@ -11,6 +11,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
11
11
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
12
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
13
13
  var _avatar = _interopRequireDefault(require("@atlaskit/avatar"));
14
+ var _teamsAvatar = _interopRequireDefault(require("@atlaskit/teams-avatar"));
14
15
  var _react = _interopRequireDefault(require("react"));
15
16
  var _utils = require("./utils");
16
17
  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); }; }
@@ -29,14 +30,17 @@ var SizeableAvatar = exports.SizeableAvatar = /*#__PURE__*/function (_React$Pure
29
30
  src = _this$props.src,
30
31
  name = _this$props.name,
31
32
  presence = _this$props.presence,
32
- appearance = _this$props.appearance;
33
- return /*#__PURE__*/_react.default.createElement(_avatar.default, {
33
+ appearance = _this$props.appearance,
34
+ _this$props$type = _this$props.type,
35
+ type = _this$props$type === void 0 ? 'person' : _this$props$type;
36
+ var props = {
34
37
  size: (0, _utils.getAvatarSize)(appearance),
35
38
  src: src,
36
39
  name: name,
37
- borderColor: "transparent",
40
+ borderColor: 'transparent',
38
41
  presence: presence
39
- });
42
+ };
43
+ return type === 'team' ? /*#__PURE__*/_react.default.createElement(_teamsAvatar.default, props) : /*#__PURE__*/_react.default.createElement(_avatar.default, props);
40
44
  }
41
45
  }]);
42
46
  return SizeableAvatar;
@@ -91,7 +91,8 @@ var TeamOption = exports.TeamOption = /*#__PURE__*/function (_React$PureComponen
91
91
  return (0, _react.jsx)(_SizeableAvatar.SizeableAvatar, {
92
92
  appearance: "big",
93
93
  src: avatarUrl,
94
- name: name
94
+ name: name,
95
+ type: "team"
95
96
  });
96
97
  });
97
98
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getLozengeProps", function () {
@@ -2,7 +2,7 @@ import { createAndFireEvent } from '@atlaskit/analytics-next';
2
2
  import { v4 as uuidv4 } from 'uuid';
3
3
  import { isCustom, isExternalUser } from './components/utils';
4
4
  const packageName = "@atlaskit/user-picker";
5
- const packageVersion = "10.18.0";
5
+ const packageVersion = "10.19.0";
6
6
  const UUID_REGEXP_TEAMS_GROUPS = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
7
7
  const UUID_REGEXP_OLD_AAID = /^[a-fA-F0-9]{1,8}:[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
8
8
  const UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
@@ -309,17 +309,19 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
309
309
  // if it is node environment, focusedOptionObserver will be falsy value.
310
310
  _defineProperty(this, "focusedOptionObserver", typeof MutationObserver === 'function' && new MutationObserver(this.focusedOptionObserverCallback));
311
311
  _defineProperty(this, "handleKeyDown", event => {
312
- // Escape
313
- if (event.keyCode === 27) {
314
- this.blur();
315
- }
312
+ if (!this.isMenuOpenOnClickForSingleSelect) {
313
+ // Escape
314
+ if (event.keyCode === 27) {
315
+ this.blur();
316
+ }
316
317
 
317
- // Space
318
- if (event.keyCode === 32 && !this.state.inputValue) {
319
- event.preventDefault();
320
- !this.props.disableInput && this.setState({
321
- inputValue: ' '
322
- });
318
+ // Space
319
+ if (event.keyCode === 32 && !this.state.inputValue) {
320
+ event.preventDefault();
321
+ !this.props.disableInput && this.setState({
322
+ inputValue: ' '
323
+ });
324
+ }
323
325
  }
324
326
  if (this.session) {
325
327
  this.session.lastKey = event.keyCode;
@@ -398,6 +400,9 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
398
400
  };
399
401
  this.optionsShownUfoExperienceInstance = userPickerOptionsShownUfoExperience.getInstance(uuidv4());
400
402
  }
403
+ get isMenuOpenOnClickForSingleSelect() {
404
+ return this.props.openMenuOnClick && !this.props.isMulti;
405
+ }
401
406
  componentDidMount() {
402
407
  const {
403
408
  open,
@@ -498,7 +503,8 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
498
503
  name,
499
504
  header,
500
505
  required,
501
- UNSAFE_hasDraggableParentComponent
506
+ UNSAFE_hasDraggableParentComponent,
507
+ placeholderAvatar
502
508
  } = this.props;
503
509
  const {
504
510
  count,
@@ -510,6 +516,15 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
510
516
  showError
511
517
  } = this.state;
512
518
  const appearance = this.getAppearance();
519
+ // these props override the default select menu open and close
520
+ const menuOpenDeciderProps = {
521
+ ...(!this.isMenuOpenOnClickForSingleSelect && {
522
+ menuIsOpen,
523
+ blurInputOnSelect: !isMulti,
524
+ openMenuOnFocus: true,
525
+ onFocus: this.handleFocus
526
+ })
527
+ };
513
528
  return /*#__PURE__*/React.createElement(SelectComponent, _extends({
514
529
  name: name,
515
530
  value: value,
@@ -527,7 +542,6 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
527
542
  enableAnimation: isMulti,
528
543
  components: components,
529
544
  inputValue: inputValue,
530
- menuIsOpen: menuIsOpen,
531
545
  isLoading: count > 0 || resolving || isLoading,
532
546
  loadingMessage: loadingMessage,
533
547
  menuPlacement: "auto",
@@ -539,11 +553,9 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
539
553
  isClearable: isClearable,
540
554
  noBorder: noBorder,
541
555
  subtle: subtle,
542
- blurInputOnSelect: !isMulti,
543
556
  closeMenuOnSelect: !isMulti,
544
557
  noOptionsMessage: showError ? loadOptionsErrorMessage : typeof noOptionsMessage === 'function' ? noOptionsMessage : () => noOptionsMessage,
545
558
  footer: footer,
546
- openMenuOnFocus: true,
547
559
  isDisabled: isDisabled,
548
560
  isFocused: menuIsOpen,
549
561
  backspaceRemovesValue: isMulti,
@@ -557,7 +569,6 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
557
569
  inputId: inputId,
558
570
  onChange: this.handleChange,
559
571
  onMenuOpen: this.handleOpen,
560
- onFocus: this.handleFocus,
561
572
  onBlur: this.handleBlur,
562
573
  onMenuClose: this.handleClose,
563
574
  onInputChange: this.handleInputChange,
@@ -565,10 +576,11 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
565
576
  onKeyDown: this.handleKeyDown,
566
577
  maxPickerHeight: maxPickerHeight,
567
578
  textFieldBackgroundColor: textFieldBackgroundColor,
568
- header: header
579
+ header: header,
580
+ placeholderAvatar: placeholderAvatar
569
581
  }, this.ariaProps, pickerProps, UNSAFE_hasDraggableParentComponent && {
570
582
  onValueContainerClick: this.handleClickDraggableParentComponent
571
- }));
583
+ }, menuOpenDeciderProps));
572
584
  }
573
585
  }
574
586
  _defineProperty(BaseUserPickerWithoutAnalytics, "defaultProps", {
@@ -577,6 +589,7 @@ _defineProperty(BaseUserPickerWithoutAnalytics, "defaultProps", {
577
589
  noBorder: false,
578
590
  textFieldBackgroundColor: false,
579
591
  isClearable: true,
580
- loadOptionsErrorMessage: () => /*#__PURE__*/React.createElement(FormattedMessage, messages.errorMessage)
592
+ loadOptionsErrorMessage: () => /*#__PURE__*/React.createElement(FormattedMessage, messages.errorMessage),
593
+ openMenuOnClick: false
581
594
  });
582
595
  export const BaseUserPicker = withAnalyticsEvents()(BaseUserPickerWithoutAnalytics);
@@ -22,12 +22,14 @@ export class SingleValueContainer extends React.Component {
22
22
  appearance,
23
23
  isFocused,
24
24
  inputValue,
25
- value
25
+ value,
26
+ placeholderAvatar
26
27
  }
27
28
  } = this.props;
28
29
  if (isFocused || !hasValue) {
29
30
  return jsx(SizeableAvatar, {
30
31
  appearance: appearance,
32
+ type: placeholderAvatar,
31
33
  src: showUserAvatar(inputValue, value) ? value.data.avatarUrl : undefined
32
34
  });
33
35
  }
@@ -1,4 +1,5 @@
1
1
  import Avatar from '@atlaskit/avatar';
2
+ import TeamAvatar from '@atlaskit/teams-avatar';
2
3
  import React from 'react';
3
4
  import { getAvatarSize } from './utils';
4
5
  export class SizeableAvatar extends React.PureComponent {
@@ -7,14 +8,16 @@ export class SizeableAvatar extends React.PureComponent {
7
8
  src,
8
9
  name,
9
10
  presence,
10
- appearance
11
+ appearance,
12
+ type = 'person'
11
13
  } = this.props;
12
- return /*#__PURE__*/React.createElement(Avatar, {
14
+ const props = {
13
15
  size: getAvatarSize(appearance),
14
- src: src,
15
- name: name,
16
- borderColor: "transparent",
17
- presence: presence
18
- });
16
+ src,
17
+ name,
18
+ borderColor: 'transparent',
19
+ presence
20
+ };
21
+ return type === 'team' ? /*#__PURE__*/React.createElement(TeamAvatar, props) : /*#__PURE__*/React.createElement(Avatar, props);
19
22
  }
20
23
  }
@@ -76,7 +76,8 @@ export class TeamOption extends React.PureComponent {
76
76
  return jsx(SizeableAvatar, {
77
77
  appearance: "big",
78
78
  src: avatarUrl,
79
- name: name
79
+ name: name,
80
+ type: "team"
80
81
  });
81
82
  });
82
83
  _defineProperty(this, "getLozengeProps", () => typeof this.props.team.lozenge === 'string' ? {
@@ -5,7 +5,7 @@ import { createAndFireEvent } from '@atlaskit/analytics-next';
5
5
  import { v4 as uuidv4 } from 'uuid';
6
6
  import { isCustom, isExternalUser } from './components/utils';
7
7
  var packageName = "@atlaskit/user-picker";
8
- var packageVersion = "10.18.0";
8
+ var packageVersion = "10.19.0";
9
9
  var UUID_REGEXP_TEAMS_GROUPS = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
10
10
  var UUID_REGEXP_OLD_AAID = /^[a-fA-F0-9]{1,8}:[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
11
11
  var UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
@@ -322,17 +322,19 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
322
322
  // if it is node environment, focusedOptionObserver will be falsy value.
323
323
  _defineProperty(_assertThisInitialized(_this), "focusedOptionObserver", typeof MutationObserver === 'function' && new MutationObserver(_this.focusedOptionObserverCallback));
324
324
  _defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
325
- // Escape
326
- if (event.keyCode === 27) {
327
- _this.blur();
328
- }
325
+ if (!_this.isMenuOpenOnClickForSingleSelect) {
326
+ // Escape
327
+ if (event.keyCode === 27) {
328
+ _this.blur();
329
+ }
329
330
 
330
- // Space
331
- if (event.keyCode === 32 && !_this.state.inputValue) {
332
- event.preventDefault();
333
- !_this.props.disableInput && _this.setState({
334
- inputValue: ' '
335
- });
331
+ // Space
332
+ if (event.keyCode === 32 && !_this.state.inputValue) {
333
+ event.preventDefault();
334
+ !_this.props.disableInput && _this.setState({
335
+ inputValue: ' '
336
+ });
337
+ }
336
338
  }
337
339
  if (_this.session) {
338
340
  _this.session.lastKey = event.keyCode;
@@ -418,6 +420,11 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
418
420
  return _this;
419
421
  }
420
422
  _createClass(BaseUserPickerWithoutAnalytics, [{
423
+ key: "isMenuOpenOnClickForSingleSelect",
424
+ get: function get() {
425
+ return this.props.openMenuOnClick && !this.props.isMulti;
426
+ }
427
+ }, {
421
428
  key: "componentDidMount",
422
429
  value: function componentDidMount() {
423
430
  var _this$props3 = this.props,
@@ -522,7 +529,8 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
522
529
  name = _this$props4.name,
523
530
  header = _this$props4.header,
524
531
  required = _this$props4.required,
525
- UNSAFE_hasDraggableParentComponent = _this$props4.UNSAFE_hasDraggableParentComponent;
532
+ UNSAFE_hasDraggableParentComponent = _this$props4.UNSAFE_hasDraggableParentComponent,
533
+ placeholderAvatar = _this$props4.placeholderAvatar;
526
534
  var _this$state3 = this.state,
527
535
  count = _this$state3.count,
528
536
  hoveringClearIndicator = _this$state3.hoveringClearIndicator,
@@ -532,6 +540,13 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
532
540
  resolving = _this$state3.resolving,
533
541
  showError = _this$state3.showError;
534
542
  var appearance = this.getAppearance();
543
+ // these props override the default select menu open and close
544
+ var menuOpenDeciderProps = _objectSpread({}, !this.isMenuOpenOnClickForSingleSelect && {
545
+ menuIsOpen: menuIsOpen,
546
+ blurInputOnSelect: !isMulti,
547
+ openMenuOnFocus: true,
548
+ onFocus: this.handleFocus
549
+ });
535
550
  return /*#__PURE__*/React.createElement(SelectComponent, _extends({
536
551
  name: name,
537
552
  value: value,
@@ -549,7 +564,6 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
549
564
  enableAnimation: isMulti,
550
565
  components: components,
551
566
  inputValue: inputValue,
552
- menuIsOpen: menuIsOpen,
553
567
  isLoading: count > 0 || resolving || isLoading,
554
568
  loadingMessage: loadingMessage,
555
569
  menuPlacement: "auto",
@@ -561,13 +575,11 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
561
575
  isClearable: isClearable,
562
576
  noBorder: noBorder,
563
577
  subtle: subtle,
564
- blurInputOnSelect: !isMulti,
565
578
  closeMenuOnSelect: !isMulti,
566
579
  noOptionsMessage: showError ? loadOptionsErrorMessage : typeof noOptionsMessage === 'function' ? noOptionsMessage : function () {
567
580
  return noOptionsMessage;
568
581
  },
569
582
  footer: footer,
570
- openMenuOnFocus: true,
571
583
  isDisabled: isDisabled,
572
584
  isFocused: menuIsOpen,
573
585
  backspaceRemovesValue: isMulti,
@@ -581,7 +593,6 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
581
593
  inputId: inputId,
582
594
  onChange: this.handleChange,
583
595
  onMenuOpen: this.handleOpen,
584
- onFocus: this.handleFocus,
585
596
  onBlur: this.handleBlur,
586
597
  onMenuClose: this.handleClose,
587
598
  onInputChange: this.handleInputChange,
@@ -589,10 +600,11 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
589
600
  onKeyDown: this.handleKeyDown,
590
601
  maxPickerHeight: maxPickerHeight,
591
602
  textFieldBackgroundColor: textFieldBackgroundColor,
592
- header: header
603
+ header: header,
604
+ placeholderAvatar: placeholderAvatar
593
605
  }, this.ariaProps, pickerProps, UNSAFE_hasDraggableParentComponent && {
594
606
  onValueContainerClick: this.handleClickDraggableParentComponent
595
- }));
607
+ }, menuOpenDeciderProps));
596
608
  }
597
609
  }], [{
598
610
  key: "getDerivedStateFromProps",
@@ -631,6 +643,7 @@ _defineProperty(BaseUserPickerWithoutAnalytics, "defaultProps", {
631
643
  isClearable: true,
632
644
  loadOptionsErrorMessage: function loadOptionsErrorMessage() {
633
645
  return /*#__PURE__*/React.createElement(FormattedMessage, messages.errorMessage);
634
- }
646
+ },
647
+ openMenuOnClick: false
635
648
  });
636
649
  export var BaseUserPicker = withAnalyticsEvents()(BaseUserPickerWithoutAnalytics);
@@ -41,10 +41,12 @@ export var SingleValueContainer = /*#__PURE__*/function (_React$Component) {
41
41
  appearance = _this$props$selectPro.appearance,
42
42
  isFocused = _this$props$selectPro.isFocused,
43
43
  inputValue = _this$props$selectPro.inputValue,
44
- value = _this$props$selectPro.value;
44
+ value = _this$props$selectPro.value,
45
+ placeholderAvatar = _this$props$selectPro.placeholderAvatar;
45
46
  if (isFocused || !hasValue) {
46
47
  return jsx(SizeableAvatar, {
47
48
  appearance: appearance,
49
+ type: placeholderAvatar,
48
50
  src: showUserAvatar(inputValue, value) ? value.data.avatarUrl : undefined
49
51
  });
50
52
  }
@@ -6,6 +6,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
6
  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); }; }
7
7
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
8
8
  import Avatar from '@atlaskit/avatar';
9
+ import TeamAvatar from '@atlaskit/teams-avatar';
9
10
  import React from 'react';
10
11
  import { getAvatarSize } from './utils';
11
12
  export var SizeableAvatar = /*#__PURE__*/function (_React$PureComponent) {
@@ -22,14 +23,17 @@ export var SizeableAvatar = /*#__PURE__*/function (_React$PureComponent) {
22
23
  src = _this$props.src,
23
24
  name = _this$props.name,
24
25
  presence = _this$props.presence,
25
- appearance = _this$props.appearance;
26
- return /*#__PURE__*/React.createElement(Avatar, {
26
+ appearance = _this$props.appearance,
27
+ _this$props$type = _this$props.type,
28
+ type = _this$props$type === void 0 ? 'person' : _this$props$type;
29
+ var props = {
27
30
  size: getAvatarSize(appearance),
28
31
  src: src,
29
32
  name: name,
30
- borderColor: "transparent",
33
+ borderColor: 'transparent',
31
34
  presence: presence
32
- });
35
+ };
36
+ return type === 'team' ? /*#__PURE__*/React.createElement(TeamAvatar, props) : /*#__PURE__*/React.createElement(Avatar, props);
33
37
  }
34
38
  }]);
35
39
  return SizeableAvatar;
@@ -85,7 +85,8 @@ export var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
85
85
  return jsx(SizeableAvatar, {
86
86
  appearance: "big",
87
87
  src: avatarUrl,
88
- name: name
88
+ name: name,
89
+ type: "team"
89
90
  });
90
91
  });
91
92
  _defineProperty(_assertThisInitialized(_this), "getLozengeProps", function () {
@@ -22,6 +22,7 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
22
22
  textFieldBackgroundColor: boolean;
23
23
  isClearable: boolean;
24
24
  loadOptionsErrorMessage: () => JSX.Element;
25
+ openMenuOnClick: boolean;
25
26
  };
26
27
  static getDerivedStateFromProps(nextProps: Partial<UserPickerProps>, prevState: UserPickerState): Partial<UserPickerState>;
27
28
  private selectRef;
@@ -41,6 +42,7 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
41
42
  private addOptions;
42
43
  private handleLoadOptionsError;
43
44
  private debouncedLoadOptions;
45
+ private get isMenuOpenOnClickForSingleSelect();
44
46
  abortOptionsShownUfoExperience: () => void;
45
47
  startOptionsShownUfoExperience: () => void;
46
48
  private executeLoadOptions;
@@ -64,11 +66,12 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
64
66
  private handleClickDraggableParentComponent;
65
67
  render(): JSX.Element;
66
68
  }
67
- export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "styles" | "value" | "footer" | "defaultValue" | "fieldId" | "width" | "menuMinWidth" | "maxPickerHeight" | "loadOptions" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "appearance" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "header" | "required" | "UNSAFE_hasDraggableParentComponent" | "SelectComponent" | "pickerProps"> & Partial<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isClearable" | "isMulti" | "textFieldBackgroundColor" | "loadOptionsErrorMessage" | "subtle" | "noBorder">> & Partial<Pick<{
69
+ export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "styles" | "value" | "footer" | "defaultValue" | "fieldId" | "width" | "menuMinWidth" | "maxPickerHeight" | "loadOptions" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "appearance" | "placeholderAvatar" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "header" | "required" | "UNSAFE_hasDraggableParentComponent" | "SelectComponent" | "pickerProps"> & Partial<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isClearable" | "isMulti" | "openMenuOnClick" | "textFieldBackgroundColor" | "loadOptionsErrorMessage" | "subtle" | "noBorder">> & Partial<Pick<{
68
70
  isMulti: boolean;
69
71
  subtle: boolean;
70
72
  noBorder: boolean;
71
73
  textFieldBackgroundColor: boolean;
72
74
  isClearable: boolean;
73
75
  loadOptionsErrorMessage: () => JSX.Element;
76
+ openMenuOnClick: boolean;
74
77
  }, never>> & React.RefAttributes<any>>;
@@ -27,7 +27,7 @@ export declare class PopupUserPickerWithoutAnalytics extends React.Component<Pop
27
27
  };
28
28
  render(): JSX.Element;
29
29
  }
30
- export declare const PopupUserPicker: React.ForwardRefExoticComponent<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "styles" | "value" | "footer" | "target" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "appearance" | "subtle" | "noBorder" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "header" | "required" | "UNSAFE_hasDraggableParentComponent" | "popupTitle"> & Partial<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "offset" | "isMulti" | "width" | "placement" | "rootBoundary" | "boundariesElement" | "shouldFlip">> & Partial<Pick<{
30
+ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "openMenuOnClick" | "styles" | "value" | "footer" | "target" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "appearance" | "subtle" | "noBorder" | "placeholderAvatar" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "header" | "required" | "UNSAFE_hasDraggableParentComponent" | "popupTitle"> & Partial<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "offset" | "isMulti" | "width" | "placement" | "rootBoundary" | "boundariesElement" | "shouldFlip">> & Partial<Pick<{
31
31
  boundariesElement: string;
32
32
  width: number;
33
33
  isMulti: boolean;
@@ -4,6 +4,7 @@ export type Props = {
4
4
  src?: string;
5
5
  name?: string;
6
6
  presence?: string;
7
+ type?: 'person' | 'team';
7
8
  };
8
9
  export declare class SizeableAvatar extends React.PureComponent<Props> {
9
10
  render(): JSX.Element;
@@ -10,7 +10,7 @@ export declare class UserPickerWithoutAnalytics extends React.Component<UserPick
10
10
  componentDidMount(): void;
11
11
  render(): JSX.Element;
12
12
  }
13
- export declare const UserPicker: React.ForwardRefExoticComponent<Pick<Omit<UserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "styles" | "value" | "footer" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "appearance" | "subtle" | "noBorder" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "header" | "required" | "UNSAFE_hasDraggableParentComponent"> & Partial<Pick<Omit<UserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isMulti" | "width">> & Partial<Pick<{
13
+ export declare const UserPicker: React.ForwardRefExoticComponent<Pick<Omit<UserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "openMenuOnClick" | "styles" | "value" | "footer" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "appearance" | "subtle" | "noBorder" | "placeholderAvatar" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "header" | "required" | "UNSAFE_hasDraggableParentComponent"> & Partial<Pick<Omit<UserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isMulti" | "width">> & Partial<Pick<{
14
14
  width: number;
15
15
  isMulti: boolean;
16
16
  }, never>> & React.RefAttributes<any>>;
@@ -101,6 +101,8 @@ export type UserPickerProps = WithAnalyticsEventsProps & {
101
101
  defaultValue?: DefaultValue;
102
102
  /** Placeholder text to be shown when there is no value in the field. */
103
103
  placeholder?: React.ReactNode;
104
+ /** Placeholder avatar style - defaults to person */
105
+ placeholderAvatar?: 'person' | 'team';
104
106
  /** Message to encourage the user to add more items to user picker. */
105
107
  addMoreMessage?: string;
106
108
  /** Message to be shown when the menu is open but no options are provided.
@@ -164,6 +166,8 @@ export type UserPickerProps = WithAnalyticsEventsProps & {
164
166
  * Context: https://hello.atlassian.net/wiki/spaces/~989411314/pages/2861097485/Investigation+Notes+for+atlaskit+select+react-beautiful-dnd#Temporary-Solution
165
167
  */
166
168
  UNSAFE_hasDraggableParentComponent?: boolean;
169
+ /** Override the internal behaviour of default menu open on focus and applicable for single value select */
170
+ openMenuOnClick?: boolean;
167
171
  };
168
172
  export type PopupUserPickerProps = UserPickerProps & {
169
173
  /** Whether to use the popup version of the single picker */
@@ -22,6 +22,7 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
22
22
  textFieldBackgroundColor: boolean;
23
23
  isClearable: boolean;
24
24
  loadOptionsErrorMessage: () => JSX.Element;
25
+ openMenuOnClick: boolean;
25
26
  };
26
27
  static getDerivedStateFromProps(nextProps: Partial<UserPickerProps>, prevState: UserPickerState): Partial<UserPickerState>;
27
28
  private selectRef;
@@ -41,6 +42,7 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
41
42
  private addOptions;
42
43
  private handleLoadOptionsError;
43
44
  private debouncedLoadOptions;
45
+ private get isMenuOpenOnClickForSingleSelect();
44
46
  abortOptionsShownUfoExperience: () => void;
45
47
  startOptionsShownUfoExperience: () => void;
46
48
  private executeLoadOptions;
@@ -64,11 +66,12 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
64
66
  private handleClickDraggableParentComponent;
65
67
  render(): JSX.Element;
66
68
  }
67
- export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "styles" | "value" | "footer" | "defaultValue" | "fieldId" | "width" | "menuMinWidth" | "maxPickerHeight" | "loadOptions" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "appearance" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "header" | "required" | "UNSAFE_hasDraggableParentComponent" | "SelectComponent" | "pickerProps"> & Partial<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isClearable" | "isMulti" | "textFieldBackgroundColor" | "loadOptionsErrorMessage" | "subtle" | "noBorder">> & Partial<Pick<{
69
+ export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "styles" | "value" | "footer" | "defaultValue" | "fieldId" | "width" | "menuMinWidth" | "maxPickerHeight" | "loadOptions" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "appearance" | "placeholderAvatar" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "header" | "required" | "UNSAFE_hasDraggableParentComponent" | "SelectComponent" | "pickerProps"> & Partial<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isClearable" | "isMulti" | "openMenuOnClick" | "textFieldBackgroundColor" | "loadOptionsErrorMessage" | "subtle" | "noBorder">> & Partial<Pick<{
68
70
  isMulti: boolean;
69
71
  subtle: boolean;
70
72
  noBorder: boolean;
71
73
  textFieldBackgroundColor: boolean;
72
74
  isClearable: boolean;
73
75
  loadOptionsErrorMessage: () => JSX.Element;
76
+ openMenuOnClick: boolean;
74
77
  }, never>> & React.RefAttributes<any>>;
@@ -27,7 +27,7 @@ export declare class PopupUserPickerWithoutAnalytics extends React.Component<Pop
27
27
  };
28
28
  render(): JSX.Element;
29
29
  }
30
- export declare const PopupUserPicker: React.ForwardRefExoticComponent<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "styles" | "value" | "footer" | "target" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "appearance" | "subtle" | "noBorder" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "header" | "required" | "UNSAFE_hasDraggableParentComponent" | "popupTitle"> & Partial<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "offset" | "isMulti" | "width" | "placement" | "rootBoundary" | "boundariesElement" | "shouldFlip">> & Partial<Pick<{
30
+ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "openMenuOnClick" | "styles" | "value" | "footer" | "target" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "appearance" | "subtle" | "noBorder" | "placeholderAvatar" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "header" | "required" | "UNSAFE_hasDraggableParentComponent" | "popupTitle"> & Partial<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "offset" | "isMulti" | "width" | "placement" | "rootBoundary" | "boundariesElement" | "shouldFlip">> & Partial<Pick<{
31
31
  boundariesElement: string;
32
32
  width: number;
33
33
  isMulti: boolean;
@@ -4,6 +4,7 @@ export type Props = {
4
4
  src?: string;
5
5
  name?: string;
6
6
  presence?: string;
7
+ type?: 'person' | 'team';
7
8
  };
8
9
  export declare class SizeableAvatar extends React.PureComponent<Props> {
9
10
  render(): JSX.Element;
@@ -10,7 +10,7 @@ export declare class UserPickerWithoutAnalytics extends React.Component<UserPick
10
10
  componentDidMount(): void;
11
11
  render(): JSX.Element;
12
12
  }
13
- export declare const UserPicker: React.ForwardRefExoticComponent<Pick<Omit<UserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "styles" | "value" | "footer" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "appearance" | "subtle" | "noBorder" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "header" | "required" | "UNSAFE_hasDraggableParentComponent"> & Partial<Pick<Omit<UserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isMulti" | "width">> & Partial<Pick<{
13
+ export declare const UserPicker: React.ForwardRefExoticComponent<Pick<Omit<UserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "openMenuOnClick" | "styles" | "value" | "footer" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "appearance" | "subtle" | "noBorder" | "placeholderAvatar" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "header" | "required" | "UNSAFE_hasDraggableParentComponent"> & Partial<Pick<Omit<UserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isMulti" | "width">> & Partial<Pick<{
14
14
  width: number;
15
15
  isMulti: boolean;
16
16
  }, never>> & React.RefAttributes<any>>;
@@ -101,6 +101,8 @@ export type UserPickerProps = WithAnalyticsEventsProps & {
101
101
  defaultValue?: DefaultValue;
102
102
  /** Placeholder text to be shown when there is no value in the field. */
103
103
  placeholder?: React.ReactNode;
104
+ /** Placeholder avatar style - defaults to person */
105
+ placeholderAvatar?: 'person' | 'team';
104
106
  /** Message to encourage the user to add more items to user picker. */
105
107
  addMoreMessage?: string;
106
108
  /** Message to be shown when the menu is open but no options are provided.
@@ -164,6 +166,8 @@ export type UserPickerProps = WithAnalyticsEventsProps & {
164
166
  * Context: https://hello.atlassian.net/wiki/spaces/~989411314/pages/2861097485/Investigation+Notes+for+atlaskit+select+react-beautiful-dnd#Temporary-Solution
165
167
  */
166
168
  UNSAFE_hasDraggableParentComponent?: boolean;
169
+ /** Override the internal behaviour of default menu open on focus and applicable for single value select */
170
+ openMenuOnClick?: boolean;
167
171
  };
168
172
  export type PopupUserPickerProps = UserPickerProps & {
169
173
  /** Whether to use the popup version of the single picker */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "10.18.0",
3
+ "version": "10.19.0",
4
4
  "description": "Fabric component for display a dropdown to select a user from",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@atlaskit/analytics-next": "^9.2.0",
46
- "@atlaskit/avatar": "^21.4.0",
46
+ "@atlaskit/avatar": "^21.5.0",
47
47
  "@atlaskit/icon": "^22.0.0",
48
48
  "@atlaskit/logo": "^13.15.0",
49
49
  "@atlaskit/lozenge": "^11.6.0",
@@ -52,8 +52,9 @@
52
52
  "@atlaskit/primitives": "^2.0.0",
53
53
  "@atlaskit/select": "^17.1.0",
54
54
  "@atlaskit/spinner": "^16.0.0",
55
+ "@atlaskit/teams-avatar": "^1.0.0",
55
56
  "@atlaskit/theme": "^12.6.0",
56
- "@atlaskit/tokens": "^1.37.0",
57
+ "@atlaskit/tokens": "^1.38.0",
57
58
  "@atlaskit/tooltip": "^18.1.0",
58
59
  "@atlaskit/ufo": "^0.2.0",
59
60
  "@babel/runtime": "^7.0.0",