@atlaskit/user-picker 10.13.2 → 10.13.3
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 +6 -0
- package/dist/cjs/analytics.js +1 -1
- package/dist/cjs/components/BaseUserPicker.js +29 -3
- package/dist/cjs/components/MultiValueContainer.js +19 -5
- package/dist/cjs/components/SingleValueContainer.js +12 -2
- package/dist/es2019/analytics.js +1 -1
- package/dist/es2019/components/BaseUserPicker.js +27 -3
- package/dist/es2019/components/MultiValueContainer.js +17 -4
- package/dist/es2019/components/SingleValueContainer.js +13 -2
- package/dist/esm/analytics.js +1 -1
- package/dist/esm/components/BaseUserPicker.js +29 -3
- package/dist/esm/components/MultiValueContainer.js +16 -4
- package/dist/esm/components/SingleValueContainer.js +12 -2
- package/dist/types/components/BaseUserPicker.d.ts +8 -1
- package/dist/types/components/MultiValueContainer.d.ts +7 -1
- package/dist/types/components/PopupUserPicker.d.ts +1 -1
- package/dist/types/components/SingleValueContainer.d.ts +4 -0
- package/dist/types/components/UserPicker.d.ts +1 -1
- package/dist/types/types.d.ts +8 -0
- package/dist/types-ts4.5/components/BaseUserPicker.d.ts +8 -1
- package/dist/types-ts4.5/components/MultiValueContainer.d.ts +7 -1
- package/dist/types-ts4.5/components/PopupUserPicker.d.ts +1 -1
- package/dist/types-ts4.5/components/SingleValueContainer.d.ts +4 -0
- package/dist/types-ts4.5/components/UserPicker.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +8 -0
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/user-picker
|
|
2
2
|
|
|
3
|
+
## 10.13.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#61371](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/61371) [`eae2cd4f6dc2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/eae2cd4f6dc2) - Adds new prop, UNSAFE_hasDraggableParentComponent, as a workaround when using user pickers inside of a react-beautiful-dnd Draggable.
|
|
8
|
+
|
|
3
9
|
## 10.13.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/analytics.js
CHANGED
|
@@ -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.13.
|
|
15
|
+
var packageVersion = "10.13.3";
|
|
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}$/;
|
|
@@ -262,6 +262,7 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
|
|
|
262
262
|
_this.abortOptionsShownUfoExperience();
|
|
263
263
|
_this.setState({
|
|
264
264
|
menuIsOpen: false,
|
|
265
|
+
initialFocusHandled: false,
|
|
265
266
|
options: []
|
|
266
267
|
});
|
|
267
268
|
});
|
|
@@ -387,6 +388,27 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
|
|
|
387
388
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getAppearance", function () {
|
|
388
389
|
return _this.props.appearance ? _this.props.appearance : 'normal';
|
|
389
390
|
});
|
|
391
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClickDraggableParentComponent", function () {
|
|
392
|
+
if (_this.state.initialFocusHandled) {
|
|
393
|
+
// As <Select /> is already focused, calling this.selectRef.current.focus() again no longer triggers its own handlers (i.e. onMenuOpen, onMenuClose)
|
|
394
|
+
// We have to manually handle the open and close states of the dropdown menu based on a user's click from this point onwards to prevent the bug
|
|
395
|
+
if (_this.state.menuIsOpen) {
|
|
396
|
+
_this.handleClose();
|
|
397
|
+
} else {
|
|
398
|
+
_this.handleOpen();
|
|
399
|
+
}
|
|
400
|
+
} else if (!_this.state.menuIsOpen) {
|
|
401
|
+
// Trigger focus state when ValueContainer is clicked for the first time
|
|
402
|
+
// The focused state will then invoke <Select /> instance's own handlers (e.g. onMenuOpen, onMenuClose)
|
|
403
|
+
// to manage the state of the dropdown menu
|
|
404
|
+
_this.focus();
|
|
405
|
+
_this.setState(function () {
|
|
406
|
+
return {
|
|
407
|
+
initialFocusHandled: true
|
|
408
|
+
};
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
});
|
|
390
412
|
_this.state = {
|
|
391
413
|
options: [],
|
|
392
414
|
isDefaultSet: false,
|
|
@@ -396,7 +418,8 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
|
|
|
396
418
|
menuIsOpen: !!_this.props.open,
|
|
397
419
|
inputValue: props.search || '',
|
|
398
420
|
resolving: false,
|
|
399
|
-
showError: false
|
|
421
|
+
showError: false,
|
|
422
|
+
initialFocusHandled: false
|
|
400
423
|
};
|
|
401
424
|
_this.optionsShownUfoExperienceInstance = _ufoExperiences.userPickerOptionsShownUfoExperience.getInstance((0, _uuid.v4)());
|
|
402
425
|
return _this;
|
|
@@ -505,7 +528,8 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
|
|
|
505
528
|
ariaLabel = _this$props4.ariaLabel,
|
|
506
529
|
name = _this$props4.name,
|
|
507
530
|
header = _this$props4.header,
|
|
508
|
-
required = _this$props4.required
|
|
531
|
+
required = _this$props4.required,
|
|
532
|
+
UNSAFE_hasDraggableParentComponent = _this$props4.UNSAFE_hasDraggableParentComponent;
|
|
509
533
|
var _this$state3 = this.state,
|
|
510
534
|
count = _this$state3.count,
|
|
511
535
|
hoveringClearIndicator = _this$state3.hoveringClearIndicator,
|
|
@@ -573,7 +597,9 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
|
|
|
573
597
|
maxPickerHeight: maxPickerHeight,
|
|
574
598
|
textFieldBackgroundColor: textFieldBackgroundColor,
|
|
575
599
|
header: header
|
|
576
|
-
}, this.ariaProps, pickerProps
|
|
600
|
+
}, this.ariaProps, pickerProps, UNSAFE_hasDraggableParentComponent && {
|
|
601
|
+
onValueContainerClick: this.handleClickDraggableParentComponent
|
|
602
|
+
}));
|
|
577
603
|
}
|
|
578
604
|
}], [{
|
|
579
605
|
key: "getDerivedStateFromProps",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
@@ -14,16 +15,19 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
14
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
17
|
var _select = require("@atlaskit/select");
|
|
17
|
-
var _react =
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
var _react2 = require("@emotion/react");
|
|
18
20
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
19
21
|
var _reactIntlNext = require("react-intl-next");
|
|
20
22
|
var _i18n = require("./i18n");
|
|
21
23
|
var _utils = require("./utils");
|
|
22
24
|
var _excluded = ["children", "innerProps"];
|
|
25
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
27
|
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; }
|
|
24
28
|
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; }
|
|
25
29
|
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); }; }
|
|
26
|
-
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; } }
|
|
30
|
+
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; } } /** @jsx jsx */
|
|
27
31
|
var MultiValueContainer = exports.MultiValueContainer = /*#__PURE__*/function (_React$PureComponent) {
|
|
28
32
|
(0, _inherits2.default)(MultiValueContainer, _React$PureComponent);
|
|
29
33
|
var _super = _createSuper(MultiValueContainer);
|
|
@@ -54,7 +58,7 @@ var MultiValueContainer = exports.MultiValueContainer = /*#__PURE__*/function (_
|
|
|
54
58
|
placeholder: placeholder
|
|
55
59
|
}) : child;
|
|
56
60
|
});
|
|
57
|
-
return
|
|
61
|
+
return (0, _react2.jsx)(_react.Fragment, null, children);
|
|
58
62
|
});
|
|
59
63
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderChildren", function () {
|
|
60
64
|
var _this$props$selectPro = _this.props.selectProps,
|
|
@@ -65,7 +69,7 @@ var MultiValueContainer = exports.MultiValueContainer = /*#__PURE__*/function (_
|
|
|
65
69
|
return _this.props.children;
|
|
66
70
|
}
|
|
67
71
|
if (addMoreMessage === undefined) {
|
|
68
|
-
return
|
|
72
|
+
return (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _i18n.messages.addMore, function (addMore) {
|
|
69
73
|
var _join, _addMoreMessages;
|
|
70
74
|
var addMoreMessages = addMore;
|
|
71
75
|
if (addMore && typeof addMore === 'string') {
|
|
@@ -77,6 +81,16 @@ var MultiValueContainer = exports.MultiValueContainer = /*#__PURE__*/function (_
|
|
|
77
81
|
}
|
|
78
82
|
return _this.addPlaceholder(addMoreMessage);
|
|
79
83
|
});
|
|
84
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onValueContainerClick", _this.props.selectProps.onValueContainerClick);
|
|
85
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "Wrapper", function (_ref) {
|
|
86
|
+
var children = _ref.children;
|
|
87
|
+
return _this.onValueContainerClick ? (0, _react2.jsx)("div", {
|
|
88
|
+
css: (0, _react2.css)({
|
|
89
|
+
flexGrow: 1
|
|
90
|
+
}),
|
|
91
|
+
onMouseDown: _this.onValueContainerClick
|
|
92
|
+
}, children) : children;
|
|
93
|
+
});
|
|
80
94
|
_this.state = {
|
|
81
95
|
valueSize: 0,
|
|
82
96
|
previousValueSize: 0
|
|
@@ -118,7 +132,7 @@ var MultiValueContainer = exports.MultiValueContainer = /*#__PURE__*/function (_
|
|
|
118
132
|
var props = _objectSpread(_objectSpread({}, valueContainerProps), {}, {
|
|
119
133
|
innerProps: this.valueContainerInnerProps
|
|
120
134
|
});
|
|
121
|
-
return
|
|
135
|
+
return (0, _react2.jsx)(this.Wrapper, null, (0, _react2.jsx)(_select.components.ValueContainer, props, this.renderChildren()));
|
|
122
136
|
}
|
|
123
137
|
}], [{
|
|
124
138
|
key: "getDerivedStateFromProps",
|
|
@@ -55,6 +55,16 @@ var SingleValueContainer = exports.SingleValueContainer = /*#__PURE__*/function
|
|
|
55
55
|
}
|
|
56
56
|
return null;
|
|
57
57
|
});
|
|
58
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onValueContainerClick", _this.props.selectProps.onValueContainerClick);
|
|
59
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "Wrapper", function (_ref) {
|
|
60
|
+
var children = _ref.children;
|
|
61
|
+
return _this.onValueContainerClick ? (0, _react2.jsx)("div", {
|
|
62
|
+
css: (0, _react2.css)({
|
|
63
|
+
flexGrow: 1
|
|
64
|
+
}),
|
|
65
|
+
onMouseDown: _this.onValueContainerClick
|
|
66
|
+
}, children) : children;
|
|
67
|
+
});
|
|
58
68
|
return _this;
|
|
59
69
|
}
|
|
60
70
|
(0, _createClass2.default)(SingleValueContainer, [{
|
|
@@ -63,9 +73,9 @@ var SingleValueContainer = exports.SingleValueContainer = /*#__PURE__*/function
|
|
|
63
73
|
var _this$props2 = this.props,
|
|
64
74
|
children = _this$props2.children,
|
|
65
75
|
valueContainerProps = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
|
|
66
|
-
return (0, _react2.jsx)(_select.components.ValueContainer, valueContainerProps, (0, _react2.jsx)("div", {
|
|
76
|
+
return (0, _react2.jsx)(this.Wrapper, null, (0, _react2.jsx)(_select.components.ValueContainer, valueContainerProps, (0, _react2.jsx)("div", {
|
|
67
77
|
css: placeholderIconContainer
|
|
68
|
-
}, this.renderAvatar()), children);
|
|
78
|
+
}, this.renderAvatar()), children));
|
|
69
79
|
}
|
|
70
80
|
}]);
|
|
71
81
|
return SingleValueContainer;
|
package/dist/es2019/analytics.js
CHANGED
|
@@ -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.13.
|
|
5
|
+
const packageVersion = "10.13.3";
|
|
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}$/;
|
|
@@ -251,6 +251,7 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
|
|
|
251
251
|
this.abortOptionsShownUfoExperience();
|
|
252
252
|
this.setState({
|
|
253
253
|
menuIsOpen: false,
|
|
254
|
+
initialFocusHandled: false,
|
|
254
255
|
options: []
|
|
255
256
|
});
|
|
256
257
|
});
|
|
@@ -364,6 +365,25 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
|
|
|
364
365
|
return options;
|
|
365
366
|
});
|
|
366
367
|
_defineProperty(this, "getAppearance", () => this.props.appearance ? this.props.appearance : 'normal');
|
|
368
|
+
_defineProperty(this, "handleClickDraggableParentComponent", () => {
|
|
369
|
+
if (this.state.initialFocusHandled) {
|
|
370
|
+
// As <Select /> is already focused, calling this.selectRef.current.focus() again no longer triggers its own handlers (i.e. onMenuOpen, onMenuClose)
|
|
371
|
+
// We have to manually handle the open and close states of the dropdown menu based on a user's click from this point onwards to prevent the bug
|
|
372
|
+
if (this.state.menuIsOpen) {
|
|
373
|
+
this.handleClose();
|
|
374
|
+
} else {
|
|
375
|
+
this.handleOpen();
|
|
376
|
+
}
|
|
377
|
+
} else if (!this.state.menuIsOpen) {
|
|
378
|
+
// Trigger focus state when ValueContainer is clicked for the first time
|
|
379
|
+
// The focused state will then invoke <Select /> instance's own handlers (e.g. onMenuOpen, onMenuClose)
|
|
380
|
+
// to manage the state of the dropdown menu
|
|
381
|
+
this.focus();
|
|
382
|
+
this.setState(() => ({
|
|
383
|
+
initialFocusHandled: true
|
|
384
|
+
}));
|
|
385
|
+
}
|
|
386
|
+
});
|
|
367
387
|
this.state = {
|
|
368
388
|
options: [],
|
|
369
389
|
isDefaultSet: false,
|
|
@@ -373,7 +393,8 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
|
|
|
373
393
|
menuIsOpen: !!this.props.open,
|
|
374
394
|
inputValue: props.search || '',
|
|
375
395
|
resolving: false,
|
|
376
|
-
showError: false
|
|
396
|
+
showError: false,
|
|
397
|
+
initialFocusHandled: false
|
|
377
398
|
};
|
|
378
399
|
this.optionsShownUfoExperienceInstance = userPickerOptionsShownUfoExperience.getInstance(uuidv4());
|
|
379
400
|
}
|
|
@@ -476,7 +497,8 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
|
|
|
476
497
|
ariaLabel,
|
|
477
498
|
name,
|
|
478
499
|
header,
|
|
479
|
-
required
|
|
500
|
+
required,
|
|
501
|
+
UNSAFE_hasDraggableParentComponent
|
|
480
502
|
} = this.props;
|
|
481
503
|
const {
|
|
482
504
|
count,
|
|
@@ -544,7 +566,9 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
|
|
|
544
566
|
maxPickerHeight: maxPickerHeight,
|
|
545
567
|
textFieldBackgroundColor: textFieldBackgroundColor,
|
|
546
568
|
header: header
|
|
547
|
-
}, this.ariaProps, pickerProps
|
|
569
|
+
}, this.ariaProps, pickerProps, UNSAFE_hasDraggableParentComponent && {
|
|
570
|
+
onValueContainerClick: this.handleClickDraggableParentComponent
|
|
571
|
+
}));
|
|
548
572
|
}
|
|
549
573
|
}
|
|
550
574
|
_defineProperty(BaseUserPickerWithoutAnalytics, "defaultProps", {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
/** @jsx jsx */
|
|
2
3
|
import { components } from '@atlaskit/select';
|
|
3
|
-
import React from 'react';
|
|
4
|
+
import React, { Fragment } from 'react';
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
4
6
|
import ReactDOM from 'react-dom';
|
|
5
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
6
8
|
import { messages } from './i18n';
|
|
@@ -43,7 +45,7 @@ export class MultiValueContainer extends React.PureComponent {
|
|
|
43
45
|
const children = React.Children.map(this.props.children, child => isChildInput(child) && this.showPlaceholder() ? /*#__PURE__*/React.cloneElement(child, {
|
|
44
46
|
placeholder
|
|
45
47
|
}) : child);
|
|
46
|
-
return
|
|
48
|
+
return jsx(Fragment, null, children);
|
|
47
49
|
});
|
|
48
50
|
_defineProperty(this, "renderChildren", () => {
|
|
49
51
|
const {
|
|
@@ -57,7 +59,7 @@ export class MultiValueContainer extends React.PureComponent {
|
|
|
57
59
|
return this.props.children;
|
|
58
60
|
}
|
|
59
61
|
if (addMoreMessage === undefined) {
|
|
60
|
-
return
|
|
62
|
+
return jsx(FormattedMessage, messages.addMore, addMore => {
|
|
61
63
|
var _join, _addMoreMessages;
|
|
62
64
|
let addMoreMessages = addMore;
|
|
63
65
|
if (addMore && typeof addMore === 'string') {
|
|
@@ -69,6 +71,17 @@ export class MultiValueContainer extends React.PureComponent {
|
|
|
69
71
|
}
|
|
70
72
|
return this.addPlaceholder(addMoreMessage);
|
|
71
73
|
});
|
|
74
|
+
_defineProperty(this, "onValueContainerClick", this.props.selectProps.onValueContainerClick);
|
|
75
|
+
_defineProperty(this, "Wrapper", ({
|
|
76
|
+
children
|
|
77
|
+
}) => {
|
|
78
|
+
return this.onValueContainerClick ? jsx("div", {
|
|
79
|
+
css: css({
|
|
80
|
+
flexGrow: 1
|
|
81
|
+
}),
|
|
82
|
+
onMouseDown: this.onValueContainerClick
|
|
83
|
+
}, children) : children;
|
|
84
|
+
});
|
|
72
85
|
this.state = {
|
|
73
86
|
valueSize: 0,
|
|
74
87
|
previousValueSize: 0
|
|
@@ -108,6 +121,6 @@ export class MultiValueContainer extends React.PureComponent {
|
|
|
108
121
|
...valueContainerProps,
|
|
109
122
|
innerProps: this.valueContainerInnerProps
|
|
110
123
|
};
|
|
111
|
-
return
|
|
124
|
+
return jsx(this.Wrapper, null, jsx(components.ValueContainer, props, this.renderChildren()));
|
|
112
125
|
}
|
|
113
126
|
}
|
|
@@ -32,14 +32,25 @@ export class SingleValueContainer extends React.Component {
|
|
|
32
32
|
}
|
|
33
33
|
return null;
|
|
34
34
|
});
|
|
35
|
+
_defineProperty(this, "onValueContainerClick", this.props.selectProps.onValueContainerClick);
|
|
36
|
+
_defineProperty(this, "Wrapper", ({
|
|
37
|
+
children
|
|
38
|
+
}) => {
|
|
39
|
+
return this.onValueContainerClick ? jsx("div", {
|
|
40
|
+
css: css({
|
|
41
|
+
flexGrow: 1
|
|
42
|
+
}),
|
|
43
|
+
onMouseDown: this.onValueContainerClick
|
|
44
|
+
}, children) : children;
|
|
45
|
+
});
|
|
35
46
|
}
|
|
36
47
|
render() {
|
|
37
48
|
const {
|
|
38
49
|
children,
|
|
39
50
|
...valueContainerProps
|
|
40
51
|
} = this.props;
|
|
41
|
-
return jsx(components.ValueContainer, valueContainerProps, jsx("div", {
|
|
52
|
+
return jsx(this.Wrapper, null, jsx(components.ValueContainer, valueContainerProps, jsx("div", {
|
|
42
53
|
css: placeholderIconContainer
|
|
43
|
-
}, this.renderAvatar()), children);
|
|
54
|
+
}, this.renderAvatar()), children));
|
|
44
55
|
}
|
|
45
56
|
}
|
package/dist/esm/analytics.js
CHANGED
|
@@ -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.13.
|
|
8
|
+
var packageVersion = "10.13.3";
|
|
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}$/;
|
|
@@ -255,6 +255,7 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
255
255
|
_this.abortOptionsShownUfoExperience();
|
|
256
256
|
_this.setState({
|
|
257
257
|
menuIsOpen: false,
|
|
258
|
+
initialFocusHandled: false,
|
|
258
259
|
options: []
|
|
259
260
|
});
|
|
260
261
|
});
|
|
@@ -380,6 +381,27 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
380
381
|
_defineProperty(_assertThisInitialized(_this), "getAppearance", function () {
|
|
381
382
|
return _this.props.appearance ? _this.props.appearance : 'normal';
|
|
382
383
|
});
|
|
384
|
+
_defineProperty(_assertThisInitialized(_this), "handleClickDraggableParentComponent", function () {
|
|
385
|
+
if (_this.state.initialFocusHandled) {
|
|
386
|
+
// As <Select /> is already focused, calling this.selectRef.current.focus() again no longer triggers its own handlers (i.e. onMenuOpen, onMenuClose)
|
|
387
|
+
// We have to manually handle the open and close states of the dropdown menu based on a user's click from this point onwards to prevent the bug
|
|
388
|
+
if (_this.state.menuIsOpen) {
|
|
389
|
+
_this.handleClose();
|
|
390
|
+
} else {
|
|
391
|
+
_this.handleOpen();
|
|
392
|
+
}
|
|
393
|
+
} else if (!_this.state.menuIsOpen) {
|
|
394
|
+
// Trigger focus state when ValueContainer is clicked for the first time
|
|
395
|
+
// The focused state will then invoke <Select /> instance's own handlers (e.g. onMenuOpen, onMenuClose)
|
|
396
|
+
// to manage the state of the dropdown menu
|
|
397
|
+
_this.focus();
|
|
398
|
+
_this.setState(function () {
|
|
399
|
+
return {
|
|
400
|
+
initialFocusHandled: true
|
|
401
|
+
};
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
});
|
|
383
405
|
_this.state = {
|
|
384
406
|
options: [],
|
|
385
407
|
isDefaultSet: false,
|
|
@@ -389,7 +411,8 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
389
411
|
menuIsOpen: !!_this.props.open,
|
|
390
412
|
inputValue: props.search || '',
|
|
391
413
|
resolving: false,
|
|
392
|
-
showError: false
|
|
414
|
+
showError: false,
|
|
415
|
+
initialFocusHandled: false
|
|
393
416
|
};
|
|
394
417
|
_this.optionsShownUfoExperienceInstance = userPickerOptionsShownUfoExperience.getInstance(uuidv4());
|
|
395
418
|
return _this;
|
|
@@ -498,7 +521,8 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
498
521
|
ariaLabel = _this$props4.ariaLabel,
|
|
499
522
|
name = _this$props4.name,
|
|
500
523
|
header = _this$props4.header,
|
|
501
|
-
required = _this$props4.required
|
|
524
|
+
required = _this$props4.required,
|
|
525
|
+
UNSAFE_hasDraggableParentComponent = _this$props4.UNSAFE_hasDraggableParentComponent;
|
|
502
526
|
var _this$state3 = this.state,
|
|
503
527
|
count = _this$state3.count,
|
|
504
528
|
hoveringClearIndicator = _this$state3.hoveringClearIndicator,
|
|
@@ -566,7 +590,9 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
566
590
|
maxPickerHeight: maxPickerHeight,
|
|
567
591
|
textFieldBackgroundColor: textFieldBackgroundColor,
|
|
568
592
|
header: header
|
|
569
|
-
}, this.ariaProps, pickerProps
|
|
593
|
+
}, this.ariaProps, pickerProps, UNSAFE_hasDraggableParentComponent && {
|
|
594
|
+
onValueContainerClick: this.handleClickDraggableParentComponent
|
|
595
|
+
}));
|
|
570
596
|
}
|
|
571
597
|
}], [{
|
|
572
598
|
key: "getDerivedStateFromProps",
|
|
@@ -11,8 +11,10 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
11
11
|
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) { _defineProperty(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; }
|
|
12
12
|
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); }; }
|
|
13
13
|
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; } }
|
|
14
|
+
/** @jsx jsx */
|
|
14
15
|
import { components } from '@atlaskit/select';
|
|
15
|
-
import React from 'react';
|
|
16
|
+
import React, { Fragment } from 'react';
|
|
17
|
+
import { css, jsx } from '@emotion/react';
|
|
16
18
|
import ReactDOM from 'react-dom';
|
|
17
19
|
import { FormattedMessage } from 'react-intl-next';
|
|
18
20
|
import { messages } from './i18n';
|
|
@@ -47,7 +49,7 @@ export var MultiValueContainer = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
47
49
|
placeholder: placeholder
|
|
48
50
|
}) : child;
|
|
49
51
|
});
|
|
50
|
-
return
|
|
52
|
+
return jsx(Fragment, null, children);
|
|
51
53
|
});
|
|
52
54
|
_defineProperty(_assertThisInitialized(_this), "renderChildren", function () {
|
|
53
55
|
var _this$props$selectPro = _this.props.selectProps,
|
|
@@ -58,7 +60,7 @@ export var MultiValueContainer = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
58
60
|
return _this.props.children;
|
|
59
61
|
}
|
|
60
62
|
if (addMoreMessage === undefined) {
|
|
61
|
-
return
|
|
63
|
+
return jsx(FormattedMessage, messages.addMore, function (addMore) {
|
|
62
64
|
var _join, _addMoreMessages;
|
|
63
65
|
var addMoreMessages = addMore;
|
|
64
66
|
if (addMore && typeof addMore === 'string') {
|
|
@@ -70,6 +72,16 @@ export var MultiValueContainer = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
70
72
|
}
|
|
71
73
|
return _this.addPlaceholder(addMoreMessage);
|
|
72
74
|
});
|
|
75
|
+
_defineProperty(_assertThisInitialized(_this), "onValueContainerClick", _this.props.selectProps.onValueContainerClick);
|
|
76
|
+
_defineProperty(_assertThisInitialized(_this), "Wrapper", function (_ref) {
|
|
77
|
+
var children = _ref.children;
|
|
78
|
+
return _this.onValueContainerClick ? jsx("div", {
|
|
79
|
+
css: css({
|
|
80
|
+
flexGrow: 1
|
|
81
|
+
}),
|
|
82
|
+
onMouseDown: _this.onValueContainerClick
|
|
83
|
+
}, children) : children;
|
|
84
|
+
});
|
|
73
85
|
_this.state = {
|
|
74
86
|
valueSize: 0,
|
|
75
87
|
previousValueSize: 0
|
|
@@ -111,7 +123,7 @@ export var MultiValueContainer = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
111
123
|
var props = _objectSpread(_objectSpread({}, valueContainerProps), {}, {
|
|
112
124
|
innerProps: this.valueContainerInnerProps
|
|
113
125
|
});
|
|
114
|
-
return
|
|
126
|
+
return jsx(this.Wrapper, null, jsx(components.ValueContainer, props, this.renderChildren()));
|
|
115
127
|
}
|
|
116
128
|
}], [{
|
|
117
129
|
key: "getDerivedStateFromProps",
|
|
@@ -49,6 +49,16 @@ export var SingleValueContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
49
49
|
}
|
|
50
50
|
return null;
|
|
51
51
|
});
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "onValueContainerClick", _this.props.selectProps.onValueContainerClick);
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "Wrapper", function (_ref) {
|
|
54
|
+
var children = _ref.children;
|
|
55
|
+
return _this.onValueContainerClick ? jsx("div", {
|
|
56
|
+
css: css({
|
|
57
|
+
flexGrow: 1
|
|
58
|
+
}),
|
|
59
|
+
onMouseDown: _this.onValueContainerClick
|
|
60
|
+
}, children) : children;
|
|
61
|
+
});
|
|
52
62
|
return _this;
|
|
53
63
|
}
|
|
54
64
|
_createClass(SingleValueContainer, [{
|
|
@@ -57,9 +67,9 @@ export var SingleValueContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
57
67
|
var _this$props2 = this.props,
|
|
58
68
|
children = _this$props2.children,
|
|
59
69
|
valueContainerProps = _objectWithoutProperties(_this$props2, _excluded);
|
|
60
|
-
return jsx(components.ValueContainer, valueContainerProps, jsx("div", {
|
|
70
|
+
return jsx(this.Wrapper, null, jsx(components.ValueContainer, valueContainerProps, jsx("div", {
|
|
61
71
|
css: placeholderIconContainer
|
|
62
|
-
}, this.renderAvatar()), children);
|
|
72
|
+
}, this.renderAvatar()), children));
|
|
63
73
|
}
|
|
64
74
|
}]);
|
|
65
75
|
return SingleValueContainer;
|
|
@@ -7,6 +7,12 @@ export type BaseUserPickerProps = UserPickerProps & {
|
|
|
7
7
|
components: any;
|
|
8
8
|
width: string | number;
|
|
9
9
|
name?: string;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated This is a temporary prop to enable user-pickers to work in Draggable elements in react-beautiful-dnd.
|
|
12
|
+
* See https://product-fabric.atlassian.net/browse/DSP-15701 for more details.
|
|
13
|
+
* It may be removed in a future minor or patch when a longer-term workaround is found.
|
|
14
|
+
*/
|
|
15
|
+
UNSAFE_hasDraggableParentComponent?: boolean;
|
|
10
16
|
};
|
|
11
17
|
export declare class BaseUserPickerWithoutAnalytics extends React.Component<BaseUserPickerProps, UserPickerState> {
|
|
12
18
|
static defaultProps: {
|
|
@@ -55,9 +61,10 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
|
|
|
55
61
|
private getOptions;
|
|
56
62
|
private getAppearance;
|
|
57
63
|
get ariaProps(): {};
|
|
64
|
+
private handleClickDraggableParentComponent;
|
|
58
65
|
render(): JSX.Element;
|
|
59
66
|
}
|
|
60
|
-
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" | "SelectComponent" | "pickerProps"> & Partial<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isClearable" | "isMulti" | "textFieldBackgroundColor" | "loadOptionsErrorMessage" | "subtle" | "noBorder">> & Partial<Pick<{
|
|
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<{
|
|
61
68
|
isMulti: boolean;
|
|
62
69
|
subtle: boolean;
|
|
63
70
|
noBorder: boolean;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import { MultiValueProps } from '@atlaskit/select';
|
|
2
3
|
import React from 'react';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
3
5
|
import { User, Option } from '../types';
|
|
4
6
|
export type State = {
|
|
5
7
|
valueSize: number;
|
|
@@ -25,6 +27,10 @@ export declare class MultiValueContainer extends React.PureComponent<Props, Stat
|
|
|
25
27
|
private showPlaceholder;
|
|
26
28
|
private addPlaceholder;
|
|
27
29
|
private renderChildren;
|
|
28
|
-
|
|
30
|
+
onValueContainerClick: any;
|
|
31
|
+
Wrapper: ({ children }: {
|
|
32
|
+
children: React.ReactElement;
|
|
33
|
+
}) => jsx.JSX.Element;
|
|
34
|
+
render(): jsx.JSX.Element;
|
|
29
35
|
}
|
|
30
36
|
export {};
|
|
@@ -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" | "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" | "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<{
|
|
31
31
|
boundariesElement: string;
|
|
32
32
|
width: number;
|
|
33
33
|
isMulti: boolean;
|
|
@@ -5,5 +5,9 @@ import { ValueContainerProps } from '@atlaskit/select';
|
|
|
5
5
|
import { User, Option } from '../types';
|
|
6
6
|
export declare class SingleValueContainer extends React.Component<ValueContainerProps<Option<User>>> {
|
|
7
7
|
private renderAvatar;
|
|
8
|
+
onValueContainerClick: any;
|
|
9
|
+
Wrapper: ({ children }: {
|
|
10
|
+
children: React.ReactElement;
|
|
11
|
+
}) => jsx.JSX.Element;
|
|
8
12
|
render(): jsx.JSX.Element;
|
|
9
13
|
}
|
|
@@ -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"> & 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" | "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<{
|
|
14
14
|
width: number;
|
|
15
15
|
isMulti: boolean;
|
|
16
16
|
}, never>> & React.RefAttributes<any>>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -156,7 +156,14 @@ export type UserPickerProps = WithAnalyticsEventsProps & {
|
|
|
156
156
|
name?: string;
|
|
157
157
|
/** Header to be displayed in MenuList */
|
|
158
158
|
header?: React.ReactNode;
|
|
159
|
+
/** Accessibility: A field to dictate if this is a mandatory field in the form. */
|
|
159
160
|
required?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Enables workaround for when <Select /> is nested inside <Draggable /> from react-beautiful-dnd
|
|
163
|
+
* This relationship prevents the dropdown menu from opening because of bugs in the default focus state and clicking in a particular area of <Select />
|
|
164
|
+
* Context: https://hello.atlassian.net/wiki/spaces/~989411314/pages/2861097485/Investigation+Notes+for+atlaskit+select+react-beautiful-dnd#Temporary-Solution
|
|
165
|
+
*/
|
|
166
|
+
UNSAFE_hasDraggableParentComponent?: boolean;
|
|
160
167
|
};
|
|
161
168
|
export type PopupUserPickerProps = UserPickerProps & {
|
|
162
169
|
/** Whether to use the popup version of the single picker */
|
|
@@ -204,6 +211,7 @@ export type UserPickerState = {
|
|
|
204
211
|
inputValue: string;
|
|
205
212
|
resolving: boolean;
|
|
206
213
|
showError: boolean;
|
|
214
|
+
initialFocusHandled: boolean;
|
|
207
215
|
};
|
|
208
216
|
export interface HighlightRange {
|
|
209
217
|
start: number;
|
|
@@ -7,6 +7,12 @@ export type BaseUserPickerProps = UserPickerProps & {
|
|
|
7
7
|
components: any;
|
|
8
8
|
width: string | number;
|
|
9
9
|
name?: string;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated This is a temporary prop to enable user-pickers to work in Draggable elements in react-beautiful-dnd.
|
|
12
|
+
* See https://product-fabric.atlassian.net/browse/DSP-15701 for more details.
|
|
13
|
+
* It may be removed in a future minor or patch when a longer-term workaround is found.
|
|
14
|
+
*/
|
|
15
|
+
UNSAFE_hasDraggableParentComponent?: boolean;
|
|
10
16
|
};
|
|
11
17
|
export declare class BaseUserPickerWithoutAnalytics extends React.Component<BaseUserPickerProps, UserPickerState> {
|
|
12
18
|
static defaultProps: {
|
|
@@ -55,9 +61,10 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
|
|
|
55
61
|
private getOptions;
|
|
56
62
|
private getAppearance;
|
|
57
63
|
get ariaProps(): {};
|
|
64
|
+
private handleClickDraggableParentComponent;
|
|
58
65
|
render(): JSX.Element;
|
|
59
66
|
}
|
|
60
|
-
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" | "SelectComponent" | "pickerProps"> & Partial<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isClearable" | "isMulti" | "textFieldBackgroundColor" | "loadOptionsErrorMessage" | "subtle" | "noBorder">> & Partial<Pick<{
|
|
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<{
|
|
61
68
|
isMulti: boolean;
|
|
62
69
|
subtle: boolean;
|
|
63
70
|
noBorder: boolean;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import { MultiValueProps } from '@atlaskit/select';
|
|
2
3
|
import React from 'react';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
3
5
|
import { User, Option } from '../types';
|
|
4
6
|
export type State = {
|
|
5
7
|
valueSize: number;
|
|
@@ -25,6 +27,10 @@ export declare class MultiValueContainer extends React.PureComponent<Props, Stat
|
|
|
25
27
|
private showPlaceholder;
|
|
26
28
|
private addPlaceholder;
|
|
27
29
|
private renderChildren;
|
|
28
|
-
|
|
30
|
+
onValueContainerClick: any;
|
|
31
|
+
Wrapper: ({ children }: {
|
|
32
|
+
children: React.ReactElement;
|
|
33
|
+
}) => jsx.JSX.Element;
|
|
34
|
+
render(): jsx.JSX.Element;
|
|
29
35
|
}
|
|
30
36
|
export {};
|
|
@@ -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" | "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" | "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<{
|
|
31
31
|
boundariesElement: string;
|
|
32
32
|
width: number;
|
|
33
33
|
isMulti: boolean;
|
|
@@ -5,5 +5,9 @@ import { ValueContainerProps } from '@atlaskit/select';
|
|
|
5
5
|
import { User, Option } from '../types';
|
|
6
6
|
export declare class SingleValueContainer extends React.Component<ValueContainerProps<Option<User>>> {
|
|
7
7
|
private renderAvatar;
|
|
8
|
+
onValueContainerClick: any;
|
|
9
|
+
Wrapper: ({ children }: {
|
|
10
|
+
children: React.ReactElement;
|
|
11
|
+
}) => jsx.JSX.Element;
|
|
8
12
|
render(): jsx.JSX.Element;
|
|
9
13
|
}
|
|
@@ -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"> & 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" | "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<{
|
|
14
14
|
width: number;
|
|
15
15
|
isMulti: boolean;
|
|
16
16
|
}, never>> & React.RefAttributes<any>>;
|
|
@@ -156,7 +156,14 @@ export type UserPickerProps = WithAnalyticsEventsProps & {
|
|
|
156
156
|
name?: string;
|
|
157
157
|
/** Header to be displayed in MenuList */
|
|
158
158
|
header?: React.ReactNode;
|
|
159
|
+
/** Accessibility: A field to dictate if this is a mandatory field in the form. */
|
|
159
160
|
required?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Enables workaround for when <Select /> is nested inside <Draggable /> from react-beautiful-dnd
|
|
163
|
+
* This relationship prevents the dropdown menu from opening because of bugs in the default focus state and clicking in a particular area of <Select />
|
|
164
|
+
* Context: https://hello.atlassian.net/wiki/spaces/~989411314/pages/2861097485/Investigation+Notes+for+atlaskit+select+react-beautiful-dnd#Temporary-Solution
|
|
165
|
+
*/
|
|
166
|
+
UNSAFE_hasDraggableParentComponent?: boolean;
|
|
160
167
|
};
|
|
161
168
|
export type PopupUserPickerProps = UserPickerProps & {
|
|
162
169
|
/** Whether to use the popup version of the single picker */
|
|
@@ -207,6 +214,7 @@ export type UserPickerState = {
|
|
|
207
214
|
inputValue: string;
|
|
208
215
|
resolving: boolean;
|
|
209
216
|
showError: boolean;
|
|
217
|
+
initialFocusHandled: boolean;
|
|
210
218
|
};
|
|
211
219
|
export interface HighlightRange {
|
|
212
220
|
start: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/user-picker",
|
|
3
|
-
"version": "10.13.
|
|
3
|
+
"version": "10.13.3",
|
|
4
4
|
"description": "Fabric component for display a dropdown to select a user from",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/select": "^17.0.3",
|
|
45
45
|
"@atlaskit/spinner": "^16.0.0",
|
|
46
46
|
"@atlaskit/theme": "^12.6.0",
|
|
47
|
-
"@atlaskit/tokens": "^1.
|
|
47
|
+
"@atlaskit/tokens": "^1.30.0",
|
|
48
48
|
"@atlaskit/tooltip": "^18.0.0",
|
|
49
49
|
"@atlaskit/ufo": "^0.2.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
@@ -61,6 +61,8 @@
|
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@atlaskit/analytics-viewer": "^0.5.0",
|
|
63
63
|
"@atlaskit/elements-test-helpers": "^0.7.0",
|
|
64
|
+
"@atlaskit/heading": "^1.4.0",
|
|
65
|
+
"@atlaskit/primitives": "^1.15.0",
|
|
64
66
|
"@atlaskit/visual-regression": "*",
|
|
65
67
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
66
68
|
"@emotion/styled": "^11.0.0",
|
|
@@ -72,6 +74,7 @@
|
|
|
72
74
|
"@types/uuid": "^3.4.4",
|
|
73
75
|
"enzyme": "^3.10.0",
|
|
74
76
|
"mock-apollo-client": "^0.1.0",
|
|
77
|
+
"react-beautiful-dnd": "^12.1.1",
|
|
75
78
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
76
79
|
"react-select-event": "^5.5.0",
|
|
77
80
|
"typescript": "~4.9.5"
|