@atlaskit/user-picker 9.5.0 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/analytics.js +8 -2
- package/dist/cjs/components/CustomOption/index.js +29 -0
- package/dist/cjs/components/CustomOption/main.js +115 -0
- package/dist/cjs/components/GroupOption/main.js +1 -1
- package/dist/cjs/components/MultiValue.js +2 -2
- package/dist/cjs/components/Option.js +9 -0
- package/dist/cjs/components/TeamOption/main.js +4 -4
- package/dist/cjs/components/UserPicker.js +1 -1
- package/dist/cjs/components/utils.js +8 -2
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/types.js +4 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics.js +9 -3
- package/dist/es2019/components/CustomOption/index.js +9 -0
- package/dist/es2019/components/CustomOption/main.js +73 -0
- package/dist/es2019/components/GroupOption/main.js +1 -1
- package/dist/es2019/components/MultiValue.js +2 -2
- package/dist/es2019/components/Option.js +9 -1
- package/dist/es2019/components/TeamOption/main.js +4 -4
- package/dist/es2019/components/UserPicker.js +1 -1
- package/dist/es2019/components/utils.js +3 -2
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/types.js +2 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics.js +9 -3
- package/dist/esm/components/CustomOption/index.js +11 -0
- package/dist/esm/components/CustomOption/main.js +99 -0
- package/dist/esm/components/GroupOption/main.js +1 -1
- package/dist/esm/components/MultiValue.js +2 -2
- package/dist/esm/components/Option.js +9 -1
- package/dist/esm/components/TeamOption/main.js +4 -4
- package/dist/esm/components/UserPicker.js +1 -1
- package/dist/esm/components/utils.js +5 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/types.js +2 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/components/BaseUserPicker.d.ts +1 -1
- package/dist/types/components/CustomOption/index.d.ts +3 -0
- package/dist/types/components/CustomOption/main.d.ts +14 -0
- package/dist/types/components/PopupUserPicker.d.ts +1 -1
- package/dist/types/components/UserPicker.d.ts +1 -1
- package/dist/types/components/utils.d.ts +2 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/types.d.ts +12 -1
- package/dist/types-ts4.0/components/BaseUserPicker.d.ts +1 -1
- package/dist/types-ts4.0/components/CustomOption/index.d.ts +3 -0
- package/dist/types-ts4.0/components/CustomOption/main.d.ts +14 -0
- package/dist/types-ts4.0/components/PopupUserPicker.d.ts +1 -1
- package/dist/types-ts4.0/components/UserPicker.d.ts +1 -1
- package/dist/types-ts4.0/components/utils.d.ts +2 -1
- package/dist/types-ts4.0/index.d.ts +2 -2
- package/dist/types-ts4.0/types.d.ts +12 -1
- package/package.json +9 -8
- package/report.api.md +25 -2
- package/tmp/api-report-tmp.d.ts +24 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/user-picker
|
|
2
2
|
|
|
3
|
+
## 9.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`faf391ab64a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/faf391ab64a) - Implementing new CustomOption which will allow for a custom avatar
|
|
8
|
+
|
|
9
|
+
## 9.5.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`c522aeea1da`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c522aeea1da) - bumped up @atlaskit/tokens version to ^0.10.19
|
|
14
|
+
|
|
3
15
|
## 9.5.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/cjs/analytics.js
CHANGED
|
@@ -74,9 +74,15 @@ var optionData2Analytics = function optionData2Analytics(option) {
|
|
|
74
74
|
sources: option.sources,
|
|
75
75
|
externalUserType: option.externalUserType
|
|
76
76
|
});
|
|
77
|
-
} else {
|
|
78
|
-
return validatedData;
|
|
79
77
|
}
|
|
78
|
+
|
|
79
|
+
if ((0, _utils.isCustom)(option) && option.analyticsType) {
|
|
80
|
+
return _objectSpread(_objectSpread({}, validatedData), {}, {
|
|
81
|
+
type: option.analyticsType
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return validatedData;
|
|
80
86
|
};
|
|
81
87
|
|
|
82
88
|
var buildValueForAnalytics = function buildValueForAnalytics(value) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
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); }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
var AsyncCustomOption = /*#__PURE__*/_react.default.lazy(function () {
|
|
19
|
+
return Promise.resolve().then(function () {
|
|
20
|
+
return _interopRequireWildcard(require('./main'));
|
|
21
|
+
}).then(function (module) {
|
|
22
|
+
return {
|
|
23
|
+
default: module.CustomOption
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
var _default = AsyncCustomOption;
|
|
29
|
+
exports.default = _default;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.CustomOption = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
+
|
|
24
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
25
|
+
|
|
26
|
+
var _tokens = require("@atlaskit/tokens");
|
|
27
|
+
|
|
28
|
+
var _core = require("@emotion/core");
|
|
29
|
+
|
|
30
|
+
var _react = _interopRequireDefault(require("react"));
|
|
31
|
+
|
|
32
|
+
var _AvatarItemOption = require("../AvatarItemOption");
|
|
33
|
+
|
|
34
|
+
var _HighlightText = require("../HighlightText");
|
|
35
|
+
|
|
36
|
+
var _SizeableAvatar = require("../SizeableAvatar");
|
|
37
|
+
|
|
38
|
+
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); }; }
|
|
39
|
+
|
|
40
|
+
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; } }
|
|
41
|
+
|
|
42
|
+
var CustomOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
43
|
+
(0, _inherits2.default)(CustomOption, _React$PureComponent);
|
|
44
|
+
|
|
45
|
+
var _super = _createSuper(CustomOption);
|
|
46
|
+
|
|
47
|
+
function CustomOption() {
|
|
48
|
+
var _this;
|
|
49
|
+
|
|
50
|
+
(0, _classCallCheck2.default)(this, CustomOption);
|
|
51
|
+
|
|
52
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
53
|
+
args[_key] = arguments[_key];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
57
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getPrimaryText", function () {
|
|
58
|
+
var _this$props$data = _this.props.data,
|
|
59
|
+
name = _this$props$data.name,
|
|
60
|
+
highlight = _this$props$data.highlight;
|
|
61
|
+
return [(0, _core.jsx)("span", {
|
|
62
|
+
key: "name",
|
|
63
|
+
css: (0, _AvatarItemOption.textWrapper)(_this.props.isSelected ? (0, _tokens.token)('color.text.selected', _colors.B400) : (0, _tokens.token)('color.text', _colors.N800))
|
|
64
|
+
}, (0, _core.jsx)(_HighlightText.HighlightText, {
|
|
65
|
+
highlights: highlight && highlight.name
|
|
66
|
+
}, name))];
|
|
67
|
+
});
|
|
68
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getBylineComponent", function (isSelected, message) {
|
|
69
|
+
return (0, _core.jsx)("span", {
|
|
70
|
+
css: (0, _AvatarItemOption.textWrapper)(isSelected ? (0, _tokens.token)('color.text.selected', _colors.B400) : (0, _tokens.token)('color.text.subtlest', _colors.N200))
|
|
71
|
+
}, message);
|
|
72
|
+
});
|
|
73
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderByline", function () {
|
|
74
|
+
var _this$props$data2;
|
|
75
|
+
|
|
76
|
+
if (!((_this$props$data2 = _this.props.data) !== null && _this$props$data2 !== void 0 && _this$props$data2.byline)) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return _this.getBylineComponent(_this.props.isSelected, _this.props.data.byline);
|
|
81
|
+
});
|
|
82
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderAvatar", function () {
|
|
83
|
+
var _this$props$data3 = _this.props.data,
|
|
84
|
+
avatarUrl = _this$props$data3.avatarUrl,
|
|
85
|
+
name = _this$props$data3.name;
|
|
86
|
+
return (0, _core.jsx)(_SizeableAvatar.SizeableAvatar, {
|
|
87
|
+
appearance: "big",
|
|
88
|
+
src: avatarUrl,
|
|
89
|
+
name: name
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getLozengeProps", function () {
|
|
93
|
+
return typeof _this.props.data.lozenge === 'string' ? {
|
|
94
|
+
text: _this.props.data.lozenge
|
|
95
|
+
} : _this.props.data.lozenge;
|
|
96
|
+
});
|
|
97
|
+
return _this;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
(0, _createClass2.default)(CustomOption, [{
|
|
101
|
+
key: "render",
|
|
102
|
+
value: function render() {
|
|
103
|
+
return (0, _core.jsx)(_AvatarItemOption.AvatarItemOption, {
|
|
104
|
+
avatar: this.renderAvatar(),
|
|
105
|
+
isDisabled: this.props.data.isDisabled,
|
|
106
|
+
lozenge: this.getLozengeProps(),
|
|
107
|
+
primaryText: this.getPrimaryText(),
|
|
108
|
+
secondaryText: this.renderByline()
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}]);
|
|
112
|
+
return CustomOption;
|
|
113
|
+
}(_react.default.PureComponent);
|
|
114
|
+
|
|
115
|
+
exports.CustomOption = CustomOption;
|
|
@@ -35,7 +35,7 @@ var _people = _interopRequireDefault(require("@atlaskit/icon/glyph/people"));
|
|
|
35
35
|
|
|
36
36
|
var _AvatarItemOption = require("../AvatarItemOption");
|
|
37
37
|
|
|
38
|
-
var _i18n = require("
|
|
38
|
+
var _i18n = require("../i18n");
|
|
39
39
|
|
|
40
40
|
var _HighlightText = require("../HighlightText");
|
|
41
41
|
|
|
@@ -144,8 +144,8 @@ var MultiValue = /*#__PURE__*/function (_React$Component) {
|
|
|
144
144
|
nextLabel = _nextProps$data.label,
|
|
145
145
|
nextData = _nextProps$data.data,
|
|
146
146
|
nextInnerProps = nextProps.innerProps,
|
|
147
|
-
nextIsFocused = nextProps.isFocused; // We can ignore onRemove here because it is
|
|
148
|
-
// that will recreated every time but with the same implementation.
|
|
147
|
+
nextIsFocused = nextProps.isFocused; // We can ignore onRemove here because it is an anonymous function
|
|
148
|
+
// that will be recreated every time but with the same implementation.
|
|
149
149
|
|
|
150
150
|
return data !== nextData || label !== nextLabel || innerProps !== nextInnerProps || isFocused !== nextIsFocused;
|
|
151
151
|
}
|
|
@@ -21,6 +21,8 @@ var _GroupOption = _interopRequireDefault(require("./GroupOption"));
|
|
|
21
21
|
|
|
22
22
|
var _EmailOption = _interopRequireDefault(require("./EmailOption"));
|
|
23
23
|
|
|
24
|
+
var _CustomOption = _interopRequireDefault(require("./CustomOption"));
|
|
25
|
+
|
|
24
26
|
var _utils = require("./utils");
|
|
25
27
|
|
|
26
28
|
var _emailValidation = require("./emailValidation");
|
|
@@ -81,6 +83,13 @@ var dataOption = function dataOption(_ref2) {
|
|
|
81
83
|
});
|
|
82
84
|
}
|
|
83
85
|
|
|
86
|
+
if ((0, _utils.isCustom)(data)) {
|
|
87
|
+
return /*#__PURE__*/_react.default.createElement(_CustomOption.default, {
|
|
88
|
+
data: data,
|
|
89
|
+
isSelected: isSelected
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
84
93
|
return null;
|
|
85
94
|
};
|
|
86
95
|
|
|
@@ -33,13 +33,13 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
33
33
|
|
|
34
34
|
var _reactIntlNext = require("react-intl-next");
|
|
35
35
|
|
|
36
|
-
var _AvatarItemOption = require("
|
|
36
|
+
var _AvatarItemOption = require("../AvatarItemOption");
|
|
37
37
|
|
|
38
|
-
var _HighlightText = require("
|
|
38
|
+
var _HighlightText = require("../HighlightText");
|
|
39
39
|
|
|
40
|
-
var _i18n = require("
|
|
40
|
+
var _i18n = require("../i18n");
|
|
41
41
|
|
|
42
|
-
var _SizeableAvatar = require("
|
|
42
|
+
var _SizeableAvatar = require("../SizeableAvatar");
|
|
43
43
|
|
|
44
44
|
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); }; }
|
|
45
45
|
|
|
@@ -43,7 +43,7 @@ var _creatableEmailSuggestion = require("./creatableEmailSuggestion");
|
|
|
43
43
|
|
|
44
44
|
var _MessagesIntlProvider = _interopRequireDefault(require("./MessagesIntlProvider"));
|
|
45
45
|
|
|
46
|
-
var _UserSourceProvider = require("
|
|
46
|
+
var _UserSourceProvider = require("../clients/UserSourceProvider");
|
|
47
47
|
|
|
48
48
|
var _ufoExperiences = require("../util/ufoExperiences");
|
|
49
49
|
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.optionToSelectableOptions = exports.optionToSelectableOption = exports.isUser = exports.isTeam = exports.isSingleValue = exports.isPopupUserPickerByProps = exports.isPopupUserPickerByComponent = exports.isLozengeText = exports.isIterable = exports.isGroup = exports.isExternalUser = exports.isEmail = exports.isDefaultValuePopulated = exports.isChildInput = exports.hasValue = exports.getOptions = exports.getAvatarUrl = exports.getAvatarSize = exports.extractOptionValue = exports.callCallback = void 0;
|
|
8
|
+
exports.optionToSelectableOptions = exports.optionToSelectableOption = exports.isUser = exports.isTeam = exports.isSingleValue = exports.isPopupUserPickerByProps = exports.isPopupUserPickerByComponent = exports.isLozengeText = exports.isIterable = exports.isGroup = exports.isExternalUser = exports.isEmail = exports.isDefaultValuePopulated = exports.isCustom = exports.isChildInput = exports.hasValue = exports.getOptions = exports.getAvatarUrl = exports.getAvatarSize = exports.extractOptionValue = exports.callCallback = void 0;
|
|
9
9
|
|
|
10
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
11
|
|
|
@@ -51,6 +51,12 @@ var isEmail = function isEmail(option) {
|
|
|
51
51
|
|
|
52
52
|
exports.isEmail = isEmail;
|
|
53
53
|
|
|
54
|
+
var isCustom = function isCustom(option) {
|
|
55
|
+
return option.type === _types.CustomType;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
exports.isCustom = isCustom;
|
|
59
|
+
|
|
54
60
|
var isDefaultValuePopulated = function isDefaultValuePopulated(value) {
|
|
55
61
|
return value && !Array.isArray(value) || Array.isArray(value) && value.length > 0;
|
|
56
62
|
};
|
|
@@ -165,7 +171,7 @@ var callCallback = function callCallback(callback) {
|
|
|
165
171
|
exports.callCallback = callCallback;
|
|
166
172
|
|
|
167
173
|
var getAvatarUrl = function getAvatarUrl(optionData) {
|
|
168
|
-
if (isUser(optionData) || isTeam(optionData)) {
|
|
174
|
+
if (isUser(optionData) || isTeam(optionData) || isCustom(optionData)) {
|
|
169
175
|
return optionData.avatarUrl;
|
|
170
176
|
}
|
|
171
177
|
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "CustomType", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _types.CustomType;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "EmailType", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function get() {
|
package/dist/cjs/types.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.UserType = exports.TeamType = exports.GroupType = exports.EmailType = void 0;
|
|
6
|
+
exports.UserType = exports.TeamType = exports.GroupType = exports.EmailType = exports.CustomType = void 0;
|
|
7
7
|
var UserType = 'user';
|
|
8
8
|
exports.UserType = UserType;
|
|
9
9
|
var TeamType = 'team';
|
|
@@ -11,4 +11,6 @@ exports.TeamType = TeamType;
|
|
|
11
11
|
var GroupType = 'group';
|
|
12
12
|
exports.GroupType = GroupType;
|
|
13
13
|
var EmailType = 'email';
|
|
14
|
-
exports.EmailType = EmailType;
|
|
14
|
+
exports.EmailType = EmailType;
|
|
15
|
+
var CustomType = 'custom';
|
|
16
|
+
exports.CustomType = CustomType;
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/analytics.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
2
2
|
import { v4 as uuidv4 } from 'uuid';
|
|
3
3
|
import versionJson from './version.json';
|
|
4
|
-
import { isExternalUser } from './components/utils';
|
|
4
|
+
import { isCustom, isExternalUser } from './components/utils';
|
|
5
5
|
const packageName = versionJson.name;
|
|
6
6
|
const packageVersion = versionJson.version;
|
|
7
7
|
const UUID_REGEXP_TEAMS_GROUPS = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
|
|
@@ -49,9 +49,15 @@ const optionData2Analytics = option => {
|
|
|
49
49
|
sources: option.sources,
|
|
50
50
|
externalUserType: option.externalUserType
|
|
51
51
|
};
|
|
52
|
-
} else {
|
|
53
|
-
return validatedData;
|
|
54
52
|
}
|
|
53
|
+
|
|
54
|
+
if (isCustom(option) && option.analyticsType) {
|
|
55
|
+
return { ...validatedData,
|
|
56
|
+
type: option.analyticsType
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return validatedData;
|
|
55
61
|
};
|
|
56
62
|
|
|
57
63
|
const buildValueForAnalytics = value => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
const AsyncCustomOption = /*#__PURE__*/React.lazy(() => import(
|
|
3
|
+
/* webpackChunkName: "@atlaskit-internal_@atlassian/user-picker/custom-option" */
|
|
4
|
+
'./main').then(module => {
|
|
5
|
+
return {
|
|
6
|
+
default: module.CustomOption
|
|
7
|
+
};
|
|
8
|
+
}));
|
|
9
|
+
export default AsyncCustomOption;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { B400, N800, N200 } from '@atlaskit/theme/colors';
|
|
5
|
+
import { token } from '@atlaskit/tokens';
|
|
6
|
+
import { jsx } from '@emotion/core';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { AvatarItemOption, textWrapper } from '../AvatarItemOption';
|
|
9
|
+
import { HighlightText } from '../HighlightText';
|
|
10
|
+
import { SizeableAvatar } from '../SizeableAvatar';
|
|
11
|
+
export class CustomOption extends React.PureComponent {
|
|
12
|
+
constructor(...args) {
|
|
13
|
+
super(...args);
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "getPrimaryText", () => {
|
|
16
|
+
const {
|
|
17
|
+
data: {
|
|
18
|
+
name,
|
|
19
|
+
highlight
|
|
20
|
+
}
|
|
21
|
+
} = this.props;
|
|
22
|
+
return [jsx("span", {
|
|
23
|
+
key: "name",
|
|
24
|
+
css: textWrapper(this.props.isSelected ? token('color.text.selected', B400) : token('color.text', N800))
|
|
25
|
+
}, jsx(HighlightText, {
|
|
26
|
+
highlights: highlight && highlight.name
|
|
27
|
+
}, name))];
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
_defineProperty(this, "getBylineComponent", (isSelected, message) => jsx("span", {
|
|
31
|
+
css: textWrapper(isSelected ? token('color.text.selected', B400) : token('color.text.subtlest', N200))
|
|
32
|
+
}, message));
|
|
33
|
+
|
|
34
|
+
_defineProperty(this, "renderByline", () => {
|
|
35
|
+
var _this$props$data;
|
|
36
|
+
|
|
37
|
+
if (!((_this$props$data = this.props.data) !== null && _this$props$data !== void 0 && _this$props$data.byline)) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return this.getBylineComponent(this.props.isSelected, this.props.data.byline);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
_defineProperty(this, "renderAvatar", () => {
|
|
45
|
+
const {
|
|
46
|
+
data: {
|
|
47
|
+
avatarUrl,
|
|
48
|
+
name
|
|
49
|
+
}
|
|
50
|
+
} = this.props;
|
|
51
|
+
return jsx(SizeableAvatar, {
|
|
52
|
+
appearance: "big",
|
|
53
|
+
src: avatarUrl,
|
|
54
|
+
name: name
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
_defineProperty(this, "getLozengeProps", () => typeof this.props.data.lozenge === 'string' ? {
|
|
59
|
+
text: this.props.data.lozenge
|
|
60
|
+
} : this.props.data.lozenge);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
render() {
|
|
64
|
+
return jsx(AvatarItemOption, {
|
|
65
|
+
avatar: this.renderAvatar(),
|
|
66
|
+
isDisabled: this.props.data.isDisabled,
|
|
67
|
+
lozenge: this.getLozengeProps(),
|
|
68
|
+
primaryText: this.getPrimaryText(),
|
|
69
|
+
secondaryText: this.renderByline()
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
}
|
|
@@ -8,7 +8,7 @@ import { N20, B400, N800, N200 } from '@atlaskit/theme/colors';
|
|
|
8
8
|
import { token } from '@atlaskit/tokens';
|
|
9
9
|
import PeopleIcon from '@atlaskit/icon/glyph/people';
|
|
10
10
|
import { AvatarItemOption, textWrapper } from '../AvatarItemOption';
|
|
11
|
-
import { messages } from '
|
|
11
|
+
import { messages } from '../i18n';
|
|
12
12
|
import { HighlightText } from '../HighlightText';
|
|
13
13
|
export const groupOptionIconWrapper = css({
|
|
14
14
|
padding: '2px',
|
|
@@ -102,8 +102,8 @@ export class MultiValue extends React.Component {
|
|
|
102
102
|
},
|
|
103
103
|
innerProps: nextInnerProps,
|
|
104
104
|
isFocused: nextIsFocused
|
|
105
|
-
} = nextProps; // We can ignore onRemove here because it is
|
|
106
|
-
// that will recreated every time but with the same implementation.
|
|
105
|
+
} = nextProps; // We can ignore onRemove here because it is an anonymous function
|
|
106
|
+
// that will be recreated every time but with the same implementation.
|
|
107
107
|
|
|
108
108
|
return data !== nextData || label !== nextLabel || innerProps !== nextInnerProps || isFocused !== nextIsFocused;
|
|
109
109
|
}
|
|
@@ -5,7 +5,8 @@ import AsyncExternalOption from './ExternalUserOption';
|
|
|
5
5
|
import AsyncTeamOption from './TeamOption';
|
|
6
6
|
import AsyncGroupOption from './GroupOption';
|
|
7
7
|
import AsyncEmailOption from './EmailOption';
|
|
8
|
-
import
|
|
8
|
+
import AsyncCustomOption from './CustomOption';
|
|
9
|
+
import { isCustom, isEmail, isTeam, isUser, isGroup, isExternalUser } from './utils';
|
|
9
10
|
import { isValidEmail } from './emailValidation';
|
|
10
11
|
|
|
11
12
|
const defaultOption = ({
|
|
@@ -67,6 +68,13 @@ const dataOption = ({
|
|
|
67
68
|
});
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
if (isCustom(data)) {
|
|
72
|
+
return /*#__PURE__*/React.createElement(AsyncCustomOption, {
|
|
73
|
+
data: data,
|
|
74
|
+
isSelected: isSelected
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
70
78
|
return null;
|
|
71
79
|
};
|
|
72
80
|
|
|
@@ -7,10 +7,10 @@ import { token } from '@atlaskit/tokens';
|
|
|
7
7
|
import { jsx } from '@emotion/core';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import { FormattedMessage } from 'react-intl-next';
|
|
10
|
-
import { AvatarItemOption, textWrapper } from '
|
|
11
|
-
import { HighlightText } from '
|
|
12
|
-
import { messages } from '
|
|
13
|
-
import { SizeableAvatar } from '
|
|
10
|
+
import { AvatarItemOption, textWrapper } from '../AvatarItemOption';
|
|
11
|
+
import { HighlightText } from '../HighlightText';
|
|
12
|
+
import { messages } from '../i18n';
|
|
13
|
+
import { SizeableAvatar } from '../SizeableAvatar';
|
|
14
14
|
export class TeamOption extends React.PureComponent {
|
|
15
15
|
constructor(...args) {
|
|
16
16
|
super(...args);
|
|
@@ -10,7 +10,7 @@ import { getComponents } from './components';
|
|
|
10
10
|
import { getCreatableProps } from './creatable';
|
|
11
11
|
import { getCreatableSuggestedEmailProps } from './creatableEmailSuggestion';
|
|
12
12
|
import MessagesIntlProvider from './MessagesIntlProvider';
|
|
13
|
-
import { ExusUserSourceProvider } from '
|
|
13
|
+
import { ExusUserSourceProvider } from '../clients/UserSourceProvider';
|
|
14
14
|
import { userPickerRenderedUfoExperience as experience, UfoErrorBoundary } from '../util/ufoExperiences';
|
|
15
15
|
import { v4 as uuidv4 } from 'uuid';
|
|
16
16
|
export class UserPickerWithoutAnalytics extends React.Component {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
|
2
|
-
import { EmailType, TeamType, GroupType, UserType } from '../types';
|
|
2
|
+
import { CustomType, EmailType, TeamType, GroupType, UserType } from '../types';
|
|
3
3
|
import { PopupSelect } from '@atlaskit/select';
|
|
4
4
|
export const isExternalUser = option => isUser(option) && Boolean(option.isExternal);
|
|
5
5
|
export const isUser = option => option.type === undefined || option.type === UserType;
|
|
6
6
|
export const isTeam = option => option.type === TeamType;
|
|
7
7
|
export const isGroup = option => option.type === GroupType;
|
|
8
8
|
export const isEmail = option => option.type === EmailType;
|
|
9
|
+
export const isCustom = option => option.type === CustomType;
|
|
9
10
|
export const isDefaultValuePopulated = value => value && !Array.isArray(value) || Array.isArray(value) && value.length > 0;
|
|
10
11
|
|
|
11
12
|
const isOptionData = option => option.name !== undefined;
|
|
@@ -71,7 +72,7 @@ export const callCallback = (callback, ...args) => {
|
|
|
71
72
|
}
|
|
72
73
|
};
|
|
73
74
|
export const getAvatarUrl = optionData => {
|
|
74
|
-
if (isUser(optionData) || isTeam(optionData)) {
|
|
75
|
+
if (isUser(optionData) || isTeam(optionData) || isCustom(optionData)) {
|
|
75
76
|
return optionData.avatarUrl;
|
|
76
77
|
}
|
|
77
78
|
|
package/dist/es2019/index.js
CHANGED
|
@@ -3,4 +3,4 @@ export { UserPicker as default } from './components/UserPicker';
|
|
|
3
3
|
export { PopupUserPicker } from './components/PopupUserPicker';
|
|
4
4
|
export { isEmail, isExternalUser, isTeam, isUser } from './components/utils';
|
|
5
5
|
export { // Constants
|
|
6
|
-
EmailType, GroupType, TeamType, UserType } from './types';
|
|
6
|
+
CustomType, EmailType, GroupType, TeamType, UserType } from './types';
|
package/dist/es2019/types.js
CHANGED
package/dist/es2019/version.json
CHANGED
package/dist/esm/analytics.js
CHANGED
|
@@ -7,7 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
7
7
|
import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
8
8
|
import { v4 as uuidv4 } from 'uuid';
|
|
9
9
|
import versionJson from './version.json';
|
|
10
|
-
import { isExternalUser } from './components/utils';
|
|
10
|
+
import { isCustom, isExternalUser } from './components/utils';
|
|
11
11
|
var packageName = versionJson.name;
|
|
12
12
|
var packageVersion = versionJson.version;
|
|
13
13
|
var UUID_REGEXP_TEAMS_GROUPS = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
|
|
@@ -57,9 +57,15 @@ var optionData2Analytics = function optionData2Analytics(option) {
|
|
|
57
57
|
sources: option.sources,
|
|
58
58
|
externalUserType: option.externalUserType
|
|
59
59
|
});
|
|
60
|
-
} else {
|
|
61
|
-
return validatedData;
|
|
62
60
|
}
|
|
61
|
+
|
|
62
|
+
if (isCustom(option) && option.analyticsType) {
|
|
63
|
+
return _objectSpread(_objectSpread({}, validatedData), {}, {
|
|
64
|
+
type: option.analyticsType
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return validatedData;
|
|
63
69
|
};
|
|
64
70
|
|
|
65
71
|
var buildValueForAnalytics = function buildValueForAnalytics(value) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var AsyncCustomOption = /*#__PURE__*/React.lazy(function () {
|
|
3
|
+
return import(
|
|
4
|
+
/* webpackChunkName: "@atlaskit-internal_@atlassian/user-picker/custom-option" */
|
|
5
|
+
'./main').then(function (module) {
|
|
6
|
+
return {
|
|
7
|
+
default: module.CustomOption
|
|
8
|
+
};
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
export default AsyncCustomOption;
|