@atlaskit/user-picker 11.24.0 → 11.25.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 +14 -0
- package/dist/cjs/analytics.js +3 -2
- package/dist/cjs/components/AvatarItemOption.js +31 -2
- package/dist/cjs/components/AvatarOrIcon.js +1 -1
- package/dist/cjs/components/BaseUserPicker.js +69 -39
- package/dist/cjs/components/CustomOption/main.js +1 -1
- package/dist/cjs/components/EmailOption/main.js +1 -1
- package/dist/cjs/components/ExternalUserOption/ExternalAvatarItemOption.js +1 -1
- package/dist/cjs/components/ExternalUserOption/InfoIcon.js +1 -1
- package/dist/cjs/components/GroupOption/main.js +1 -1
- package/dist/cjs/components/MultiValue.js +48 -44
- package/dist/cjs/components/SingleValue.compiled.css +2 -0
- package/dist/cjs/components/SingleValue.js +12 -2
- package/dist/cjs/components/i18n.js +5 -0
- package/dist/cjs/components/utils.js +1 -1
- package/dist/cjs/util/group-options-by-type/index.js +7 -3
- package/dist/es2019/analytics.js +2 -1
- package/dist/es2019/components/AvatarItemOption.js +31 -2
- package/dist/es2019/components/AvatarOrIcon.js +1 -1
- package/dist/es2019/components/BaseUserPicker.js +30 -1
- package/dist/es2019/components/CustomOption/main.js +1 -1
- package/dist/es2019/components/EmailOption/main.js +1 -1
- package/dist/es2019/components/ExternalUserOption/ExternalAvatarItemOption.js +1 -1
- package/dist/es2019/components/ExternalUserOption/InfoIcon.js +1 -1
- package/dist/es2019/components/GroupOption/main.js +1 -1
- package/dist/es2019/components/MultiValue.js +43 -35
- package/dist/es2019/components/SingleValue.compiled.css +2 -0
- package/dist/es2019/components/SingleValue.js +11 -2
- package/dist/es2019/components/i18n.js +5 -0
- package/dist/es2019/components/utils.js +1 -1
- package/dist/es2019/util/group-options-by-type/index.js +7 -3
- package/dist/esm/analytics.js +2 -1
- package/dist/esm/components/AvatarItemOption.js +31 -2
- package/dist/esm/components/AvatarOrIcon.js +1 -1
- package/dist/esm/components/BaseUserPicker.js +69 -39
- package/dist/esm/components/CustomOption/main.js +1 -1
- package/dist/esm/components/EmailOption/main.js +1 -1
- package/dist/esm/components/ExternalUserOption/ExternalAvatarItemOption.js +1 -1
- package/dist/esm/components/ExternalUserOption/InfoIcon.js +1 -1
- package/dist/esm/components/GroupOption/main.js +1 -1
- package/dist/esm/components/MultiValue.js +46 -44
- package/dist/esm/components/SingleValue.compiled.css +2 -0
- package/dist/esm/components/SingleValue.js +11 -2
- package/dist/esm/components/i18n.js +5 -0
- package/dist/esm/components/utils.js +1 -1
- package/dist/esm/util/group-options-by-type/index.js +7 -3
- package/dist/types/analytics.d.ts +2 -2
- package/dist/types/components/AvatarItemOption.d.ts +2 -2
- package/dist/types/components/BaseUserPicker.d.ts +4 -1
- package/dist/types/components/ExternalUserOption/index.d.ts +4 -2
- package/dist/types/components/ExternalUserOption/main.d.ts +3 -2
- package/dist/types/components/GroupOption/main.d.ts +2 -2
- package/dist/types/components/PopupUserPicker.d.ts +90 -86
- package/dist/types/components/UserPicker.d.ts +2 -1
- package/dist/types/components/i18n.d.ts +5 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types.d.ts +4 -0
- package/dist/types/util/group-options-by-type/index.d.ts +2 -1
- package/dist/types-ts4.5/analytics.d.ts +2 -2
- package/dist/types-ts4.5/components/AvatarItemOption.d.ts +2 -2
- package/dist/types-ts4.5/components/BaseUserPicker.d.ts +4 -1
- package/dist/types-ts4.5/components/ExternalUserOption/index.d.ts +4 -2
- package/dist/types-ts4.5/components/ExternalUserOption/main.d.ts +3 -2
- package/dist/types-ts4.5/components/GroupOption/main.d.ts +2 -2
- package/dist/types-ts4.5/components/PopupUserPicker.d.ts +90 -86
- package/dist/types-ts4.5/components/UserPicker.d.ts +2 -1
- package/dist/types-ts4.5/components/i18n.d.ts +5 -0
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +4 -0
- package/dist/types-ts4.5/util/group-options-by-type/index.d.ts +2 -1
- package/package.json +13 -7
|
@@ -14,6 +14,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
14
14
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
15
15
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
16
16
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
17
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
18
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
18
19
|
import { UFOExperienceState } from '@atlaskit/ufo';
|
|
19
20
|
import debounce from 'lodash/debounce';
|
|
@@ -345,7 +346,7 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
345
346
|
hoveringClearIndicator: hoveringClearIndicator
|
|
346
347
|
});
|
|
347
348
|
});
|
|
348
|
-
_defineProperty(_this, "
|
|
349
|
+
_defineProperty(_this, "getOptionsOld", function () {
|
|
349
350
|
var options = getOptions(_this.state.options) || [];
|
|
350
351
|
var _this$props2 = _this.props,
|
|
351
352
|
maxOptions = _this$props2.maxOptions,
|
|
@@ -370,6 +371,35 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
370
371
|
}
|
|
371
372
|
return groupByTypeOrder ? groupOptionsByType(options, groupByTypeOrder) : options;
|
|
372
373
|
});
|
|
374
|
+
_defineProperty(_this, "getOptionsNew", function () {
|
|
375
|
+
var options = getOptions(_this.state.options) || [];
|
|
376
|
+
var _this$props3 = _this.props,
|
|
377
|
+
maxOptions = _this$props3.maxOptions,
|
|
378
|
+
isMulti = _this$props3.isMulti,
|
|
379
|
+
groupByTypeOrder = _this$props3.groupByTypeOrder,
|
|
380
|
+
customGroupLabels = _this$props3.customGroupLabels;
|
|
381
|
+
if (maxOptions === 0) {
|
|
382
|
+
return [];
|
|
383
|
+
}
|
|
384
|
+
if (maxOptions && maxOptions > 0 && maxOptions < options.length) {
|
|
385
|
+
var _value3 = _this.state.value;
|
|
386
|
+
var filteredOptions = options;
|
|
387
|
+
// Filter out previously selected options
|
|
388
|
+
if (isMulti && Array.isArray(_value3)) {
|
|
389
|
+
var valueIds = _value3.map(function (item) {
|
|
390
|
+
return item.data.id;
|
|
391
|
+
});
|
|
392
|
+
filteredOptions = options.filter(function (option) {
|
|
393
|
+
return valueIds.indexOf(option.data.id) === -1;
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
return groupByTypeOrder ? groupOptionsByType(filteredOptions.slice(0, maxOptions), groupByTypeOrder, customGroupLabels) : filteredOptions.slice(0, maxOptions);
|
|
397
|
+
}
|
|
398
|
+
return groupByTypeOrder ? groupOptionsByType(options, groupByTypeOrder, customGroupLabels) : options;
|
|
399
|
+
});
|
|
400
|
+
_defineProperty(_this, "getOptions", function () {
|
|
401
|
+
return fg('jsm-wfo-assignee-recommendation-on-queues') ? _this.getOptionsNew() : _this.getOptionsOld();
|
|
402
|
+
});
|
|
373
403
|
_defineProperty(_this, "getAppearance", function () {
|
|
374
404
|
return _this.props.appearance ? _this.props.appearance : 'normal';
|
|
375
405
|
});
|
|
@@ -435,9 +465,9 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
435
465
|
}, {
|
|
436
466
|
key: "componentDidMount",
|
|
437
467
|
value: function componentDidMount() {
|
|
438
|
-
var _this$
|
|
439
|
-
open = _this$
|
|
440
|
-
search = _this$
|
|
468
|
+
var _this$props4 = this.props,
|
|
469
|
+
open = _this$props4.open,
|
|
470
|
+
search = _this$props4.search;
|
|
441
471
|
// load options when the picker open
|
|
442
472
|
if (open) {
|
|
443
473
|
if (!this.session) {
|
|
@@ -505,41 +535,41 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
505
535
|
}, {
|
|
506
536
|
key: "render",
|
|
507
537
|
value: function render() {
|
|
508
|
-
var _this$
|
|
509
|
-
isMulti = _this$
|
|
510
|
-
isLoading = _this$
|
|
511
|
-
subtle = _this$
|
|
512
|
-
noBorder = _this$
|
|
513
|
-
placeholder = _this$
|
|
514
|
-
isClearable = _this$
|
|
515
|
-
isDisabled = _this$
|
|
516
|
-
isInvalid = _this$
|
|
517
|
-
clearValueLabel = _this$
|
|
518
|
-
menuMinWidth = _this$
|
|
519
|
-
menuPortalTarget = _this$
|
|
520
|
-
loadOptionsErrorMessage = _this$
|
|
521
|
-
addMoreMessage = _this$
|
|
522
|
-
noOptionsMessage = _this$
|
|
523
|
-
footer = _this$
|
|
524
|
-
disableInput = _this$
|
|
525
|
-
components = _this$
|
|
526
|
-
pickerProps = _this$
|
|
527
|
-
SelectComponent = _this$
|
|
528
|
-
styles = _this$
|
|
529
|
-
autoFocus = _this$
|
|
530
|
-
fieldId = _this$
|
|
531
|
-
inputId = _this$
|
|
532
|
-
maxPickerHeight = _this$
|
|
533
|
-
textFieldBackgroundColor = _this$
|
|
534
|
-
ariaLabelledBy = _this$
|
|
535
|
-
ariaDescribedBy = _this$
|
|
536
|
-
ariaLive = _this$
|
|
537
|
-
ariaLabel = _this$
|
|
538
|
-
name = _this$
|
|
539
|
-
header = _this$
|
|
540
|
-
required = _this$
|
|
541
|
-
UNSAFE_hasDraggableParentComponent = _this$
|
|
542
|
-
placeholderAvatar = _this$
|
|
538
|
+
var _this$props5 = this.props,
|
|
539
|
+
isMulti = _this$props5.isMulti,
|
|
540
|
+
isLoading = _this$props5.isLoading,
|
|
541
|
+
subtle = _this$props5.subtle,
|
|
542
|
+
noBorder = _this$props5.noBorder,
|
|
543
|
+
placeholder = _this$props5.placeholder,
|
|
544
|
+
isClearable = _this$props5.isClearable,
|
|
545
|
+
isDisabled = _this$props5.isDisabled,
|
|
546
|
+
isInvalid = _this$props5.isInvalid,
|
|
547
|
+
clearValueLabel = _this$props5.clearValueLabel,
|
|
548
|
+
menuMinWidth = _this$props5.menuMinWidth,
|
|
549
|
+
menuPortalTarget = _this$props5.menuPortalTarget,
|
|
550
|
+
loadOptionsErrorMessage = _this$props5.loadOptionsErrorMessage,
|
|
551
|
+
addMoreMessage = _this$props5.addMoreMessage,
|
|
552
|
+
noOptionsMessage = _this$props5.noOptionsMessage,
|
|
553
|
+
footer = _this$props5.footer,
|
|
554
|
+
disableInput = _this$props5.disableInput,
|
|
555
|
+
components = _this$props5.components,
|
|
556
|
+
pickerProps = _this$props5.pickerProps,
|
|
557
|
+
SelectComponent = _this$props5.SelectComponent,
|
|
558
|
+
styles = _this$props5.styles,
|
|
559
|
+
autoFocus = _this$props5.autoFocus,
|
|
560
|
+
fieldId = _this$props5.fieldId,
|
|
561
|
+
inputId = _this$props5.inputId,
|
|
562
|
+
maxPickerHeight = _this$props5.maxPickerHeight,
|
|
563
|
+
textFieldBackgroundColor = _this$props5.textFieldBackgroundColor,
|
|
564
|
+
ariaLabelledBy = _this$props5.ariaLabelledBy,
|
|
565
|
+
ariaDescribedBy = _this$props5.ariaDescribedBy,
|
|
566
|
+
ariaLive = _this$props5.ariaLive,
|
|
567
|
+
ariaLabel = _this$props5.ariaLabel,
|
|
568
|
+
name = _this$props5.name,
|
|
569
|
+
header = _this$props5.header,
|
|
570
|
+
required = _this$props5.required,
|
|
571
|
+
UNSAFE_hasDraggableParentComponent = _this$props5.UNSAFE_hasDraggableParentComponent,
|
|
572
|
+
placeholderAvatar = _this$props5.placeholderAvatar;
|
|
543
573
|
var _this$state3 = this.state,
|
|
544
574
|
count = _this$state3.count,
|
|
545
575
|
hoveringClearIndicator = _this$state3.hoveringClearIndicator,
|
|
@@ -11,7 +11,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
11
11
|
* @jsx jsx
|
|
12
12
|
*/
|
|
13
13
|
import { B400, N800, N200 } from '@atlaskit/theme/colors';
|
|
14
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
14
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
15
15
|
import { jsx } from '@emotion/react';
|
|
16
16
|
import React from 'react';
|
|
17
17
|
import { AvatarItemOption, textWrapper } from '../AvatarItemOption';
|
|
@@ -13,7 +13,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { FormattedMessage } from 'react-intl-next';
|
|
15
15
|
import { B400, N200, N800 } from '@atlaskit/theme/colors';
|
|
16
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
16
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
17
17
|
import { jsx } from '@emotion/react';
|
|
18
18
|
import { AddOptionAvatar } from '../AddOptionAvatar';
|
|
19
19
|
import { AvatarItemOption, textWrapper } from '../AvatarItemOption';
|
|
@@ -6,7 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
* @jsx jsx
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
9
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
11
|
import { B400 } from '@atlaskit/theme/colors';
|
|
12
12
|
var outerWrapper = function outerWrapper(isDisabled) {
|
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
6
|
import { useCallback, useState } from 'react';
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import EditorPanelIcon from '@atlaskit/icon/core/status-information';
|
|
10
10
|
import { N50, N200 } from '@atlaskit/theme/colors';
|
|
@@ -13,7 +13,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
13
13
|
*/
|
|
14
14
|
import React from 'react';
|
|
15
15
|
import { FormattedMessage } from 'react-intl-next';
|
|
16
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
16
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
17
17
|
import { css, jsx } from '@emotion/react';
|
|
18
18
|
import { N20, B400, N800, N200 } from '@atlaskit/theme/colors';
|
|
19
19
|
import PeopleIcon from '@atlaskit/icon/core/people-group';
|
|
@@ -21,14 +21,17 @@ import { components } from '@atlaskit/select';
|
|
|
21
21
|
import { css, jsx } from '@emotion/react';
|
|
22
22
|
import Avatar from '@atlaskit/avatar';
|
|
23
23
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
24
|
-
import { AvatarTag } from '@atlaskit/tag';
|
|
24
|
+
import { AvatarTag, default as Tag } from '@atlaskit/tag';
|
|
25
25
|
import TeamAvatar from '@atlaskit/teams-avatar';
|
|
26
26
|
import { AddOptionAvatar } from './AddOptionAvatar';
|
|
27
27
|
import { AvatarOrIcon } from './AvatarOrIcon';
|
|
28
28
|
import { SizeableAvatar } from './SizeableAvatar';
|
|
29
29
|
import { getAvatarUrl, isEmail, isGroup, isTeam } from './utils';
|
|
30
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
30
31
|
import PeopleIcon from '@atlaskit/icon/core/people-group';
|
|
31
32
|
import { VerifiedTeamIcon } from '@atlaskit/people-teams-ui-public/verified-team-icon';
|
|
33
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
34
|
+
import { messages } from './i18n';
|
|
32
35
|
export var scrollToValue = function scrollToValue(valueContainer, control) {
|
|
33
36
|
var _valueContainer$getBo = valueContainer.getBoundingClientRect(),
|
|
34
37
|
top = _valueContainer$getBo.top,
|
|
@@ -49,6 +52,10 @@ var groupTagContainerOld = xcss({
|
|
|
49
52
|
var groupTagContainer = xcss({
|
|
50
53
|
paddingLeft: 'space.050'
|
|
51
54
|
});
|
|
55
|
+
var archivedLozengeWrapper = xcss({
|
|
56
|
+
display: 'flex',
|
|
57
|
+
paddingLeft: 'space.050'
|
|
58
|
+
});
|
|
52
59
|
var iconStyle = css({
|
|
53
60
|
display: 'flex',
|
|
54
61
|
alignItems: 'center',
|
|
@@ -106,11 +113,19 @@ export var MultiValue = /*#__PURE__*/function (_React$Component) {
|
|
|
106
113
|
});
|
|
107
114
|
_defineProperty(_this, "getElemAfter", function () {
|
|
108
115
|
var data = _this.props.data.data;
|
|
116
|
+
var canShowArchivedLozenge = isTeam(data) && (data === null || data === void 0 ? void 0 : data.state) === 'DISBANDED' && fg('enable-sup-archive-experience');
|
|
109
117
|
if (isGroup(data) && data.includeTeamsUpdates || isTeam(data) && data.verified) {
|
|
110
118
|
return jsx(VerifiedTeamIcon, {
|
|
111
119
|
size: data.includeTeamsUpdates ? 'small' : 'medium'
|
|
112
120
|
});
|
|
113
121
|
}
|
|
122
|
+
if (canShowArchivedLozenge) {
|
|
123
|
+
return jsx(Box, {
|
|
124
|
+
xcss: archivedLozengeWrapper
|
|
125
|
+
}, jsx(Lozenge, {
|
|
126
|
+
appearance: "default"
|
|
127
|
+
}, jsx(FormattedMessage, messages.archivedLozenge)));
|
|
128
|
+
}
|
|
114
129
|
return null;
|
|
115
130
|
});
|
|
116
131
|
_this.containerRef = /*#__PURE__*/React.createRef();
|
|
@@ -165,6 +180,7 @@ export var MultiValue = /*#__PURE__*/function (_React$Component) {
|
|
|
165
180
|
var isEmailOption = isEmail(data);
|
|
166
181
|
var avatarUrl = getAvatarUrl(data);
|
|
167
182
|
var isDisabled = Boolean((_this$props$selectPro = this.props.selectProps) === null || _this$props$selectPro === void 0 ? void 0 : _this$props$selectPro.isDisabled);
|
|
183
|
+
var canShowArchivedLozenge = isTeam(data) && (data === null || data === void 0 ? void 0 : data.state) === 'DISBANDED' && fg('enable-sup-archive-experience');
|
|
168
184
|
var avatarProps = avatarUrl ? {
|
|
169
185
|
name: data.name,
|
|
170
186
|
src: avatarUrl
|
|
@@ -176,70 +192,52 @@ export var MultiValue = /*#__PURE__*/function (_React$Component) {
|
|
|
176
192
|
return true;
|
|
177
193
|
};
|
|
178
194
|
if (isEmailOption) {
|
|
179
|
-
var emailAvatar = function emailAvatar(props) {
|
|
180
|
-
return jsx(Avatar, _extends({}, props, {
|
|
181
|
-
children: jsx(AddOptionAvatar, {
|
|
182
|
-
isLozenge: true,
|
|
183
|
-
isPendingAction: data.isPendingAction
|
|
184
|
-
})
|
|
185
|
-
}));
|
|
186
|
-
};
|
|
187
195
|
return jsx("span", {
|
|
188
196
|
ref: this.containerRef,
|
|
189
197
|
css: avatarTagWrapperStyle,
|
|
190
198
|
"data-user-picker-multi-value": true
|
|
191
|
-
}, jsx(
|
|
199
|
+
}, jsx(Tag, {
|
|
192
200
|
text: label,
|
|
193
|
-
|
|
194
|
-
|
|
201
|
+
elemBefore: jsx(AddOptionAvatar, {
|
|
202
|
+
isLozenge: true,
|
|
203
|
+
isPendingAction: data.isPendingAction
|
|
204
|
+
}),
|
|
195
205
|
isRemovable: !isDisabled,
|
|
196
206
|
onBeforeRemoveAction: removeAction
|
|
197
207
|
}));
|
|
198
208
|
}
|
|
199
209
|
if (isGroupOption) {
|
|
200
|
-
var groupAvatar = function groupAvatar(props) {
|
|
201
|
-
return jsx(Avatar, _extends({}, props, {
|
|
202
|
-
children: jsx(Box, {
|
|
203
|
-
xcss: groupTagContainer
|
|
204
|
-
}, jsx(PeopleIcon, {
|
|
205
|
-
color: "currentColor",
|
|
206
|
-
label: "" // This element is a decorative icon and does not require a label
|
|
207
|
-
,
|
|
208
|
-
size: "small"
|
|
209
|
-
}))
|
|
210
|
-
}));
|
|
211
|
-
};
|
|
212
210
|
return jsx("span", {
|
|
213
211
|
ref: this.containerRef,
|
|
214
212
|
css: avatarTagWrapperStyle,
|
|
215
213
|
"data-user-picker-multi-value": true
|
|
216
|
-
}, jsx(
|
|
217
|
-
type: "other",
|
|
214
|
+
}, jsx(Tag, {
|
|
218
215
|
text: label,
|
|
219
|
-
|
|
216
|
+
elemBefore: jsx(Box, {
|
|
217
|
+
xcss: groupTagContainer
|
|
218
|
+
}, jsx(PeopleIcon, {
|
|
219
|
+
color: "currentColor",
|
|
220
|
+
label: "" // This element is a decorative icon and does not require a label
|
|
221
|
+
,
|
|
222
|
+
size: "small"
|
|
223
|
+
})),
|
|
220
224
|
isRemovable: !isDisabled,
|
|
221
|
-
onBeforeRemoveAction: removeAction
|
|
222
|
-
avatar: groupAvatar
|
|
225
|
+
onBeforeRemoveAction: removeAction
|
|
223
226
|
}));
|
|
224
227
|
}
|
|
225
228
|
if (data.icon) {
|
|
226
|
-
var iconAvatar = function iconAvatar(props) {
|
|
227
|
-
return jsx(Avatar, _extends({}, props, {
|
|
228
|
-
children: jsx("div", {
|
|
229
|
-
css: iconStyle,
|
|
230
|
-
style: {
|
|
231
|
-
color: data.iconColor
|
|
232
|
-
}
|
|
233
|
-
}, data.icon)
|
|
234
|
-
}));
|
|
235
|
-
};
|
|
236
229
|
return jsx("span", {
|
|
230
|
+
ref: this.containerRef,
|
|
237
231
|
css: avatarTagWrapperStyle,
|
|
238
232
|
"data-user-picker-multi-value": true
|
|
239
|
-
}, jsx(
|
|
233
|
+
}, jsx(Tag, {
|
|
240
234
|
text: label,
|
|
241
|
-
|
|
242
|
-
|
|
235
|
+
elemBefore: jsx("div", {
|
|
236
|
+
css: iconStyle,
|
|
237
|
+
style: {
|
|
238
|
+
color: data.iconColor
|
|
239
|
+
}
|
|
240
|
+
}, data.icon),
|
|
243
241
|
isRemovable: !isDisabled,
|
|
244
242
|
onBeforeRemoveAction: removeAction
|
|
245
243
|
}));
|
|
@@ -248,7 +246,7 @@ export var MultiValue = /*#__PURE__*/function (_React$Component) {
|
|
|
248
246
|
ref: this.containerRef,
|
|
249
247
|
css: avatarTagWrapperStyle,
|
|
250
248
|
"data-user-picker-multi-value": true
|
|
251
|
-
}, isTeamOption ? jsx(AvatarTag, {
|
|
249
|
+
}, isTeamOption ? jsx(React.Fragment, null, jsx(AvatarTag, {
|
|
252
250
|
type: "other",
|
|
253
251
|
text: label,
|
|
254
252
|
isVerified: isTeamOption ? data.verified : undefined,
|
|
@@ -257,7 +255,11 @@ export var MultiValue = /*#__PURE__*/function (_React$Component) {
|
|
|
257
255
|
avatar: function avatar(props) {
|
|
258
256
|
return jsx(TeamAvatar, _extends({}, props, avatarProps));
|
|
259
257
|
}
|
|
260
|
-
})
|
|
258
|
+
}), canShowArchivedLozenge ? jsx(Box, {
|
|
259
|
+
xcss: archivedLozengeWrapper
|
|
260
|
+
}, jsx(Lozenge, {
|
|
261
|
+
appearance: "default"
|
|
262
|
+
}, jsx(FormattedMessage, messages.archivedLozenge))) : null) : jsx(AvatarTag, {
|
|
261
263
|
type: "user",
|
|
262
264
|
text: label,
|
|
263
265
|
isRemovable: !isDisabled,
|
|
@@ -3,17 +3,21 @@ import "./SingleValue.compiled.css";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { components } from '@atlaskit/select';
|
|
6
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
6
7
|
import { AvatarOrIcon } from './AvatarOrIcon';
|
|
7
8
|
import { SizeableAvatar } from './SizeableAvatar';
|
|
8
9
|
import { getAvatarUrl, isTeam, isGroup } from './utils';
|
|
9
10
|
import { getAppearanceForAppType } from '@atlaskit/avatar';
|
|
10
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { VerifiedTeamIcon } from '@atlaskit/people-teams-ui-public/verified-team-icon';
|
|
13
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
12
14
|
import { Box, Flex, Inline } from '@atlaskit/primitives/compiled';
|
|
15
|
+
import { messages } from './i18n';
|
|
13
16
|
var styles = {
|
|
14
17
|
avatarItem: "_1reo15vq _18m915vq _4cvr1h6o _1ul953f4",
|
|
15
18
|
avatarItemTextWrapper: "_16jlkb7n _1o9zkb7n _i0dl1osq _1ul9idpf _p12f1osq _bozgu2gc _vwz419ii",
|
|
16
|
-
avatarItemText: "_syazi7uo _1reo15vq _1bto1l2s _o5721q9c"
|
|
19
|
+
avatarItemText: "_syazi7uo _1reo15vq _1bto1l2s _o5721q9c",
|
|
20
|
+
archivedLozengeWrapper: "_1e0c1txw _19bv1b66"
|
|
17
21
|
};
|
|
18
22
|
var ElementAfter = function ElementAfter(props) {
|
|
19
23
|
var data = props.data.data,
|
|
@@ -33,6 +37,7 @@ export var SingleValue = function SingleValue(props) {
|
|
|
33
37
|
_props$selectProps = props.selectProps,
|
|
34
38
|
appearance = _props$selectProps.appearance,
|
|
35
39
|
isFocused = _props$selectProps.isFocused;
|
|
40
|
+
var canShowArchivedLozenge = isTeam(data) && (data === null || data === void 0 ? void 0 : data.state) === 'DISBANDED' && fg('enable-sup-archive-experience');
|
|
36
41
|
return !isFocused ? /*#__PURE__*/React.createElement(components.SingleValue, props, /*#__PURE__*/React.createElement(Flex, {
|
|
37
42
|
xcss: styles.avatarItem
|
|
38
43
|
}, data.icon ? /*#__PURE__*/React.createElement(AvatarOrIcon, {
|
|
@@ -55,5 +60,9 @@ export var SingleValue = function SingleValue(props) {
|
|
|
55
60
|
xcss: styles.avatarItemText
|
|
56
61
|
}, /*#__PURE__*/React.createElement(Inline, {
|
|
57
62
|
alignBlock: "center"
|
|
58
|
-
}, label, /*#__PURE__*/React.createElement(
|
|
63
|
+
}, label, canShowArchivedLozenge ? /*#__PURE__*/React.createElement(Box, {
|
|
64
|
+
xcss: styles.archivedLozengeWrapper
|
|
65
|
+
}, /*#__PURE__*/React.createElement(Lozenge, {
|
|
66
|
+
appearance: "default"
|
|
67
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.archivedLozenge))) : null, /*#__PURE__*/React.createElement(ElementAfter, props))))))) : null;
|
|
59
68
|
};
|
|
@@ -170,6 +170,11 @@ export var messages = defineMessages({
|
|
|
170
170
|
defaultMessage: 'Guest groups can only access certain spaces and have limited access to user info.',
|
|
171
171
|
description: 'Tooltip text for lozenge showing that a group is for guests in Confluence'
|
|
172
172
|
},
|
|
173
|
+
archivedLozenge: {
|
|
174
|
+
id: 'fabric.elements.user-picker.archived.lozenge.text',
|
|
175
|
+
defaultMessage: 'Archived',
|
|
176
|
+
description: 'Text within the lozenge when the selected team has been archived/disbanded'
|
|
177
|
+
},
|
|
173
178
|
userTypeLabel: {
|
|
174
179
|
id: 'fabric.elements.user-picker.user.type.label',
|
|
175
180
|
defaultMessage: 'People',
|
|
@@ -12,7 +12,7 @@ export var isUser = function isUser(option) {
|
|
|
12
12
|
return option.type === undefined || option.type === UserType;
|
|
13
13
|
};
|
|
14
14
|
export var isTeam = function isTeam(option) {
|
|
15
|
-
return option.type === TeamType;
|
|
15
|
+
return (option === null || option === void 0 ? void 0 : option.type) === TeamType;
|
|
16
16
|
};
|
|
17
17
|
export var isGroup = function isGroup(option) {
|
|
18
18
|
return option.type === GroupType;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
3
4
|
import memoizeOne from 'memoize-one';
|
|
4
5
|
import { messages } from '../../components/i18n';
|
|
5
|
-
var getLabelForType = function getLabelForType(type) {
|
|
6
|
+
var getLabelForType = function getLabelForType(type, customLabels) {
|
|
7
|
+
if (customLabels && type in customLabels && fg('jsm-wfo-assignee-recommendation-on-queues')) {
|
|
8
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, customLabels[type]);
|
|
9
|
+
}
|
|
6
10
|
switch (type) {
|
|
7
11
|
case 'user':
|
|
8
12
|
return /*#__PURE__*/React.createElement(FormattedMessage, messages.userTypeLabel);
|
|
@@ -18,7 +22,7 @@ var getLabelForType = function getLabelForType(type) {
|
|
|
18
22
|
return /*#__PURE__*/React.createElement(FormattedMessage, messages.otherTypeLabel);
|
|
19
23
|
}
|
|
20
24
|
};
|
|
21
|
-
export var groupOptionsByType = memoizeOne(function (options, groupByTypeOrder) {
|
|
25
|
+
export var groupOptionsByType = memoizeOne(function (options, groupByTypeOrder, customGroupLabels) {
|
|
22
26
|
// If groupByTypeOrder is empty, just return the original options
|
|
23
27
|
if (groupByTypeOrder.length === 0) {
|
|
24
28
|
return options;
|
|
@@ -38,7 +42,7 @@ export var groupOptionsByType = memoizeOne(function (options, groupByTypeOrder)
|
|
|
38
42
|
groupByTypeOrder.forEach(function (type) {
|
|
39
43
|
if (groupedMap.has(type)) {
|
|
40
44
|
result.push({
|
|
41
|
-
label: getLabelForType(type),
|
|
45
|
+
label: getLabelForType(type, customGroupLabels),
|
|
42
46
|
options: groupedMap.get(type)
|
|
43
47
|
});
|
|
44
48
|
groupedMap.delete(type);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
|
|
1
|
+
import { UIAnalyticsEvent, type AnalyticsEventPayload, type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
2
|
import { type UserPickerProps, type UserPickerState } from './types';
|
|
3
3
|
export type UserPickerSession = {
|
|
4
4
|
downCount: number;
|
|
@@ -9,7 +9,7 @@ export type UserPickerSession = {
|
|
|
9
9
|
upCount: number;
|
|
10
10
|
};
|
|
11
11
|
export declare const startSession: () => UserPickerSession;
|
|
12
|
-
export declare const createAndFireEventInElementsChannel: (payload: AnalyticsEventPayload) => (createAnalyticsEvent:
|
|
12
|
+
export declare const createAndFireEventInElementsChannel: (payload: AnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => UIAnalyticsEvent;
|
|
13
13
|
export interface EventCreator {
|
|
14
14
|
(props: UserPickerProps, state: UserPickerState, session?: UserPickerSession): AnalyticsEventPayload;
|
|
15
15
|
(props: UserPickerProps, state: UserPickerState, session?: UserPickerSession, ...args: any[]): AnalyticsEventPayload;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { type ReactNode } from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
6
|
+
import { jsx, type SerializedStyles } from '@emotion/react';
|
|
7
7
|
import { type LozengeProps } from '../types';
|
|
8
|
-
export declare const textWrapper: (color?: string) =>
|
|
8
|
+
export declare const textWrapper: (color?: string) => SerializedStyles;
|
|
9
9
|
export type AvatarItemOptionProps = {
|
|
10
10
|
avatar: ReactNode;
|
|
11
11
|
isDisabled?: boolean;
|
|
@@ -62,6 +62,8 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
|
|
|
62
62
|
componentDidUpdate(prevProps: UserPickerProps, prevState: UserPickerState): void;
|
|
63
63
|
private handleKeyDown;
|
|
64
64
|
handleClearIndicatorHover: (hoveringClearIndicator: boolean) => void;
|
|
65
|
+
private getOptionsOld;
|
|
66
|
+
private getOptionsNew;
|
|
65
67
|
private getOptions;
|
|
66
68
|
private getAppearance;
|
|
67
69
|
get ariaProps(): Partial<AriaAttributes>;
|
|
@@ -90,6 +92,7 @@ export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
90
92
|
footer?: React.ReactNode;
|
|
91
93
|
forwardedRef?: React.ForwardedRef<UserPickerRef>;
|
|
92
94
|
groupByTypeOrder?: NonNullable<OptionData['type']>[];
|
|
95
|
+
customGroupLabels?: Partial<Record<NonNullable<OptionData['type']>, React.ReactNode>>;
|
|
93
96
|
header?: React.ReactNode;
|
|
94
97
|
height?: number | string;
|
|
95
98
|
includeTeamsUpdates?: boolean;
|
|
@@ -160,7 +163,7 @@ export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
160
163
|
*/
|
|
161
164
|
UNSAFE_hasDraggableParentComponent?: boolean;
|
|
162
165
|
width: string | number;
|
|
163
|
-
}, keyof WithAnalyticsEventsProps>, 'options' | 'noOptionsMessage' | 'placeholder' | 'addMoreMessage' | 'allowEmail' | 'anchor' | 'appearance' | 'ariaDescribedBy' | 'ariaLabel' | 'ariaLabelledBy' | 'ariaLive' | 'autoFocus' | 'captureMenuScroll' | 'clearValueLabel' | 'closeMenuOnScroll' | 'components' | 'defaultValue' | 'disableInput' | 'emailLabel' | 'fieldId' | 'footer' | 'forwardedRef' | 'groupByTypeOrder' | 'header' | 'height' | 'includeTeamsUpdates' | 'inputId' | 'isDisabled' | 'isFooterFocused' | 'isInvalid' | 'isLoading' | 'isValidEmail' | 'loadOptions' | 'loadUserSource' | 'maxOptions' | 'maxPickerHeight' | 'menuIsOpen' | 'menuMinWidth' | 'menuPortalTarget' | 'menuPosition' | 'menuShouldBlockScroll' | 'name' | 'onBlur' | 'onChange' | 'onClear' | 'onClose' | 'onFocus' | 'onInputChange' | 'onKeyDown' | 'onOpen' | 'onSelection' | 'open' | 'placeholderAvatar' | 'popupSelectProps' | 'required' | 'search' | 'setIsFooterFocused' | 'showClearIndicator' | 'strategy' | 'styles' | 'suggestEmailsForDomain' | 'UNSAFE_hasDraggableParentComponent' | 'value' | 'width' | 'pickerProps' | 'SelectComponent'> & {
|
|
166
|
+
}, keyof WithAnalyticsEventsProps>, 'options' | 'noOptionsMessage' | 'placeholder' | 'addMoreMessage' | 'allowEmail' | 'anchor' | 'appearance' | 'ariaDescribedBy' | 'ariaLabel' | 'ariaLabelledBy' | 'ariaLive' | 'autoFocus' | 'captureMenuScroll' | 'clearValueLabel' | 'closeMenuOnScroll' | 'components' | 'defaultValue' | 'disableInput' | 'emailLabel' | 'fieldId' | 'footer' | 'forwardedRef' | 'groupByTypeOrder' | 'customGroupLabels' | 'header' | 'height' | 'includeTeamsUpdates' | 'inputId' | 'isDisabled' | 'isFooterFocused' | 'isInvalid' | 'isLoading' | 'isValidEmail' | 'loadOptions' | 'loadUserSource' | 'maxOptions' | 'maxPickerHeight' | 'menuIsOpen' | 'menuMinWidth' | 'menuPortalTarget' | 'menuPosition' | 'menuShouldBlockScroll' | 'name' | 'onBlur' | 'onChange' | 'onClear' | 'onClose' | 'onFocus' | 'onInputChange' | 'onKeyDown' | 'onOpen' | 'onSelection' | 'open' | 'placeholderAvatar' | 'popupSelectProps' | 'required' | 'search' | 'setIsFooterFocused' | 'showClearIndicator' | 'strategy' | 'styles' | 'suggestEmailsForDomain' | 'UNSAFE_hasDraggableParentComponent' | 'value' | 'width' | 'pickerProps' | 'SelectComponent'> & {
|
|
164
167
|
isClearable?: boolean | undefined;
|
|
165
168
|
isMulti?: boolean | undefined;
|
|
166
169
|
loadOptionsErrorMessage?: ((value: {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
1
2
|
import React from 'react';
|
|
3
|
+
import type { ExternalUser } from '../../types';
|
|
2
4
|
declare const AsyncExternalUserOption: React.LazyExoticComponent<React.ForwardRefExoticComponent<Omit<{
|
|
3
5
|
isSelected: boolean;
|
|
4
6
|
status?: string;
|
|
5
|
-
user:
|
|
6
|
-
}, keyof
|
|
7
|
+
user: ExternalUser;
|
|
8
|
+
}, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>>;
|
|
7
9
|
export default AsyncExternalUserOption;
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import { type SerializedStyles } from '@emotion/react';
|
|
6
7
|
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
7
8
|
import { type ExternalUser } from '../../types';
|
|
8
|
-
export declare const imageContainer:
|
|
9
|
-
export declare const emailDomainWrapper:
|
|
9
|
+
export declare const imageContainer: SerializedStyles;
|
|
10
|
+
export declare const emailDomainWrapper: SerializedStyles;
|
|
10
11
|
export type ExternalUserOptionProps = WithAnalyticsEventsProps & {
|
|
11
12
|
isSelected: boolean;
|
|
12
13
|
status?: string;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
6
|
+
import { jsx, type SerializedStyles } from '@emotion/react';
|
|
7
7
|
import { type Group } from '../../types';
|
|
8
|
-
export declare const groupOptionIconWrapper:
|
|
8
|
+
export declare const groupOptionIconWrapper: SerializedStyles;
|
|
9
9
|
export type GroupOptionProps = {
|
|
10
10
|
group: Group;
|
|
11
11
|
includeTeamsUpdates?: boolean;
|