@atlaskit/user-picker 9.7.4 → 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 +12 -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 +56 -156
- 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 +9 -84
- 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 +56 -167
- 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/dist/types/types.d.ts +1 -1
- package/package.json +3 -2
- package/report.api.md +1 -4
- package/tmp/api-report-tmp.d.ts +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["ref"];
|
|
4
|
-
|
|
5
4
|
/** @jsx jsx */
|
|
6
5
|
import { AvatarItem } from '@atlaskit/avatar';
|
|
7
6
|
import { css, jsx } from '@emotion/react';
|
|
@@ -25,11 +24,11 @@ var avatarItemComponent = css({
|
|
|
25
24
|
});
|
|
26
25
|
export var SingleValue = function SingleValue(props) {
|
|
27
26
|
var _props$data = props.data,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
label = _props$data.label,
|
|
28
|
+
data = _props$data.data,
|
|
29
|
+
_props$selectProps = props.selectProps,
|
|
30
|
+
appearance = _props$selectProps.appearance,
|
|
31
|
+
isFocused = _props$selectProps.isFocused;
|
|
33
32
|
return !isFocused ? jsx(components.SingleValue, props, jsx(AvatarItem, {
|
|
34
33
|
backgroundColor: "transparent",
|
|
35
34
|
avatar: jsx(SizeableAvatar, {
|
|
@@ -40,8 +39,7 @@ export var SingleValue = function SingleValue(props) {
|
|
|
40
39
|
primaryText: label
|
|
41
40
|
}, function (_ref) {
|
|
42
41
|
var ref = _ref.ref,
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
45
43
|
return jsx("div", _extends({
|
|
46
44
|
css: avatarItemComponent
|
|
47
45
|
}, props));
|
|
@@ -7,11 +7,8 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
9
|
var _excluded = ["children"];
|
|
10
|
-
|
|
11
10
|
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); }; }
|
|
12
|
-
|
|
13
11
|
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
|
-
|
|
15
12
|
/** @jsx jsx */
|
|
16
13
|
import React from 'react';
|
|
17
14
|
import { css, jsx } from '@emotion/react';
|
|
@@ -23,61 +20,47 @@ var placeholderIconContainer = css({
|
|
|
23
20
|
lineHeight: 0,
|
|
24
21
|
gridArea: '1/1/2/2'
|
|
25
22
|
});
|
|
26
|
-
|
|
27
23
|
var showUserAvatar = function showUserAvatar(inputValue, value) {
|
|
28
24
|
return value && value.data && inputValue === value.label;
|
|
29
25
|
};
|
|
30
|
-
|
|
31
26
|
export var SingleValueContainer = /*#__PURE__*/function (_React$Component) {
|
|
32
27
|
_inherits(SingleValueContainer, _React$Component);
|
|
33
|
-
|
|
34
28
|
var _super = _createSuper(SingleValueContainer);
|
|
35
|
-
|
|
36
29
|
function SingleValueContainer() {
|
|
37
30
|
var _this;
|
|
38
|
-
|
|
39
31
|
_classCallCheck(this, SingleValueContainer);
|
|
40
|
-
|
|
41
32
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
42
33
|
args[_key] = arguments[_key];
|
|
43
34
|
}
|
|
44
|
-
|
|
45
35
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
46
|
-
|
|
47
36
|
_defineProperty(_assertThisInitialized(_this), "renderAvatar", function () {
|
|
48
37
|
var _this$props = _this.props,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
38
|
+
hasValue = _this$props.hasValue,
|
|
39
|
+
_this$props$selectPro = _this$props.selectProps,
|
|
40
|
+
appearance = _this$props$selectPro.appearance,
|
|
41
|
+
isFocused = _this$props$selectPro.isFocused,
|
|
42
|
+
inputValue = _this$props$selectPro.inputValue,
|
|
43
|
+
value = _this$props$selectPro.value;
|
|
56
44
|
if (isFocused || !hasValue) {
|
|
57
45
|
return jsx(SizeableAvatar, {
|
|
58
46
|
appearance: appearance,
|
|
59
47
|
src: showUserAvatar(inputValue, value) ? value.data.avatarUrl : undefined
|
|
60
48
|
});
|
|
61
49
|
}
|
|
62
|
-
|
|
63
50
|
return null;
|
|
64
51
|
});
|
|
65
|
-
|
|
66
52
|
return _this;
|
|
67
53
|
}
|
|
68
|
-
|
|
69
54
|
_createClass(SingleValueContainer, [{
|
|
70
55
|
key: "render",
|
|
71
56
|
value: function render() {
|
|
72
57
|
var _this$props2 = this.props,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
58
|
+
children = _this$props2.children,
|
|
59
|
+
valueContainerProps = _objectWithoutProperties(_this$props2, _excluded);
|
|
76
60
|
return jsx(components.ValueContainer, valueContainerProps, jsx("div", {
|
|
77
61
|
css: placeholderIconContainer
|
|
78
62
|
}, this.renderAvatar()), children);
|
|
79
63
|
}
|
|
80
64
|
}]);
|
|
81
|
-
|
|
82
65
|
return SingleValueContainer;
|
|
83
66
|
}(React.Component);
|
|
@@ -3,33 +3,26 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
6
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
|
|
9
7
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
-
|
|
11
8
|
import Avatar from '@atlaskit/avatar';
|
|
12
9
|
import React from 'react';
|
|
13
10
|
import { getAvatarSize } from './utils';
|
|
14
11
|
export var SizeableAvatar = /*#__PURE__*/function (_React$PureComponent) {
|
|
15
12
|
_inherits(SizeableAvatar, _React$PureComponent);
|
|
16
|
-
|
|
17
13
|
var _super = _createSuper(SizeableAvatar);
|
|
18
|
-
|
|
19
14
|
function SizeableAvatar() {
|
|
20
15
|
_classCallCheck(this, SizeableAvatar);
|
|
21
|
-
|
|
22
16
|
return _super.apply(this, arguments);
|
|
23
17
|
}
|
|
24
|
-
|
|
25
18
|
_createClass(SizeableAvatar, [{
|
|
26
19
|
key: "render",
|
|
27
20
|
value: function render() {
|
|
28
21
|
var _this$props = this.props,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
src = _this$props.src,
|
|
23
|
+
name = _this$props.name,
|
|
24
|
+
presence = _this$props.presence,
|
|
25
|
+
appearance = _this$props.appearance;
|
|
33
26
|
return /*#__PURE__*/React.createElement(Avatar, {
|
|
34
27
|
size: getAvatarSize(appearance),
|
|
35
28
|
src: src,
|
|
@@ -39,6 +32,5 @@ export var SizeableAvatar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
39
32
|
});
|
|
40
33
|
}
|
|
41
34
|
}]);
|
|
42
|
-
|
|
43
35
|
return SizeableAvatar;
|
|
44
36
|
}(React.PureComponent);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
var AsyncTeamOption = /*#__PURE__*/React.lazy(function () {
|
|
3
|
-
return import(
|
|
4
|
-
/* webpackChunkName: "@atlaskit-internal_@atlassian/user-picker/team-option" */
|
|
5
|
-
'./main').then(function (module) {
|
|
3
|
+
return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/user-picker/team-option" */'./main').then(function (module) {
|
|
6
4
|
return {
|
|
7
5
|
default: module.TeamOption
|
|
8
6
|
};
|
|
@@ -6,11 +6,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
|
|
10
9
|
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); }; }
|
|
11
|
-
|
|
12
10
|
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; } }
|
|
13
|
-
|
|
14
11
|
/** @jsx jsx */
|
|
15
12
|
import { B400, N800, N200 } from '@atlaskit/theme/colors';
|
|
16
13
|
import { jsx } from '@emotion/react';
|
|
@@ -22,24 +19,18 @@ import { messages } from '../i18n';
|
|
|
22
19
|
import { SizeableAvatar } from '../SizeableAvatar';
|
|
23
20
|
export var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
24
21
|
_inherits(TeamOption, _React$PureComponent);
|
|
25
|
-
|
|
26
22
|
var _super = _createSuper(TeamOption);
|
|
27
|
-
|
|
28
23
|
function TeamOption() {
|
|
29
24
|
var _this;
|
|
30
|
-
|
|
31
25
|
_classCallCheck(this, TeamOption);
|
|
32
|
-
|
|
33
26
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34
27
|
args[_key] = arguments[_key];
|
|
35
28
|
}
|
|
36
|
-
|
|
37
29
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
38
|
-
|
|
39
30
|
_defineProperty(_assertThisInitialized(_this), "getPrimaryText", function () {
|
|
40
31
|
var _this$props$team = _this.props.team,
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
name = _this$props$team.name,
|
|
33
|
+
highlight = _this$props$team.highlight;
|
|
43
34
|
return [jsx("span", {
|
|
44
35
|
key: "name",
|
|
45
36
|
css: textWrapper(_this.props.isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text, ".concat(N800, ")"))
|
|
@@ -47,14 +38,14 @@ export var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
47
38
|
highlights: highlight && highlight.name
|
|
48
39
|
}, name))];
|
|
49
40
|
});
|
|
50
|
-
|
|
51
41
|
_defineProperty(_assertThisInitialized(_this), "renderByline", function () {
|
|
52
42
|
var _this$props = _this.props,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
isSelected = _this$props.isSelected,
|
|
44
|
+
_this$props$team2 = _this$props.team,
|
|
45
|
+
memberCount = _this$props$team2.memberCount,
|
|
46
|
+
includesYou = _this$props$team2.includesYou;
|
|
57
47
|
|
|
48
|
+
// if Member count is missing, do not show the byline, regardless of the availability of includesYou
|
|
58
49
|
if (memberCount === null || typeof memberCount === 'undefined') {
|
|
59
50
|
return undefined;
|
|
60
51
|
} else {
|
|
@@ -81,45 +72,37 @@ export var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
81
72
|
}
|
|
82
73
|
}
|
|
83
74
|
});
|
|
84
|
-
|
|
85
75
|
_defineProperty(_assertThisInitialized(_this), "getBylineComponent", function (isSelected, message) {
|
|
86
76
|
return jsx("span", {
|
|
87
77
|
css: textWrapper(isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text-subtlest, ".concat(N200, ")"))
|
|
88
78
|
}, message);
|
|
89
79
|
});
|
|
90
|
-
|
|
91
80
|
_defineProperty(_assertThisInitialized(_this), "renderAvatar", function () {
|
|
92
81
|
var _this$props$team3 = _this.props.team,
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
avatarUrl = _this$props$team3.avatarUrl,
|
|
83
|
+
name = _this$props$team3.name;
|
|
95
84
|
return jsx(SizeableAvatar, {
|
|
96
85
|
appearance: "big",
|
|
97
86
|
src: avatarUrl,
|
|
98
87
|
name: name
|
|
99
88
|
});
|
|
100
89
|
});
|
|
101
|
-
|
|
102
90
|
_defineProperty(_assertThisInitialized(_this), "getLozengeProps", function () {
|
|
103
91
|
return typeof _this.props.team.lozenge === 'string' ? {
|
|
104
92
|
text: _this.props.team.lozenge
|
|
105
93
|
} : _this.props.team.lozenge;
|
|
106
94
|
});
|
|
107
|
-
|
|
108
95
|
_defineProperty(_assertThisInitialized(_this), "renderCustomByLine", function () {
|
|
109
96
|
var _this$props$team4;
|
|
110
|
-
|
|
111
97
|
if (!((_this$props$team4 = _this.props.team) !== null && _this$props$team4 !== void 0 && _this$props$team4.byline)) {
|
|
112
98
|
return undefined;
|
|
113
99
|
}
|
|
114
|
-
|
|
115
100
|
return jsx("span", {
|
|
116
101
|
css: textWrapper(_this.props.isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text-subtlest, ".concat(N200, ")"))
|
|
117
102
|
}, _this.props.team.byline);
|
|
118
103
|
});
|
|
119
|
-
|
|
120
104
|
return _this;
|
|
121
105
|
}
|
|
122
|
-
|
|
123
106
|
_createClass(TeamOption, [{
|
|
124
107
|
key: "render",
|
|
125
108
|
value: function render() {
|
|
@@ -132,6 +115,5 @@ export var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
132
115
|
});
|
|
133
116
|
}
|
|
134
117
|
}]);
|
|
135
|
-
|
|
136
118
|
return TeamOption;
|
|
137
119
|
}(React.PureComponent);
|
|
@@ -5,11 +5,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
8
|
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); }; }
|
|
10
|
-
|
|
11
9
|
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; } }
|
|
12
|
-
|
|
13
10
|
/** @jsx jsx */
|
|
14
11
|
import { B400, N800, N200 } from '@atlaskit/theme/colors';
|
|
15
12
|
import { jsx } from '@emotion/react';
|
|
@@ -20,32 +17,25 @@ import { SizeableAvatar } from './SizeableAvatar';
|
|
|
20
17
|
import { hasValue } from './utils';
|
|
21
18
|
export var UserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
22
19
|
_inherits(UserOption, _React$PureComponent);
|
|
23
|
-
|
|
24
20
|
var _super = _createSuper(UserOption);
|
|
25
|
-
|
|
26
21
|
function UserOption() {
|
|
27
22
|
var _this;
|
|
28
|
-
|
|
29
23
|
_classCallCheck(this, UserOption);
|
|
30
|
-
|
|
31
24
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
32
25
|
args[_key] = arguments[_key];
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
36
|
-
|
|
37
28
|
_defineProperty(_assertThisInitialized(_this), "getPrimaryText", function () {
|
|
38
29
|
var _this$props$user = _this.props.user,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
name = _this$props$user.name,
|
|
31
|
+
publicName = _this$props$user.publicName,
|
|
32
|
+
highlight = _this$props$user.highlight;
|
|
42
33
|
var result = [jsx("span", {
|
|
43
34
|
key: "name",
|
|
44
35
|
css: textWrapper(_this.props.isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text, ".concat(N800, ")"))
|
|
45
36
|
}, jsx(HighlightText, {
|
|
46
37
|
highlights: highlight && highlight.name
|
|
47
38
|
}, name))];
|
|
48
|
-
|
|
49
39
|
if (hasValue(publicName) && name.trim() !== publicName.trim()) {
|
|
50
40
|
result.push(jsx(React.Fragment, {
|
|
51
41
|
key: "publicName"
|
|
@@ -55,22 +45,19 @@ export var UserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
55
45
|
highlights: highlight && highlight.publicName
|
|
56
46
|
}, publicName), ")")));
|
|
57
47
|
}
|
|
58
|
-
|
|
59
48
|
return result;
|
|
60
49
|
});
|
|
61
|
-
|
|
62
50
|
_defineProperty(_assertThisInitialized(_this), "renderSecondaryText", function () {
|
|
63
51
|
return _this.props.user.byline ? jsx("span", {
|
|
64
52
|
css: textWrapper(_this.props.isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text-subtlest, ".concat(N200, ")"))
|
|
65
53
|
}, _this.props.user.byline) : undefined;
|
|
66
54
|
});
|
|
67
|
-
|
|
68
55
|
_defineProperty(_assertThisInitialized(_this), "renderAvatar", function () {
|
|
69
56
|
var _this$props = _this.props,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
57
|
+
_this$props$user2 = _this$props.user,
|
|
58
|
+
avatarUrl = _this$props$user2.avatarUrl,
|
|
59
|
+
name = _this$props$user2.name,
|
|
60
|
+
status = _this$props.status;
|
|
74
61
|
return jsx(SizeableAvatar, {
|
|
75
62
|
appearance: "big",
|
|
76
63
|
src: avatarUrl,
|
|
@@ -78,16 +65,13 @@ export var UserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
78
65
|
name: name
|
|
79
66
|
});
|
|
80
67
|
});
|
|
81
|
-
|
|
82
68
|
_defineProperty(_assertThisInitialized(_this), "getLozengeProps", function () {
|
|
83
69
|
return typeof _this.props.user.lozenge === 'string' ? {
|
|
84
70
|
text: _this.props.user.lozenge
|
|
85
71
|
} : _this.props.user.lozenge;
|
|
86
72
|
});
|
|
87
|
-
|
|
88
73
|
return _this;
|
|
89
74
|
}
|
|
90
|
-
|
|
91
75
|
_createClass(UserOption, [{
|
|
92
76
|
key: "render",
|
|
93
77
|
value: function render() {
|
|
@@ -100,6 +84,5 @@ export var UserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
100
84
|
});
|
|
101
85
|
}
|
|
102
86
|
}]);
|
|
103
|
-
|
|
104
87
|
return UserOption;
|
|
105
88
|
}(React.PureComponent);
|
|
@@ -5,15 +5,10 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
8
|
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; }
|
|
10
|
-
|
|
11
9
|
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) { _defineProperty(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; }
|
|
12
|
-
|
|
13
10
|
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); }; }
|
|
14
|
-
|
|
15
11
|
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; } }
|
|
16
|
-
|
|
17
12
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
18
13
|
import Select, { CreatableSelect } from '@atlaskit/select';
|
|
19
14
|
import { UFOExperienceState } from '@atlaskit/ufo';
|
|
@@ -29,26 +24,22 @@ import { userPickerRenderedUfoExperience as experience, UfoErrorBoundary } from
|
|
|
29
24
|
import { v4 as uuidv4 } from 'uuid';
|
|
30
25
|
export var UserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
31
26
|
_inherits(UserPickerWithoutAnalytics, _React$Component);
|
|
32
|
-
|
|
33
27
|
var _super = _createSuper(UserPickerWithoutAnalytics);
|
|
34
|
-
|
|
35
28
|
function UserPickerWithoutAnalytics(props) {
|
|
36
29
|
var _this;
|
|
37
|
-
|
|
38
30
|
_classCallCheck(this, UserPickerWithoutAnalytics);
|
|
39
|
-
|
|
40
31
|
_this = _super.call(this, props);
|
|
41
32
|
_this.ufoId = uuidv4();
|
|
42
33
|
var experienceForId = experience.getInstance(_this.ufoId);
|
|
43
34
|
experienceForId.start();
|
|
44
35
|
return _this;
|
|
45
36
|
}
|
|
46
|
-
|
|
47
37
|
_createClass(UserPickerWithoutAnalytics, [{
|
|
48
38
|
key: "componentDidMount",
|
|
49
39
|
value: function componentDidMount() {
|
|
50
|
-
var experienceForId = experience.getInstance(this.ufoId);
|
|
40
|
+
var experienceForId = experience.getInstance(this.ufoId);
|
|
51
41
|
|
|
42
|
+
// Send UFO success if the experience is still in progress i.e. hasn't failed
|
|
52
43
|
if ([UFOExperienceState.IN_PROGRESS.id, UFOExperienceState.STARTED.id].includes(experienceForId.state.id)) {
|
|
53
44
|
experienceForId.success();
|
|
54
45
|
}
|
|
@@ -57,18 +48,18 @@ export var UserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component)
|
|
|
57
48
|
key: "render",
|
|
58
49
|
value: function render() {
|
|
59
50
|
var _this$props = this.props,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
51
|
+
emailLabel = _this$props.emailLabel,
|
|
52
|
+
allowEmail = _this$props.allowEmail,
|
|
53
|
+
suggestEmailsForDomain = _this$props.suggestEmailsForDomain,
|
|
54
|
+
isMulti = _this$props.isMulti,
|
|
55
|
+
isValidEmail = _this$props.isValidEmail,
|
|
56
|
+
anchor = _this$props.anchor,
|
|
57
|
+
menuPortalTarget = _this$props.menuPortalTarget,
|
|
58
|
+
menuPosition = _this$props.menuPosition,
|
|
59
|
+
menuShouldBlockScroll = _this$props.menuShouldBlockScroll,
|
|
60
|
+
captureMenuScroll = _this$props.captureMenuScroll,
|
|
61
|
+
closeMenuOnScroll = _this$props.closeMenuOnScroll,
|
|
62
|
+
loadUserSource = _this$props.loadUserSource;
|
|
72
63
|
var width = this.props.width;
|
|
73
64
|
var SelectComponent = allowEmail ? CreatableSelect : Select;
|
|
74
65
|
var creatableProps = suggestEmailsForDomain ? getCreatableSuggestedEmailProps(suggestEmailsForDomain, isValidEmail) : getCreatableProps(isValidEmail);
|
|
@@ -95,13 +86,10 @@ export var UserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component)
|
|
|
95
86
|
})))));
|
|
96
87
|
}
|
|
97
88
|
}]);
|
|
98
|
-
|
|
99
89
|
return UserPickerWithoutAnalytics;
|
|
100
90
|
}(React.Component);
|
|
101
|
-
|
|
102
91
|
_defineProperty(UserPickerWithoutAnalytics, "defaultProps", {
|
|
103
92
|
width: 350,
|
|
104
93
|
isMulti: false
|
|
105
94
|
});
|
|
106
|
-
|
|
107
95
|
export var UserPicker = withAnalyticsEvents()(UserPickerWithoutAnalytics);
|
|
@@ -8,11 +8,9 @@ export function batchByKey(callback) {
|
|
|
8
8
|
});
|
|
9
9
|
calls[key] = [];
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
13
12
|
args[_key - 1] = arguments[_key];
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
calls[key].push(args);
|
|
17
15
|
};
|
|
18
16
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
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; }
|
|
4
|
-
|
|
5
3
|
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) { _defineProperty(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; }
|
|
6
|
-
|
|
7
4
|
import memoizeOne from 'memoize-one';
|
|
8
5
|
import { ClearIndicator } from './ClearIndicator';
|
|
9
6
|
import { MultiValue } from './MultiValue';
|
|
@@ -14,10 +11,10 @@ import { Input } from './Input';
|
|
|
14
11
|
import { SingleValueContainer } from './SingleValueContainer';
|
|
15
12
|
import { PopupInput } from './PopupInput';
|
|
16
13
|
import { PopupControl } from './PopupControl';
|
|
14
|
+
|
|
17
15
|
/**
|
|
18
16
|
* Memoize getComponents to avoid rerenders.
|
|
19
17
|
*/
|
|
20
|
-
|
|
21
18
|
export var getComponents = memoizeOne(function (multi, anchor) {
|
|
22
19
|
if (anchor) {
|
|
23
20
|
return {
|
|
@@ -45,12 +42,10 @@ export var getPopupComponents = memoizeOne(function (hasPopupTitle) {
|
|
|
45
42
|
ValueContainer: SingleValueContainer,
|
|
46
43
|
Input: PopupInput
|
|
47
44
|
};
|
|
48
|
-
|
|
49
45
|
if (hasPopupTitle) {
|
|
50
46
|
return _objectSpread(_objectSpread({}, baseProps), {}, {
|
|
51
47
|
Control: PopupControl
|
|
52
48
|
});
|
|
53
49
|
}
|
|
54
|
-
|
|
55
50
|
return baseProps;
|
|
56
51
|
});
|
|
@@ -3,14 +3,12 @@ import { EmailType } from '../types';
|
|
|
3
3
|
import { isValidEmail as defaultIsValidEmail } from './emailValidation';
|
|
4
4
|
import { isEmail } from './utils';
|
|
5
5
|
var validOption = ['VALID', 'POTENTIAL'];
|
|
6
|
-
|
|
7
6
|
var isValidNewOption = function isValidNewOption() {
|
|
8
7
|
var isValidEmail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultIsValidEmail;
|
|
9
8
|
return function (inputValue) {
|
|
10
9
|
return inputValue && validOption.includes(isValidEmail(inputValue));
|
|
11
10
|
};
|
|
12
11
|
};
|
|
13
|
-
|
|
14
12
|
var getNewOptionData = function getNewOptionData(inputValue) {
|
|
15
13
|
return {
|
|
16
14
|
label: inputValue,
|
|
@@ -22,26 +20,21 @@ var getNewOptionData = function getNewOptionData(inputValue) {
|
|
|
22
20
|
}
|
|
23
21
|
};
|
|
24
22
|
};
|
|
25
|
-
|
|
26
23
|
var formatCreateLabel = function formatCreateLabel(inputText) {
|
|
27
24
|
if (inputText) {
|
|
28
25
|
return inputText.trim();
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
return '';
|
|
32
28
|
};
|
|
33
|
-
|
|
34
29
|
var isOptionDisabled = function isOptionDisabled() {
|
|
35
30
|
var isValidEmail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultIsValidEmail;
|
|
36
31
|
return function (option) {
|
|
37
32
|
if (isEmail(option.data)) {
|
|
38
33
|
return isValidEmail(option.data.id) !== 'VALID';
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
return !!option.isDisabled;
|
|
42
36
|
};
|
|
43
37
|
};
|
|
44
|
-
|
|
45
38
|
function creatableProps(isValidEmail) {
|
|
46
39
|
return {
|
|
47
40
|
allowCreateWhileLoading: true,
|
|
@@ -51,7 +44,7 @@ function creatableProps(isValidEmail) {
|
|
|
51
44
|
formatCreateLabel: formatCreateLabel,
|
|
52
45
|
isOptionDisabled: isOptionDisabled(isValidEmail)
|
|
53
46
|
};
|
|
54
|
-
}
|
|
55
|
-
|
|
47
|
+
}
|
|
56
48
|
|
|
49
|
+
// ignoring the 'clear' memoizeOne function object property
|
|
57
50
|
export var getCreatableProps = memoizeOne(creatableProps);
|
|
@@ -3,12 +3,11 @@ import { EmailType } from '../types';
|
|
|
3
3
|
import { isValidEmail as defaultIsValidEmail } from './emailValidation';
|
|
4
4
|
import { isEmail } from './utils';
|
|
5
5
|
var validOption = ['VALID', 'POTENTIAL'];
|
|
6
|
-
|
|
7
6
|
var isValidNewOption = function isValidNewOption(inputValue) {
|
|
8
7
|
return inputValue && inputValue.length > 0;
|
|
9
|
-
};
|
|
10
|
-
|
|
8
|
+
};
|
|
11
9
|
|
|
10
|
+
// Generates suggested option data based on user input and validity of the input (if it is an email or not);
|
|
12
11
|
var getNewOptionData = function getNewOptionData() {
|
|
13
12
|
var isValidEmail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultIsValidEmail;
|
|
14
13
|
var emailDomain = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -16,7 +15,6 @@ var getNewOptionData = function getNewOptionData() {
|
|
|
16
15
|
if (!inputValue) {
|
|
17
16
|
return null;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
var isEmail = inputValue && validOption.includes(isValidEmail(inputValue));
|
|
21
19
|
var value = isEmail ? inputValue : "".concat(inputValue.replace(/\s+/g, '.').toLocaleLowerCase(), "@").concat(emailDomain);
|
|
22
20
|
return {
|
|
@@ -31,29 +29,26 @@ var getNewOptionData = function getNewOptionData() {
|
|
|
31
29
|
};
|
|
32
30
|
};
|
|
33
31
|
};
|
|
34
|
-
|
|
35
32
|
var formatCreateLabel = function formatCreateLabel(inputText) {
|
|
36
33
|
if (inputText) {
|
|
37
34
|
return inputText.trim();
|
|
38
35
|
}
|
|
39
|
-
|
|
40
36
|
return '';
|
|
41
|
-
};
|
|
42
|
-
|
|
37
|
+
};
|
|
43
38
|
|
|
39
|
+
// Option will not be selectable until the email value is valid and can actually be invited
|
|
44
40
|
var isOptionDisabled = function isOptionDisabled() {
|
|
45
41
|
var isValidEmail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultIsValidEmail;
|
|
46
42
|
return function (option) {
|
|
47
43
|
if (isEmail(option.data)) {
|
|
48
44
|
return isValidEmail(option.data.id) !== 'VALID';
|
|
49
45
|
}
|
|
50
|
-
|
|
51
46
|
return !!option.isDisabled;
|
|
52
47
|
};
|
|
53
|
-
};
|
|
54
|
-
// to the user as a suggested option when they are typing in a value
|
|
55
|
-
|
|
48
|
+
};
|
|
56
49
|
|
|
50
|
+
// Generates user picker props to always create an email item visible
|
|
51
|
+
// to the user as a suggested option when they are typing in a value
|
|
57
52
|
export var getCreatableSuggestedEmailProps = memoizeOne(function (emailDomain, isValidEmail) {
|
|
58
53
|
return {
|
|
59
54
|
allowCreateWhileLoading: true,
|