@atlaskit/user-picker 9.2.0 → 9.3.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,23 @@
1
1
  # @atlaskit/user-picker
2
2
 
3
+ ## 9.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`bc0b47732f8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bc0b47732f8) - [ux] Fix bug where user picker input is not being unfocused when disableInput is set. The new behavior will enable you to still focus on the input but not interact with it, unless it is to delete selected users.
8
+
9
+ ## 9.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`d27d65448a2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d27d65448a2) - [ux] Add margin-left to addMoreText field
14
+
15
+ ## 9.2.1
16
+
17
+ ### Patch Changes
18
+
19
+ - [`607b182bb8a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/607b182bb8a) - Add typecasting to prevent type errors during multivaluecontainer placeholder translations. Also fix warnings for importing json attributes from version.json for analytics.
20
+
3
21
  ## 9.2.0
4
22
 
5
23
  ### Minor Changes
@@ -13,7 +13,7 @@ var _analyticsNext = require("@atlaskit/analytics-next");
13
13
 
14
14
  var _uuid = require("uuid");
15
15
 
16
- var _version = require("./version.json");
16
+ var _version = _interopRequireDefault(require("./version.json"));
17
17
 
18
18
  var _utils = require("./components/utils");
19
19
 
@@ -21,6 +21,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
21
21
 
22
22
  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; }
23
23
 
24
+ var packageName = _version.default.name;
25
+ var packageVersion = _version.default.version;
24
26
  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}$/;
25
27
  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}$/;
26
28
  var UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
@@ -47,8 +49,8 @@ var createEvent = function createEvent(eventType, action, actionSubject) {
47
49
  action: action,
48
50
  actionSubject: actionSubject,
49
51
  attributes: _objectSpread({
50
- packageName: _version.name,
51
- packageVersion: _version.version
52
+ packageName: packageName,
53
+ packageVersion: packageVersion
52
54
  }, attributes)
53
55
  };
54
56
  };
@@ -152,7 +152,8 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
152
152
  });
153
153
 
154
154
  _this.setState({
155
- value: remainingValues ? remainingValues : []
155
+ value: remainingValues ? remainingValues : [],
156
+ menuIsOpen: true
156
157
  });
157
158
  }
158
159
 
@@ -366,8 +367,7 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
366
367
 
367
368
  if (event.keyCode === 32 && !_this.state.inputValue) {
368
369
  event.preventDefault();
369
-
370
- _this.setState({
370
+ !_this.props.disableInput && _this.setState({
371
371
  inputValue: ' '
372
372
  });
373
373
  }
@@ -582,6 +582,10 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
582
582
  value: function getDerivedStateFromProps(nextProps, prevState) {
583
583
  var derivedState = {};
584
584
 
585
+ if (nextProps.isDisabled || nextProps.disableInput) {
586
+ derivedState.menuIsOpen = false;
587
+ }
588
+
585
589
  if (nextProps.open !== undefined) {
586
590
  derivedState.menuIsOpen = nextProps.open;
587
591
  }
@@ -47,9 +47,15 @@ var Input = /*#__PURE__*/function (_React$Component) {
47
47
 
48
48
  _this = _super.call.apply(_super, [this].concat(args));
49
49
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeyPress", function (e) {
50
+ var _this$props$selectPro;
51
+
50
52
  if (e.key === 'Enter') {
51
53
  e.preventDefault();
52
54
  }
55
+
56
+ if ((_this$props$selectPro = _this.props.selectProps) !== null && _this$props$selectPro !== void 0 && _this$props$selectPro.disableInput) {
57
+ e.preventDefault();
58
+ }
53
59
  });
54
60
  return _this;
55
61
  }
@@ -57,10 +63,8 @@ var Input = /*#__PURE__*/function (_React$Component) {
57
63
  (0, _createClass2.default)(Input, [{
58
64
  key: "render",
59
65
  value: function render() {
60
- var selectProps = this.props.selectProps;
61
66
  return /*#__PURE__*/_react.default.createElement(_select.components.Input, (0, _extends2.default)({}, this.props, {
62
67
  innerRef: this.props.innerRef,
63
- isDisabled: selectProps && selectProps.disableInput,
64
68
  onKeyPress: this.handleKeyPress
65
69
  }));
66
70
  }
@@ -95,7 +95,16 @@ var MultiValueContainer = /*#__PURE__*/function (_React$PureComponent) {
95
95
 
96
96
  if (addMoreMessage === undefined) {
97
97
  return /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _i18n.messages.addMore, function (addMore) {
98
- return _this.addPlaceholder(addMore);
98
+ var _join, _addMoreMessages;
99
+
100
+ var addMoreMessages = addMore;
101
+
102
+ if (addMore && typeof addMore === 'string') {
103
+ addMoreMessages = [addMore];
104
+ }
105
+
106
+ var placeholder = (_join = (_addMoreMessages = addMoreMessages) === null || _addMoreMessages === void 0 ? void 0 : _addMoreMessages.join('')) !== null && _join !== void 0 ? _join : '';
107
+ return _this.addPlaceholder(placeholder);
99
108
  });
100
109
  }
101
110
 
@@ -39,6 +39,7 @@ var INDICATOR_WIDTH = 39;
39
39
  exports.INDICATOR_WIDTH = INDICATOR_WIDTH;
40
40
  var TOTAL_PADDING_TAG_TO_CONTAINER = 10;
41
41
  var TAG_MARGIN_WIDTH = 4;
42
+ var PLACEHOLDER_MARGIN = 2;
42
43
  var getStyles = (0, _memoizeOne.default)(function (width, isMulti, overrideStyles) {
43
44
  var styles = {
44
45
  menu: function menu(css, state) {
@@ -171,6 +172,7 @@ var getStyles = (0, _memoizeOne.default)(function (width, isMulti, overrideStyle
171
172
  /* Necessary to make input height and tag height the same. */
172
173
  marginBottom: TAG_MARGIN_WIDTH,
173
174
  marginTop: TAG_MARGIN_WIDTH,
175
+ marginLeft: PLACEHOLDER_MARGIN,
174
176
 
175
177
  /* Padding top and bottom of 2 is set by default. */
176
178
  paddingTop: 0,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.2.0",
3
+ "version": "9.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,9 @@
1
1
  import { createAndFireEvent } from '@atlaskit/analytics-next';
2
2
  import { v4 as uuidv4 } from 'uuid';
3
- import { name as packageName, version as packageVersion } from './version.json';
3
+ import versionJson from './version.json';
4
4
  import { isExternalUser } from './components/utils';
5
+ const packageName = versionJson.name;
6
+ const packageVersion = versionJson.version;
5
7
  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}$/;
6
8
  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}$/;
7
9
  const UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
@@ -18,6 +18,10 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
18
18
  static getDerivedStateFromProps(nextProps, prevState) {
19
19
  const derivedState = {};
20
20
 
21
+ if (nextProps.isDisabled || nextProps.disableInput) {
22
+ derivedState.menuIsOpen = false;
23
+ }
24
+
21
25
  if (nextProps.open !== undefined) {
22
26
  derivedState.menuIsOpen = nextProps.open;
23
27
  }
@@ -119,7 +123,8 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
119
123
  if (removedValue && this.state.value && Array.isArray(this.state.value)) {
120
124
  const remainingValues = this.state.value.filter(val => val.data.id !== removedValue.data.id);
121
125
  this.setState({
122
- value: remainingValues ? remainingValues : []
126
+ value: remainingValues ? remainingValues : [],
127
+ menuIsOpen: true
123
128
  });
124
129
  }
125
130
 
@@ -324,7 +329,7 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
324
329
 
325
330
  if (event.keyCode === 32 && !this.state.inputValue) {
326
331
  event.preventDefault();
327
- this.setState({
332
+ !this.props.disableInput && this.setState({
328
333
  inputValue: ' '
329
334
  });
330
335
  }
@@ -7,19 +7,21 @@ export class Input extends React.Component {
7
7
  super(...args);
8
8
 
9
9
  _defineProperty(this, "handleKeyPress", e => {
10
+ var _this$props$selectPro;
11
+
10
12
  if (e.key === 'Enter') {
11
13
  e.preventDefault();
12
14
  }
15
+
16
+ if ((_this$props$selectPro = this.props.selectProps) !== null && _this$props$selectPro !== void 0 && _this$props$selectPro.disableInput) {
17
+ e.preventDefault();
18
+ }
13
19
  });
14
20
  }
15
21
 
16
22
  render() {
17
- const {
18
- selectProps
19
- } = this.props;
20
23
  return /*#__PURE__*/React.createElement(components.Input, _extends({}, this.props, {
21
24
  innerRef: this.props.innerRef,
22
- isDisabled: selectProps && selectProps.disableInput,
23
25
  onKeyPress: this.handleKeyPress
24
26
  }));
25
27
  }
@@ -67,7 +67,18 @@ export class MultiValueContainer extends React.PureComponent {
67
67
  }
68
68
 
69
69
  if (addMoreMessage === undefined) {
70
- return /*#__PURE__*/React.createElement(FormattedMessage, messages.addMore, addMore => this.addPlaceholder(addMore));
70
+ return /*#__PURE__*/React.createElement(FormattedMessage, messages.addMore, addMore => {
71
+ var _join, _addMoreMessages;
72
+
73
+ let addMoreMessages = addMore;
74
+
75
+ if (addMore && typeof addMore === 'string') {
76
+ addMoreMessages = [addMore];
77
+ }
78
+
79
+ const placeholder = (_join = (_addMoreMessages = addMoreMessages) === null || _addMoreMessages === void 0 ? void 0 : _addMoreMessages.join('')) !== null && _join !== void 0 ? _join : '';
80
+ return this.addPlaceholder(placeholder);
81
+ });
71
82
  }
72
83
 
73
84
  return this.addPlaceholder(addMoreMessage);
@@ -9,6 +9,7 @@ export const AVATAR_PADDING = 6;
9
9
  export const INDICATOR_WIDTH = 39;
10
10
  const TOTAL_PADDING_TAG_TO_CONTAINER = 10;
11
11
  const TAG_MARGIN_WIDTH = 4;
12
+ const PLACEHOLDER_MARGIN = 2;
12
13
  export const getStyles = memoizeOne((width, isMulti, overrideStyles) => {
13
14
  let styles = {
14
15
  menu: (css, state) => ({ ...css,
@@ -129,6 +130,7 @@ export const getStyles = memoizeOne((width, isMulti, overrideStyles) => {
129
130
  /* Necessary to make input height and tag height the same. */
130
131
  marginBottom: TAG_MARGIN_WIDTH,
131
132
  marginTop: TAG_MARGIN_WIDTH,
133
+ marginLeft: PLACEHOLDER_MARGIN,
132
134
 
133
135
  /* Padding top and bottom of 2 is set by default. */
134
136
  paddingTop: 0,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.2.0",
3
+ "version": "9.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -6,8 +6,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
 
7
7
  import { createAndFireEvent } from '@atlaskit/analytics-next';
8
8
  import { v4 as uuidv4 } from 'uuid';
9
- import { name as packageName, version as packageVersion } from './version.json';
9
+ import versionJson from './version.json';
10
10
  import { isExternalUser } from './components/utils';
11
+ var packageName = versionJson.name;
12
+ var packageVersion = versionJson.version;
11
13
  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}$/;
12
14
  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}$/;
13
15
  var UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
@@ -135,7 +135,8 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
135
135
  });
136
136
 
137
137
  _this.setState({
138
- value: remainingValues ? remainingValues : []
138
+ value: remainingValues ? remainingValues : [],
139
+ menuIsOpen: true
139
140
  });
140
141
  }
141
142
 
@@ -364,8 +365,7 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
364
365
 
365
366
  if (event.keyCode === 32 && !_this.state.inputValue) {
366
367
  event.preventDefault();
367
-
368
- _this.setState({
368
+ !_this.props.disableInput && _this.setState({
369
369
  inputValue: ' '
370
370
  });
371
371
  }
@@ -584,6 +584,10 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
584
584
  value: function getDerivedStateFromProps(nextProps, prevState) {
585
585
  var derivedState = {};
586
586
 
587
+ if (nextProps.isDisabled || nextProps.disableInput) {
588
+ derivedState.menuIsOpen = false;
589
+ }
590
+
587
591
  if (nextProps.open !== undefined) {
588
592
  derivedState.menuIsOpen = nextProps.open;
589
593
  }
@@ -30,9 +30,15 @@ export var Input = /*#__PURE__*/function (_React$Component) {
30
30
  _this = _super.call.apply(_super, [this].concat(args));
31
31
 
32
32
  _defineProperty(_assertThisInitialized(_this), "handleKeyPress", function (e) {
33
+ var _this$props$selectPro;
34
+
33
35
  if (e.key === 'Enter') {
34
36
  e.preventDefault();
35
37
  }
38
+
39
+ if ((_this$props$selectPro = _this.props.selectProps) !== null && _this$props$selectPro !== void 0 && _this$props$selectPro.disableInput) {
40
+ e.preventDefault();
41
+ }
36
42
  });
37
43
 
38
44
  return _this;
@@ -41,10 +47,8 @@ export var Input = /*#__PURE__*/function (_React$Component) {
41
47
  _createClass(Input, [{
42
48
  key: "render",
43
49
  value: function render() {
44
- var selectProps = this.props.selectProps;
45
50
  return /*#__PURE__*/React.createElement(components.Input, _extends({}, this.props, {
46
51
  innerRef: this.props.innerRef,
47
- isDisabled: selectProps && selectProps.disableInput,
48
52
  onKeyPress: this.handleKeyPress
49
53
  }));
50
54
  }
@@ -77,7 +77,16 @@ export var MultiValueContainer = /*#__PURE__*/function (_React$PureComponent) {
77
77
 
78
78
  if (addMoreMessage === undefined) {
79
79
  return /*#__PURE__*/React.createElement(FormattedMessage, messages.addMore, function (addMore) {
80
- return _this.addPlaceholder(addMore);
80
+ var _join, _addMoreMessages;
81
+
82
+ var addMoreMessages = addMore;
83
+
84
+ if (addMore && typeof addMore === 'string') {
85
+ addMoreMessages = [addMore];
86
+ }
87
+
88
+ var placeholder = (_join = (_addMoreMessages = addMoreMessages) === null || _addMoreMessages === void 0 ? void 0 : _addMoreMessages.join('')) !== null && _join !== void 0 ? _join : '';
89
+ return _this.addPlaceholder(placeholder);
81
90
  });
82
91
  }
83
92
 
@@ -19,6 +19,7 @@ export var AVATAR_PADDING = 6;
19
19
  export var INDICATOR_WIDTH = 39;
20
20
  var TOTAL_PADDING_TAG_TO_CONTAINER = 10;
21
21
  var TAG_MARGIN_WIDTH = 4;
22
+ var PLACEHOLDER_MARGIN = 2;
22
23
  export var getStyles = memoizeOne(function (width, isMulti, overrideStyles) {
23
24
  var styles = {
24
25
  menu: function menu(css, state) {
@@ -154,6 +155,7 @@ export var getStyles = memoizeOne(function (width, isMulti, overrideStyles) {
154
155
  /* Necessary to make input height and tag height the same. */
155
156
  marginBottom: TAG_MARGIN_WIDTH,
156
157
  marginTop: TAG_MARGIN_WIDTH,
158
+ marginLeft: PLACEHOLDER_MARGIN,
157
159
 
158
160
  /* Padding top and bottom of 2 is set by default. */
159
161
  paddingTop: 0,
@@ -1,5 +1,5 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
 
4
4
  /**
5
5
  * Tries to get the most specific messages bundle for a given locale.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.2.0",
3
+ "version": "9.3.0",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.2.0",
3
+ "version": "9.3.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/"
@@ -29,10 +29,10 @@
29
29
  "@atlaskit/analytics-next": "^8.2.0",
30
30
  "@atlaskit/avatar": "^21.0.0",
31
31
  "@atlaskit/icon": "^21.10.0",
32
- "@atlaskit/logo": "^13.7.0",
32
+ "@atlaskit/logo": "^13.8.0",
33
33
  "@atlaskit/lozenge": "^11.0.0",
34
34
  "@atlaskit/popper": "^5.0.0",
35
- "@atlaskit/select": "^15.3.0",
35
+ "@atlaskit/select": "^15.4.0",
36
36
  "@atlaskit/spinner": "^15.1.4",
37
37
  "@atlaskit/theme": "^12.1.0",
38
38
  "@atlaskit/tokens": "^0.10.0",
@@ -59,7 +59,7 @@
59
59
  "@atlaskit/range": "^6.0.0",
60
60
  "@atlaskit/section-message": "^6.0.0",
61
61
  "@atlaskit/textfield": "^5.0.0",
62
- "@atlaskit/util-data-test": "^17.3.0",
62
+ "@atlaskit/util-data-test": "^17.5.0",
63
63
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
64
64
  "@emotion/styled": "^10.0.7",
65
65
  "@testing-library/dom": "^7.7.3",
package/report.api.md ADDED
@@ -0,0 +1,552 @@
1
+ ## API Report File for "@atlaskit/user-picker"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ import { Placement } from '@atlaskit/popper';
7
+ import { default as React_2 } from 'react';
8
+ import { ReactNode } from 'react';
9
+ import { StylesConfig } from '@atlaskit/select';
10
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
11
+
12
+ export declare type ActionTypes =
13
+ | 'select-option'
14
+ | 'deselect-option'
15
+ | 'remove-value'
16
+ | 'pop-value'
17
+ | 'set-value'
18
+ | 'clear'
19
+ | 'create-option';
20
+
21
+ export declare type Appearance = 'normal' | 'compact';
22
+
23
+ export declare type AtlasKitSelectChange = (
24
+ value: AtlaskitSelectValue,
25
+ extraInfo: {
26
+ removedValue?: Option_2;
27
+ option?: Option_2;
28
+ action: ActionTypes;
29
+ },
30
+ ) => void;
31
+
32
+ export declare type AtlaskitSelectValue =
33
+ | Option_2
34
+ | Array<Option_2>
35
+ | null
36
+ | undefined;
37
+
38
+ declare type BoundariesElement =
39
+ | 'scrollParent'
40
+ | 'window'
41
+ | 'viewport'
42
+ | HTMLElement;
43
+
44
+ export declare type DefaultValue =
45
+ | Value
46
+ | OptionIdentifier
47
+ | OptionIdentifier[];
48
+
49
+ export declare interface Email extends OptionData {
50
+ type: 'email';
51
+ suggestion?: boolean;
52
+ }
53
+
54
+ export declare const EmailType = 'email';
55
+
56
+ export declare type EmailValidationResponse = 'INVALID' | 'POTENTIAL' | 'VALID';
57
+
58
+ export declare type EmailValidator = (
59
+ inputText: string,
60
+ ) => EmailValidationResponse;
61
+
62
+ export declare interface ExternalUser extends User {
63
+ externalUserType?: 'crossSite' | 'thirdParty';
64
+ requiresSourceHydration?: boolean;
65
+ sources: UserSource[];
66
+ }
67
+
68
+ export declare interface Group extends OptionData {
69
+ highlight?: GroupHighlight;
70
+ type: 'group';
71
+ }
72
+
73
+ export declare interface GroupHighlight {
74
+ name: HighlightRange[];
75
+ }
76
+
77
+ export declare const GroupType = 'group';
78
+
79
+ export declare interface HighlightRange {
80
+ start: number;
81
+ end: number;
82
+ }
83
+
84
+ export declare type InputActionTypes =
85
+ | 'set-value'
86
+ | 'input-change'
87
+ | 'input-blur'
88
+ | 'menu-close';
89
+
90
+ export declare const isEmail: (option: OptionData) => option is Email;
91
+
92
+ export declare const isExternalUser: (
93
+ option: OptionData,
94
+ ) => option is ExternalUser;
95
+
96
+ export declare const isTeam: (option: OptionData) => option is Team;
97
+
98
+ export declare const isUser: (option: OptionData) => option is User;
99
+
100
+ export declare const isValidEmail: EmailValidator;
101
+
102
+ export declare interface LoadOptions {
103
+ (searchText?: string, sessionId?: string):
104
+ | Promisable<OptionData | OptionData[]>
105
+ | Iterable<
106
+ Promisable<OptionData[] | OptionData> | OptionData | OptionData[]
107
+ >;
108
+ }
109
+
110
+ declare interface LoadUserSource {
111
+ (accountId: string, signal?: AbortSignal): Promise<UserSourceResult[]>;
112
+ }
113
+
114
+ declare type LozengeColor =
115
+ | 'default'
116
+ | 'success'
117
+ | 'removed'
118
+ | 'inprogress'
119
+ | 'new'
120
+ | 'moved';
121
+
122
+ export declare interface LozengeProps {
123
+ text: string;
124
+ tooltip?: string;
125
+ appearance?: LozengeColor;
126
+ isBold?: boolean;
127
+ }
128
+
129
+ export declare type OnChange = (value: Value, action: ActionTypes) => void;
130
+
131
+ export declare type OnInputChange = (
132
+ query?: string,
133
+ sessionId?: string,
134
+ ) => void;
135
+
136
+ export declare type OnOption = (value: Value, sessionId?: string) => void;
137
+
138
+ export declare type OnPicker = (sessionId?: string) => void;
139
+
140
+ declare type Option_2<Data = OptionData> = {
141
+ label: string;
142
+ value: string;
143
+ data: Data;
144
+ };
145
+ export { Option_2 as Option };
146
+
147
+ export declare interface OptionData {
148
+ avatarUrl?: any;
149
+ id: string;
150
+ name: string;
151
+ type?: 'user' | 'team' | 'email' | 'group';
152
+ fixed?: boolean;
153
+ lozenge?: string | LozengeProps;
154
+ }
155
+
156
+ export declare type OptionIdentifier = Pick<OptionData, 'id' | 'type'>;
157
+
158
+ export declare const PopupUserPicker: React_2.ForwardRefExoticComponent<
159
+ Pick<
160
+ Omit<PopupUserPickerProps, keyof WithAnalyticsEventsProps>,
161
+ | 'target'
162
+ | 'autoFocus'
163
+ | 'captureMenuScroll'
164
+ | 'closeMenuOnScroll'
165
+ | 'inputId'
166
+ | 'isClearable'
167
+ | 'isDisabled'
168
+ | 'isLoading'
169
+ | 'menuPosition'
170
+ | 'menuPortalTarget'
171
+ | 'menuShouldBlockScroll'
172
+ | 'noOptionsMessage'
173
+ | 'onBlur'
174
+ | 'onChange'
175
+ | 'onFocus'
176
+ | 'onInputChange'
177
+ | 'options'
178
+ | 'placeholder'
179
+ | 'styles'
180
+ | 'value'
181
+ | 'defaultValue'
182
+ | 'fieldId'
183
+ | 'menuMinWidth'
184
+ | 'maxPickerHeight'
185
+ | 'textFieldBackgroundColor'
186
+ | 'loadOptions'
187
+ | 'loadUserSource'
188
+ | 'search'
189
+ | 'anchor'
190
+ | 'open'
191
+ | 'onSelection'
192
+ | 'onClear'
193
+ | 'onClose'
194
+ | 'appearance'
195
+ | 'subtle'
196
+ | 'noBorder'
197
+ | 'addMoreMessage'
198
+ | 'clearValueLabel'
199
+ | 'allowEmail'
200
+ | 'suggestEmailsForDomain'
201
+ | 'emailLabel'
202
+ | 'disableInput'
203
+ | 'isValidEmail'
204
+ | 'maxOptions'
205
+ | 'ariaLabelledBy'
206
+ | 'ariaLive'
207
+ | 'popupTitle'
208
+ > &
209
+ Partial<
210
+ Pick<
211
+ Omit<PopupUserPickerProps, keyof WithAnalyticsEventsProps>,
212
+ | 'isMulti'
213
+ | 'width'
214
+ | 'offset'
215
+ | 'boundariesElement'
216
+ | 'placement'
217
+ | 'rootBoundary'
218
+ | 'shouldFlip'
219
+ >
220
+ > &
221
+ Partial<
222
+ Pick<
223
+ {
224
+ boundariesElement: string;
225
+ width: number;
226
+ isMulti: boolean;
227
+ offset: number[];
228
+ placement: string;
229
+ rootBoundary: string;
230
+ shouldFlip: boolean;
231
+ },
232
+ never
233
+ >
234
+ > &
235
+ React_2.RefAttributes<any>
236
+ >;
237
+
238
+ export declare type PopupUserPickerProps = UserPickerProps & {
239
+ /** Whether to use the popup version of the single picker */
240
+ target: Target;
241
+ /** Optional title assigned to popup picker */
242
+ popupTitle?: string;
243
+ /**
244
+ * The boundary element that the popup will check for overflow.
245
+ * Defaults to `"viewport"` which are parent scroll containers,
246
+ * but can be set to any element.
247
+ */
248
+ boundariesElement?: BoundariesElement;
249
+ /**
250
+ * Distance the popup should be offset from the reference in the format of [along, away] (units in px).
251
+ */
252
+ offset?: [number, number];
253
+ /**
254
+ * Placement of where the popup should be displayed relative to the trigger element.
255
+ * Defaults to `"auto"`.
256
+ */
257
+ placement?: Placement;
258
+ /**
259
+ * The root boundary that the popup will check for overflow.
260
+ * Defaults to `"viewport"` but can be set to `"document"`.
261
+ * See `@atlaskit/popper` for further details.
262
+ */
263
+ rootBoundary?: RootBoundary;
264
+ /**
265
+ * Allows the dropdown menu to be placed on the opposite side of its trigger if it does not
266
+ * fit in the viewport.
267
+ */
268
+ shouldFlip?: boolean;
269
+ };
270
+
271
+ export declare type Promisable<T> = T | PromiseLike<T>;
272
+
273
+ declare type RootBoundary = 'viewport' | 'document';
274
+
275
+ export declare type Target = (options: {
276
+ ref: any;
277
+ isOpen: boolean;
278
+ }) => ReactNode;
279
+
280
+ export declare interface Team extends OptionData {
281
+ avatarUrl?: string;
282
+ description?: string;
283
+ memberCount?: number;
284
+ members?: TeamMember[];
285
+ includesYou?: boolean;
286
+ highlight?: TeamHighlight;
287
+ type: 'team';
288
+ }
289
+
290
+ export declare interface TeamHighlight {
291
+ name: HighlightRange[];
292
+ description?: HighlightRange[];
293
+ }
294
+
295
+ export declare interface TeamMember {
296
+ name: string;
297
+ id: string;
298
+ }
299
+
300
+ export declare const TeamType = 'team';
301
+
302
+ export declare interface User extends OptionData {
303
+ avatarUrl?: string;
304
+ publicName?: string;
305
+ highlight?: UserHighlight;
306
+ byline?: string;
307
+ type?: 'user';
308
+ email?: string;
309
+ isExternal?: boolean;
310
+ }
311
+
312
+ export declare interface UserHighlight {
313
+ name: HighlightRange[];
314
+ publicName: HighlightRange[];
315
+ }
316
+
317
+ declare const UserPicker: React_2.ForwardRefExoticComponent<
318
+ Pick<
319
+ Omit<UserPickerProps, keyof WithAnalyticsEventsProps>,
320
+ | 'autoFocus'
321
+ | 'captureMenuScroll'
322
+ | 'closeMenuOnScroll'
323
+ | 'inputId'
324
+ | 'isClearable'
325
+ | 'isDisabled'
326
+ | 'isLoading'
327
+ | 'menuPosition'
328
+ | 'menuPortalTarget'
329
+ | 'menuShouldBlockScroll'
330
+ | 'noOptionsMessage'
331
+ | 'onBlur'
332
+ | 'onChange'
333
+ | 'onFocus'
334
+ | 'onInputChange'
335
+ | 'options'
336
+ | 'placeholder'
337
+ | 'styles'
338
+ | 'value'
339
+ | 'defaultValue'
340
+ | 'fieldId'
341
+ | 'menuMinWidth'
342
+ | 'maxPickerHeight'
343
+ | 'textFieldBackgroundColor'
344
+ | 'loadOptions'
345
+ | 'loadUserSource'
346
+ | 'search'
347
+ | 'anchor'
348
+ | 'open'
349
+ | 'onSelection'
350
+ | 'onClear'
351
+ | 'onClose'
352
+ | 'appearance'
353
+ | 'subtle'
354
+ | 'noBorder'
355
+ | 'addMoreMessage'
356
+ | 'clearValueLabel'
357
+ | 'allowEmail'
358
+ | 'suggestEmailsForDomain'
359
+ | 'emailLabel'
360
+ | 'disableInput'
361
+ | 'isValidEmail'
362
+ | 'maxOptions'
363
+ | 'ariaLabelledBy'
364
+ | 'ariaLive'
365
+ > &
366
+ Partial<
367
+ Pick<
368
+ Omit<UserPickerProps, keyof WithAnalyticsEventsProps>,
369
+ 'isMulti' | 'width'
370
+ >
371
+ > &
372
+ Partial<
373
+ Pick<
374
+ {
375
+ width: number;
376
+ isMulti: boolean;
377
+ },
378
+ never
379
+ >
380
+ > &
381
+ React_2.RefAttributes<any>
382
+ >;
383
+ export default UserPicker;
384
+
385
+ export declare type UserPickerProps = WithAnalyticsEventsProps & {
386
+ /**
387
+ * Used to configure additional information regarding where the
388
+ * user picker has been mounted.
389
+ *
390
+ * The purpose is to give more context as to where user picker events
391
+ * are being fired from, as the current data may not uniquely identify
392
+ * which field is the source.
393
+ *
394
+ * The value will be passed as a data attribute for analytics.
395
+ * Examples include "assignee", "watchers" and "share".
396
+ *
397
+ * A second usage for the fieldId is for server side rendering (SSR) where it must be a unique id per UserPicker
398
+ * instance contained in the serialized SSR content. E.g. a SPA page rendered through SSR that has multiple user pickers.
399
+ *
400
+ * fieldId can be set to null if the integrator is not listening
401
+ * for the analytic events or does not care about SSR.
402
+ */
403
+ fieldId: string | null;
404
+ /** List of users or teams to be used as options by the user picker. */
405
+ options?: OptionData[];
406
+ /** Width of the user picker field. It can be the amount of pixels as numbers or a string with the percentage. */
407
+ width?: number | string;
408
+ /** Sets the minimum width for the menu. If not set, menu will always have the same width of the field. */
409
+ menuMinWidth?: number;
410
+ /** Sets max height of the user picker. If not set, the height will grow based on number of picked users. */
411
+ maxPickerHeight?: number;
412
+ /** Sets the background color to be the same color as a textfield (Atlaskit N10) */
413
+ textFieldBackgroundColor?: boolean;
414
+ /**
415
+ * Function used to load options asynchronously.
416
+ * accepts two optional params:
417
+ * searchText?: optional text to filter results
418
+ * sessionId?: user picker session identifier, used to track success metric for users providers
419
+ */
420
+ loadOptions?: LoadOptions;
421
+ /**
422
+ * Function used to load user source if they are an external user.
423
+ * accepts two params:
424
+ * accountId: account ID of the user to lookup sources
425
+ * signal: AbortController signal to abort the request if the tooltip is closed
426
+ */
427
+ loadUserSource?: LoadUserSource;
428
+ /** Callback for value change events fired whenever a selection is inserted or removed. */
429
+ onChange?: OnChange;
430
+ /** To enable multi user picker. */
431
+ isMulti?: boolean;
432
+ /** Input text value. */
433
+ search?: string;
434
+ /** Anchor for the user picker popup. */
435
+ anchor?: React_2.ComponentType<any>;
436
+ /** Controls if user picker menu is open or not. If not provided, UserPicker will control menu state internally. */
437
+ open?: boolean;
438
+ /** Show the loading indicator. */
439
+ isLoading?: boolean;
440
+ /** Callback for search input text change events. */
441
+ onInputChange?: OnInputChange;
442
+ /** Callback for when a selection is made. */
443
+ onSelection?: OnOption;
444
+ /** Callback for when the field gains focus. */
445
+ onFocus?: OnPicker;
446
+ /** Callback for when the field loses focus. */
447
+ onBlur?: OnPicker;
448
+ /** Callback for when the value/s in the picker is cleared. */
449
+ onClear?: OnPicker;
450
+ /** Callback that is triggered when popup picker is closed */
451
+ onClose?: OnPicker;
452
+ /** Appearance of the user picker. */
453
+ appearance?: Appearance;
454
+ /** Display the picker with a subtle style. */
455
+ subtle?: boolean;
456
+ /** Display the picker with no border. */
457
+ noBorder?: boolean;
458
+ /**
459
+ * You may pass through a `StylesConfig` to be merged with the picker default styles if a custom override is required.
460
+ * Consider using noBorder, subtle before customising further.
461
+ * See https://react-select.com/styles
462
+ */
463
+ styles?: StylesConfig;
464
+ /** Default value for the field to be used on initial render.
465
+ * `defaultValue` differs from `value` in that it sets the initial value then leaves the component 'uncontrolled'
466
+ * whereas setting the `value` prop delegates responsibility for maintaining the value to the caller
467
+ * (i.e. listen to `onChange`) */
468
+ defaultValue?: DefaultValue;
469
+ /** Placeholder text to be shown when there is no value in the field. */
470
+ placeholder?: React_2.ReactNode;
471
+ /** Message to encourage the user to add more items to user picker. */
472
+ addMoreMessage?: string;
473
+ /** Message to be shown when the menu is open but no options are provided.
474
+ * If message is null, no message will be displayed.
475
+ * If message is undefined, default message will be displayed.
476
+ */
477
+ noOptionsMessage?:
478
+ | ((value: { inputValue: string }) => string | null)
479
+ | string
480
+ | null;
481
+ /** Controls if the user picker has a value or not. If not provided, UserPicker will control the value internally. */
482
+ value?: Value;
483
+ /** Disable all interactions with the picker, putting it in a read-only state. */
484
+ isDisabled?: boolean;
485
+ /** Display a remove button on the single picker. True by default. */
486
+ isClearable?: boolean;
487
+ /** Optional tooltip to display on hover over the clear indicator. */
488
+ clearValueLabel?: string;
489
+ /** React-select prop for controlling menu position */
490
+ menuPosition?: 'absolute' | 'fixed';
491
+ /** React-select prop for blocking menu scroll on container when menu scrolled to the very top/bottom of the menu */
492
+ captureMenuScroll?: boolean;
493
+ /** Whether the menu should use a portal, and where it should attach. */
494
+ menuPortalTarget?: HTMLElement;
495
+ /** Whether the user is allowed to enter emails as a value. */
496
+ allowEmail?: boolean;
497
+ /** Setting this with allowEmail will cause the picker to constantly show an email option at the bottom for the supplied email domain/an email the user types in */
498
+ suggestEmailsForDomain?: string;
499
+ /** Email option label */
500
+ emailLabel?: string;
501
+ /** Whether to disable interaction with the input */
502
+ disableInput?: boolean;
503
+ /** Override default email validation function. */
504
+ isValidEmail?: EmailValidator;
505
+ /** Override the internal behaviour to automatically focus the control when the picker is open */
506
+ autoFocus?: boolean;
507
+ /** The maximum number options to be displayed in the dropdown menu during any state of search. The value should be non-negative. */
508
+ maxOptions?: number;
509
+ /** Allows clicking on a label with the same id to open user picker. */
510
+ inputId?: string;
511
+ /** Whether to close menu on scroll */
512
+ closeMenuOnScroll?: boolean | EventListener;
513
+ /** Whether to block scrolling actions */
514
+ menuShouldBlockScroll?: boolean;
515
+ /** Accessibility: Identifies the element (or elements) that labels the current element.*/
516
+ ariaLabelledBy?: string;
517
+ /** Accessibility: Used to set the priority with which screen reader should treat updates to live regions.*/
518
+ ariaLive?: 'polite' | 'off' | 'assertive';
519
+ };
520
+
521
+ export declare type UserPickerState = {
522
+ options: OptionData[];
523
+ value?: AtlaskitSelectValue;
524
+ isDefaultSet: boolean;
525
+ inflightRequest: number;
526
+ count: number;
527
+ hoveringClearIndicator: boolean;
528
+ menuIsOpen: boolean;
529
+ inputValue: string;
530
+ resolving: boolean;
531
+ };
532
+
533
+ export declare type UserSource =
534
+ | 'google'
535
+ | 'slack'
536
+ | 'microsoft'
537
+ | 'github'
538
+ | 'jira'
539
+ | 'confluence'
540
+ | 'other-atlassian';
541
+
542
+ declare interface UserSourceResult {
543
+ sourceId: string;
544
+ sourceType: UserSource;
545
+ }
546
+
547
+ export declare const UserType = 'user';
548
+
549
+ export declare type Value = OptionData | OptionData[] | null | undefined;
550
+
551
+ export {};
552
+ ```