@atlaskit/user-picker 11.24.0 → 11.25.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 +8 -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 +12 -6
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
6
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
8
|
import Lozenge from '@atlaskit/lozenge';
|
|
9
|
+
import Tag from '@atlaskit/tag';
|
|
9
10
|
import { isLozengeText } from './utils';
|
|
10
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
const AsyncTooltip = /*#__PURE__*/React.lazy(() => import( /* webpackChunkName: "@atlaskit-internal_@atlaskit/tooltip" */'@atlaskit/tooltip').then(module => {
|
|
@@ -106,6 +107,14 @@ export const textWrapper = color => {
|
|
|
106
107
|
color
|
|
107
108
|
});
|
|
108
109
|
};
|
|
110
|
+
const lozengeAppearanceToTagColor = {
|
|
111
|
+
default: 'standard',
|
|
112
|
+
success: 'lime',
|
|
113
|
+
removed: 'red',
|
|
114
|
+
inprogress: 'blue',
|
|
115
|
+
new: 'purple',
|
|
116
|
+
moved: 'orange'
|
|
117
|
+
};
|
|
109
118
|
export const AvatarItemOption = ({
|
|
110
119
|
avatar,
|
|
111
120
|
isDisabled,
|
|
@@ -113,6 +122,26 @@ export const AvatarItemOption = ({
|
|
|
113
122
|
primaryText,
|
|
114
123
|
secondaryText
|
|
115
124
|
}) => {
|
|
125
|
+
const renderTag = () => {
|
|
126
|
+
if (isLozengeText(lozenge) && !lozenge.isBold) {
|
|
127
|
+
const color = lozenge.appearance ? lozengeAppearanceToTagColor[lozenge.appearance] : 'standard';
|
|
128
|
+
const tag = jsx(Tag, {
|
|
129
|
+
text: lozenge.text,
|
|
130
|
+
color: color,
|
|
131
|
+
isRemovable: false,
|
|
132
|
+
migration_fallback: "lozenge"
|
|
133
|
+
});
|
|
134
|
+
if (lozenge.tooltip) {
|
|
135
|
+
return jsx(React.Suspense, {
|
|
136
|
+
fallback: tag
|
|
137
|
+
}, jsx(AsyncTooltip, {
|
|
138
|
+
content: lozenge.tooltip
|
|
139
|
+
}, tag));
|
|
140
|
+
}
|
|
141
|
+
return tag;
|
|
142
|
+
}
|
|
143
|
+
return renderLozenge();
|
|
144
|
+
};
|
|
116
145
|
const renderLozenge = () => {
|
|
117
146
|
if (isLozengeText(lozenge)) {
|
|
118
147
|
if (lozenge !== null && lozenge !== void 0 && lozenge.tooltip) {
|
|
@@ -140,6 +169,6 @@ export const AvatarItemOption = ({
|
|
|
140
169
|
css: getTextStyle(true)
|
|
141
170
|
}, secondaryText))), lozenge && jsx("div", {
|
|
142
171
|
css: additionalInfo
|
|
143
|
-
}, renderLozenge()))
|
|
172
|
+
}, fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? renderTag() : renderLozenge()))
|
|
144
173
|
);
|
|
145
174
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { SizeableAvatar } from './SizeableAvatar';
|
|
7
7
|
import { getAvatarSize } from './utils';
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
const iconStyle = css({
|
|
11
11
|
display: 'flex',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
5
|
import { UFOExperienceState } from '@atlaskit/ufo';
|
|
5
6
|
import debounce from 'lodash/debounce';
|
|
@@ -341,7 +342,7 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
|
|
|
341
342
|
hoveringClearIndicator
|
|
342
343
|
});
|
|
343
344
|
});
|
|
344
|
-
_defineProperty(this, "
|
|
345
|
+
_defineProperty(this, "getOptionsOld", () => {
|
|
345
346
|
const options = getOptions(this.state.options) || [];
|
|
346
347
|
const {
|
|
347
348
|
maxOptions,
|
|
@@ -365,6 +366,34 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
|
|
|
365
366
|
}
|
|
366
367
|
return groupByTypeOrder ? groupOptionsByType(options, groupByTypeOrder) : options;
|
|
367
368
|
});
|
|
369
|
+
_defineProperty(this, "getOptionsNew", () => {
|
|
370
|
+
const options = getOptions(this.state.options) || [];
|
|
371
|
+
const {
|
|
372
|
+
maxOptions,
|
|
373
|
+
isMulti,
|
|
374
|
+
groupByTypeOrder,
|
|
375
|
+
customGroupLabels
|
|
376
|
+
} = this.props;
|
|
377
|
+
if (maxOptions === 0) {
|
|
378
|
+
return [];
|
|
379
|
+
}
|
|
380
|
+
if (maxOptions && maxOptions > 0 && maxOptions < options.length) {
|
|
381
|
+
const {
|
|
382
|
+
value
|
|
383
|
+
} = this.state;
|
|
384
|
+
let filteredOptions = options;
|
|
385
|
+
// Filter out previously selected options
|
|
386
|
+
if (isMulti && Array.isArray(value)) {
|
|
387
|
+
const valueIds = value.map(item => item.data.id);
|
|
388
|
+
filteredOptions = options.filter(option => valueIds.indexOf(option.data.id) === -1);
|
|
389
|
+
}
|
|
390
|
+
return groupByTypeOrder ? groupOptionsByType(filteredOptions.slice(0, maxOptions), groupByTypeOrder, customGroupLabels) : filteredOptions.slice(0, maxOptions);
|
|
391
|
+
}
|
|
392
|
+
return groupByTypeOrder ? groupOptionsByType(options, groupByTypeOrder, customGroupLabels) : options;
|
|
393
|
+
});
|
|
394
|
+
_defineProperty(this, "getOptions", () => {
|
|
395
|
+
return fg('jsm-wfo-assignee-recommendation-on-queues') ? this.getOptionsNew() : this.getOptionsOld();
|
|
396
|
+
});
|
|
368
397
|
_defineProperty(this, "getAppearance", () => this.props.appearance ? this.props.appearance : 'normal');
|
|
369
398
|
_defineProperty(this, "handleClickDraggableParentComponent", () => {
|
|
370
399
|
if (this.state.initialFocusHandled) {
|
|
@@ -4,7 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
6
|
import { B400, N800, N200 } from '@atlaskit/theme/colors';
|
|
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 { jsx } from '@emotion/react';
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { AvatarItemOption, textWrapper } from '../AvatarItemOption';
|
|
@@ -6,7 +6,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
8
|
import { B400, N200, N800 } from '@atlaskit/theme/colors';
|
|
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 { jsx } from '@emotion/react';
|
|
11
11
|
import { AddOptionAvatar } from '../AddOptionAvatar';
|
|
12
12
|
import { AvatarItemOption, textWrapper } from '../AvatarItemOption';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
6
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
8
|
import { B400 } from '@atlaskit/theme/colors';
|
|
9
9
|
const outerWrapper = isDisabled => css({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { useCallback, useState } from 'react';
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
6
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
8
|
import EditorPanelIcon from '@atlaskit/icon/core/status-information';
|
|
9
9
|
import { N50, N200 } from '@atlaskit/theme/colors';
|
|
@@ -6,7 +6,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { FormattedMessage } from 'react-intl-next';
|
|
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 { N20, B400, N800, N200 } from '@atlaskit/theme/colors';
|
|
12
12
|
import PeopleIcon from '@atlaskit/icon/core/people-group';
|
|
@@ -12,14 +12,17 @@ import { components } from '@atlaskit/select';
|
|
|
12
12
|
import { css, jsx } from '@emotion/react';
|
|
13
13
|
import Avatar from '@atlaskit/avatar';
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
|
-
import { AvatarTag } from '@atlaskit/tag';
|
|
15
|
+
import { AvatarTag, default as Tag } from '@atlaskit/tag';
|
|
16
16
|
import TeamAvatar from '@atlaskit/teams-avatar';
|
|
17
17
|
import { AddOptionAvatar } from './AddOptionAvatar';
|
|
18
18
|
import { AvatarOrIcon } from './AvatarOrIcon';
|
|
19
19
|
import { SizeableAvatar } from './SizeableAvatar';
|
|
20
20
|
import { getAvatarUrl, isEmail, isGroup, isTeam } from './utils';
|
|
21
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
21
22
|
import PeopleIcon from '@atlaskit/icon/core/people-group';
|
|
22
23
|
import { VerifiedTeamIcon } from '@atlaskit/people-teams-ui-public/verified-team-icon';
|
|
24
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
25
|
+
import { messages } from './i18n';
|
|
23
26
|
export const scrollToValue = (valueContainer, control) => {
|
|
24
27
|
const {
|
|
25
28
|
top,
|
|
@@ -42,6 +45,10 @@ const groupTagContainerOld = xcss({
|
|
|
42
45
|
const groupTagContainer = xcss({
|
|
43
46
|
paddingLeft: 'space.050'
|
|
44
47
|
});
|
|
48
|
+
const archivedLozengeWrapper = xcss({
|
|
49
|
+
display: 'flex',
|
|
50
|
+
paddingLeft: 'space.050'
|
|
51
|
+
});
|
|
45
52
|
const iconStyle = css({
|
|
46
53
|
display: 'flex',
|
|
47
54
|
alignItems: 'center',
|
|
@@ -105,11 +112,19 @@ export class MultiValue extends React.Component {
|
|
|
105
112
|
data
|
|
106
113
|
}
|
|
107
114
|
} = this.props;
|
|
115
|
+
const canShowArchivedLozenge = isTeam(data) && (data === null || data === void 0 ? void 0 : data.state) === 'DISBANDED' && fg('enable-sup-archive-experience');
|
|
108
116
|
if (isGroup(data) && data.includeTeamsUpdates || isTeam(data) && data.verified) {
|
|
109
117
|
return jsx(VerifiedTeamIcon, {
|
|
110
118
|
size: data.includeTeamsUpdates ? 'small' : 'medium'
|
|
111
119
|
});
|
|
112
120
|
}
|
|
121
|
+
if (canShowArchivedLozenge) {
|
|
122
|
+
return jsx(Box, {
|
|
123
|
+
xcss: archivedLozengeWrapper
|
|
124
|
+
}, jsx(Lozenge, {
|
|
125
|
+
appearance: "default"
|
|
126
|
+
}, jsx(FormattedMessage, messages.archivedLozenge)));
|
|
127
|
+
}
|
|
113
128
|
return null;
|
|
114
129
|
});
|
|
115
130
|
this.containerRef = /*#__PURE__*/React.createRef();
|
|
@@ -168,6 +183,7 @@ export class MultiValue extends React.Component {
|
|
|
168
183
|
const isEmailOption = isEmail(data);
|
|
169
184
|
const avatarUrl = getAvatarUrl(data);
|
|
170
185
|
const isDisabled = Boolean((_this$props$selectPro = this.props.selectProps) === null || _this$props$selectPro === void 0 ? void 0 : _this$props$selectPro.isDisabled);
|
|
186
|
+
const canShowArchivedLozenge = isTeam(data) && (data === null || data === void 0 ? void 0 : data.state) === 'DISBANDED' && fg('enable-sup-archive-experience');
|
|
171
187
|
const avatarProps = avatarUrl ? {
|
|
172
188
|
name: data.name,
|
|
173
189
|
src: avatarUrl
|
|
@@ -179,64 +195,52 @@ export class MultiValue extends React.Component {
|
|
|
179
195
|
return true;
|
|
180
196
|
};
|
|
181
197
|
if (isEmailOption) {
|
|
182
|
-
const emailAvatar = props => jsx(Avatar, _extends({}, props, {
|
|
183
|
-
children: jsx(AddOptionAvatar, {
|
|
184
|
-
isLozenge: true,
|
|
185
|
-
isPendingAction: data.isPendingAction
|
|
186
|
-
})
|
|
187
|
-
}));
|
|
188
198
|
return jsx("span", {
|
|
189
199
|
ref: this.containerRef,
|
|
190
200
|
css: avatarTagWrapperStyle,
|
|
191
201
|
"data-user-picker-multi-value": true
|
|
192
|
-
}, jsx(
|
|
202
|
+
}, jsx(Tag, {
|
|
193
203
|
text: label,
|
|
194
|
-
|
|
195
|
-
|
|
204
|
+
elemBefore: jsx(AddOptionAvatar, {
|
|
205
|
+
isLozenge: true,
|
|
206
|
+
isPendingAction: data.isPendingAction
|
|
207
|
+
}),
|
|
196
208
|
isRemovable: !isDisabled,
|
|
197
209
|
onBeforeRemoveAction: removeAction
|
|
198
210
|
}));
|
|
199
211
|
}
|
|
200
212
|
if (isGroupOption) {
|
|
201
|
-
|
|
202
|
-
|
|
213
|
+
return jsx("span", {
|
|
214
|
+
ref: this.containerRef,
|
|
215
|
+
css: avatarTagWrapperStyle,
|
|
216
|
+
"data-user-picker-multi-value": true
|
|
217
|
+
}, jsx(Tag, {
|
|
218
|
+
text: label,
|
|
219
|
+
elemBefore: jsx(Box, {
|
|
203
220
|
xcss: groupTagContainer
|
|
204
221
|
}, jsx(PeopleIcon, {
|
|
205
222
|
color: "currentColor",
|
|
206
223
|
label: "" // This element is a decorative icon and does not require a label
|
|
207
224
|
,
|
|
208
225
|
size: "small"
|
|
209
|
-
}))
|
|
226
|
+
})),
|
|
227
|
+
isRemovable: !isDisabled,
|
|
228
|
+
onBeforeRemoveAction: removeAction
|
|
210
229
|
}));
|
|
230
|
+
}
|
|
231
|
+
if (data.icon) {
|
|
211
232
|
return jsx("span", {
|
|
212
233
|
ref: this.containerRef,
|
|
213
234
|
css: avatarTagWrapperStyle,
|
|
214
235
|
"data-user-picker-multi-value": true
|
|
215
|
-
}, jsx(
|
|
216
|
-
type: "other",
|
|
236
|
+
}, jsx(Tag, {
|
|
217
237
|
text: label,
|
|
218
|
-
|
|
219
|
-
isRemovable: !isDisabled,
|
|
220
|
-
onBeforeRemoveAction: removeAction,
|
|
221
|
-
avatar: groupAvatar
|
|
222
|
-
}));
|
|
223
|
-
}
|
|
224
|
-
if (data.icon) {
|
|
225
|
-
const iconAvatar = props => jsx(Avatar, _extends({}, props, {
|
|
226
|
-
children: jsx("div", {
|
|
238
|
+
elemBefore: jsx("div", {
|
|
227
239
|
css: iconStyle,
|
|
228
240
|
style: {
|
|
229
241
|
color: data.iconColor
|
|
230
242
|
}
|
|
231
|
-
}, data.icon)
|
|
232
|
-
}));
|
|
233
|
-
return jsx("span", {
|
|
234
|
-
css: avatarTagWrapperStyle,
|
|
235
|
-
"data-user-picker-multi-value": true
|
|
236
|
-
}, jsx(AvatarTag, {
|
|
237
|
-
text: label,
|
|
238
|
-
type: isTeamOption ? 'other' : 'user',
|
|
239
|
-
avatar: iconAvatar,
|
|
243
|
+
}, data.icon),
|
|
240
244
|
isRemovable: !isDisabled,
|
|
241
245
|
onBeforeRemoveAction: removeAction
|
|
242
246
|
}));
|
|
@@ -245,14 +249,18 @@ export class MultiValue extends React.Component {
|
|
|
245
249
|
ref: this.containerRef,
|
|
246
250
|
css: avatarTagWrapperStyle,
|
|
247
251
|
"data-user-picker-multi-value": true
|
|
248
|
-
}, isTeamOption ? jsx(AvatarTag, {
|
|
252
|
+
}, isTeamOption ? jsx(React.Fragment, null, jsx(AvatarTag, {
|
|
249
253
|
type: "other",
|
|
250
254
|
text: label,
|
|
251
255
|
isVerified: isTeamOption ? data.verified : undefined,
|
|
252
256
|
isRemovable: !isDisabled,
|
|
253
257
|
onBeforeRemoveAction: removeAction,
|
|
254
258
|
avatar: props => jsx(TeamAvatar, _extends({}, props, avatarProps))
|
|
255
|
-
})
|
|
259
|
+
}), canShowArchivedLozenge ? jsx(Box, {
|
|
260
|
+
xcss: archivedLozengeWrapper
|
|
261
|
+
}, jsx(Lozenge, {
|
|
262
|
+
appearance: "default"
|
|
263
|
+
}, jsx(FormattedMessage, messages.archivedLozenge))) : null) : jsx(AvatarTag, {
|
|
256
264
|
type: "user",
|
|
257
265
|
text: label,
|
|
258
266
|
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
|
const 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
|
const ElementAfter = props => {
|
|
19
23
|
const {
|
|
@@ -42,6 +46,7 @@ export const SingleValue = props => {
|
|
|
42
46
|
isFocused
|
|
43
47
|
}
|
|
44
48
|
} = props;
|
|
49
|
+
const canShowArchivedLozenge = isTeam(data) && (data === null || data === void 0 ? void 0 : data.state) === 'DISBANDED' && fg('enable-sup-archive-experience');
|
|
45
50
|
return !isFocused ? /*#__PURE__*/React.createElement(components.SingleValue, props, /*#__PURE__*/React.createElement(Flex, {
|
|
46
51
|
xcss: styles.avatarItem
|
|
47
52
|
}, data.icon ? /*#__PURE__*/React.createElement(AvatarOrIcon, {
|
|
@@ -64,5 +69,9 @@ export const SingleValue = props => {
|
|
|
64
69
|
xcss: styles.avatarItemText
|
|
65
70
|
}, /*#__PURE__*/React.createElement(Inline, {
|
|
66
71
|
alignBlock: "center"
|
|
67
|
-
}, label, /*#__PURE__*/React.createElement(
|
|
72
|
+
}, label, canShowArchivedLozenge ? /*#__PURE__*/React.createElement(Box, {
|
|
73
|
+
xcss: styles.archivedLozengeWrapper
|
|
74
|
+
}, /*#__PURE__*/React.createElement(Lozenge, {
|
|
75
|
+
appearance: "default"
|
|
76
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.archivedLozenge))) : null, /*#__PURE__*/React.createElement(ElementAfter, props))))))) : null;
|
|
68
77
|
};
|
|
@@ -170,6 +170,11 @@ export const 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',
|
|
@@ -3,7 +3,7 @@ import { CustomType, EmailType, TeamType, GroupType, UserType, ExternalUserType
|
|
|
3
3
|
import { PopupSelect } from '@atlaskit/select';
|
|
4
4
|
export const isExternalUser = option => option.type === ExternalUserType || Boolean(option.isExternal);
|
|
5
5
|
export const isUser = option => option.type === undefined || option.type === UserType;
|
|
6
|
-
export const isTeam = option => option.type === TeamType;
|
|
6
|
+
export const isTeam = option => (option === null || option === void 0 ? void 0 : option.type) === TeamType;
|
|
7
7
|
export const isGroup = option => option.type === GroupType;
|
|
8
8
|
export const isEmail = option => option.type === EmailType;
|
|
9
9
|
export const isCustom = option => option.type === CustomType;
|
|
@@ -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
|
-
const getLabelForType = type => {
|
|
6
|
+
const 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 @@ const getLabelForType = type => {
|
|
|
18
22
|
return /*#__PURE__*/React.createElement(FormattedMessage, messages.otherTypeLabel);
|
|
19
23
|
}
|
|
20
24
|
};
|
|
21
|
-
export const groupOptionsByType = memoizeOne((options, groupByTypeOrder) => {
|
|
25
|
+
export const groupOptionsByType = memoizeOne((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 const groupOptionsByType = memoizeOne((options, groupByTypeOrder) => {
|
|
|
38
42
|
groupByTypeOrder.forEach(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);
|
package/dist/esm/analytics.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
4
5
|
import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
5
6
|
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
6
7
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
7
8
|
import { v4 as uuidv4 } from 'uuid';
|
|
8
9
|
import { isCustom, isExternalUser } from './components/utils';
|
|
9
10
|
var packageName = "@atlaskit/user-picker";
|
|
10
|
-
var packageVersion = "
|
|
11
|
+
var packageVersion = "0.0.0-development";
|
|
11
12
|
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}$/;
|
|
12
13
|
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}$/;
|
|
13
14
|
var UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
|
|
@@ -6,9 +6,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
* @jsx jsx
|
|
7
7
|
*/
|
|
8
8
|
import React from 'react';
|
|
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 Lozenge from '@atlaskit/lozenge';
|
|
12
|
+
import Tag from '@atlaskit/tag';
|
|
12
13
|
import { isLozengeText } from './utils';
|
|
13
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
var AsyncTooltip = /*#__PURE__*/React.lazy(function () {
|
|
@@ -107,12 +108,40 @@ export var textWrapper = function textWrapper(color) {
|
|
|
107
108
|
color: color
|
|
108
109
|
});
|
|
109
110
|
};
|
|
111
|
+
var lozengeAppearanceToTagColor = {
|
|
112
|
+
default: 'standard',
|
|
113
|
+
success: 'lime',
|
|
114
|
+
removed: 'red',
|
|
115
|
+
inprogress: 'blue',
|
|
116
|
+
new: 'purple',
|
|
117
|
+
moved: 'orange'
|
|
118
|
+
};
|
|
110
119
|
export var AvatarItemOption = function AvatarItemOption(_ref) {
|
|
111
120
|
var avatar = _ref.avatar,
|
|
112
121
|
isDisabled = _ref.isDisabled,
|
|
113
122
|
lozenge = _ref.lozenge,
|
|
114
123
|
primaryText = _ref.primaryText,
|
|
115
124
|
secondaryText = _ref.secondaryText;
|
|
125
|
+
var renderTag = function renderTag() {
|
|
126
|
+
if (isLozengeText(lozenge) && !lozenge.isBold) {
|
|
127
|
+
var color = lozenge.appearance ? lozengeAppearanceToTagColor[lozenge.appearance] : 'standard';
|
|
128
|
+
var tag = jsx(Tag, {
|
|
129
|
+
text: lozenge.text,
|
|
130
|
+
color: color,
|
|
131
|
+
isRemovable: false,
|
|
132
|
+
migration_fallback: "lozenge"
|
|
133
|
+
});
|
|
134
|
+
if (lozenge.tooltip) {
|
|
135
|
+
return jsx(React.Suspense, {
|
|
136
|
+
fallback: tag
|
|
137
|
+
}, jsx(AsyncTooltip, {
|
|
138
|
+
content: lozenge.tooltip
|
|
139
|
+
}, tag));
|
|
140
|
+
}
|
|
141
|
+
return tag;
|
|
142
|
+
}
|
|
143
|
+
return renderLozenge();
|
|
144
|
+
};
|
|
116
145
|
var renderLozenge = function renderLozenge() {
|
|
117
146
|
if (isLozengeText(lozenge)) {
|
|
118
147
|
if (lozenge !== null && lozenge !== void 0 && lozenge.tooltip) {
|
|
@@ -140,6 +169,6 @@ export var AvatarItemOption = function AvatarItemOption(_ref) {
|
|
|
140
169
|
css: getTextStyle(true)
|
|
141
170
|
}, secondaryText))), lozenge && jsx("div", {
|
|
142
171
|
css: additionalInfo
|
|
143
|
-
}, renderLozenge()))
|
|
172
|
+
}, fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? renderTag() : renderLozenge()))
|
|
144
173
|
);
|
|
145
174
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { SizeableAvatar } from './SizeableAvatar';
|
|
7
7
|
import { getAvatarSize } from './utils';
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
var iconStyle = css({
|
|
11
11
|
display: 'flex',
|