@atlaskit/user-picker 10.0.0 → 10.0.1
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 +2 -53
- package/dist/cjs/clients/UserSourceProvider.js +11 -33
- package/dist/cjs/components/AddOptionAvatar.js +2 -9
- package/dist/cjs/components/AvatarItemOption.js +4 -29
- package/dist/cjs/components/BaseUserPicker.js +55 -155
- package/dist/cjs/components/ClearIndicator.js +4 -35
- package/dist/cjs/components/CustomOption/index.js +0 -7
- package/dist/cjs/components/CustomOption/main.js +4 -30
- package/dist/cjs/components/EmailOption/index.js +0 -7
- package/dist/cjs/components/EmailOption/main.js +2 -29
- package/dist/cjs/components/ExternalUserOption/ExternalAvatarItemOption.js +4 -15
- package/dist/cjs/components/ExternalUserOption/InfoIcon.js +4 -13
- package/dist/cjs/components/ExternalUserOption/SourcesTooltipContent.js +4 -20
- package/dist/cjs/components/ExternalUserOption/index.js +0 -7
- package/dist/cjs/components/ExternalUserOption/main.js +10 -48
- package/dist/cjs/components/ExternalUserSourcesContainer.js +5 -13
- package/dist/cjs/components/GroupOption/index.js +0 -7
- package/dist/cjs/components/GroupOption/main.js +4 -31
- package/dist/cjs/components/HighlightText.js +3 -27
- package/dist/cjs/components/Input.js +0 -23
- package/dist/cjs/components/MessagesIntlProvider.js +3 -20
- package/dist/cjs/components/MultiValue.js +21 -57
- package/dist/cjs/components/MultiValueContainer.js +8 -47
- package/dist/cjs/components/Option.js +5 -27
- package/dist/cjs/components/PopupControl.js +0 -22
- package/dist/cjs/components/PopupInput.js +0 -22
- package/dist/cjs/components/PopupUserPicker.js +10 -39
- package/dist/cjs/components/SingleValue.js +6 -17
- package/dist/cjs/components/SingleValueContainer.js +8 -37
- package/dist/cjs/components/SizeableAvatar.js +4 -20
- package/dist/cjs/components/TeamOption/index.js +0 -7
- package/dist/cjs/components/TeamOption/main.js +9 -37
- package/dist/cjs/components/UserOption.js +7 -34
- package/dist/cjs/components/UserPicker.js +14 -50
- package/dist/cjs/components/assets/github.js +0 -4
- package/dist/cjs/components/assets/google.js +0 -4
- package/dist/cjs/components/assets/microsoft.js +0 -4
- package/dist/cjs/components/assets/slack.js +0 -4
- package/dist/cjs/components/batch.js +0 -3
- package/dist/cjs/components/components.js +0 -17
- package/dist/cjs/components/creatable.js +2 -15
- package/dist/cjs/components/creatableEmailSuggestion.js +7 -18
- package/dist/cjs/components/emailValidation.js +0 -4
- package/dist/cjs/components/i18n.js +0 -2
- package/dist/cjs/components/popup.js +0 -3
- package/dist/cjs/components/styles.js +10 -26
- package/dist/cjs/components/utils.js +0 -53
- package/dist/cjs/i18n/cs.js +1 -1
- package/dist/cjs/i18n/da.js +1 -1
- package/dist/cjs/i18n/de.js +1 -1
- package/dist/cjs/i18n/en.js +31 -4
- package/dist/cjs/i18n/en_GB.js +31 -4
- package/dist/cjs/i18n/en_ZZ.js +1 -1
- package/dist/cjs/i18n/es.js +1 -1
- package/dist/cjs/i18n/et.js +0 -1
- package/dist/cjs/i18n/fi.js +1 -1
- package/dist/cjs/i18n/fr.js +1 -1
- package/dist/cjs/i18n/hu.js +1 -1
- package/dist/cjs/i18n/index.js +0 -31
- package/dist/cjs/i18n/it.js +1 -1
- package/dist/cjs/i18n/ja.js +1 -1
- package/dist/cjs/i18n/ko.js +1 -1
- package/dist/cjs/i18n/nb.js +1 -1
- package/dist/cjs/i18n/nl.js +1 -1
- package/dist/cjs/i18n/pl.js +1 -1
- package/dist/cjs/i18n/pt_BR.js +1 -1
- package/dist/cjs/i18n/pt_PT.js +0 -1
- package/dist/cjs/i18n/ru.js +1 -1
- package/dist/cjs/i18n/sk.js +0 -1
- package/dist/cjs/i18n/sv.js +1 -1
- package/dist/cjs/i18n/th.js +1 -1
- package/dist/cjs/i18n/tr.js +1 -1
- package/dist/cjs/i18n/uk.js +1 -1
- package/dist/cjs/i18n/vi.js +1 -1
- package/dist/cjs/i18n/zh.js +1 -1
- package/dist/cjs/i18n/zh_TW.js +1 -1
- package/dist/cjs/index.js +0 -5
- package/dist/cjs/util/i18n-util.js +0 -43
- package/dist/cjs/util/ufoExperiences.js +0 -17
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics.js +18 -35
- package/dist/es2019/clients/UserSourceProvider.js +0 -6
- package/dist/es2019/components/AddOptionAvatar.js +0 -2
- package/dist/es2019/components/AvatarItemOption.js +1 -10
- package/dist/es2019/components/BaseUserPicker.js +8 -83
- package/dist/es2019/components/ClearIndicator.js +5 -11
- package/dist/es2019/components/CustomOption/index.js +1 -3
- package/dist/es2019/components/CustomOption/main.js +0 -10
- package/dist/es2019/components/EmailOption/index.js +1 -3
- package/dist/es2019/components/EmailOption/main.js +0 -9
- package/dist/es2019/components/ExternalUserOption/ExternalAvatarItemOption.js +1 -4
- package/dist/es2019/components/ExternalUserOption/index.js +1 -3
- package/dist/es2019/components/ExternalUserOption/main.js +0 -15
- package/dist/es2019/components/ExternalUserSourcesContainer.js +0 -2
- package/dist/es2019/components/GroupOption/index.js +1 -3
- package/dist/es2019/components/GroupOption/main.js +0 -7
- package/dist/es2019/components/HighlightText.js +0 -11
- package/dist/es2019/components/Input.js +0 -5
- package/dist/es2019/components/MessagesIntlProvider.js +2 -4
- package/dist/es2019/components/MultiValue.js +3 -15
- package/dist/es2019/components/MultiValueContainer.js +4 -24
- package/dist/es2019/components/Option.js +0 -9
- package/dist/es2019/components/PopupControl.js +0 -4
- package/dist/es2019/components/PopupInput.js +0 -6
- package/dist/es2019/components/PopupUserPicker.js +0 -8
- package/dist/es2019/components/SingleValue.js +0 -1
- package/dist/es2019/components/SingleValueContainer.js +0 -8
- package/dist/es2019/components/SizeableAvatar.js +0 -1
- package/dist/es2019/components/TeamOption/index.js +1 -3
- package/dist/es2019/components/TeamOption/main.js +2 -12
- package/dist/es2019/components/UserOption.js +0 -9
- package/dist/es2019/components/UserPicker.js +6 -8
- package/dist/es2019/components/batch.js +0 -1
- package/dist/es2019/components/components.js +3 -4
- package/dist/es2019/components/creatable.js +2 -9
- package/dist/es2019/components/creatableEmailSuggestion.js +7 -12
- package/dist/es2019/components/emailValidation.js +0 -2
- package/dist/es2019/components/styles.js +30 -22
- package/dist/es2019/components/utils.js +2 -8
- package/dist/es2019/i18n/cs.js +1 -0
- package/dist/es2019/i18n/da.js +1 -0
- package/dist/es2019/i18n/de.js +1 -0
- package/dist/es2019/i18n/en.js +31 -4
- package/dist/es2019/i18n/en_GB.js +31 -4
- package/dist/es2019/i18n/en_ZZ.js +1 -0
- package/dist/es2019/i18n/es.js +1 -0
- package/dist/es2019/i18n/fi.js +1 -0
- package/dist/es2019/i18n/fr.js +1 -0
- package/dist/es2019/i18n/hu.js +1 -0
- package/dist/es2019/i18n/it.js +1 -0
- package/dist/es2019/i18n/ja.js +1 -0
- package/dist/es2019/i18n/ko.js +1 -0
- package/dist/es2019/i18n/nb.js +1 -0
- package/dist/es2019/i18n/nl.js +1 -0
- package/dist/es2019/i18n/pl.js +1 -0
- package/dist/es2019/i18n/pt_BR.js +1 -0
- package/dist/es2019/i18n/ru.js +1 -0
- package/dist/es2019/i18n/sv.js +1 -0
- package/dist/es2019/i18n/th.js +1 -0
- package/dist/es2019/i18n/tr.js +1 -0
- package/dist/es2019/i18n/uk.js +1 -0
- package/dist/es2019/i18n/vi.js +1 -0
- package/dist/es2019/i18n/zh.js +1 -0
- package/dist/es2019/i18n/zh_TW.js +1 -0
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/util/i18n-util.js +30 -120
- package/dist/es2019/util/ufoExperiences.js +0 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics.js +2 -30
- package/dist/esm/clients/UserSourceProvider.js +11 -21
- package/dist/esm/components/AddOptionAvatar.js +1 -3
- package/dist/esm/components/AvatarItemOption.js +5 -18
- package/dist/esm/components/BaseUserPicker.js +55 -166
- package/dist/esm/components/ClearIndicator.js +5 -23
- package/dist/esm/components/CustomOption/index.js +1 -3
- package/dist/esm/components/CustomOption/main.js +4 -22
- package/dist/esm/components/EmailOption/index.js +1 -3
- package/dist/esm/components/EmailOption/main.js +2 -20
- package/dist/esm/components/ExternalUserOption/ExternalAvatarItemOption.js +5 -11
- package/dist/esm/components/ExternalUserOption/InfoIcon.js +3 -5
- package/dist/esm/components/ExternalUserOption/SourcesTooltipContent.js +3 -3
- package/dist/esm/components/ExternalUserOption/index.js +1 -3
- package/dist/esm/components/ExternalUserOption/main.js +10 -35
- package/dist/esm/components/ExternalUserSourcesContainer.js +5 -8
- package/dist/esm/components/GroupOption/index.js +1 -3
- package/dist/esm/components/GroupOption/main.js +4 -19
- package/dist/esm/components/HighlightText.js +3 -21
- package/dist/esm/components/Input.js +0 -14
- package/dist/esm/components/MessagesIntlProvider.js +3 -10
- package/dist/esm/components/MultiValue.js +21 -39
- package/dist/esm/components/MultiValueContainer.js +8 -37
- package/dist/esm/components/Option.js +5 -15
- package/dist/esm/components/PopupControl.js +0 -11
- package/dist/esm/components/PopupInput.js +0 -14
- package/dist/esm/components/PopupUserPicker.js +10 -28
- package/dist/esm/components/SingleValue.js +6 -8
- package/dist/esm/components/SingleValueContainer.js +8 -25
- package/dist/esm/components/SizeableAvatar.js +4 -12
- package/dist/esm/components/TeamOption/index.js +1 -3
- package/dist/esm/components/TeamOption/main.js +9 -27
- package/dist/esm/components/UserOption.js +7 -24
- package/dist/esm/components/UserPicker.js +14 -26
- package/dist/esm/components/batch.js +0 -2
- package/dist/esm/components/components.js +1 -6
- package/dist/esm/components/creatable.js +2 -9
- package/dist/esm/components/creatableEmailSuggestion.js +7 -12
- package/dist/esm/components/emailValidation.js +0 -2
- package/dist/esm/components/styles.js +10 -21
- package/dist/esm/components/utils.js +0 -11
- package/dist/esm/i18n/cs.js +1 -0
- package/dist/esm/i18n/da.js +1 -0
- package/dist/esm/i18n/de.js +1 -0
- package/dist/esm/i18n/en.js +31 -4
- package/dist/esm/i18n/en_GB.js +31 -4
- package/dist/esm/i18n/en_ZZ.js +1 -0
- package/dist/esm/i18n/es.js +1 -0
- package/dist/esm/i18n/fi.js +1 -0
- package/dist/esm/i18n/fr.js +1 -0
- package/dist/esm/i18n/hu.js +1 -0
- package/dist/esm/i18n/it.js +1 -0
- package/dist/esm/i18n/ja.js +1 -0
- package/dist/esm/i18n/ko.js +1 -0
- package/dist/esm/i18n/nb.js +1 -0
- package/dist/esm/i18n/nl.js +1 -0
- package/dist/esm/i18n/pl.js +1 -0
- package/dist/esm/i18n/pt_BR.js +1 -0
- package/dist/esm/i18n/ru.js +1 -0
- package/dist/esm/i18n/sv.js +1 -0
- package/dist/esm/i18n/th.js +1 -0
- package/dist/esm/i18n/tr.js +1 -0
- package/dist/esm/i18n/uk.js +1 -0
- package/dist/esm/i18n/vi.js +1 -0
- package/dist/esm/i18n/zh.js +1 -0
- package/dist/esm/i18n/zh_TW.js +1 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/util/i18n-util.js +30 -126
- package/dist/esm/util/ufoExperiences.js +0 -9
- package/dist/esm/version.json +1 -1
- package/dist/types/i18n/cs.d.ts +1 -0
- package/dist/types/i18n/da.d.ts +1 -0
- package/dist/types/i18n/de.d.ts +1 -0
- package/dist/types/i18n/en.d.ts +28 -1
- package/dist/types/i18n/en_GB.d.ts +28 -1
- package/dist/types/i18n/en_ZZ.d.ts +1 -0
- package/dist/types/i18n/es.d.ts +1 -0
- package/dist/types/i18n/fi.d.ts +1 -0
- package/dist/types/i18n/fr.d.ts +1 -0
- package/dist/types/i18n/hu.d.ts +1 -0
- package/dist/types/i18n/it.d.ts +1 -0
- package/dist/types/i18n/ja.d.ts +1 -0
- package/dist/types/i18n/ko.d.ts +1 -0
- package/dist/types/i18n/nb.d.ts +1 -0
- package/dist/types/i18n/nl.d.ts +1 -0
- package/dist/types/i18n/pl.d.ts +1 -0
- package/dist/types/i18n/pt_BR.d.ts +1 -0
- package/dist/types/i18n/ru.d.ts +1 -0
- package/dist/types/i18n/sv.d.ts +1 -0
- package/dist/types/i18n/th.d.ts +1 -0
- package/dist/types/i18n/tr.d.ts +1 -0
- package/dist/types/i18n/uk.d.ts +1 -0
- package/dist/types/i18n/vi.d.ts +1 -0
- package/dist/types/i18n/zh.d.ts +1 -0
- package/dist/types/i18n/zh_TW.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,72 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.BaseUserPickerWithoutAnalytics = exports.BaseUserPicker = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
11
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
-
|
|
18
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
|
|
20
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
-
|
|
22
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
-
|
|
24
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
-
|
|
26
16
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
27
|
-
|
|
28
17
|
var _ufo = require("@atlaskit/ufo");
|
|
29
|
-
|
|
30
18
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
31
|
-
|
|
32
19
|
var _react = _interopRequireDefault(require("react"));
|
|
33
|
-
|
|
34
20
|
var _reactIntlNext = require("react-intl-next");
|
|
35
|
-
|
|
36
21
|
var _uuid = require("uuid");
|
|
37
|
-
|
|
38
22
|
var _analytics = require("../analytics");
|
|
39
|
-
|
|
40
23
|
var _batch = require("./batch");
|
|
41
|
-
|
|
42
24
|
var _i18n = require("./i18n");
|
|
43
|
-
|
|
44
25
|
var _utils = require("./utils");
|
|
45
|
-
|
|
46
26
|
var _ufoExperiences = require("../util/ufoExperiences");
|
|
47
|
-
|
|
48
27
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
49
|
-
|
|
50
28
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
51
|
-
|
|
52
29
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
53
|
-
|
|
54
30
|
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); }; }
|
|
55
|
-
|
|
56
31
|
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; } }
|
|
57
|
-
|
|
58
32
|
var loadingMessage = function loadingMessage() {
|
|
59
33
|
return null;
|
|
60
34
|
};
|
|
61
|
-
|
|
62
35
|
var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
63
36
|
(0, _inherits2.default)(BaseUserPickerWithoutAnalytics, _React$Component);
|
|
64
|
-
|
|
65
37
|
var _super = _createSuper(BaseUserPickerWithoutAnalytics);
|
|
66
|
-
|
|
67
38
|
function BaseUserPickerWithoutAnalytics(props) {
|
|
68
39
|
var _this;
|
|
69
|
-
|
|
70
40
|
(0, _classCallCheck2.default)(this, BaseUserPickerWithoutAnalytics);
|
|
71
41
|
_this = _super.call(this, props);
|
|
72
42
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSessionId", function () {
|
|
@@ -101,62 +71,47 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
101
71
|
}));
|
|
102
72
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleChange", function (value, _ref) {
|
|
103
73
|
var action = _ref.action,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
74
|
+
removedValue = _ref.removedValue,
|
|
75
|
+
option = _ref.option;
|
|
107
76
|
if (removedValue && removedValue.data.fixed) {
|
|
108
77
|
return;
|
|
109
78
|
}
|
|
110
|
-
|
|
111
79
|
_this.resetInputState();
|
|
112
|
-
|
|
113
80
|
var _this$props = _this.props,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
81
|
+
onChange = _this$props.onChange,
|
|
82
|
+
onSelection = _this$props.onSelection,
|
|
83
|
+
onClear = _this$props.onClear,
|
|
84
|
+
isMulti = _this$props.isMulti;
|
|
118
85
|
(0, _utils.callCallback)(onChange, (0, _utils.extractOptionValue)(value), action);
|
|
119
|
-
|
|
120
86
|
switch (action) {
|
|
121
87
|
case 'select-option':
|
|
122
88
|
if (value) {
|
|
123
89
|
(0, _utils.callCallback)(onSelection, (0, _utils.extractOptionValue)(value), _this.getSessionId());
|
|
124
90
|
}
|
|
125
|
-
|
|
126
91
|
_this.fireEvent(_analytics.selectEvent, isMulti ? option : value);
|
|
127
|
-
|
|
128
92
|
_this.session = isMulti ? (0, _analytics.startSession)() : undefined;
|
|
129
93
|
break;
|
|
130
|
-
|
|
131
94
|
case 'clear':
|
|
132
95
|
(0, _utils.callCallback)(onClear);
|
|
133
|
-
|
|
134
96
|
_this.fireEvent(_analytics.clearEvent);
|
|
135
|
-
|
|
136
97
|
break;
|
|
137
|
-
|
|
138
98
|
case 'remove-value':
|
|
139
99
|
case 'pop-value':
|
|
140
100
|
if (removedValue) {
|
|
141
101
|
_this.fireEvent(_analytics.deleteEvent, removedValue.data);
|
|
142
102
|
}
|
|
143
|
-
|
|
144
103
|
break;
|
|
145
104
|
}
|
|
146
|
-
|
|
147
105
|
_this.fireEvent(_analytics.searchedEvent);
|
|
148
|
-
|
|
149
106
|
if (removedValue && _this.state.value && Array.isArray(_this.state.value)) {
|
|
150
107
|
var remainingValues = _this.state.value.filter(function (val) {
|
|
151
108
|
return val.data.id !== removedValue.data.id;
|
|
152
109
|
});
|
|
153
|
-
|
|
154
110
|
_this.setState({
|
|
155
111
|
value: remainingValues ? remainingValues : [],
|
|
156
112
|
menuIsOpen: true
|
|
157
113
|
});
|
|
158
114
|
}
|
|
159
|
-
|
|
160
115
|
if (!_this.props.value) {
|
|
161
116
|
_this.setState({
|
|
162
117
|
value: value ? value : []
|
|
@@ -168,12 +123,10 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
168
123
|
});
|
|
169
124
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "addOptions", (0, _batch.batchByKey)(function (request, newOptions) {
|
|
170
125
|
var resolving = _this.state.resolving;
|
|
171
|
-
|
|
172
126
|
_this.setState(function (_ref2) {
|
|
173
127
|
var inflightRequest = _ref2.inflightRequest,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
128
|
+
options = _ref2.options,
|
|
129
|
+
count = _ref2.count;
|
|
177
130
|
if (inflightRequest.toString() === request) {
|
|
178
131
|
return {
|
|
179
132
|
options: (resolving ? options : []).concat(newOptions.reduce(function (nextOptions, item) {
|
|
@@ -183,38 +136,30 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
183
136
|
resolving: count - newOptions.length !== 0
|
|
184
137
|
};
|
|
185
138
|
}
|
|
186
|
-
|
|
187
139
|
return null;
|
|
188
140
|
});
|
|
189
141
|
}));
|
|
190
142
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleLoadOptionsError", function () {
|
|
191
143
|
var count = _this.state.count;
|
|
192
144
|
var newCount = count - 1;
|
|
193
|
-
|
|
194
145
|
_this.setState({
|
|
195
146
|
count: newCount,
|
|
196
147
|
resolving: newCount !== 0
|
|
197
148
|
});
|
|
198
|
-
|
|
199
149
|
_this.fireEvent(_analytics.failedEvent);
|
|
200
150
|
});
|
|
201
151
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "debouncedLoadOptions", (0, _debounce.default)(function (search) {
|
|
202
152
|
var loadOptions = _this.props.loadOptions;
|
|
203
|
-
|
|
204
153
|
if (loadOptions) {
|
|
205
154
|
_this.setState(function (_ref3) {
|
|
206
155
|
var previousRequest = _ref3.inflightRequest;
|
|
207
156
|
var inflightRequest = previousRequest + 1;
|
|
208
157
|
var result = _this.session && _this.session.id ? loadOptions(search, _this.session.id) : loadOptions(search);
|
|
209
|
-
|
|
210
158
|
var addOptions = _this.addOptions.bind((0, _assertThisInitialized2.default)(_this), inflightRequest.toString());
|
|
211
|
-
|
|
212
159
|
var count = 0;
|
|
213
|
-
|
|
214
160
|
if ((0, _utils.isIterable)(result)) {
|
|
215
161
|
var _iterator = _createForOfIteratorHelper(result),
|
|
216
|
-
|
|
217
|
-
|
|
162
|
+
_step;
|
|
218
163
|
try {
|
|
219
164
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
220
165
|
var _value = _step.value;
|
|
@@ -230,7 +175,6 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
230
175
|
Promise.resolve(result).then(addOptions).catch(_this.handleLoadOptionsError);
|
|
231
176
|
count++;
|
|
232
177
|
}
|
|
233
|
-
|
|
234
178
|
return {
|
|
235
179
|
inflightRequest: inflightRequest,
|
|
236
180
|
count: count,
|
|
@@ -249,12 +193,10 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
249
193
|
});
|
|
250
194
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "startOptionsShownUfoExperience", function () {
|
|
251
195
|
_this.abortOptionsShownUfoExperience();
|
|
252
|
-
|
|
253
196
|
_this.optionsShownUfoExperienceInstance.start();
|
|
254
197
|
});
|
|
255
198
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "executeLoadOptions", function (search) {
|
|
256
199
|
var loadOptions = _this.props.loadOptions;
|
|
257
|
-
|
|
258
200
|
if (loadOptions) {
|
|
259
201
|
_this.setState({
|
|
260
202
|
resolving: true
|
|
@@ -265,24 +207,18 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
265
207
|
});
|
|
266
208
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleFocus", function (event) {
|
|
267
209
|
var _this$state = _this.state,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
210
|
+
value = _this$state.value,
|
|
211
|
+
menuIsOpen = _this$state.menuIsOpen;
|
|
271
212
|
if (!menuIsOpen || !_this.session) {
|
|
272
213
|
_this.startSession();
|
|
273
214
|
}
|
|
274
|
-
|
|
275
215
|
_this.startOptionsShownUfoExperience();
|
|
276
|
-
|
|
277
216
|
(0, _utils.callCallback)(_this.props.onFocus, _this.getSessionId());
|
|
278
|
-
|
|
279
217
|
_this.setState({
|
|
280
218
|
menuIsOpen: true
|
|
281
219
|
});
|
|
282
|
-
|
|
283
220
|
if (!_this.props.isMulti && (0, _utils.isSingleValue)(value)) {
|
|
284
221
|
var input = event.target;
|
|
285
|
-
|
|
286
222
|
_this.setState({
|
|
287
223
|
inputValue: value.label
|
|
288
224
|
}, function () {
|
|
@@ -297,20 +233,15 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
297
233
|
_this.setState({
|
|
298
234
|
inputValue: ''
|
|
299
235
|
});
|
|
300
|
-
|
|
301
236
|
(0, _utils.callCallback)(_this.props.onInputChange, '', _this.getSessionId());
|
|
302
237
|
});
|
|
303
238
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleBlur", function () {
|
|
304
239
|
(0, _utils.callCallback)(_this.props.onBlur, _this.getSessionId());
|
|
305
|
-
|
|
306
240
|
if ((0, _utils.isPopupUserPickerByComponent)(_this.props.SelectComponent)) {
|
|
307
241
|
return;
|
|
308
242
|
}
|
|
309
|
-
|
|
310
243
|
_this.resetInputState();
|
|
311
|
-
|
|
312
244
|
_this.abortOptionsShownUfoExperience();
|
|
313
|
-
|
|
314
245
|
_this.setState({
|
|
315
246
|
menuIsOpen: false,
|
|
316
247
|
options: []
|
|
@@ -318,9 +249,7 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
318
249
|
});
|
|
319
250
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClose", function () {
|
|
320
251
|
_this.resetInputState();
|
|
321
|
-
|
|
322
252
|
(0, _utils.callCallback)(_this.props.onClose, _this.getSessionId());
|
|
323
|
-
|
|
324
253
|
_this.setState({
|
|
325
254
|
menuIsOpen: false,
|
|
326
255
|
options: []
|
|
@@ -328,60 +257,50 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
328
257
|
});
|
|
329
258
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleInputChange", function (search, _ref4) {
|
|
330
259
|
var action = _ref4.action;
|
|
331
|
-
|
|
332
260
|
if (action === 'input-change' || action === 'set-value') {
|
|
333
261
|
(0, _utils.callCallback)(_this.props.onInputChange, search, _this.getSessionId());
|
|
334
|
-
|
|
335
262
|
_this.setState({
|
|
336
263
|
inputValue: search
|
|
337
264
|
});
|
|
338
|
-
|
|
339
265
|
_this.startOptionsShownUfoExperience();
|
|
340
|
-
|
|
341
266
|
_this.executeLoadOptions(search);
|
|
342
267
|
}
|
|
343
268
|
});
|
|
344
269
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fireEvent", function (eventCreator) {
|
|
345
270
|
var createAnalyticsEvent = _this.props.createAnalyticsEvent;
|
|
346
|
-
|
|
347
271
|
if (createAnalyticsEvent) {
|
|
348
272
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
349
273
|
args[_key - 1] = arguments[_key];
|
|
350
274
|
}
|
|
351
|
-
|
|
352
275
|
(0, _analytics.createAndFireEventInElementsChannel)(eventCreator.apply(void 0, [_this.props, _this.state, _this.session, _this.journeyId].concat(args)))(createAnalyticsEvent);
|
|
353
276
|
}
|
|
354
277
|
});
|
|
355
278
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "startSession", function () {
|
|
356
279
|
_this.session = (0, _analytics.startSession)();
|
|
357
280
|
_this.journeyId = _this.getSessionId();
|
|
358
|
-
|
|
359
281
|
_this.fireEvent(_analytics.focusEvent);
|
|
360
282
|
});
|
|
361
283
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeyDown", function (event) {
|
|
362
284
|
// Escape
|
|
363
285
|
if (event.keyCode === 27) {
|
|
364
286
|
_this.blur();
|
|
365
|
-
}
|
|
366
|
-
|
|
287
|
+
}
|
|
367
288
|
|
|
289
|
+
// Space
|
|
368
290
|
if (event.keyCode === 32 && !_this.state.inputValue) {
|
|
369
291
|
event.preventDefault();
|
|
370
292
|
!_this.props.disableInput && _this.setState({
|
|
371
293
|
inputValue: ' '
|
|
372
294
|
});
|
|
373
295
|
}
|
|
374
|
-
|
|
375
296
|
if (_this.session) {
|
|
376
297
|
_this.session.lastKey = event.keyCode;
|
|
377
|
-
|
|
378
298
|
switch (event.keyCode) {
|
|
379
299
|
// KeyUp 38
|
|
380
300
|
case 38:
|
|
381
301
|
_this.session.upCount++;
|
|
382
302
|
break;
|
|
383
303
|
// KeyDown 40
|
|
384
|
-
|
|
385
304
|
case 40:
|
|
386
305
|
_this.session.downCount++;
|
|
387
306
|
break;
|
|
@@ -396,30 +315,25 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
396
315
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getOptions", function () {
|
|
397
316
|
var options = (0, _utils.getOptions)(_this.state.options) || [];
|
|
398
317
|
var _this$props2 = _this.props,
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
318
|
+
maxOptions = _this$props2.maxOptions,
|
|
319
|
+
isMulti = _this$props2.isMulti;
|
|
402
320
|
if (maxOptions === 0) {
|
|
403
321
|
return [];
|
|
404
322
|
}
|
|
405
|
-
|
|
406
323
|
if (maxOptions && maxOptions > 0 && maxOptions < options.length) {
|
|
407
324
|
var _value2 = _this.state.value;
|
|
408
|
-
var filteredOptions = options;
|
|
409
|
-
|
|
325
|
+
var filteredOptions = options;
|
|
326
|
+
// Filter out previously selected options
|
|
410
327
|
if (isMulti && Array.isArray(_value2)) {
|
|
411
328
|
var valueIds = _value2.map(function (item) {
|
|
412
329
|
return item.data.id;
|
|
413
330
|
});
|
|
414
|
-
|
|
415
331
|
filteredOptions = options.filter(function (option) {
|
|
416
332
|
return valueIds.indexOf(option.data.id) === -1;
|
|
417
333
|
});
|
|
418
334
|
}
|
|
419
|
-
|
|
420
335
|
return filteredOptions.slice(0, maxOptions);
|
|
421
336
|
}
|
|
422
|
-
|
|
423
337
|
return options;
|
|
424
338
|
});
|
|
425
339
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getAppearance", function () {
|
|
@@ -438,19 +352,17 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
438
352
|
_this.optionsShownUfoExperienceInstance = _ufoExperiences.userPickerOptionsShownUfoExperience.getInstance((0, _uuid.v4)());
|
|
439
353
|
return _this;
|
|
440
354
|
}
|
|
441
|
-
|
|
442
355
|
(0, _createClass2.default)(BaseUserPickerWithoutAnalytics, [{
|
|
443
356
|
key: "componentDidMount",
|
|
444
357
|
value: function componentDidMount() {
|
|
445
358
|
var _this$props3 = this.props,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
359
|
+
open = _this$props3.open,
|
|
360
|
+
search = _this$props3.search;
|
|
361
|
+
// load options when the picker open
|
|
449
362
|
if (open) {
|
|
450
363
|
if (!this.session) {
|
|
451
364
|
this.startSession();
|
|
452
365
|
}
|
|
453
|
-
|
|
454
366
|
this.executeLoadOptions(search);
|
|
455
367
|
}
|
|
456
368
|
}
|
|
@@ -458,35 +370,30 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
458
370
|
key: "componentDidUpdate",
|
|
459
371
|
value: function componentDidUpdate(_, prevState) {
|
|
460
372
|
var _this$state2 = this.state,
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
373
|
+
menuIsOpen = _this$state2.menuIsOpen,
|
|
374
|
+
options = _this$state2.options,
|
|
375
|
+
resolving = _this$state2.resolving,
|
|
376
|
+
count = _this$state2.count;
|
|
377
|
+
// load options when the picker open
|
|
466
378
|
if (menuIsOpen && !prevState.menuIsOpen) {
|
|
467
379
|
if (!this.session) {
|
|
468
380
|
// session should have been created onFocus
|
|
469
381
|
this.startSession();
|
|
470
382
|
}
|
|
471
|
-
|
|
472
383
|
this.executeLoadOptions();
|
|
473
384
|
}
|
|
474
|
-
|
|
475
385
|
if (!menuIsOpen && prevState.menuIsOpen && this.session) {
|
|
476
386
|
this.fireEvent(_analytics.cancelEvent, prevState);
|
|
477
387
|
this.session = undefined;
|
|
478
388
|
}
|
|
479
|
-
|
|
480
389
|
if (menuIsOpen && (!prevState.menuIsOpen && options.length > 0 || options.length !== prevState.options.length)) {
|
|
481
390
|
this.fireEvent(_analytics.searchedEvent);
|
|
482
391
|
}
|
|
483
|
-
|
|
484
392
|
if (this.state.inputValue !== prevState.inputValue) {
|
|
485
393
|
if (this.session) {
|
|
486
394
|
this.session.inputChangeTime = Date.now();
|
|
487
395
|
}
|
|
488
396
|
}
|
|
489
|
-
|
|
490
397
|
if (menuIsOpen && (!_.loadOptions || prevState.menuIsOpen) && count === 0 && !resolving && [_ufo.UFOExperienceState.STARTED.id, _ufo.UFOExperienceState.IN_PROGRESS.id].includes(this.optionsShownUfoExperienceInstance.state.id)) {
|
|
491
398
|
this.optionsShownUfoExperienceInstance.success();
|
|
492
399
|
}
|
|
@@ -495,37 +402,37 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
495
402
|
key: "render",
|
|
496
403
|
value: function render() {
|
|
497
404
|
var _this$props4 = this.props,
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
405
|
+
isMulti = _this$props4.isMulti,
|
|
406
|
+
isLoading = _this$props4.isLoading,
|
|
407
|
+
subtle = _this$props4.subtle,
|
|
408
|
+
noBorder = _this$props4.noBorder,
|
|
409
|
+
placeholder = _this$props4.placeholder,
|
|
410
|
+
isClearable = _this$props4.isClearable,
|
|
411
|
+
isDisabled = _this$props4.isDisabled,
|
|
412
|
+
clearValueLabel = _this$props4.clearValueLabel,
|
|
413
|
+
menuMinWidth = _this$props4.menuMinWidth,
|
|
414
|
+
menuPortalTarget = _this$props4.menuPortalTarget,
|
|
415
|
+
addMoreMessage = _this$props4.addMoreMessage,
|
|
416
|
+
noOptionsMessage = _this$props4.noOptionsMessage,
|
|
417
|
+
disableInput = _this$props4.disableInput,
|
|
418
|
+
components = _this$props4.components,
|
|
419
|
+
pickerProps = _this$props4.pickerProps,
|
|
420
|
+
SelectComponent = _this$props4.SelectComponent,
|
|
421
|
+
styles = _this$props4.styles,
|
|
422
|
+
autoFocus = _this$props4.autoFocus,
|
|
423
|
+
fieldId = _this$props4.fieldId,
|
|
424
|
+
inputId = _this$props4.inputId,
|
|
425
|
+
maxPickerHeight = _this$props4.maxPickerHeight,
|
|
426
|
+
textFieldBackgroundColor = _this$props4.textFieldBackgroundColor,
|
|
427
|
+
ariaLabelledBy = _this$props4.ariaLabelledBy,
|
|
428
|
+
ariaLive = _this$props4.ariaLive;
|
|
522
429
|
var _this$state3 = this.state,
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
430
|
+
count = _this$state3.count,
|
|
431
|
+
hoveringClearIndicator = _this$state3.hoveringClearIndicator,
|
|
432
|
+
menuIsOpen = _this$state3.menuIsOpen,
|
|
433
|
+
value = _this$state3.value,
|
|
434
|
+
inputValue = _this$state3.inputValue,
|
|
435
|
+
resolving = _this$state3.resolving;
|
|
529
436
|
var appearance = this.getAppearance();
|
|
530
437
|
return /*#__PURE__*/_react.default.createElement(SelectComponent, (0, _extends2.default)({
|
|
531
438
|
value: value,
|
|
@@ -581,36 +488,29 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
581
488
|
key: "getDerivedStateFromProps",
|
|
582
489
|
value: function getDerivedStateFromProps(nextProps, prevState) {
|
|
583
490
|
var derivedState = {};
|
|
584
|
-
|
|
585
491
|
if (nextProps.isDisabled || nextProps.disableInput) {
|
|
586
492
|
derivedState.menuIsOpen = false;
|
|
587
493
|
}
|
|
588
|
-
|
|
589
494
|
if (nextProps.open !== undefined) {
|
|
590
495
|
derivedState.menuIsOpen = nextProps.open;
|
|
591
496
|
}
|
|
592
|
-
|
|
593
497
|
if (nextProps.value !== undefined) {
|
|
594
498
|
derivedState.value = (0, _utils.optionToSelectableOptions)(nextProps.value);
|
|
595
499
|
} else if ((0, _utils.isDefaultValuePopulated)(nextProps.defaultValue) && !prevState.isDefaultSet) {
|
|
596
500
|
derivedState.value = (0, _utils.optionToSelectableOptions)(nextProps.defaultValue);
|
|
597
501
|
derivedState.isDefaultSet = true;
|
|
598
502
|
}
|
|
599
|
-
|
|
600
503
|
if (nextProps.search !== undefined && nextProps.search !== prevState.inputValue) {
|
|
601
504
|
derivedState.inputValue = nextProps.search;
|
|
602
505
|
}
|
|
603
|
-
|
|
604
506
|
if (nextProps.options !== undefined) {
|
|
605
507
|
derivedState.options = nextProps.options;
|
|
606
508
|
}
|
|
607
|
-
|
|
608
509
|
return derivedState;
|
|
609
510
|
}
|
|
610
511
|
}]);
|
|
611
512
|
return BaseUserPickerWithoutAnalytics;
|
|
612
513
|
}(_react.default.Component);
|
|
613
|
-
|
|
614
514
|
exports.BaseUserPickerWithoutAnalytics = BaseUserPickerWithoutAnalytics;
|
|
615
515
|
(0, _defineProperty2.default)(BaseUserPickerWithoutAnalytics, "defaultProps", {
|
|
616
516
|
isMulti: false,
|
|
@@ -1,46 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.ClearIndicator = void 0;
|
|
9
|
-
|
|
10
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
-
|
|
12
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
12
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
-
|
|
20
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
17
|
var _react = _interopRequireDefault(require("react"));
|
|
29
|
-
|
|
30
18
|
var _select = require("@atlaskit/select");
|
|
31
|
-
|
|
32
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
-
|
|
34
20
|
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; }
|
|
35
|
-
|
|
36
21
|
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); }; }
|
|
37
|
-
|
|
38
22
|
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; } }
|
|
39
|
-
|
|
40
23
|
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); }
|
|
41
|
-
|
|
42
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || (0, _typeof2.default)(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; }
|
|
43
|
-
|
|
44
25
|
var AsyncTooltip = /*#__PURE__*/_react.default.lazy(function () {
|
|
45
26
|
return Promise.resolve().then(function () {
|
|
46
27
|
return _interopRequireWildcard(require('@atlaskit/tooltip'));
|
|
@@ -50,51 +31,40 @@ var AsyncTooltip = /*#__PURE__*/_react.default.lazy(function () {
|
|
|
50
31
|
};
|
|
51
32
|
});
|
|
52
33
|
});
|
|
53
|
-
|
|
54
34
|
var ClearIndicator = /*#__PURE__*/function (_React$PureComponent) {
|
|
55
35
|
(0, _inherits2.default)(ClearIndicator, _React$PureComponent);
|
|
56
|
-
|
|
57
36
|
var _super = _createSuper(ClearIndicator);
|
|
58
|
-
|
|
59
37
|
function ClearIndicator() {
|
|
60
38
|
var _this;
|
|
61
|
-
|
|
62
39
|
(0, _classCallCheck2.default)(this, ClearIndicator);
|
|
63
|
-
|
|
64
40
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
65
41
|
args[_key] = arguments[_key];
|
|
66
42
|
}
|
|
67
|
-
|
|
68
43
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
69
44
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMouseDown", function (event) {
|
|
70
45
|
if (event && event.type === 'mousedown' && event.button !== 0) {
|
|
71
46
|
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
47
|
+
}
|
|
48
|
+
// Prevent focus when clear on blurred state
|
|
75
49
|
var _this$props = _this.props,
|
|
76
|
-
|
|
77
|
-
|
|
50
|
+
clearValue = _this$props.clearValue,
|
|
51
|
+
selectProps = _this$props.selectProps;
|
|
78
52
|
clearValue();
|
|
79
|
-
|
|
80
53
|
if (selectProps && !selectProps.isFocused) {
|
|
81
54
|
event.stopPropagation();
|
|
82
55
|
}
|
|
83
56
|
});
|
|
84
57
|
return _this;
|
|
85
58
|
}
|
|
86
|
-
|
|
87
59
|
(0, _createClass2.default)(ClearIndicator, [{
|
|
88
60
|
key: "render",
|
|
89
61
|
value: function render() {
|
|
90
62
|
var clearValueLabel = this.props.selectProps.clearValueLabel;
|
|
91
|
-
|
|
92
63
|
var Indicator = /*#__PURE__*/_react.default.createElement(_select.components.ClearIndicator, (0, _extends2.default)({}, this.props, {
|
|
93
64
|
innerProps: _objectSpread(_objectSpread({}, this.props.innerProps), {}, {
|
|
94
65
|
onMouseDown: this.handleMouseDown
|
|
95
66
|
})
|
|
96
67
|
}));
|
|
97
|
-
|
|
98
68
|
return clearValueLabel ? /*#__PURE__*/_react.default.createElement(_react.default.Suspense, {
|
|
99
69
|
fallback: Indicator
|
|
100
70
|
}, /*#__PURE__*/_react.default.createElement(AsyncTooltip, {
|
|
@@ -104,5 +74,4 @@ var ClearIndicator = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
104
74
|
}]);
|
|
105
75
|
return ClearIndicator;
|
|
106
76
|
}(_react.default.PureComponent);
|
|
107
|
-
|
|
108
77
|
exports.ClearIndicator = ClearIndicator;
|