@atlaskit/user-picker 11.13.2 → 11.15.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 +19 -0
- package/afm-jira/tsconfig.json +1 -1
- package/dist/cjs/analytics.js +1 -1
- package/dist/cjs/components/BaseUserPicker.js +3 -6
- package/dist/cjs/components/GroupOption/main.js +23 -2
- package/dist/cjs/components/Option.js +4 -2
- package/dist/cjs/components/SingleValue.js +8 -3
- package/dist/cjs/components/SingleValueContainer.js +4 -1
- package/dist/cjs/components/TeamOption/main.js +47 -14
- package/dist/cjs/components/UserPicker.js +5 -2
- package/dist/cjs/components/i18n.js +35 -0
- package/dist/cjs/index.js +7 -0
- package/dist/es2019/analytics.js +1 -1
- package/dist/es2019/components/BaseUserPicker.js +3 -6
- package/dist/es2019/components/GroupOption/main.js +23 -2
- package/dist/es2019/components/Option.js +4 -2
- package/dist/es2019/components/SingleValue.js +8 -3
- package/dist/es2019/components/SingleValueContainer.js +4 -1
- package/dist/es2019/components/TeamOption/main.js +40 -8
- package/dist/es2019/components/UserPicker.js +4 -2
- package/dist/es2019/components/i18n.js +35 -0
- package/dist/es2019/index.js +1 -0
- package/dist/esm/analytics.js +1 -1
- package/dist/esm/components/BaseUserPicker.js +3 -6
- package/dist/esm/components/GroupOption/main.js +23 -2
- package/dist/esm/components/Option.js +4 -2
- package/dist/esm/components/SingleValue.js +8 -3
- package/dist/esm/components/SingleValueContainer.js +4 -1
- package/dist/esm/components/TeamOption/main.js +47 -14
- package/dist/esm/components/UserPicker.js +5 -2
- package/dist/esm/components/i18n.js +35 -0
- package/dist/esm/index.js +1 -0
- package/dist/types/components/BaseUserPicker.d.ts +2 -1
- package/dist/types/components/GroupOption/main.d.ts +2 -0
- package/dist/types/components/Option.d.ts +1 -0
- package/dist/types/components/PopupUserPicker.d.ts +2 -0
- package/dist/types/components/SingleValue.d.ts +4 -2
- package/dist/types/components/TeamOption/main.d.ts +2 -0
- package/dist/types/components/UserPicker.d.ts +2 -1
- package/dist/types/components/components.d.ts +1 -1
- package/dist/types/components/i18n.d.ts +35 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types.d.ts +6 -0
- package/dist/types-ts4.5/components/BaseUserPicker.d.ts +2 -1
- package/dist/types-ts4.5/components/GroupOption/main.d.ts +2 -0
- package/dist/types-ts4.5/components/Option.d.ts +1 -0
- package/dist/types-ts4.5/components/PopupUserPicker.d.ts +2 -0
- package/dist/types-ts4.5/components/SingleValue.d.ts +4 -2
- package/dist/types-ts4.5/components/TeamOption/main.d.ts +2 -0
- package/dist/types-ts4.5/components/UserPicker.d.ts +2 -1
- package/dist/types-ts4.5/components/components.d.ts +1 -1
- package/dist/types-ts4.5/components/i18n.d.ts +35 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/types.d.ts +6 -0
- package/package.json +5 -6
|
@@ -24,7 +24,8 @@ export class TeamOption extends React.PureComponent {
|
|
|
24
24
|
name,
|
|
25
25
|
highlight,
|
|
26
26
|
verified
|
|
27
|
-
}
|
|
27
|
+
},
|
|
28
|
+
includeTeamsUpdates
|
|
28
29
|
} = this.props;
|
|
29
30
|
return [jsx("span", {
|
|
30
31
|
key: "name"
|
|
@@ -35,16 +36,19 @@ export class TeamOption extends React.PureComponent {
|
|
|
35
36
|
alignBlock: "center"
|
|
36
37
|
}, jsx(HighlightText, {
|
|
37
38
|
highlights: highlight && highlight.name
|
|
38
|
-
}, name), verified &&
|
|
39
|
+
}, name), verified && !includeTeamsUpdates && this.renderVerifiedIcon()))];
|
|
39
40
|
});
|
|
40
41
|
_defineProperty(this, "renderByline", () => {
|
|
41
42
|
const {
|
|
42
43
|
isSelected,
|
|
43
44
|
team: {
|
|
44
45
|
memberCount,
|
|
45
|
-
includesYou
|
|
46
|
-
|
|
46
|
+
includesYou,
|
|
47
|
+
verified
|
|
48
|
+
},
|
|
49
|
+
includeTeamsUpdates
|
|
47
50
|
} = this.props;
|
|
51
|
+
const isVerified = includeTeamsUpdates && verified;
|
|
48
52
|
|
|
49
53
|
// if Member count is missing, do not show the byline, regardless of the availability of includesYou
|
|
50
54
|
if (memberCount === null || typeof memberCount === 'undefined') {
|
|
@@ -52,9 +56,18 @@ export class TeamOption extends React.PureComponent {
|
|
|
52
56
|
} else {
|
|
53
57
|
if (includesYou === true) {
|
|
54
58
|
if (memberCount > 50) {
|
|
55
|
-
return this.getBylineComponent(isSelected, jsx(FormattedMessage, messages.
|
|
59
|
+
return this.getBylineComponent(isSelected, isVerified ? jsx(FormattedMessage, _extends({}, messages.officialPlus50MembersWithYou, {
|
|
60
|
+
values: {
|
|
61
|
+
verifiedIcon: this.renderVerifiedIcon()
|
|
62
|
+
}
|
|
63
|
+
})) : jsx(FormattedMessage, messages.plus50MembersWithYou));
|
|
56
64
|
} else {
|
|
57
|
-
return this.getBylineComponent(isSelected, jsx(FormattedMessage, _extends({}, messages.
|
|
65
|
+
return this.getBylineComponent(isSelected, isVerified ? jsx(FormattedMessage, _extends({}, messages.officialMemberCountWithYou, {
|
|
66
|
+
values: {
|
|
67
|
+
verifiedIcon: this.renderVerifiedIcon(),
|
|
68
|
+
count: memberCount
|
|
69
|
+
}
|
|
70
|
+
})) : jsx(FormattedMessage, _extends({}, messages.memberCountWithYou, {
|
|
58
71
|
values: {
|
|
59
72
|
count: memberCount
|
|
60
73
|
}
|
|
@@ -62,9 +75,18 @@ export class TeamOption extends React.PureComponent {
|
|
|
62
75
|
}
|
|
63
76
|
} else {
|
|
64
77
|
if (memberCount > 50) {
|
|
65
|
-
return this.getBylineComponent(isSelected, jsx(FormattedMessage, messages.
|
|
78
|
+
return this.getBylineComponent(isSelected, isVerified ? jsx(FormattedMessage, _extends({}, messages.officialPlus50MembersWithoutYou, {
|
|
79
|
+
values: {
|
|
80
|
+
verifiedIcon: this.renderVerifiedIcon()
|
|
81
|
+
}
|
|
82
|
+
})) : jsx(FormattedMessage, messages.plus50MembersWithoutYou));
|
|
66
83
|
} else {
|
|
67
|
-
return this.getBylineComponent(isSelected, jsx(FormattedMessage, _extends({}, messages.
|
|
84
|
+
return this.getBylineComponent(isSelected, isVerified ? jsx(FormattedMessage, _extends({}, messages.officialMemberCountWithoutYou, {
|
|
85
|
+
values: {
|
|
86
|
+
verifiedIcon: this.renderVerifiedIcon(),
|
|
87
|
+
count: memberCount
|
|
88
|
+
}
|
|
89
|
+
})) : jsx(FormattedMessage, _extends({}, messages.memberCountWithoutYou, {
|
|
68
90
|
values: {
|
|
69
91
|
count: memberCount
|
|
70
92
|
}
|
|
@@ -90,6 +112,16 @@ export class TeamOption extends React.PureComponent {
|
|
|
90
112
|
type: "team"
|
|
91
113
|
});
|
|
92
114
|
});
|
|
115
|
+
_defineProperty(this, "renderVerifiedIcon", () => {
|
|
116
|
+
if (this.props.team.verified) {
|
|
117
|
+
return jsx(VerifiedTeamIcon, {
|
|
118
|
+
label: "",
|
|
119
|
+
size: "small",
|
|
120
|
+
spacing: "none"
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return undefined;
|
|
124
|
+
});
|
|
93
125
|
_defineProperty(this, "getLozengeProps", () => typeof this.props.team.lozenge === 'string' ? {
|
|
94
126
|
text: this.props.team.lozenge
|
|
95
127
|
} : this.props.team.lozenge);
|
|
@@ -51,7 +51,8 @@ export class UserPickerWithoutAnalytics extends React.Component {
|
|
|
51
51
|
closeMenuOnScroll,
|
|
52
52
|
loadUserSource,
|
|
53
53
|
required = false,
|
|
54
|
-
showClearIndicator = false
|
|
54
|
+
showClearIndicator = false,
|
|
55
|
+
includeTeamsUpdates = false
|
|
55
56
|
} = this.props;
|
|
56
57
|
const width = this.props.width;
|
|
57
58
|
const SelectComponent = allowEmail ? CreatableSelect : Select;
|
|
@@ -62,7 +63,8 @@ export class UserPickerWithoutAnalytics extends React.Component {
|
|
|
62
63
|
menuPosition,
|
|
63
64
|
menuShouldBlockScroll,
|
|
64
65
|
captureMenuScroll,
|
|
65
|
-
required
|
|
66
|
+
required,
|
|
67
|
+
includeTeamsUpdates
|
|
66
68
|
};
|
|
67
69
|
const pickerProps = allowEmail ? {
|
|
68
70
|
...defaultPickerProps,
|
|
@@ -25,6 +25,26 @@ export const messages = defineMessages({
|
|
|
25
25
|
defaultMessage: 'Something went wrong',
|
|
26
26
|
description: 'Error message to display when options fail to load.'
|
|
27
27
|
},
|
|
28
|
+
teamByline: {
|
|
29
|
+
id: 'fabric.elements.user-picker.team.byline',
|
|
30
|
+
defaultMessage: 'Team',
|
|
31
|
+
description: 'Byline for team'
|
|
32
|
+
},
|
|
33
|
+
officialTeamByline: {
|
|
34
|
+
id: 'fabric.elements.user-picker.team.byline.official',
|
|
35
|
+
defaultMessage: 'Official team {verifiedIcon}',
|
|
36
|
+
description: 'Byline for official team'
|
|
37
|
+
},
|
|
38
|
+
officialMemberCountWithoutYou: {
|
|
39
|
+
id: 'fabric.elements.user-picker.team.member.count.official',
|
|
40
|
+
defaultMessage: 'Official team {verifiedIcon} • {count} {count, plural, one {member} other {members}}',
|
|
41
|
+
description: 'Byline to show the number of members in the team when the current user is not a member of the team'
|
|
42
|
+
},
|
|
43
|
+
officialMemberCountWithYou: {
|
|
44
|
+
id: 'fabric.elements.user-picker.team.member.count.official.including.you',
|
|
45
|
+
defaultMessage: 'Official team {verifiedIcon} • {count} {count, plural, one {member} other {members}}, including you',
|
|
46
|
+
description: 'Byline to show the number of members in the team when the current user is also a member of the team'
|
|
47
|
+
},
|
|
28
48
|
memberCountWithoutYou: {
|
|
29
49
|
id: 'fabric.elements.user-picker.team.member.count',
|
|
30
50
|
defaultMessage: 'Team • {count} {count, plural, one {member} other {members}}',
|
|
@@ -35,6 +55,16 @@ export const messages = defineMessages({
|
|
|
35
55
|
defaultMessage: 'Team • {count} {count, plural, one {member} other {members}}, including you',
|
|
36
56
|
description: 'Byline to show the number of members in the team when the current user is also a member of the team'
|
|
37
57
|
},
|
|
58
|
+
officialPlus50MembersWithoutYou: {
|
|
59
|
+
id: 'fabric.elements.user-picker.team.member.50plus.official',
|
|
60
|
+
defaultMessage: 'Official team {verifiedIcon} • 50+ members',
|
|
61
|
+
description: 'Byline to show the number of members in the team when the number exceeds 50'
|
|
62
|
+
},
|
|
63
|
+
officialPlus50MembersWithYou: {
|
|
64
|
+
id: 'fabric.elements.user-picker.team.member.50plus.official.including.you',
|
|
65
|
+
defaultMessage: 'Official team {verifiedIcon} • 50+ members, including you',
|
|
66
|
+
description: 'Byline to show the number of members in the team when the number exceeds 50 and also includes the current user'
|
|
67
|
+
},
|
|
38
68
|
plus50MembersWithoutYou: {
|
|
39
69
|
id: 'fabric.elements.user-picker.team.member.50plus',
|
|
40
70
|
defaultMessage: 'Team • 50+ members',
|
|
@@ -60,6 +90,11 @@ export const messages = defineMessages({
|
|
|
60
90
|
defaultMessage: 'Enter an email address',
|
|
61
91
|
description: 'Byline for a potentially valid email option.'
|
|
62
92
|
},
|
|
93
|
+
adminManagedGroupByline: {
|
|
94
|
+
id: 'fabric.elements.user-picker.group.byline.admin-managed',
|
|
95
|
+
defaultMessage: 'Admin group {verifiedIcon}',
|
|
96
|
+
description: 'Byline for admin-managed groups with verified icon'
|
|
97
|
+
},
|
|
63
98
|
groupByline: {
|
|
64
99
|
id: 'fabric.elements.user-picker.group.byline',
|
|
65
100
|
defaultMessage: 'Admin-managed group',
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { isValidEmail } from './components/emailValidation';
|
|
2
2
|
export { UserPicker as default } from './components/UserPicker';
|
|
3
3
|
export { PopupUserPicker } from './components/PopupUserPicker';
|
|
4
|
+
export { SingleValue } from './components/SingleValue';
|
|
4
5
|
export { isEmail, isExternalUser, isTeam, isUser, isGroup } from './components/utils';
|
|
5
6
|
export {
|
|
6
7
|
// Constants
|
package/dist/esm/analytics.js
CHANGED
|
@@ -6,7 +6,7 @@ import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
|
6
6
|
import { v4 as uuidv4 } from 'uuid';
|
|
7
7
|
import { isCustom, isExternalUser } from './components/utils';
|
|
8
8
|
var packageName = "@atlaskit/user-picker";
|
|
9
|
-
var packageVersion = "
|
|
9
|
+
var packageVersion = "0.0.0-development";
|
|
10
10
|
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}$/;
|
|
11
11
|
var UUID_REGEXP_OLD_AAID = /^[a-fA-F0-9]{1,8}:[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
|
|
12
12
|
var UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
|
|
@@ -27,7 +27,6 @@ import { messages } from './i18n';
|
|
|
27
27
|
import { callCallback, extractOptionValue, getOptions, isIterable, isPopupUserPickerByComponent, isDefaultValuePopulated, isSingleValue, optionToSelectableOptions } from './utils';
|
|
28
28
|
import { groupOptionsByType } from '../util/group-options-by-type';
|
|
29
29
|
import { userPickerOptionsShownUfoExperience } from '../util/ufoExperiences';
|
|
30
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
31
30
|
var loadingMessage = function loadingMessage() {
|
|
32
31
|
return null;
|
|
33
32
|
};
|
|
@@ -531,10 +530,8 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
531
530
|
name: name,
|
|
532
531
|
value: value,
|
|
533
532
|
autoFocus: autoFocus !== undefined ? autoFocus : menuIsOpen,
|
|
534
|
-
labelId:
|
|
535
|
-
|
|
536
|
-
descriptionId: fg('user_picker_migrate_aria_label_description') ? ariaDescribedBy !== null && ariaDescribedBy !== void 0 ? ariaDescribedBy : ariaDescribedByStandard : undefined,
|
|
537
|
-
"aria-describedby": fg('user_picker_migrate_aria_label_description') ? undefined : ariaDescribedBy,
|
|
533
|
+
labelId: ariaLabelledBy !== null && ariaLabelledBy !== void 0 ? ariaLabelledBy : ariaLabelledByStandard,
|
|
534
|
+
descriptionId: ariaDescribedBy !== null && ariaDescribedBy !== void 0 ? ariaDescribedBy : ariaDescribedByStandard,
|
|
538
535
|
"aria-live": ariaLive,
|
|
539
536
|
"aria-required": required // This has been added as a safety net.
|
|
540
537
|
,
|
|
@@ -587,7 +584,7 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
587
584
|
textFieldBackgroundColor: textFieldBackgroundColor,
|
|
588
585
|
header: header,
|
|
589
586
|
placeholderAvatar: placeholderAvatar
|
|
590
|
-
},
|
|
587
|
+
}, restAriaProps, pickerProps, UNSAFE_hasDraggableParentComponent && {
|
|
591
588
|
onValueContainerClick: this.handleClickDraggableParentComponent
|
|
592
589
|
}, menuOpenDeciderProps));
|
|
593
590
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
@@ -16,6 +17,7 @@ import { FormattedMessage } from 'react-intl-next';
|
|
|
16
17
|
import { css, jsx } from '@emotion/react';
|
|
17
18
|
import { N20, B400, N800, N200 } from '@atlaskit/theme/colors';
|
|
18
19
|
import PeopleIcon from '@atlaskit/icon/core/migration/people-group--people';
|
|
20
|
+
import { VerifiedTeamIcon } from '@atlaskit/people-teams-ui-public/verified-team-icon';
|
|
19
21
|
import { AvatarItemOption, textWrapper } from '../AvatarItemOption';
|
|
20
22
|
import { messages } from '../i18n';
|
|
21
23
|
import { HighlightText } from '../HighlightText';
|
|
@@ -63,15 +65,34 @@ export var GroupOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
63
65
|
spacing: "spacious"
|
|
64
66
|
}));
|
|
65
67
|
});
|
|
68
|
+
_defineProperty(_this, "renderVerifiedIcon", function () {
|
|
69
|
+
return jsx(VerifiedTeamIcon, {
|
|
70
|
+
label: "",
|
|
71
|
+
size: "small",
|
|
72
|
+
spacing: "none"
|
|
73
|
+
});
|
|
74
|
+
});
|
|
66
75
|
_defineProperty(_this, "renderByline", function () {
|
|
67
76
|
var _this$props2 = _this.props,
|
|
68
77
|
isSelected = _this$props2.isSelected,
|
|
69
|
-
group = _this$props2.group
|
|
78
|
+
group = _this$props2.group,
|
|
79
|
+
includeTeamsUpdates = _this$props2.includeTeamsUpdates;
|
|
80
|
+
var getGroupByline = function getGroupByline() {
|
|
81
|
+
if (includeTeamsUpdates) {
|
|
82
|
+
return jsx(FormattedMessage, _extends({}, messages.adminManagedGroupByline, {
|
|
83
|
+
values: {
|
|
84
|
+
verifiedIcon: _this.renderVerifiedIcon()
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
87
|
+
} else {
|
|
88
|
+
return jsx(FormattedMessage, messages.groupByline);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
70
91
|
return jsx("span", {
|
|
71
92
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
72
93
|
css: textWrapper(isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text-subtlest, ".concat(N200, ")")),
|
|
73
94
|
"data-testid": "user-picker-group-secondary-text"
|
|
74
|
-
}, group.byline ? group.byline :
|
|
95
|
+
}, group.byline ? group.byline : getGroupByline());
|
|
75
96
|
});
|
|
76
97
|
_defineProperty(_this, "getLozengeProps", function () {
|
|
77
98
|
return typeof _this.props.group.lozenge === 'string' ? {
|
|
@@ -54,13 +54,15 @@ var dataOption = function dataOption(_ref2) {
|
|
|
54
54
|
if (isTeam(data)) {
|
|
55
55
|
return /*#__PURE__*/React.createElement(AsyncTeamOption, {
|
|
56
56
|
team: data,
|
|
57
|
-
isSelected: isSelected
|
|
57
|
+
isSelected: isSelected,
|
|
58
|
+
includeTeamsUpdates: data.includeTeamsUpdates
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
if (isGroup(data)) {
|
|
61
62
|
return /*#__PURE__*/React.createElement(AsyncGroupOption, {
|
|
62
63
|
group: data,
|
|
63
|
-
isSelected: isSelected
|
|
64
|
+
isSelected: isSelected,
|
|
65
|
+
includeTeamsUpdates: data.includeTeamsUpdates
|
|
64
66
|
});
|
|
65
67
|
}
|
|
66
68
|
if (isCustom(data)) {
|
|
@@ -5,6 +5,8 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
5
5
|
import { components } from '@atlaskit/select';
|
|
6
6
|
import { SizeableAvatar } from './SizeableAvatar';
|
|
7
7
|
import { getAvatarUrl, isTeam } from './utils';
|
|
8
|
+
import { getAppearanceForAppType } from '@atlaskit/avatar';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
10
|
import { VerifiedTeamIcon } from '@atlaskit/people-teams-ui-public/verified-team-icon';
|
|
9
11
|
import { Box, Flex, Inline } from '@atlaskit/primitives/compiled';
|
|
10
12
|
var styles = {
|
|
@@ -13,8 +15,10 @@ var styles = {
|
|
|
13
15
|
avatarItemText: "_syazi7uo _1reo15vq _1bto1l2s _o5721q9c"
|
|
14
16
|
};
|
|
15
17
|
var ElementAfter = function ElementAfter(props) {
|
|
16
|
-
var data = props.data.data
|
|
17
|
-
|
|
18
|
+
var data = props.data.data,
|
|
19
|
+
shouldShowVerifiedIcon = props.shouldShowVerifiedIcon;
|
|
20
|
+
var showIcon = shouldShowVerifiedIcon ? shouldShowVerifiedIcon(data) : isTeam(data) && data.verified;
|
|
21
|
+
if (showIcon) {
|
|
18
22
|
return /*#__PURE__*/React.createElement(VerifiedTeamIcon, null);
|
|
19
23
|
}
|
|
20
24
|
return null;
|
|
@@ -31,7 +35,8 @@ export var SingleValue = function SingleValue(props) {
|
|
|
31
35
|
}, /*#__PURE__*/React.createElement(SizeableAvatar, {
|
|
32
36
|
src: getAvatarUrl(data),
|
|
33
37
|
appearance: appearance,
|
|
34
|
-
type: isTeam(data) ? 'team' : 'person'
|
|
38
|
+
type: isTeam(data) ? 'team' : 'person',
|
|
39
|
+
avatarAppearanceShape: fg('jira_ai_agent_avatar_user_picker_user_option') ? getAppearanceForAppType(data.appType) : undefined
|
|
35
40
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
36
41
|
xcss: styles.avatarItem
|
|
37
42
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -16,6 +16,8 @@ import React from 'react';
|
|
|
16
16
|
import { components } from '@atlaskit/select';
|
|
17
17
|
import { SizeableAvatar } from './SizeableAvatar';
|
|
18
18
|
import ValueContainerWrapper from './ValueContainerWrapper';
|
|
19
|
+
import { getAppearanceForAppType } from '@atlaskit/avatar';
|
|
20
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
19
21
|
var valueContainerStyles = {
|
|
20
22
|
root: "_yv0e5bpd _ca0q12x7 _n3td12x7 _19bvze3t _1reo15vq _18m91wug _1fjgglyw _c71l1osq _1suq1j28 _1ke8idpf"
|
|
21
23
|
};
|
|
@@ -45,7 +47,8 @@ export var SingleValueContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
45
47
|
return /*#__PURE__*/React.createElement(SizeableAvatar, {
|
|
46
48
|
appearance: appearance,
|
|
47
49
|
type: placeholderAvatar,
|
|
48
|
-
src: showUserAvatar(inputValue, value) ? value.data.avatarUrl : undefined
|
|
50
|
+
src: showUserAvatar(inputValue, value) ? value.data.avatarUrl : undefined,
|
|
51
|
+
avatarAppearanceShape: value && value.data && fg('jira_ai_agent_avatar_user_picker_user_option') ? getAppearanceForAppType(value.data.appType) : undefined
|
|
49
52
|
});
|
|
50
53
|
}
|
|
51
54
|
return null;
|
|
@@ -31,10 +31,12 @@ export var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
31
31
|
}
|
|
32
32
|
_this = _callSuper(this, TeamOption, [].concat(args));
|
|
33
33
|
_defineProperty(_this, "getPrimaryText", function () {
|
|
34
|
-
var _this$props
|
|
34
|
+
var _this$props = _this.props,
|
|
35
|
+
_this$props$team = _this$props.team,
|
|
35
36
|
name = _this$props$team.name,
|
|
36
37
|
highlight = _this$props$team.highlight,
|
|
37
|
-
verified = _this$props$team.verified
|
|
38
|
+
verified = _this$props$team.verified,
|
|
39
|
+
includeTeamsUpdates = _this$props.includeTeamsUpdates;
|
|
38
40
|
return [jsx("span", {
|
|
39
41
|
key: "name"
|
|
40
42
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -44,14 +46,17 @@ export var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
44
46
|
alignBlock: "center"
|
|
45
47
|
}, jsx(HighlightText, {
|
|
46
48
|
highlights: highlight && highlight.name
|
|
47
|
-
}, name), verified &&
|
|
49
|
+
}, name), verified && !includeTeamsUpdates && _this.renderVerifiedIcon()))];
|
|
48
50
|
});
|
|
49
51
|
_defineProperty(_this, "renderByline", function () {
|
|
50
|
-
var _this$
|
|
51
|
-
isSelected = _this$
|
|
52
|
-
_this$
|
|
53
|
-
memberCount = _this$
|
|
54
|
-
includesYou = _this$
|
|
52
|
+
var _this$props2 = _this.props,
|
|
53
|
+
isSelected = _this$props2.isSelected,
|
|
54
|
+
_this$props2$team = _this$props2.team,
|
|
55
|
+
memberCount = _this$props2$team.memberCount,
|
|
56
|
+
includesYou = _this$props2$team.includesYou,
|
|
57
|
+
verified = _this$props2$team.verified,
|
|
58
|
+
includeTeamsUpdates = _this$props2.includeTeamsUpdates;
|
|
59
|
+
var isVerified = includeTeamsUpdates && verified;
|
|
55
60
|
|
|
56
61
|
// if Member count is missing, do not show the byline, regardless of the availability of includesYou
|
|
57
62
|
if (memberCount === null || typeof memberCount === 'undefined') {
|
|
@@ -59,9 +64,18 @@ export var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
59
64
|
} else {
|
|
60
65
|
if (includesYou === true) {
|
|
61
66
|
if (memberCount > 50) {
|
|
62
|
-
return _this.getBylineComponent(isSelected, jsx(FormattedMessage, messages.
|
|
67
|
+
return _this.getBylineComponent(isSelected, isVerified ? jsx(FormattedMessage, _extends({}, messages.officialPlus50MembersWithYou, {
|
|
68
|
+
values: {
|
|
69
|
+
verifiedIcon: _this.renderVerifiedIcon()
|
|
70
|
+
}
|
|
71
|
+
})) : jsx(FormattedMessage, messages.plus50MembersWithYou));
|
|
63
72
|
} else {
|
|
64
|
-
return _this.getBylineComponent(isSelected, jsx(FormattedMessage, _extends({}, messages.
|
|
73
|
+
return _this.getBylineComponent(isSelected, isVerified ? jsx(FormattedMessage, _extends({}, messages.officialMemberCountWithYou, {
|
|
74
|
+
values: {
|
|
75
|
+
verifiedIcon: _this.renderVerifiedIcon(),
|
|
76
|
+
count: memberCount
|
|
77
|
+
}
|
|
78
|
+
})) : jsx(FormattedMessage, _extends({}, messages.memberCountWithYou, {
|
|
65
79
|
values: {
|
|
66
80
|
count: memberCount
|
|
67
81
|
}
|
|
@@ -69,9 +83,18 @@ export var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
69
83
|
}
|
|
70
84
|
} else {
|
|
71
85
|
if (memberCount > 50) {
|
|
72
|
-
return _this.getBylineComponent(isSelected, jsx(FormattedMessage, messages.
|
|
86
|
+
return _this.getBylineComponent(isSelected, isVerified ? jsx(FormattedMessage, _extends({}, messages.officialPlus50MembersWithoutYou, {
|
|
87
|
+
values: {
|
|
88
|
+
verifiedIcon: _this.renderVerifiedIcon()
|
|
89
|
+
}
|
|
90
|
+
})) : jsx(FormattedMessage, messages.plus50MembersWithoutYou));
|
|
73
91
|
} else {
|
|
74
|
-
return _this.getBylineComponent(isSelected, jsx(FormattedMessage, _extends({}, messages.
|
|
92
|
+
return _this.getBylineComponent(isSelected, isVerified ? jsx(FormattedMessage, _extends({}, messages.officialMemberCountWithoutYou, {
|
|
93
|
+
values: {
|
|
94
|
+
verifiedIcon: _this.renderVerifiedIcon(),
|
|
95
|
+
count: memberCount
|
|
96
|
+
}
|
|
97
|
+
})) : jsx(FormattedMessage, _extends({}, messages.memberCountWithoutYou, {
|
|
75
98
|
values: {
|
|
76
99
|
count: memberCount
|
|
77
100
|
}
|
|
@@ -95,14 +118,24 @@ export var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
95
118
|
type: "team"
|
|
96
119
|
});
|
|
97
120
|
});
|
|
121
|
+
_defineProperty(_this, "renderVerifiedIcon", function () {
|
|
122
|
+
if (_this.props.team.verified) {
|
|
123
|
+
return jsx(VerifiedTeamIcon, {
|
|
124
|
+
label: "",
|
|
125
|
+
size: "small",
|
|
126
|
+
spacing: "none"
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
});
|
|
98
131
|
_defineProperty(_this, "getLozengeProps", function () {
|
|
99
132
|
return typeof _this.props.team.lozenge === 'string' ? {
|
|
100
133
|
text: _this.props.team.lozenge
|
|
101
134
|
} : _this.props.team.lozenge;
|
|
102
135
|
});
|
|
103
136
|
_defineProperty(_this, "renderCustomByLine", function () {
|
|
104
|
-
var _this$props$
|
|
105
|
-
if (!((_this$props$
|
|
137
|
+
var _this$props$team2;
|
|
138
|
+
if (!((_this$props$team2 = _this.props.team) !== null && _this$props$team2 !== void 0 && _this$props$team2.byline)) {
|
|
106
139
|
return undefined;
|
|
107
140
|
}
|
|
108
141
|
return jsx("span", {
|
|
@@ -70,7 +70,9 @@ export var UserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component)
|
|
|
70
70
|
_this$props$required = _this$props.required,
|
|
71
71
|
required = _this$props$required === void 0 ? false : _this$props$required,
|
|
72
72
|
_this$props$showClear = _this$props.showClearIndicator,
|
|
73
|
-
showClearIndicator = _this$props$showClear === void 0 ? false : _this$props$showClear
|
|
73
|
+
showClearIndicator = _this$props$showClear === void 0 ? false : _this$props$showClear,
|
|
74
|
+
_this$props$includeTe = _this$props.includeTeamsUpdates,
|
|
75
|
+
includeTeamsUpdates = _this$props$includeTe === void 0 ? false : _this$props$includeTe;
|
|
74
76
|
var width = this.props.width;
|
|
75
77
|
var SelectComponent = allowEmail ? CreatableSelect : Select;
|
|
76
78
|
var creatableProps = suggestEmailsForDomain ? getCreatableSuggestedEmailProps(suggestEmailsForDomain, isValidEmail) : getCreatableProps(isValidEmail);
|
|
@@ -80,7 +82,8 @@ export var UserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component)
|
|
|
80
82
|
menuPosition: menuPosition,
|
|
81
83
|
menuShouldBlockScroll: menuShouldBlockScroll,
|
|
82
84
|
captureMenuScroll: captureMenuScroll,
|
|
83
|
-
required: required
|
|
85
|
+
required: required,
|
|
86
|
+
includeTeamsUpdates: includeTeamsUpdates
|
|
84
87
|
};
|
|
85
88
|
var pickerProps = allowEmail ? _objectSpread(_objectSpread(_objectSpread({}, defaultPickerProps), creatableProps), {}, {
|
|
86
89
|
emailLabel: emailLabel
|
|
@@ -25,6 +25,26 @@ export var messages = defineMessages({
|
|
|
25
25
|
defaultMessage: 'Something went wrong',
|
|
26
26
|
description: 'Error message to display when options fail to load.'
|
|
27
27
|
},
|
|
28
|
+
teamByline: {
|
|
29
|
+
id: 'fabric.elements.user-picker.team.byline',
|
|
30
|
+
defaultMessage: 'Team',
|
|
31
|
+
description: 'Byline for team'
|
|
32
|
+
},
|
|
33
|
+
officialTeamByline: {
|
|
34
|
+
id: 'fabric.elements.user-picker.team.byline.official',
|
|
35
|
+
defaultMessage: 'Official team {verifiedIcon}',
|
|
36
|
+
description: 'Byline for official team'
|
|
37
|
+
},
|
|
38
|
+
officialMemberCountWithoutYou: {
|
|
39
|
+
id: 'fabric.elements.user-picker.team.member.count.official',
|
|
40
|
+
defaultMessage: 'Official team {verifiedIcon} • {count} {count, plural, one {member} other {members}}',
|
|
41
|
+
description: 'Byline to show the number of members in the team when the current user is not a member of the team'
|
|
42
|
+
},
|
|
43
|
+
officialMemberCountWithYou: {
|
|
44
|
+
id: 'fabric.elements.user-picker.team.member.count.official.including.you',
|
|
45
|
+
defaultMessage: 'Official team {verifiedIcon} • {count} {count, plural, one {member} other {members}}, including you',
|
|
46
|
+
description: 'Byline to show the number of members in the team when the current user is also a member of the team'
|
|
47
|
+
},
|
|
28
48
|
memberCountWithoutYou: {
|
|
29
49
|
id: 'fabric.elements.user-picker.team.member.count',
|
|
30
50
|
defaultMessage: 'Team • {count} {count, plural, one {member} other {members}}',
|
|
@@ -35,6 +55,16 @@ export var messages = defineMessages({
|
|
|
35
55
|
defaultMessage: 'Team • {count} {count, plural, one {member} other {members}}, including you',
|
|
36
56
|
description: 'Byline to show the number of members in the team when the current user is also a member of the team'
|
|
37
57
|
},
|
|
58
|
+
officialPlus50MembersWithoutYou: {
|
|
59
|
+
id: 'fabric.elements.user-picker.team.member.50plus.official',
|
|
60
|
+
defaultMessage: 'Official team {verifiedIcon} • 50+ members',
|
|
61
|
+
description: 'Byline to show the number of members in the team when the number exceeds 50'
|
|
62
|
+
},
|
|
63
|
+
officialPlus50MembersWithYou: {
|
|
64
|
+
id: 'fabric.elements.user-picker.team.member.50plus.official.including.you',
|
|
65
|
+
defaultMessage: 'Official team {verifiedIcon} • 50+ members, including you',
|
|
66
|
+
description: 'Byline to show the number of members in the team when the number exceeds 50 and also includes the current user'
|
|
67
|
+
},
|
|
38
68
|
plus50MembersWithoutYou: {
|
|
39
69
|
id: 'fabric.elements.user-picker.team.member.50plus',
|
|
40
70
|
defaultMessage: 'Team • 50+ members',
|
|
@@ -60,6 +90,11 @@ export var messages = defineMessages({
|
|
|
60
90
|
defaultMessage: 'Enter an email address',
|
|
61
91
|
description: 'Byline for a potentially valid email option.'
|
|
62
92
|
},
|
|
93
|
+
adminManagedGroupByline: {
|
|
94
|
+
id: 'fabric.elements.user-picker.group.byline.admin-managed',
|
|
95
|
+
defaultMessage: 'Admin group {verifiedIcon}',
|
|
96
|
+
description: 'Byline for admin-managed groups with verified icon'
|
|
97
|
+
},
|
|
63
98
|
groupByline: {
|
|
64
99
|
id: 'fabric.elements.user-picker.group.byline',
|
|
65
100
|
defaultMessage: 'Admin-managed group',
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { isValidEmail } from './components/emailValidation';
|
|
2
2
|
export { UserPicker as default } from './components/UserPicker';
|
|
3
3
|
export { PopupUserPicker } from './components/PopupUserPicker';
|
|
4
|
+
export { SingleValue } from './components/SingleValue';
|
|
4
5
|
export { isEmail, isExternalUser, isTeam, isUser, isGroup } from './components/utils';
|
|
5
6
|
export {
|
|
6
7
|
// Constants
|
|
@@ -88,6 +88,7 @@ export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
88
88
|
groupByTypeOrder?: NonNullable<OptionData["type"]>[];
|
|
89
89
|
header?: React.ReactNode;
|
|
90
90
|
height?: number | string;
|
|
91
|
+
includeTeamsUpdates?: boolean;
|
|
91
92
|
inputId?: string;
|
|
92
93
|
isClearable?: boolean;
|
|
93
94
|
isDisabled?: boolean;
|
|
@@ -150,7 +151,7 @@ export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
150
151
|
*/
|
|
151
152
|
UNSAFE_hasDraggableParentComponent?: boolean;
|
|
152
153
|
width: string | number;
|
|
153
|
-
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "placeholder" | "isDisabled" | "onChange" | "onInputChange" | "value" | "appearance" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isInvalid" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onFocus" | "onKeyDown" | "options" | "styles" | "required" | "footer" | "defaultValue" | "search" | "anchor" | "addMoreMessage" | "allowEmail" | "ariaDescribedBy" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "clearValueLabel" | "disableInput" | "emailLabel" | "fieldId" | "forwardedRef" | "groupByTypeOrder" | "header" | "height" | "isValidEmail" | "loadOptions" | "loadUserSource" | "maxOptions" | "maxPickerHeight" | "menuMinWidth" | "onClear" | "onClose" | "onOpen" | "onSelection" | "open" | "placeholderAvatar" | "popupSelectProps" | "showClearIndicator" | "strategy" | "suggestEmailsForDomain" | "UNSAFE_hasDraggableParentComponent" | "width" | "pickerProps" | "SelectComponent"> & {
|
|
154
|
+
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "placeholder" | "isDisabled" | "onChange" | "onInputChange" | "value" | "appearance" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isInvalid" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onFocus" | "onKeyDown" | "options" | "styles" | "required" | "footer" | "defaultValue" | "search" | "anchor" | "addMoreMessage" | "allowEmail" | "ariaDescribedBy" | "ariaLabel" | "ariaLabelledBy" | "ariaLive" | "clearValueLabel" | "disableInput" | "emailLabel" | "fieldId" | "forwardedRef" | "groupByTypeOrder" | "header" | "height" | "includeTeamsUpdates" | "isValidEmail" | "loadOptions" | "loadUserSource" | "maxOptions" | "maxPickerHeight" | "menuMinWidth" | "onClear" | "onClose" | "onOpen" | "onSelection" | "open" | "placeholderAvatar" | "popupSelectProps" | "showClearIndicator" | "strategy" | "suggestEmailsForDomain" | "UNSAFE_hasDraggableParentComponent" | "width" | "pickerProps" | "SelectComponent"> & {
|
|
154
155
|
isClearable?: boolean | undefined;
|
|
155
156
|
isMulti?: boolean | undefined;
|
|
156
157
|
openMenuOnClick?: boolean | undefined;
|
|
@@ -8,11 +8,13 @@ import { type Group } from '../../types';
|
|
|
8
8
|
export declare const groupOptionIconWrapper: import("@emotion/react").SerializedStyles;
|
|
9
9
|
export type GroupOptionProps = {
|
|
10
10
|
group: Group;
|
|
11
|
+
includeTeamsUpdates?: boolean;
|
|
11
12
|
isSelected: boolean;
|
|
12
13
|
};
|
|
13
14
|
export declare class GroupOption extends React.PureComponent<GroupOptionProps> {
|
|
14
15
|
private getPrimaryText;
|
|
15
16
|
private renderAvatar;
|
|
17
|
+
private renderVerifiedIcon;
|
|
16
18
|
private renderByline;
|
|
17
19
|
private getLozengeProps;
|
|
18
20
|
render(): jsx.JSX.Element;
|
|
@@ -42,6 +42,7 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
42
42
|
groupByTypeOrder?: NonNullable<import("../types").OptionData["type"]>[];
|
|
43
43
|
header?: React.ReactNode;
|
|
44
44
|
height?: number | string;
|
|
45
|
+
includeTeamsUpdates?: boolean;
|
|
45
46
|
inputId?: string;
|
|
46
47
|
isClearable?: boolean;
|
|
47
48
|
isDisabled?: boolean;
|
|
@@ -149,6 +150,7 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
149
150
|
groupByTypeOrder?: NonNullable<import("../types").OptionData["type"]>[] | undefined;
|
|
150
151
|
header?: React.ReactNode;
|
|
151
152
|
height?: number | string | undefined;
|
|
153
|
+
includeTeamsUpdates?: boolean | undefined;
|
|
152
154
|
isValidEmail?: import("./emailValidation").EmailValidator | undefined;
|
|
153
155
|
loadOptions?: import("../types").LoadOptions | undefined;
|
|
154
156
|
loadOptionsErrorMessage?: ((value: {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { type Option } from '../types';
|
|
1
|
+
import { type Option, type OptionData } from '../types';
|
|
2
2
|
import { type SingleValueProps } from '@atlaskit/select';
|
|
3
|
-
export type Props = SingleValueProps<Option
|
|
3
|
+
export type Props = SingleValueProps<Option> & {
|
|
4
|
+
shouldShowVerifiedIcon?: (data: OptionData) => boolean;
|
|
5
|
+
};
|
|
4
6
|
export declare const SingleValue: (props: Props) => JSX.Element | null;
|
|
@@ -2,6 +2,7 @@ import { jsx } from '@emotion/react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { type Team } from '../../types';
|
|
4
4
|
export type TeamOptionProps = {
|
|
5
|
+
includeTeamsUpdates?: boolean;
|
|
5
6
|
isSelected: boolean;
|
|
6
7
|
team: Team;
|
|
7
8
|
};
|
|
@@ -10,6 +11,7 @@ export declare class TeamOption extends React.PureComponent<TeamOptionProps> {
|
|
|
10
11
|
private renderByline;
|
|
11
12
|
private getBylineComponent;
|
|
12
13
|
private renderAvatar;
|
|
14
|
+
private renderVerifiedIcon;
|
|
13
15
|
private getLozengeProps;
|
|
14
16
|
private renderCustomByLine;
|
|
15
17
|
render(): jsx.JSX.Element;
|