@atlaskit/user-picker 11.2.3 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/components/AvatarItemOption.js +2 -2
- package/dist/cjs/components/BaseUserPicker.js +6 -3
- package/dist/cjs/components/i18n.js +35 -0
- package/dist/cjs/util/group-options-by-type/index.js +55 -0
- package/dist/es2019/components/AvatarItemOption.js +2 -2
- package/dist/es2019/components/BaseUserPicker.js +6 -3
- package/dist/es2019/components/i18n.js +35 -0
- package/dist/es2019/util/group-options-by-type/index.js +48 -0
- package/dist/esm/components/AvatarItemOption.js +2 -2
- package/dist/esm/components/BaseUserPicker.js +6 -3
- package/dist/esm/components/i18n.js +35 -0
- package/dist/esm/util/group-options-by-type/index.js +48 -0
- package/dist/types/components/BaseUserPicker.d.ts +9 -3
- package/dist/types/components/PopupUserPicker.d.ts +7 -5
- package/dist/types/components/UserPicker.d.ts +4 -3
- package/dist/types/components/components.d.ts +3 -2
- package/dist/types/components/i18n.d.ts +35 -0
- package/dist/types/components/popup.d.ts +1 -1
- package/dist/types/types.d.ts +6 -0
- package/dist/types/util/group-options-by-type/index.d.ts +2 -0
- package/dist/types-ts4.5/components/BaseUserPicker.d.ts +9 -3
- package/dist/types-ts4.5/components/PopupUserPicker.d.ts +7 -5
- package/dist/types-ts4.5/components/UserPicker.d.ts +4 -3
- package/dist/types-ts4.5/components/components.d.ts +3 -2
- package/dist/types-ts4.5/components/i18n.d.ts +35 -0
- package/dist/types-ts4.5/components/popup.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +6 -0
- package/dist/types-ts4.5/util/group-options-by-type/index.d.ts +2 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/user-picker
|
|
2
2
|
|
|
3
|
+
## 11.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#175242](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/175242)
|
|
8
|
+
[`f01b0e8dbc8ba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f01b0e8dbc8ba) -
|
|
9
|
+
[ux] add a new props: groupByTypeOrder to allow group the options by type
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 11.2.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -45,7 +45,6 @@ var wrapper = function wrapper(isDisabled) {
|
|
|
45
45
|
var optionWrapper = (0, _react2.css)({
|
|
46
46
|
maxWidth: '100%',
|
|
47
47
|
minWidth: 0,
|
|
48
|
-
flex: '1 1 100%',
|
|
49
48
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
50
49
|
lineHeight: '1.4',
|
|
51
50
|
paddingLeft: "var(--ds-space-100, 8px)"
|
|
@@ -62,7 +61,8 @@ var getTextStyle = function getTextStyle(isSecondary) {
|
|
|
62
61
|
}, secondaryCssArgs));
|
|
63
62
|
};
|
|
64
63
|
var additionalInfo = (0, _react2.css)({
|
|
65
|
-
float: 'right'
|
|
64
|
+
float: 'right',
|
|
65
|
+
marginLeft: "var(--ds-space-100, 8px)"
|
|
66
66
|
});
|
|
67
67
|
var textWrapper = exports.textWrapper = function textWrapper(color) {
|
|
68
68
|
return (0, _react2.css)({
|
|
@@ -13,6 +13,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
13
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _ufo = require("@atlaskit/ufo");
|
|
17
18
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
18
19
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -22,6 +23,7 @@ var _analytics = require("../analytics");
|
|
|
22
23
|
var _batch = require("./batch");
|
|
23
24
|
var _i18n = require("./i18n");
|
|
24
25
|
var _utils = require("./utils");
|
|
26
|
+
var _groupOptionsByType = require("../util/group-options-by-type");
|
|
25
27
|
var _ufoExperiences = require("../util/ufoExperiences");
|
|
26
28
|
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; }
|
|
27
29
|
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) { (0, _defineProperty2.default)(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; }
|
|
@@ -332,7 +334,8 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
|
|
|
332
334
|
var options = (0, _utils.getOptions)(_this.state.options) || [];
|
|
333
335
|
var _this$props2 = _this.props,
|
|
334
336
|
maxOptions = _this$props2.maxOptions,
|
|
335
|
-
isMulti = _this$props2.isMulti
|
|
337
|
+
isMulti = _this$props2.isMulti,
|
|
338
|
+
groupByTypeOrder = _this$props2.groupByTypeOrder;
|
|
336
339
|
if (maxOptions === 0) {
|
|
337
340
|
return [];
|
|
338
341
|
}
|
|
@@ -348,9 +351,9 @@ var BaseUserPickerWithoutAnalytics = exports.BaseUserPickerWithoutAnalytics = /*
|
|
|
348
351
|
return valueIds.indexOf(option.data.id) === -1;
|
|
349
352
|
});
|
|
350
353
|
}
|
|
351
|
-
return filteredOptions.slice(0, maxOptions);
|
|
354
|
+
return groupByTypeOrder && (0, _platformFeatureFlags.fg)('support_group_by_type_for_user_picker') ? (0, _groupOptionsByType.groupOptionsByType)(filteredOptions.slice(0, maxOptions), groupByTypeOrder) : filteredOptions.slice(0, maxOptions);
|
|
352
355
|
}
|
|
353
|
-
return options;
|
|
356
|
+
return groupByTypeOrder && (0, _platformFeatureFlags.fg)('support_group_by_type_for_user_picker') ? (0, _groupOptionsByType.groupOptionsByType)(options, groupByTypeOrder) : options;
|
|
354
357
|
});
|
|
355
358
|
(0, _defineProperty2.default)(_this, "getAppearance", function () {
|
|
356
359
|
return _this.props.appearance ? _this.props.appearance : 'normal';
|
|
@@ -135,5 +135,40 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
|
135
135
|
id: 'fabric.elements.user-picker.guest.lozenge.tooltip.group',
|
|
136
136
|
defaultMessage: 'Guest groups can only access certain spaces and have limited access to user info.',
|
|
137
137
|
description: 'Tooltip text for lozenge showing that a group is for guests in Confluence'
|
|
138
|
+
},
|
|
139
|
+
userTypeLabel: {
|
|
140
|
+
id: 'fabric.elements.user-picker.user.type.label',
|
|
141
|
+
defaultMessage: 'People',
|
|
142
|
+
description: 'Label for user type'
|
|
143
|
+
},
|
|
144
|
+
teamTypeLabel: {
|
|
145
|
+
id: 'fabric.elements.user-picker.team.type.label',
|
|
146
|
+
defaultMessage: 'Teams',
|
|
147
|
+
description: 'Label for team type'
|
|
148
|
+
},
|
|
149
|
+
emailTypeLabel: {
|
|
150
|
+
id: 'fabric.elements.user-picker.email.type.label',
|
|
151
|
+
defaultMessage: 'Emails',
|
|
152
|
+
description: 'Label for email type'
|
|
153
|
+
},
|
|
154
|
+
groupTypeLabel: {
|
|
155
|
+
id: 'fabric.elements.user-picker.group.type.label',
|
|
156
|
+
defaultMessage: 'Groups',
|
|
157
|
+
description: 'Label for group type'
|
|
158
|
+
},
|
|
159
|
+
externalUserTypeLabel: {
|
|
160
|
+
id: 'fabric.elements.user-picker.external.user.type.label',
|
|
161
|
+
defaultMessage: 'External Users',
|
|
162
|
+
description: 'Label for external user type'
|
|
163
|
+
},
|
|
164
|
+
customTypeLabel: {
|
|
165
|
+
id: 'fabric.elements.user-picker.custom.type.label',
|
|
166
|
+
defaultMessage: 'Customs',
|
|
167
|
+
description: 'Label for custom type'
|
|
168
|
+
},
|
|
169
|
+
otherTypeLabel: {
|
|
170
|
+
id: 'fabric.elements.user-picker.other.type.label',
|
|
171
|
+
defaultMessage: 'Others',
|
|
172
|
+
description: 'Label for other type'
|
|
138
173
|
}
|
|
139
174
|
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.groupOptionsByType = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
11
|
+
var _i18n = require("../../components/i18n");
|
|
12
|
+
var getLabelForType = function getLabelForType(type) {
|
|
13
|
+
switch (type) {
|
|
14
|
+
case 'user':
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _i18n.messages.userTypeLabel);
|
|
16
|
+
case 'team':
|
|
17
|
+
return /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _i18n.messages.teamTypeLabel);
|
|
18
|
+
case 'group':
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _i18n.messages.groupTypeLabel);
|
|
20
|
+
case 'custom':
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _i18n.messages.customTypeLabel);
|
|
22
|
+
case 'external_user':
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _i18n.messages.externalUserTypeLabel);
|
|
24
|
+
default:
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _i18n.messages.otherTypeLabel);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var groupOptionsByType = exports.groupOptionsByType = (0, _memoizeOne.default)(function (options, groupByTypeOrder) {
|
|
29
|
+
// If groupByTypeOrder is empty, just return the original options
|
|
30
|
+
if (groupByTypeOrder.length === 0) {
|
|
31
|
+
return options;
|
|
32
|
+
}
|
|
33
|
+
var groupedMap = new Map();
|
|
34
|
+
options.forEach(function (option) {
|
|
35
|
+
var type = option.data.type || 'other';
|
|
36
|
+
if (!groupedMap.has(type)) {
|
|
37
|
+
groupedMap.set(type, []);
|
|
38
|
+
}
|
|
39
|
+
groupedMap.get(type).push(option);
|
|
40
|
+
});
|
|
41
|
+
var result = [];
|
|
42
|
+
|
|
43
|
+
// add groups in the specified order
|
|
44
|
+
// type is not in groupByTypeOrder, don't add it to the result
|
|
45
|
+
groupByTypeOrder.forEach(function (type) {
|
|
46
|
+
if (groupedMap.has(type)) {
|
|
47
|
+
result.push({
|
|
48
|
+
label: getLabelForType(type),
|
|
49
|
+
options: groupedMap.get(type)
|
|
50
|
+
});
|
|
51
|
+
groupedMap.delete(type);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return result;
|
|
55
|
+
});
|
|
@@ -29,7 +29,6 @@ const wrapper = isDisabled => css({
|
|
|
29
29
|
const optionWrapper = css({
|
|
30
30
|
maxWidth: '100%',
|
|
31
31
|
minWidth: 0,
|
|
32
|
-
flex: '1 1 100%',
|
|
33
32
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
34
33
|
lineHeight: '1.4',
|
|
35
34
|
paddingLeft: "var(--ds-space-100, 8px)"
|
|
@@ -48,7 +47,8 @@ const getTextStyle = isSecondary => {
|
|
|
48
47
|
});
|
|
49
48
|
};
|
|
50
49
|
const additionalInfo = css({
|
|
51
|
-
float: 'right'
|
|
50
|
+
float: 'right',
|
|
51
|
+
marginLeft: "var(--ds-space-100, 8px)"
|
|
52
52
|
});
|
|
53
53
|
export const textWrapper = color => css({
|
|
54
54
|
overflow: 'hidden',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { UFOExperienceState } from '@atlaskit/ufo';
|
|
5
6
|
import debounce from 'lodash/debounce';
|
|
6
7
|
import React from 'react';
|
|
@@ -10,6 +11,7 @@ import { cancelEvent, clearEvent, createAndFireEventInElementsChannel, deleteEve
|
|
|
10
11
|
import { batchByKey } from './batch';
|
|
11
12
|
import { messages } from './i18n';
|
|
12
13
|
import { callCallback, extractOptionValue, getOptions, isIterable, isPopupUserPickerByComponent, isDefaultValuePopulated, isSingleValue, optionToSelectableOptions } from './utils';
|
|
14
|
+
import { groupOptionsByType } from "../util/group-options-by-type";
|
|
13
15
|
import { userPickerOptionsShownUfoExperience } from '../util/ufoExperiences';
|
|
14
16
|
const loadingMessage = () => null;
|
|
15
17
|
const classNamePrefix = 'fabric-user-picker';
|
|
@@ -323,7 +325,8 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
|
|
|
323
325
|
const options = getOptions(this.state.options) || [];
|
|
324
326
|
const {
|
|
325
327
|
maxOptions,
|
|
326
|
-
isMulti
|
|
328
|
+
isMulti,
|
|
329
|
+
groupByTypeOrder
|
|
327
330
|
} = this.props;
|
|
328
331
|
if (maxOptions === 0) {
|
|
329
332
|
return [];
|
|
@@ -338,9 +341,9 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
|
|
|
338
341
|
const valueIds = value.map(item => item.data.id);
|
|
339
342
|
filteredOptions = options.filter(option => valueIds.indexOf(option.data.id) === -1);
|
|
340
343
|
}
|
|
341
|
-
return filteredOptions.slice(0, maxOptions);
|
|
344
|
+
return groupByTypeOrder && fg('support_group_by_type_for_user_picker') ? groupOptionsByType(filteredOptions.slice(0, maxOptions), groupByTypeOrder) : filteredOptions.slice(0, maxOptions);
|
|
342
345
|
}
|
|
343
|
-
return options;
|
|
346
|
+
return groupByTypeOrder && fg('support_group_by_type_for_user_picker') ? groupOptionsByType(options, groupByTypeOrder) : options;
|
|
344
347
|
});
|
|
345
348
|
_defineProperty(this, "getAppearance", () => this.props.appearance ? this.props.appearance : 'normal');
|
|
346
349
|
_defineProperty(this, "handleClickDraggableParentComponent", () => {
|
|
@@ -129,5 +129,40 @@ export const messages = defineMessages({
|
|
|
129
129
|
id: 'fabric.elements.user-picker.guest.lozenge.tooltip.group',
|
|
130
130
|
defaultMessage: 'Guest groups can only access certain spaces and have limited access to user info.',
|
|
131
131
|
description: 'Tooltip text for lozenge showing that a group is for guests in Confluence'
|
|
132
|
+
},
|
|
133
|
+
userTypeLabel: {
|
|
134
|
+
id: 'fabric.elements.user-picker.user.type.label',
|
|
135
|
+
defaultMessage: 'People',
|
|
136
|
+
description: 'Label for user type'
|
|
137
|
+
},
|
|
138
|
+
teamTypeLabel: {
|
|
139
|
+
id: 'fabric.elements.user-picker.team.type.label',
|
|
140
|
+
defaultMessage: 'Teams',
|
|
141
|
+
description: 'Label for team type'
|
|
142
|
+
},
|
|
143
|
+
emailTypeLabel: {
|
|
144
|
+
id: 'fabric.elements.user-picker.email.type.label',
|
|
145
|
+
defaultMessage: 'Emails',
|
|
146
|
+
description: 'Label for email type'
|
|
147
|
+
},
|
|
148
|
+
groupTypeLabel: {
|
|
149
|
+
id: 'fabric.elements.user-picker.group.type.label',
|
|
150
|
+
defaultMessage: 'Groups',
|
|
151
|
+
description: 'Label for group type'
|
|
152
|
+
},
|
|
153
|
+
externalUserTypeLabel: {
|
|
154
|
+
id: 'fabric.elements.user-picker.external.user.type.label',
|
|
155
|
+
defaultMessage: 'External Users',
|
|
156
|
+
description: 'Label for external user type'
|
|
157
|
+
},
|
|
158
|
+
customTypeLabel: {
|
|
159
|
+
id: 'fabric.elements.user-picker.custom.type.label',
|
|
160
|
+
defaultMessage: 'Customs',
|
|
161
|
+
description: 'Label for custom type'
|
|
162
|
+
},
|
|
163
|
+
otherTypeLabel: {
|
|
164
|
+
id: 'fabric.elements.user-picker.other.type.label',
|
|
165
|
+
defaultMessage: 'Others',
|
|
166
|
+
description: 'Label for other type'
|
|
132
167
|
}
|
|
133
168
|
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FormattedMessage } from "react-intl-next";
|
|
3
|
+
import memoizeOne from "memoize-one";
|
|
4
|
+
import { messages } from "../../components/i18n";
|
|
5
|
+
const getLabelForType = type => {
|
|
6
|
+
switch (type) {
|
|
7
|
+
case 'user':
|
|
8
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, messages.userTypeLabel);
|
|
9
|
+
case 'team':
|
|
10
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, messages.teamTypeLabel);
|
|
11
|
+
case 'group':
|
|
12
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, messages.groupTypeLabel);
|
|
13
|
+
case 'custom':
|
|
14
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, messages.customTypeLabel);
|
|
15
|
+
case 'external_user':
|
|
16
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, messages.externalUserTypeLabel);
|
|
17
|
+
default:
|
|
18
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, messages.otherTypeLabel);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export const groupOptionsByType = memoizeOne((options, groupByTypeOrder) => {
|
|
22
|
+
// If groupByTypeOrder is empty, just return the original options
|
|
23
|
+
if (groupByTypeOrder.length === 0) {
|
|
24
|
+
return options;
|
|
25
|
+
}
|
|
26
|
+
const groupedMap = new Map();
|
|
27
|
+
options.forEach(option => {
|
|
28
|
+
const type = option.data.type || 'other';
|
|
29
|
+
if (!groupedMap.has(type)) {
|
|
30
|
+
groupedMap.set(type, []);
|
|
31
|
+
}
|
|
32
|
+
groupedMap.get(type).push(option);
|
|
33
|
+
});
|
|
34
|
+
const result = [];
|
|
35
|
+
|
|
36
|
+
// add groups in the specified order
|
|
37
|
+
// type is not in groupByTypeOrder, don't add it to the result
|
|
38
|
+
groupByTypeOrder.forEach(type => {
|
|
39
|
+
if (groupedMap.has(type)) {
|
|
40
|
+
result.push({
|
|
41
|
+
label: getLabelForType(type),
|
|
42
|
+
options: groupedMap.get(type)
|
|
43
|
+
});
|
|
44
|
+
groupedMap.delete(type);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
});
|
|
@@ -36,7 +36,6 @@ var wrapper = function wrapper(isDisabled) {
|
|
|
36
36
|
var optionWrapper = css({
|
|
37
37
|
maxWidth: '100%',
|
|
38
38
|
minWidth: 0,
|
|
39
|
-
flex: '1 1 100%',
|
|
40
39
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
41
40
|
lineHeight: '1.4',
|
|
42
41
|
paddingLeft: "var(--ds-space-100, 8px)"
|
|
@@ -53,7 +52,8 @@ var getTextStyle = function getTextStyle(isSecondary) {
|
|
|
53
52
|
}, secondaryCssArgs));
|
|
54
53
|
};
|
|
55
54
|
var additionalInfo = css({
|
|
56
|
-
float: 'right'
|
|
55
|
+
float: 'right',
|
|
56
|
+
marginLeft: "var(--ds-space-100, 8px)"
|
|
57
57
|
});
|
|
58
58
|
export var textWrapper = function textWrapper(color) {
|
|
59
59
|
return css({
|
|
@@ -13,6 +13,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
13
13
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
14
14
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
15
15
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
16
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
17
|
import { UFOExperienceState } from '@atlaskit/ufo';
|
|
17
18
|
import debounce from 'lodash/debounce';
|
|
18
19
|
import React from 'react';
|
|
@@ -22,6 +23,7 @@ import { cancelEvent, clearEvent, createAndFireEventInElementsChannel, deleteEve
|
|
|
22
23
|
import { batchByKey } from './batch';
|
|
23
24
|
import { messages } from './i18n';
|
|
24
25
|
import { callCallback, extractOptionValue, getOptions, isIterable, isPopupUserPickerByComponent, isDefaultValuePopulated, isSingleValue, optionToSelectableOptions } from './utils';
|
|
26
|
+
import { groupOptionsByType } from "../util/group-options-by-type";
|
|
25
27
|
import { userPickerOptionsShownUfoExperience } from '../util/ufoExperiences';
|
|
26
28
|
var loadingMessage = function loadingMessage() {
|
|
27
29
|
return null;
|
|
@@ -325,7 +327,8 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
325
327
|
var options = getOptions(_this.state.options) || [];
|
|
326
328
|
var _this$props2 = _this.props,
|
|
327
329
|
maxOptions = _this$props2.maxOptions,
|
|
328
|
-
isMulti = _this$props2.isMulti
|
|
330
|
+
isMulti = _this$props2.isMulti,
|
|
331
|
+
groupByTypeOrder = _this$props2.groupByTypeOrder;
|
|
329
332
|
if (maxOptions === 0) {
|
|
330
333
|
return [];
|
|
331
334
|
}
|
|
@@ -341,9 +344,9 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
341
344
|
return valueIds.indexOf(option.data.id) === -1;
|
|
342
345
|
});
|
|
343
346
|
}
|
|
344
|
-
return filteredOptions.slice(0, maxOptions);
|
|
347
|
+
return groupByTypeOrder && fg('support_group_by_type_for_user_picker') ? groupOptionsByType(filteredOptions.slice(0, maxOptions), groupByTypeOrder) : filteredOptions.slice(0, maxOptions);
|
|
345
348
|
}
|
|
346
|
-
return options;
|
|
349
|
+
return groupByTypeOrder && fg('support_group_by_type_for_user_picker') ? groupOptionsByType(options, groupByTypeOrder) : options;
|
|
347
350
|
});
|
|
348
351
|
_defineProperty(_this, "getAppearance", function () {
|
|
349
352
|
return _this.props.appearance ? _this.props.appearance : 'normal';
|
|
@@ -129,5 +129,40 @@ export var messages = defineMessages({
|
|
|
129
129
|
id: 'fabric.elements.user-picker.guest.lozenge.tooltip.group',
|
|
130
130
|
defaultMessage: 'Guest groups can only access certain spaces and have limited access to user info.',
|
|
131
131
|
description: 'Tooltip text for lozenge showing that a group is for guests in Confluence'
|
|
132
|
+
},
|
|
133
|
+
userTypeLabel: {
|
|
134
|
+
id: 'fabric.elements.user-picker.user.type.label',
|
|
135
|
+
defaultMessage: 'People',
|
|
136
|
+
description: 'Label for user type'
|
|
137
|
+
},
|
|
138
|
+
teamTypeLabel: {
|
|
139
|
+
id: 'fabric.elements.user-picker.team.type.label',
|
|
140
|
+
defaultMessage: 'Teams',
|
|
141
|
+
description: 'Label for team type'
|
|
142
|
+
},
|
|
143
|
+
emailTypeLabel: {
|
|
144
|
+
id: 'fabric.elements.user-picker.email.type.label',
|
|
145
|
+
defaultMessage: 'Emails',
|
|
146
|
+
description: 'Label for email type'
|
|
147
|
+
},
|
|
148
|
+
groupTypeLabel: {
|
|
149
|
+
id: 'fabric.elements.user-picker.group.type.label',
|
|
150
|
+
defaultMessage: 'Groups',
|
|
151
|
+
description: 'Label for group type'
|
|
152
|
+
},
|
|
153
|
+
externalUserTypeLabel: {
|
|
154
|
+
id: 'fabric.elements.user-picker.external.user.type.label',
|
|
155
|
+
defaultMessage: 'External Users',
|
|
156
|
+
description: 'Label for external user type'
|
|
157
|
+
},
|
|
158
|
+
customTypeLabel: {
|
|
159
|
+
id: 'fabric.elements.user-picker.custom.type.label',
|
|
160
|
+
defaultMessage: 'Customs',
|
|
161
|
+
description: 'Label for custom type'
|
|
162
|
+
},
|
|
163
|
+
otherTypeLabel: {
|
|
164
|
+
id: 'fabric.elements.user-picker.other.type.label',
|
|
165
|
+
defaultMessage: 'Others',
|
|
166
|
+
description: 'Label for other type'
|
|
132
167
|
}
|
|
133
168
|
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FormattedMessage } from "react-intl-next";
|
|
3
|
+
import memoizeOne from "memoize-one";
|
|
4
|
+
import { messages } from "../../components/i18n";
|
|
5
|
+
var getLabelForType = function getLabelForType(type) {
|
|
6
|
+
switch (type) {
|
|
7
|
+
case 'user':
|
|
8
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, messages.userTypeLabel);
|
|
9
|
+
case 'team':
|
|
10
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, messages.teamTypeLabel);
|
|
11
|
+
case 'group':
|
|
12
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, messages.groupTypeLabel);
|
|
13
|
+
case 'custom':
|
|
14
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, messages.customTypeLabel);
|
|
15
|
+
case 'external_user':
|
|
16
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, messages.externalUserTypeLabel);
|
|
17
|
+
default:
|
|
18
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, messages.otherTypeLabel);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export var groupOptionsByType = memoizeOne(function (options, groupByTypeOrder) {
|
|
22
|
+
// If groupByTypeOrder is empty, just return the original options
|
|
23
|
+
if (groupByTypeOrder.length === 0) {
|
|
24
|
+
return options;
|
|
25
|
+
}
|
|
26
|
+
var groupedMap = new Map();
|
|
27
|
+
options.forEach(function (option) {
|
|
28
|
+
var type = option.data.type || 'other';
|
|
29
|
+
if (!groupedMap.has(type)) {
|
|
30
|
+
groupedMap.set(type, []);
|
|
31
|
+
}
|
|
32
|
+
groupedMap.get(type).push(option);
|
|
33
|
+
});
|
|
34
|
+
var result = [];
|
|
35
|
+
|
|
36
|
+
// add groups in the specified order
|
|
37
|
+
// type is not in groupByTypeOrder, don't add it to the result
|
|
38
|
+
groupByTypeOrder.forEach(function (type) {
|
|
39
|
+
if (groupedMap.has(type)) {
|
|
40
|
+
result.push({
|
|
41
|
+
label: getLabelForType(type),
|
|
42
|
+
options: groupedMap.get(type)
|
|
43
|
+
});
|
|
44
|
+
groupedMap.delete(type);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
});
|
|
@@ -66,6 +66,11 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
|
|
|
66
66
|
}
|
|
67
67
|
export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
68
68
|
fieldId: string | null;
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated This is a temporary prop to enable user-pickers to work in Draggable elements in react-beautiful-dnd.
|
|
71
|
+
* See https://product-fabric.atlassian.net/browse/DSP-15701 for more details.
|
|
72
|
+
* It may be removed in a future minor or patch when a longer-term workaround is found.
|
|
73
|
+
*/
|
|
69
74
|
options?: OptionData[] | undefined;
|
|
70
75
|
width?: string | number | undefined;
|
|
71
76
|
menuMinWidth?: number | undefined;
|
|
@@ -108,7 +113,7 @@ export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
108
113
|
isInvalid?: boolean | undefined;
|
|
109
114
|
isClearable?: boolean | undefined;
|
|
110
115
|
clearValueLabel?: string | undefined;
|
|
111
|
-
menuPosition?: "
|
|
116
|
+
menuPosition?: "fixed" | "absolute" | undefined;
|
|
112
117
|
captureMenuScroll?: boolean | undefined;
|
|
113
118
|
menuPortalTarget?: HTMLElement | undefined;
|
|
114
119
|
allowEmail?: boolean | undefined;
|
|
@@ -130,9 +135,10 @@ export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
130
135
|
required?: boolean | undefined;
|
|
131
136
|
UNSAFE_hasDraggableParentComponent?: boolean | undefined;
|
|
132
137
|
openMenuOnClick?: boolean | undefined;
|
|
133
|
-
strategy?: "
|
|
138
|
+
strategy?: "fixed" | "absolute" | undefined;
|
|
134
139
|
showClearIndicator?: boolean | undefined;
|
|
135
140
|
forwardedRef?: React.ForwardedRef<import("../types").UserPickerRef> | undefined;
|
|
141
|
+
groupByTypeOrder?: NonNullable<"user" | "team" | "email" | "group" | "custom" | "external_user" | undefined>[] | undefined;
|
|
136
142
|
} & {
|
|
137
143
|
SelectComponent: React.ComponentType<any>;
|
|
138
144
|
pickerProps?: any;
|
|
@@ -146,7 +152,7 @@ export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
146
152
|
* It may be removed in a future minor or patch when a longer-term workaround is found.
|
|
147
153
|
*/
|
|
148
154
|
UNSAFE_hasDraggableParentComponent?: boolean | undefined;
|
|
149
|
-
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isInvalid" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "styles" | "value" | "required" | "appearance" | "footer" | "defaultValue" | "fieldId" | "width" | "menuMinWidth" | "maxPickerHeight" | "loadOptions" | "loadUserSource" | "
|
|
155
|
+
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isInvalid" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "styles" | "value" | "required" | "appearance" | "footer" | "defaultValue" | "anchor" | "fieldId" | "width" | "menuMinWidth" | "maxPickerHeight" | "loadOptions" | "loadUserSource" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "placeholderAvatar" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaDescribedBy" | "ariaLive" | "header" | "UNSAFE_hasDraggableParentComponent" | "strategy" | "showClearIndicator" | "forwardedRef" | "groupByTypeOrder" | "SelectComponent" | "pickerProps"> & {
|
|
150
156
|
isClearable?: boolean | undefined;
|
|
151
157
|
isMulti?: boolean | undefined;
|
|
152
158
|
openMenuOnClick?: boolean | undefined;
|
|
@@ -63,7 +63,7 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
63
63
|
isInvalid?: boolean | undefined;
|
|
64
64
|
isClearable?: boolean | undefined;
|
|
65
65
|
clearValueLabel?: string | undefined;
|
|
66
|
-
menuPosition?: "
|
|
66
|
+
menuPosition?: "fixed" | "absolute" | undefined;
|
|
67
67
|
captureMenuScroll?: boolean | undefined;
|
|
68
68
|
menuPortalTarget?: HTMLElement | undefined;
|
|
69
69
|
allowEmail?: boolean | undefined;
|
|
@@ -85,9 +85,10 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
85
85
|
required?: boolean | undefined;
|
|
86
86
|
UNSAFE_hasDraggableParentComponent?: boolean | undefined;
|
|
87
87
|
openMenuOnClick?: boolean | undefined;
|
|
88
|
-
strategy?: "
|
|
88
|
+
strategy?: "fixed" | "absolute" | undefined;
|
|
89
89
|
showClearIndicator?: boolean | undefined;
|
|
90
90
|
forwardedRef?: React.ForwardedRef<import("../types").UserPickerRef> | undefined;
|
|
91
|
+
groupByTypeOrder?: NonNullable<"user" | "team" | "email" | "group" | "custom" | "external_user" | undefined>[] | undefined;
|
|
91
92
|
} & {
|
|
92
93
|
target: import("../types").Target;
|
|
93
94
|
popupTitle?: string | undefined;
|
|
@@ -111,7 +112,7 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
111
112
|
isInvalid?: boolean | undefined;
|
|
112
113
|
isLoading?: boolean | undefined;
|
|
113
114
|
isMulti?: boolean | undefined;
|
|
114
|
-
menuPosition?: "
|
|
115
|
+
menuPosition?: "fixed" | "absolute" | undefined;
|
|
115
116
|
menuPortalTarget?: HTMLElement | undefined;
|
|
116
117
|
menuShouldBlockScroll?: boolean | undefined;
|
|
117
118
|
name?: string | undefined;
|
|
@@ -131,6 +132,7 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
131
132
|
footer?: React.ReactNode;
|
|
132
133
|
target?: import("../types").Target | undefined;
|
|
133
134
|
defaultValue?: import("../types").DefaultValue;
|
|
135
|
+
anchor?: React.ComponentType<any> | undefined;
|
|
134
136
|
fieldId?: string | null | undefined;
|
|
135
137
|
width?: string | number | undefined;
|
|
136
138
|
menuMinWidth?: number | undefined;
|
|
@@ -141,7 +143,6 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
141
143
|
inputValue: string;
|
|
142
144
|
}) => React.ReactNode) | undefined;
|
|
143
145
|
loadUserSource?: import("../types").LoadUserSource | undefined;
|
|
144
|
-
anchor?: React.ComponentType<any> | undefined;
|
|
145
146
|
open?: boolean | undefined;
|
|
146
147
|
onSelection?: import("../types").OnOption | undefined;
|
|
147
148
|
onClear?: import("../types").OnPicker | undefined;
|
|
@@ -164,9 +165,10 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
164
165
|
ariaLive?: "polite" | "off" | "assertive" | undefined;
|
|
165
166
|
header?: React.ReactNode;
|
|
166
167
|
UNSAFE_hasDraggableParentComponent?: boolean | undefined;
|
|
167
|
-
strategy?: "
|
|
168
|
+
strategy?: "fixed" | "absolute" | undefined;
|
|
168
169
|
showClearIndicator?: boolean | undefined;
|
|
169
170
|
forwardedRef?: React.ForwardedRef<import("../types").UserPickerRef> | undefined;
|
|
171
|
+
groupByTypeOrder?: NonNullable<"user" | "team" | "email" | "group" | "custom" | "external_user" | undefined>[] | undefined;
|
|
170
172
|
popupTitle?: string | undefined;
|
|
171
173
|
placement?: import("@popperjs/core").Placement | undefined;
|
|
172
174
|
rootBoundary?: import("../types").RootBoundary | undefined;
|
|
@@ -54,7 +54,7 @@ export declare const UserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
54
54
|
isInvalid?: boolean | undefined;
|
|
55
55
|
isClearable?: boolean | undefined;
|
|
56
56
|
clearValueLabel?: string | undefined;
|
|
57
|
-
menuPosition?: "
|
|
57
|
+
menuPosition?: "fixed" | "absolute" | undefined;
|
|
58
58
|
captureMenuScroll?: boolean | undefined;
|
|
59
59
|
menuPortalTarget?: HTMLElement | undefined;
|
|
60
60
|
allowEmail?: boolean | undefined;
|
|
@@ -76,10 +76,11 @@ export declare const UserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
76
76
|
required?: boolean | undefined;
|
|
77
77
|
UNSAFE_hasDraggableParentComponent?: boolean | undefined;
|
|
78
78
|
openMenuOnClick?: boolean | undefined;
|
|
79
|
-
strategy?: "
|
|
79
|
+
strategy?: "fixed" | "absolute" | undefined;
|
|
80
80
|
showClearIndicator?: boolean | undefined;
|
|
81
81
|
forwardedRef?: React.ForwardedRef<import("../types").UserPickerRef> | undefined;
|
|
82
|
-
|
|
82
|
+
groupByTypeOrder?: NonNullable<"user" | "team" | "email" | "group" | "custom" | "external_user" | undefined>[] | undefined;
|
|
83
|
+
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isClearable" | "isInvalid" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "openMenuOnClick" | "styles" | "value" | "required" | "appearance" | "footer" | "defaultValue" | "anchor" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "subtle" | "noBorder" | "placeholderAvatar" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaDescribedBy" | "ariaLive" | "header" | "UNSAFE_hasDraggableParentComponent" | "strategy" | "showClearIndicator" | "forwardedRef" | "groupByTypeOrder"> & {
|
|
83
84
|
isMulti?: boolean | undefined;
|
|
84
85
|
width?: string | number | undefined;
|
|
85
86
|
} & {} & React.RefAttributes<any>>;
|
|
@@ -63,7 +63,7 @@ export declare const getComponents: import("memoize-one").MemoizedFn<(multi?: bo
|
|
|
63
63
|
isInvalid?: boolean | undefined;
|
|
64
64
|
isClearable?: boolean | undefined;
|
|
65
65
|
clearValueLabel?: string | undefined;
|
|
66
|
-
menuPosition?: "
|
|
66
|
+
menuPosition?: "fixed" | "absolute" | undefined;
|
|
67
67
|
captureMenuScroll?: boolean | undefined;
|
|
68
68
|
menuPortalTarget?: HTMLElement | undefined;
|
|
69
69
|
allowEmail?: boolean | undefined;
|
|
@@ -85,9 +85,10 @@ export declare const getComponents: import("memoize-one").MemoizedFn<(multi?: bo
|
|
|
85
85
|
required?: boolean | undefined;
|
|
86
86
|
UNSAFE_hasDraggableParentComponent?: boolean | undefined;
|
|
87
87
|
openMenuOnClick?: boolean | undefined;
|
|
88
|
-
strategy?: "
|
|
88
|
+
strategy?: "fixed" | "absolute" | undefined;
|
|
89
89
|
showClearIndicator?: boolean | undefined;
|
|
90
90
|
forwardedRef?: import("react").ForwardedRef<import("../types").UserPickerRef> | undefined;
|
|
91
|
+
groupByTypeOrder?: NonNullable<"user" | "team" | "email" | "group" | "custom" | "external_user" | undefined>[] | undefined;
|
|
91
92
|
}) => JSX.Element) | import("react").ComponentType<import("packages/design-system/react-select/dist/types").ControlProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>>;
|
|
92
93
|
DropdownIndicator: import("react").ComponentType<import("@atlaskit/select").DropdownIndicatorProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>> | null;
|
|
93
94
|
GroupHeading?: import("react").ComponentType<import("packages/design-system/react-select/dist/types").GroupHeadingProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>> | undefined;
|
|
@@ -129,4 +129,39 @@ export declare const messages: {
|
|
|
129
129
|
defaultMessage: string;
|
|
130
130
|
description: string;
|
|
131
131
|
};
|
|
132
|
+
userTypeLabel: {
|
|
133
|
+
id: string;
|
|
134
|
+
defaultMessage: string;
|
|
135
|
+
description: string;
|
|
136
|
+
};
|
|
137
|
+
teamTypeLabel: {
|
|
138
|
+
id: string;
|
|
139
|
+
defaultMessage: string;
|
|
140
|
+
description: string;
|
|
141
|
+
};
|
|
142
|
+
emailTypeLabel: {
|
|
143
|
+
id: string;
|
|
144
|
+
defaultMessage: string;
|
|
145
|
+
description: string;
|
|
146
|
+
};
|
|
147
|
+
groupTypeLabel: {
|
|
148
|
+
id: string;
|
|
149
|
+
defaultMessage: string;
|
|
150
|
+
description: string;
|
|
151
|
+
};
|
|
152
|
+
externalUserTypeLabel: {
|
|
153
|
+
id: string;
|
|
154
|
+
defaultMessage: string;
|
|
155
|
+
description: string;
|
|
156
|
+
};
|
|
157
|
+
customTypeLabel: {
|
|
158
|
+
id: string;
|
|
159
|
+
defaultMessage: string;
|
|
160
|
+
description: string;
|
|
161
|
+
};
|
|
162
|
+
otherTypeLabel: {
|
|
163
|
+
id: string;
|
|
164
|
+
defaultMessage: string;
|
|
165
|
+
description: string;
|
|
166
|
+
};
|
|
132
167
|
};
|
|
@@ -10,7 +10,7 @@ export declare const getPopupProps: import("memoize-one").MemoizedFn<(width: str
|
|
|
10
10
|
popupTitle: string | undefined;
|
|
11
11
|
popperProps: {
|
|
12
12
|
placement: Placement;
|
|
13
|
-
strategy: "
|
|
13
|
+
strategy: "fixed" | "absolute";
|
|
14
14
|
modifiers: ({
|
|
15
15
|
name: string;
|
|
16
16
|
options: {
|
package/dist/types/types.d.ts
CHANGED
|
@@ -182,6 +182,8 @@ export type UserPickerProps = WithAnalyticsEventsProps & {
|
|
|
182
182
|
showClearIndicator?: boolean;
|
|
183
183
|
/** Ref to the underlying select */
|
|
184
184
|
forwardedRef?: React.ForwardedRef<UserPickerRef>;
|
|
185
|
+
/** group the options by type */
|
|
186
|
+
groupByTypeOrder?: NonNullable<OptionData['type']>[];
|
|
185
187
|
};
|
|
186
188
|
export type UserPickerRef = {
|
|
187
189
|
focus: () => void;
|
|
@@ -340,6 +342,10 @@ export type Option<Data = OptionData> = {
|
|
|
340
342
|
label: string;
|
|
341
343
|
value: string;
|
|
342
344
|
};
|
|
345
|
+
export type GroupedOptions = {
|
|
346
|
+
label: React.JSX.Element;
|
|
347
|
+
options: Option[];
|
|
348
|
+
};
|
|
343
349
|
export interface UserSourceResult {
|
|
344
350
|
sourceId: string;
|
|
345
351
|
sourceType: UserSource;
|
|
@@ -66,6 +66,11 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
|
|
|
66
66
|
}
|
|
67
67
|
export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
68
68
|
fieldId: string | null;
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated This is a temporary prop to enable user-pickers to work in Draggable elements in react-beautiful-dnd.
|
|
71
|
+
* See https://product-fabric.atlassian.net/browse/DSP-15701 for more details.
|
|
72
|
+
* It may be removed in a future minor or patch when a longer-term workaround is found.
|
|
73
|
+
*/
|
|
69
74
|
options?: OptionData[] | undefined;
|
|
70
75
|
width?: string | number | undefined;
|
|
71
76
|
menuMinWidth?: number | undefined;
|
|
@@ -108,7 +113,7 @@ export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
108
113
|
isInvalid?: boolean | undefined;
|
|
109
114
|
isClearable?: boolean | undefined;
|
|
110
115
|
clearValueLabel?: string | undefined;
|
|
111
|
-
menuPosition?: "
|
|
116
|
+
menuPosition?: "fixed" | "absolute" | undefined;
|
|
112
117
|
captureMenuScroll?: boolean | undefined;
|
|
113
118
|
menuPortalTarget?: HTMLElement | undefined;
|
|
114
119
|
allowEmail?: boolean | undefined;
|
|
@@ -130,9 +135,10 @@ export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
130
135
|
required?: boolean | undefined;
|
|
131
136
|
UNSAFE_hasDraggableParentComponent?: boolean | undefined;
|
|
132
137
|
openMenuOnClick?: boolean | undefined;
|
|
133
|
-
strategy?: "
|
|
138
|
+
strategy?: "fixed" | "absolute" | undefined;
|
|
134
139
|
showClearIndicator?: boolean | undefined;
|
|
135
140
|
forwardedRef?: React.ForwardedRef<import("../types").UserPickerRef> | undefined;
|
|
141
|
+
groupByTypeOrder?: NonNullable<"user" | "team" | "email" | "group" | "custom" | "external_user" | undefined>[] | undefined;
|
|
136
142
|
} & {
|
|
137
143
|
SelectComponent: React.ComponentType<any>;
|
|
138
144
|
pickerProps?: any;
|
|
@@ -146,7 +152,7 @@ export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
146
152
|
* It may be removed in a future minor or patch when a longer-term workaround is found.
|
|
147
153
|
*/
|
|
148
154
|
UNSAFE_hasDraggableParentComponent?: boolean | undefined;
|
|
149
|
-
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isInvalid" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "styles" | "value" | "required" | "appearance" | "footer" | "defaultValue" | "fieldId" | "width" | "menuMinWidth" | "maxPickerHeight" | "loadOptions" | "loadUserSource" | "
|
|
155
|
+
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isInvalid" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "styles" | "value" | "required" | "appearance" | "footer" | "defaultValue" | "anchor" | "fieldId" | "width" | "menuMinWidth" | "maxPickerHeight" | "loadOptions" | "loadUserSource" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "placeholderAvatar" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaDescribedBy" | "ariaLive" | "header" | "UNSAFE_hasDraggableParentComponent" | "strategy" | "showClearIndicator" | "forwardedRef" | "groupByTypeOrder" | "SelectComponent" | "pickerProps"> & {
|
|
150
156
|
isClearable?: boolean | undefined;
|
|
151
157
|
isMulti?: boolean | undefined;
|
|
152
158
|
openMenuOnClick?: boolean | undefined;
|
|
@@ -63,7 +63,7 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
63
63
|
isInvalid?: boolean | undefined;
|
|
64
64
|
isClearable?: boolean | undefined;
|
|
65
65
|
clearValueLabel?: string | undefined;
|
|
66
|
-
menuPosition?: "
|
|
66
|
+
menuPosition?: "fixed" | "absolute" | undefined;
|
|
67
67
|
captureMenuScroll?: boolean | undefined;
|
|
68
68
|
menuPortalTarget?: HTMLElement | undefined;
|
|
69
69
|
allowEmail?: boolean | undefined;
|
|
@@ -85,9 +85,10 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
85
85
|
required?: boolean | undefined;
|
|
86
86
|
UNSAFE_hasDraggableParentComponent?: boolean | undefined;
|
|
87
87
|
openMenuOnClick?: boolean | undefined;
|
|
88
|
-
strategy?: "
|
|
88
|
+
strategy?: "fixed" | "absolute" | undefined;
|
|
89
89
|
showClearIndicator?: boolean | undefined;
|
|
90
90
|
forwardedRef?: React.ForwardedRef<import("../types").UserPickerRef> | undefined;
|
|
91
|
+
groupByTypeOrder?: NonNullable<"user" | "team" | "email" | "group" | "custom" | "external_user" | undefined>[] | undefined;
|
|
91
92
|
} & {
|
|
92
93
|
target: import("../types").Target;
|
|
93
94
|
popupTitle?: string | undefined;
|
|
@@ -117,7 +118,7 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
117
118
|
isInvalid?: boolean | undefined;
|
|
118
119
|
isLoading?: boolean | undefined;
|
|
119
120
|
isMulti?: boolean | undefined;
|
|
120
|
-
menuPosition?: "
|
|
121
|
+
menuPosition?: "fixed" | "absolute" | undefined;
|
|
121
122
|
menuPortalTarget?: HTMLElement | undefined;
|
|
122
123
|
menuShouldBlockScroll?: boolean | undefined;
|
|
123
124
|
name?: string | undefined;
|
|
@@ -137,6 +138,7 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
137
138
|
footer?: React.ReactNode;
|
|
138
139
|
target?: import("../types").Target | undefined;
|
|
139
140
|
defaultValue?: import("../types").DefaultValue;
|
|
141
|
+
anchor?: React.ComponentType<any> | undefined;
|
|
140
142
|
fieldId?: string | null | undefined;
|
|
141
143
|
width?: string | number | undefined;
|
|
142
144
|
menuMinWidth?: number | undefined;
|
|
@@ -147,7 +149,6 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
147
149
|
inputValue: string;
|
|
148
150
|
}) => React.ReactNode) | undefined;
|
|
149
151
|
loadUserSource?: import("../types").LoadUserSource | undefined;
|
|
150
|
-
anchor?: React.ComponentType<any> | undefined;
|
|
151
152
|
open?: boolean | undefined;
|
|
152
153
|
onSelection?: import("../types").OnOption | undefined;
|
|
153
154
|
onClear?: import("../types").OnPicker | undefined;
|
|
@@ -170,9 +171,10 @@ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Omit<Pick<
|
|
|
170
171
|
ariaLive?: "polite" | "off" | "assertive" | undefined;
|
|
171
172
|
header?: React.ReactNode;
|
|
172
173
|
UNSAFE_hasDraggableParentComponent?: boolean | undefined;
|
|
173
|
-
strategy?: "
|
|
174
|
+
strategy?: "fixed" | "absolute" | undefined;
|
|
174
175
|
showClearIndicator?: boolean | undefined;
|
|
175
176
|
forwardedRef?: React.ForwardedRef<import("../types").UserPickerRef> | undefined;
|
|
177
|
+
groupByTypeOrder?: NonNullable<"user" | "team" | "email" | "group" | "custom" | "external_user" | undefined>[] | undefined;
|
|
176
178
|
popupTitle?: string | undefined;
|
|
177
179
|
placement?: import("@popperjs/core").Placement | undefined;
|
|
178
180
|
rootBoundary?: import("../types").RootBoundary | undefined;
|
|
@@ -54,7 +54,7 @@ export declare const UserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
54
54
|
isInvalid?: boolean | undefined;
|
|
55
55
|
isClearable?: boolean | undefined;
|
|
56
56
|
clearValueLabel?: string | undefined;
|
|
57
|
-
menuPosition?: "
|
|
57
|
+
menuPosition?: "fixed" | "absolute" | undefined;
|
|
58
58
|
captureMenuScroll?: boolean | undefined;
|
|
59
59
|
menuPortalTarget?: HTMLElement | undefined;
|
|
60
60
|
allowEmail?: boolean | undefined;
|
|
@@ -76,10 +76,11 @@ export declare const UserPicker: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
76
76
|
required?: boolean | undefined;
|
|
77
77
|
UNSAFE_hasDraggableParentComponent?: boolean | undefined;
|
|
78
78
|
openMenuOnClick?: boolean | undefined;
|
|
79
|
-
strategy?: "
|
|
79
|
+
strategy?: "fixed" | "absolute" | undefined;
|
|
80
80
|
showClearIndicator?: boolean | undefined;
|
|
81
81
|
forwardedRef?: React.ForwardedRef<import("../types").UserPickerRef> | undefined;
|
|
82
|
-
|
|
82
|
+
groupByTypeOrder?: NonNullable<"user" | "team" | "email" | "group" | "custom" | "external_user" | undefined>[] | undefined;
|
|
83
|
+
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isClearable" | "isInvalid" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "name" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "onKeyDown" | "openMenuOnClick" | "styles" | "value" | "required" | "appearance" | "footer" | "defaultValue" | "anchor" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "open" | "onSelection" | "onClear" | "onOpen" | "onClose" | "subtle" | "noBorder" | "placeholderAvatar" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabel" | "ariaLabelledBy" | "ariaDescribedBy" | "ariaLive" | "header" | "UNSAFE_hasDraggableParentComponent" | "strategy" | "showClearIndicator" | "forwardedRef" | "groupByTypeOrder"> & {
|
|
83
84
|
isMulti?: boolean | undefined;
|
|
84
85
|
width?: string | number | undefined;
|
|
85
86
|
} & {} & React.RefAttributes<any>>;
|
|
@@ -63,7 +63,7 @@ export declare const getComponents: import("memoize-one").MemoizedFn<(multi?: bo
|
|
|
63
63
|
isInvalid?: boolean | undefined;
|
|
64
64
|
isClearable?: boolean | undefined;
|
|
65
65
|
clearValueLabel?: string | undefined;
|
|
66
|
-
menuPosition?: "
|
|
66
|
+
menuPosition?: "fixed" | "absolute" | undefined;
|
|
67
67
|
captureMenuScroll?: boolean | undefined;
|
|
68
68
|
menuPortalTarget?: HTMLElement | undefined;
|
|
69
69
|
allowEmail?: boolean | undefined;
|
|
@@ -85,9 +85,10 @@ export declare const getComponents: import("memoize-one").MemoizedFn<(multi?: bo
|
|
|
85
85
|
required?: boolean | undefined;
|
|
86
86
|
UNSAFE_hasDraggableParentComponent?: boolean | undefined;
|
|
87
87
|
openMenuOnClick?: boolean | undefined;
|
|
88
|
-
strategy?: "
|
|
88
|
+
strategy?: "fixed" | "absolute" | undefined;
|
|
89
89
|
showClearIndicator?: boolean | undefined;
|
|
90
90
|
forwardedRef?: import("react").ForwardedRef<import("../types").UserPickerRef> | undefined;
|
|
91
|
+
groupByTypeOrder?: NonNullable<"user" | "team" | "email" | "group" | "custom" | "external_user" | undefined>[] | undefined;
|
|
91
92
|
}) => JSX.Element) | import("react").ComponentType<import("packages/design-system/react-select/dist/types").ControlProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>>;
|
|
92
93
|
DropdownIndicator: import("react").ComponentType<import("@atlaskit/select").DropdownIndicatorProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>> | null;
|
|
93
94
|
GroupHeading?: import("react").ComponentType<import("packages/design-system/react-select/dist/types").GroupHeadingProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>> | undefined;
|
|
@@ -129,4 +129,39 @@ export declare const messages: {
|
|
|
129
129
|
defaultMessage: string;
|
|
130
130
|
description: string;
|
|
131
131
|
};
|
|
132
|
+
userTypeLabel: {
|
|
133
|
+
id: string;
|
|
134
|
+
defaultMessage: string;
|
|
135
|
+
description: string;
|
|
136
|
+
};
|
|
137
|
+
teamTypeLabel: {
|
|
138
|
+
id: string;
|
|
139
|
+
defaultMessage: string;
|
|
140
|
+
description: string;
|
|
141
|
+
};
|
|
142
|
+
emailTypeLabel: {
|
|
143
|
+
id: string;
|
|
144
|
+
defaultMessage: string;
|
|
145
|
+
description: string;
|
|
146
|
+
};
|
|
147
|
+
groupTypeLabel: {
|
|
148
|
+
id: string;
|
|
149
|
+
defaultMessage: string;
|
|
150
|
+
description: string;
|
|
151
|
+
};
|
|
152
|
+
externalUserTypeLabel: {
|
|
153
|
+
id: string;
|
|
154
|
+
defaultMessage: string;
|
|
155
|
+
description: string;
|
|
156
|
+
};
|
|
157
|
+
customTypeLabel: {
|
|
158
|
+
id: string;
|
|
159
|
+
defaultMessage: string;
|
|
160
|
+
description: string;
|
|
161
|
+
};
|
|
162
|
+
otherTypeLabel: {
|
|
163
|
+
id: string;
|
|
164
|
+
defaultMessage: string;
|
|
165
|
+
description: string;
|
|
166
|
+
};
|
|
132
167
|
};
|
|
@@ -10,7 +10,7 @@ export declare const getPopupProps: import("memoize-one").MemoizedFn<(width: str
|
|
|
10
10
|
popupTitle: string | undefined;
|
|
11
11
|
popperProps: {
|
|
12
12
|
placement: Placement;
|
|
13
|
-
strategy: "
|
|
13
|
+
strategy: "fixed" | "absolute";
|
|
14
14
|
modifiers: ({
|
|
15
15
|
name: string;
|
|
16
16
|
options: {
|
|
@@ -182,6 +182,8 @@ export type UserPickerProps = WithAnalyticsEventsProps & {
|
|
|
182
182
|
showClearIndicator?: boolean;
|
|
183
183
|
/** Ref to the underlying select */
|
|
184
184
|
forwardedRef?: React.ForwardedRef<UserPickerRef>;
|
|
185
|
+
/** group the options by type */
|
|
186
|
+
groupByTypeOrder?: NonNullable<OptionData['type']>[];
|
|
185
187
|
};
|
|
186
188
|
export type UserPickerRef = {
|
|
187
189
|
focus: () => void;
|
|
@@ -343,6 +345,10 @@ export type Option<Data = OptionData> = {
|
|
|
343
345
|
label: string;
|
|
344
346
|
value: string;
|
|
345
347
|
};
|
|
348
|
+
export type GroupedOptions = {
|
|
349
|
+
label: React.JSX.Element;
|
|
350
|
+
options: Option[];
|
|
351
|
+
};
|
|
346
352
|
export interface UserSourceResult {
|
|
347
353
|
sourceId: string;
|
|
348
354
|
sourceType: UserSource;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/user-picker",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"description": "Fabric component for display a dropdown to select a user from",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -51,18 +51,18 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
53
53
|
"@atlaskit/avatar": "^25.1.0",
|
|
54
|
-
"@atlaskit/icon": "^27.
|
|
54
|
+
"@atlaskit/icon": "^27.1.0",
|
|
55
55
|
"@atlaskit/logo": "^19.1.0",
|
|
56
56
|
"@atlaskit/lozenge": "^13.0.0",
|
|
57
57
|
"@atlaskit/people-teams-ui-public": "^3.1.0",
|
|
58
58
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
59
59
|
"@atlaskit/popper": "^7.0.0",
|
|
60
|
-
"@atlaskit/primitives": "^14.
|
|
60
|
+
"@atlaskit/primitives": "^14.9.0",
|
|
61
61
|
"@atlaskit/select": "^20.7.0",
|
|
62
62
|
"@atlaskit/spinner": "^18.0.0",
|
|
63
63
|
"@atlaskit/teams-avatar": "^2.3.0",
|
|
64
64
|
"@atlaskit/theme": "^18.0.0",
|
|
65
|
-
"@atlaskit/tokens": "^5.
|
|
65
|
+
"@atlaskit/tokens": "^5.4.0",
|
|
66
66
|
"@atlaskit/tooltip": "^20.3.0",
|
|
67
67
|
"@atlaskit/ufo": "^0.4.0",
|
|
68
68
|
"@babel/runtime": "^7.0.0",
|
|
@@ -114,6 +114,9 @@
|
|
|
114
114
|
},
|
|
115
115
|
"user-picker-show-clear-indicator": {
|
|
116
116
|
"type": "boolean"
|
|
117
|
+
},
|
|
118
|
+
"support_group_by_type_for_user_picker": {
|
|
119
|
+
"type": "boolean"
|
|
117
120
|
}
|
|
118
121
|
}
|
|
119
122
|
}
|