@atlaskit/user-picker 10.29.2 → 10.30.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,13 @@
1
1
  # @atlaskit/user-picker
2
2
 
3
+ ## 10.30.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#101739](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101739)
8
+ [`b9f6cdeb8cfcb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b9f6cdeb8cfcb) -
9
+ Add support for React 18
10
+
3
11
  ## 10.29.2
4
12
 
5
13
  ### Patch Changes
@@ -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.29.2";
15
+ var packageVersion = "10.30.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}$/;
@@ -158,36 +158,33 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
158
158
  (0, _defineProperty2.default)(_this, "debouncedLoadOptions", (0, _debounce.default)(function (search) {
159
159
  var loadOptions = _this.props.loadOptions;
160
160
  if (loadOptions) {
161
- _this.setState(function (_ref3) {
162
- var previousRequest = _ref3.inflightRequest;
163
- var inflightRequest = previousRequest + 1;
164
- var result = _this.session && _this.session.id ? loadOptions(search, _this.session.id) : loadOptions(search);
165
- var addOptions = _this.addOptions.bind(_this, inflightRequest.toString());
166
- var count = 0;
167
- if ((0, _utils.isIterable)(result)) {
168
- var _iterator = _createForOfIteratorHelper(result),
169
- _step;
170
- try {
171
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
172
- var _value = _step.value;
173
- Promise.resolve(_value).then(addOptions).catch(_this.handleLoadOptionsError);
174
- count++;
175
- }
176
- } catch (err) {
177
- _iterator.e(err);
178
- } finally {
179
- _iterator.f();
161
+ var inflightRequest = _this.state.inflightRequest + 1;
162
+ var result = _this.session && _this.session.id ? loadOptions(search, _this.session.id) : loadOptions(search);
163
+ var addOptions = _this.addOptions.bind(_this, inflightRequest.toString());
164
+ var count = 0;
165
+ if ((0, _utils.isIterable)(result)) {
166
+ var _iterator = _createForOfIteratorHelper(result),
167
+ _step;
168
+ try {
169
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
170
+ var _value = _step.value;
171
+ Promise.resolve(_value).then(addOptions).catch(_this.handleLoadOptionsError);
172
+ count++;
180
173
  }
181
- } else {
182
- Promise.resolve(result).then(addOptions).catch(_this.handleLoadOptionsError);
183
- count++;
174
+ } catch (err) {
175
+ _iterator.e(err);
176
+ } finally {
177
+ _iterator.f();
184
178
  }
185
- return {
186
- inflightRequest: inflightRequest,
187
- count: count,
188
- resolving: count !== 0,
189
- options: []
190
- };
179
+ } else {
180
+ Promise.resolve(result).then(addOptions).catch(_this.handleLoadOptionsError);
181
+ count++;
182
+ }
183
+ _this.setState({
184
+ inflightRequest: inflightRequest,
185
+ count: count,
186
+ resolving: count !== 0,
187
+ options: []
191
188
  });
192
189
  }
193
190
  }, 200));
@@ -272,8 +269,8 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
272
269
  options: []
273
270
  });
274
271
  });
275
- (0, _defineProperty2.default)(_this, "handleInputChange", function (search, _ref4) {
276
- var action = _ref4.action;
272
+ (0, _defineProperty2.default)(_this, "handleInputChange", function (search, _ref3) {
273
+ var action = _ref3.action;
277
274
  if (action === 'input-change' || action === 'set-value') {
278
275
  (0, _utils.callCallback)(_this.props.onInputChange, search, _this.getSessionId());
279
276
  _this.setState({
@@ -39,7 +39,9 @@ var UserPickerWithoutAnalytics = exports.UserPickerWithoutAnalytics = /*#__PURE_
39
39
  _this = _callSuper(this, UserPickerWithoutAnalytics, [props]);
40
40
  _this.ufoId = (0, _uuid.v4)();
41
41
  var experienceForId = _ufoExperiences.userPickerRenderedUfoExperience.getInstance(_this.ufoId);
42
- experienceForId.start();
42
+ if (![_ufo.UFOExperienceState.IN_PROGRESS.id, _ufo.UFOExperienceState.STARTED.id].includes(experienceForId.state.id)) {
43
+ experienceForId.start();
44
+ }
43
45
  return _this;
44
46
  }
45
47
  (0, _inherits2.default)(UserPickerWithoutAnalytics, _React$Component);
@@ -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.29.2";
5
+ const packageVersion = "10.30.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}$/;
@@ -157,28 +157,24 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
157
157
  loadOptions
158
158
  } = this.props;
159
159
  if (loadOptions) {
160
- this.setState(({
161
- inflightRequest: previousRequest
162
- }) => {
163
- const inflightRequest = previousRequest + 1;
164
- const result = this.session && this.session.id ? loadOptions(search, this.session.id) : loadOptions(search);
165
- const addOptions = this.addOptions.bind(this, inflightRequest.toString());
166
- let count = 0;
167
- if (isIterable(result)) {
168
- for (const value of result) {
169
- Promise.resolve(value).then(addOptions).catch(this.handleLoadOptionsError);
170
- count++;
171
- }
172
- } else {
173
- Promise.resolve(result).then(addOptions).catch(this.handleLoadOptionsError);
160
+ const inflightRequest = this.state.inflightRequest + 1;
161
+ const result = this.session && this.session.id ? loadOptions(search, this.session.id) : loadOptions(search);
162
+ const addOptions = this.addOptions.bind(this, inflightRequest.toString());
163
+ let count = 0;
164
+ if (isIterable(result)) {
165
+ for (const value of result) {
166
+ Promise.resolve(value).then(addOptions).catch(this.handleLoadOptionsError);
174
167
  count++;
175
168
  }
176
- return {
177
- inflightRequest,
178
- count,
179
- resolving: count !== 0,
180
- options: []
181
- };
169
+ } else {
170
+ Promise.resolve(result).then(addOptions).catch(this.handleLoadOptionsError);
171
+ count++;
172
+ }
173
+ this.setState({
174
+ inflightRequest,
175
+ count,
176
+ resolving: count !== 0,
177
+ options: []
182
178
  });
183
179
  }
184
180
  }, 200));
@@ -18,7 +18,9 @@ export class UserPickerWithoutAnalytics extends React.Component {
18
18
  super(props);
19
19
  this.ufoId = uuidv4();
20
20
  const experienceForId = experience.getInstance(this.ufoId);
21
- experienceForId.start();
21
+ if (![UFOExperienceState.IN_PROGRESS.id, UFOExperienceState.STARTED.id].includes(experienceForId.state.id)) {
22
+ experienceForId.start();
23
+ }
22
24
  }
23
25
  componentDidMount() {
24
26
  const experienceForId = experience.getInstance(this.ufoId);
@@ -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.29.2";
8
+ var packageVersion = "10.30.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}$/;
@@ -151,36 +151,33 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
151
151
  _defineProperty(_this, "debouncedLoadOptions", debounce(function (search) {
152
152
  var loadOptions = _this.props.loadOptions;
153
153
  if (loadOptions) {
154
- _this.setState(function (_ref3) {
155
- var previousRequest = _ref3.inflightRequest;
156
- var inflightRequest = previousRequest + 1;
157
- var result = _this.session && _this.session.id ? loadOptions(search, _this.session.id) : loadOptions(search);
158
- var addOptions = _this.addOptions.bind(_this, inflightRequest.toString());
159
- var count = 0;
160
- if (isIterable(result)) {
161
- var _iterator = _createForOfIteratorHelper(result),
162
- _step;
163
- try {
164
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
165
- var _value = _step.value;
166
- Promise.resolve(_value).then(addOptions).catch(_this.handleLoadOptionsError);
167
- count++;
168
- }
169
- } catch (err) {
170
- _iterator.e(err);
171
- } finally {
172
- _iterator.f();
154
+ var inflightRequest = _this.state.inflightRequest + 1;
155
+ var result = _this.session && _this.session.id ? loadOptions(search, _this.session.id) : loadOptions(search);
156
+ var addOptions = _this.addOptions.bind(_this, inflightRequest.toString());
157
+ var count = 0;
158
+ if (isIterable(result)) {
159
+ var _iterator = _createForOfIteratorHelper(result),
160
+ _step;
161
+ try {
162
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
163
+ var _value = _step.value;
164
+ Promise.resolve(_value).then(addOptions).catch(_this.handleLoadOptionsError);
165
+ count++;
173
166
  }
174
- } else {
175
- Promise.resolve(result).then(addOptions).catch(_this.handleLoadOptionsError);
176
- count++;
167
+ } catch (err) {
168
+ _iterator.e(err);
169
+ } finally {
170
+ _iterator.f();
177
171
  }
178
- return {
179
- inflightRequest: inflightRequest,
180
- count: count,
181
- resolving: count !== 0,
182
- options: []
183
- };
172
+ } else {
173
+ Promise.resolve(result).then(addOptions).catch(_this.handleLoadOptionsError);
174
+ count++;
175
+ }
176
+ _this.setState({
177
+ inflightRequest: inflightRequest,
178
+ count: count,
179
+ resolving: count !== 0,
180
+ options: []
184
181
  });
185
182
  }
186
183
  }, 200));
@@ -265,8 +262,8 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
265
262
  options: []
266
263
  });
267
264
  });
268
- _defineProperty(_this, "handleInputChange", function (search, _ref4) {
269
- var action = _ref4.action;
265
+ _defineProperty(_this, "handleInputChange", function (search, _ref3) {
266
+ var action = _ref3.action;
270
267
  if (action === 'input-change' || action === 'set-value') {
271
268
  callCallback(_this.props.onInputChange, search, _this.getSessionId());
272
269
  _this.setState({
@@ -29,7 +29,9 @@ export var UserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component)
29
29
  _this = _callSuper(this, UserPickerWithoutAnalytics, [props]);
30
30
  _this.ufoId = uuidv4();
31
31
  var experienceForId = experience.getInstance(_this.ufoId);
32
- experienceForId.start();
32
+ if (![UFOExperienceState.IN_PROGRESS.id, UFOExperienceState.STARTED.id].includes(experienceForId.state.id)) {
33
+ experienceForId.start();
34
+ }
33
35
  return _this;
34
36
  }
35
37
  _inherits(UserPickerWithoutAnalytics, _React$Component);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "10.29.2",
3
+ "version": "10.30.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,6 +29,7 @@
29
29
  "./types": "./src/types.ts"
30
30
  },
31
31
  "atlassian": {
32
+ "runReact18": true,
32
33
  "team": "Search Platform: Search Experience",
33
34
  "slack": {
34
35
  "channel": "#search-plex-prs",
@@ -48,7 +49,7 @@
48
49
  "dependencies": {
49
50
  "@atlaskit/analytics-next": "^10.2.0",
50
51
  "@atlaskit/avatar": "^21.17.0",
51
- "@atlaskit/icon": "^23.3.0",
52
+ "@atlaskit/icon": "^23.4.0",
52
53
  "@atlaskit/logo": "^15.1.0",
53
54
  "@atlaskit/lozenge": "^11.12.0",
54
55
  "@atlaskit/people-teams-ui-public": "^2.0.0",
@@ -59,7 +60,7 @@
59
60
  "@atlaskit/spinner": "^16.3.0",
60
61
  "@atlaskit/teams-avatar": "^1.1.0",
61
62
  "@atlaskit/theme": "^14.0.0",
62
- "@atlaskit/tokens": "^3.0.0",
63
+ "@atlaskit/tokens": "^3.1.0",
63
64
  "@atlaskit/tooltip": "^19.0.0",
64
65
  "@atlaskit/ufo": "^0.3.0",
65
66
  "@babel/runtime": "^7.0.0",
@@ -69,8 +70,8 @@
69
70
  "uuid": "^3.1.0"
70
71
  },
71
72
  "peerDependencies": {
72
- "react": "^16.8.0",
73
- "react-dom": "^16.8.0",
73
+ "react": "^16.8.0 || ^17.0.0 || ^18.2.0",
74
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.2.0",
74
75
  "react-intl-next": "npm:react-intl@^5.18.1"
75
76
  },
76
77
  "devDependencies": {