@atlaskit/user-picker 11.2.2 → 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 +18 -0
- package/afm-cc/tsconfig.json +1 -4
- package/afm-jira/tsconfig.json +0 -3
- package/afm-post-office/tsconfig.json +0 -3
- package/afm-townsquare/tsconfig.json +69 -0
- package/dist/cjs/analytics.js +1 -1
- package/dist/cjs/components/AvatarItemOption.js +2 -2
- package/dist/cjs/components/BaseUserPicker.js +6 -3
- package/dist/cjs/components/Control.compiled.css +3 -2
- package/dist/cjs/components/Control.js +4 -2
- package/dist/cjs/components/i18n.js +35 -0
- package/dist/cjs/util/group-options-by-type/index.js +55 -0
- package/dist/es2019/analytics.js +1 -1
- package/dist/es2019/components/AvatarItemOption.js +2 -2
- package/dist/es2019/components/BaseUserPicker.js +6 -3
- package/dist/es2019/components/Control.compiled.css +3 -2
- package/dist/es2019/components/Control.js +4 -2
- package/dist/es2019/components/i18n.js +35 -0
- package/dist/es2019/util/group-options-by-type/index.js +48 -0
- package/dist/esm/analytics.js +1 -1
- package/dist/esm/components/AvatarItemOption.js +2 -2
- package/dist/esm/components/BaseUserPicker.js +6 -3
- package/dist/esm/components/Control.compiled.css +3 -2
- package/dist/esm/components/Control.js +4 -2
- 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/Control.d.ts +2 -1
- package/dist/types/components/PopupControl.d.ts +2 -1
- 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 +71 -1
- 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/Control.d.ts +2 -1
- package/dist/types-ts4.5/components/PopupControl.d.ts +2 -1
- 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 +71 -1
- 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/docs/1-smart-user-picker.tsx +2 -7
- package/package.json +7 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
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
|
+
|
|
15
|
+
## 11.2.3
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 11.2.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"declaration": true,
|
|
5
5
|
"target": "es5",
|
|
6
6
|
"composite": true,
|
|
7
|
-
"outDir": "
|
|
7
|
+
"outDir": "../../../../../confluence/tsDist/@atlaskit__user-picker",
|
|
8
8
|
"rootDir": "../"
|
|
9
9
|
},
|
|
10
10
|
"include": [
|
|
@@ -26,9 +26,6 @@
|
|
|
26
26
|
{
|
|
27
27
|
"path": "../../../design-system/icon/afm-cc/tsconfig.json"
|
|
28
28
|
},
|
|
29
|
-
{
|
|
30
|
-
"path": "../../../design-system/link/afm-cc/tsconfig.json"
|
|
31
|
-
},
|
|
32
29
|
{
|
|
33
30
|
"path": "../../../design-system/logo/afm-cc/tsconfig.json"
|
|
34
31
|
},
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.townsquare.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"outDir": "../../../../../townsquare/tsDist/@atlaskit__user-picker/app",
|
|
7
|
+
"rootDir": "../",
|
|
8
|
+
"composite": true
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"../src/**/*.ts",
|
|
12
|
+
"../src/**/*.tsx"
|
|
13
|
+
],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"../src/**/__tests__/*",
|
|
16
|
+
"../src/**/*.test.*",
|
|
17
|
+
"../src/**/test.*"
|
|
18
|
+
],
|
|
19
|
+
"references": [
|
|
20
|
+
{
|
|
21
|
+
"path": "../../../analytics/analytics-next/afm-townsquare/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../../design-system/avatar/afm-townsquare/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../../design-system/icon/afm-townsquare/tsconfig.json"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../../design-system/logo/afm-townsquare/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../../design-system/lozenge/afm-townsquare/tsconfig.json"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../../../people-and-teams/people-teams-ui-public/afm-townsquare/tsconfig.json"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../../../platform/feature-flags/afm-townsquare/tsconfig.json"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../../design-system/popper/afm-townsquare/tsconfig.json"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../../../design-system/primitives/afm-townsquare/tsconfig.json"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "../../../design-system/select/afm-townsquare/tsconfig.json"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"path": "../../../design-system/spinner/afm-townsquare/tsconfig.json"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "../../../people-and-teams/teams-avatar/afm-townsquare/tsconfig.json"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"path": "../../../design-system/theme/afm-townsquare/tsconfig.json"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"path": "../../../design-system/tokens/afm-townsquare/tsconfig.json"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"path": "../../../design-system/tooltip/afm-townsquare/tsconfig.json"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "../../../data/ufo-external/afm-townsquare/tsconfig.json"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
package/dist/cjs/analytics.js
CHANGED
|
@@ -12,7 +12,7 @@ var _utils = require("./components/utils");
|
|
|
12
12
|
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; }
|
|
13
13
|
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; }
|
|
14
14
|
var packageName = "@atlaskit/user-picker";
|
|
15
|
-
var packageVersion = "11.2.
|
|
15
|
+
var packageVersion = "11.2.3";
|
|
16
16
|
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}$/;
|
|
17
17
|
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}$/;
|
|
18
18
|
var UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
|
|
@@ -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';
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
._1h6d1bqt{border-color:var(--ds-border-danger,#e2483d)}
|
|
3
3
|
._1h6d1elr{border-color:var(--ds-border-input,#8590a2)}
|
|
4
4
|
._1h6d1j28{border-color:transparent}
|
|
5
|
-
._1h6d1p6i{border-color:var(--ds-border-focused,#388bff)}.
|
|
5
|
+
._1h6d1p6i{border-color:var(--ds-border-focused,#388bff)}._14regrf3 .fabric-user-picker__clear-indicator{opacity:0!important}
|
|
6
|
+
._19bvidpf{padding-left:0}
|
|
6
7
|
._1a98zg3v:hover .fabric-user-picker__clear-indicator{opacity:1!important}
|
|
7
|
-
.
|
|
8
|
+
._1tke1wug{min-height:auto}
|
|
8
9
|
._bfhk1j28{background-color:transparent}
|
|
9
10
|
._bfhk1j9a{background-color:var(--ds-background-input,#fff)}
|
|
10
11
|
._ca0qidpf{padding-top:0}
|
|
@@ -19,11 +19,13 @@ var controlStyles = {
|
|
|
19
19
|
focused: "_1h6d1p6i _bfhk1j9a _4cvx1p6i _irr31j9a",
|
|
20
20
|
disabled: "_irr3syzs",
|
|
21
21
|
subtle: "_1h6d1j28 _bfhk1j28 _4cvx1j28 _irr31gly",
|
|
22
|
-
root: "_ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1h6d1elr _bfhk1j9a _p12f1osq
|
|
22
|
+
root: "_ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1h6d1elr _bfhk1j9a _p12f1osq _14regrf3 _4cvx1elr _irr31d5g _1a98zg3v",
|
|
23
|
+
compact: "_1tke1wug"
|
|
23
24
|
};
|
|
24
25
|
var Control = function Control(props) {
|
|
26
|
+
var isCompact = props.appearance === 'compact';
|
|
25
27
|
return /*#__PURE__*/React.createElement(_select.components.Control, (0, _extends2.default)({}, props, {
|
|
26
|
-
xcss: (0, _react2.cx)(controlStyles.root, (props.selectProps.subtle || props.selectProps.noBorder) && controlStyles.subtle, props.isFocused && controlStyles.focused, props.isInvalid && controlStyles.invalid, props.isDisabled && controlStyles.disabled)
|
|
28
|
+
xcss: (0, _react2.cx)(controlStyles.root, isCompact && controlStyles.compact, (props.selectProps.subtle || props.selectProps.noBorder) && controlStyles.subtle, props.isFocused && controlStyles.focused, props.isInvalid && controlStyles.invalid, props.isDisabled && controlStyles.disabled)
|
|
27
29
|
}));
|
|
28
30
|
};
|
|
29
31
|
var _default = exports.default = Control;
|
|
@@ -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
|
+
});
|
package/dist/es2019/analytics.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
|
2
2
|
import { v4 as uuidv4 } from 'uuid';
|
|
3
3
|
import { isCustom, isExternalUser } from './components/utils';
|
|
4
4
|
const packageName = "@atlaskit/user-picker";
|
|
5
|
-
const packageVersion = "11.2.
|
|
5
|
+
const packageVersion = "11.2.3";
|
|
6
6
|
const UUID_REGEXP_TEAMS_GROUPS = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
|
|
7
7
|
const 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}$/;
|
|
8
8
|
const UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
|
|
@@ -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", () => {
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
._1h6d1bqt{border-color:var(--ds-border-danger,#e2483d)}
|
|
3
3
|
._1h6d1elr{border-color:var(--ds-border-input,#8590a2)}
|
|
4
4
|
._1h6d1j28{border-color:transparent}
|
|
5
|
-
._1h6d1p6i{border-color:var(--ds-border-focused,#388bff)}.
|
|
5
|
+
._1h6d1p6i{border-color:var(--ds-border-focused,#388bff)}._14regrf3 .fabric-user-picker__clear-indicator{opacity:0!important}
|
|
6
|
+
._19bvidpf{padding-left:0}
|
|
6
7
|
._1a98zg3v:hover .fabric-user-picker__clear-indicator{opacity:1!important}
|
|
7
|
-
.
|
|
8
|
+
._1tke1wug{min-height:auto}
|
|
8
9
|
._bfhk1j28{background-color:transparent}
|
|
9
10
|
._bfhk1j9a{background-color:var(--ds-background-input,#fff)}
|
|
10
11
|
._ca0qidpf{padding-top:0}
|
|
@@ -10,11 +10,13 @@ const controlStyles = {
|
|
|
10
10
|
focused: "_1h6d1p6i _bfhk1j9a _4cvx1p6i _irr31j9a",
|
|
11
11
|
disabled: "_irr3syzs",
|
|
12
12
|
subtle: "_1h6d1j28 _bfhk1j28 _4cvx1j28 _irr31gly",
|
|
13
|
-
root: "_ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1h6d1elr _bfhk1j9a _p12f1osq
|
|
13
|
+
root: "_ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1h6d1elr _bfhk1j9a _p12f1osq _14regrf3 _4cvx1elr _irr31d5g _1a98zg3v",
|
|
14
|
+
compact: "_1tke1wug"
|
|
14
15
|
};
|
|
15
16
|
const Control = props => {
|
|
17
|
+
const isCompact = props.appearance === 'compact';
|
|
16
18
|
return /*#__PURE__*/React.createElement(components.Control, _extends({}, props, {
|
|
17
|
-
xcss: cx(controlStyles.root, (props.selectProps.subtle || props.selectProps.noBorder) && controlStyles.subtle, props.isFocused && controlStyles.focused, props.isInvalid && controlStyles.invalid, props.isDisabled && controlStyles.disabled)
|
|
19
|
+
xcss: cx(controlStyles.root, isCompact && controlStyles.compact, (props.selectProps.subtle || props.selectProps.noBorder) && controlStyles.subtle, props.isFocused && controlStyles.focused, props.isInvalid && controlStyles.invalid, props.isDisabled && controlStyles.disabled)
|
|
18
20
|
}));
|
|
19
21
|
};
|
|
20
22
|
export default Control;
|
|
@@ -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
|
+
});
|
package/dist/esm/analytics.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
|
5
5
|
import { v4 as uuidv4 } from 'uuid';
|
|
6
6
|
import { isCustom, isExternalUser } from './components/utils';
|
|
7
7
|
var packageName = "@atlaskit/user-picker";
|
|
8
|
-
var packageVersion = "11.2.
|
|
8
|
+
var packageVersion = "11.2.3";
|
|
9
9
|
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}$/;
|
|
10
10
|
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}$/;
|
|
11
11
|
var UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
|
|
@@ -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';
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
._1h6d1bqt{border-color:var(--ds-border-danger,#e2483d)}
|
|
3
3
|
._1h6d1elr{border-color:var(--ds-border-input,#8590a2)}
|
|
4
4
|
._1h6d1j28{border-color:transparent}
|
|
5
|
-
._1h6d1p6i{border-color:var(--ds-border-focused,#388bff)}.
|
|
5
|
+
._1h6d1p6i{border-color:var(--ds-border-focused,#388bff)}._14regrf3 .fabric-user-picker__clear-indicator{opacity:0!important}
|
|
6
|
+
._19bvidpf{padding-left:0}
|
|
6
7
|
._1a98zg3v:hover .fabric-user-picker__clear-indicator{opacity:1!important}
|
|
7
|
-
.
|
|
8
|
+
._1tke1wug{min-height:auto}
|
|
8
9
|
._bfhk1j28{background-color:transparent}
|
|
9
10
|
._bfhk1j9a{background-color:var(--ds-background-input,#fff)}
|
|
10
11
|
._ca0qidpf{padding-top:0}
|
|
@@ -10,11 +10,13 @@ var controlStyles = {
|
|
|
10
10
|
focused: "_1h6d1p6i _bfhk1j9a _4cvx1p6i _irr31j9a",
|
|
11
11
|
disabled: "_irr3syzs",
|
|
12
12
|
subtle: "_1h6d1j28 _bfhk1j28 _4cvx1j28 _irr31gly",
|
|
13
|
-
root: "_ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1h6d1elr _bfhk1j9a _p12f1osq
|
|
13
|
+
root: "_ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1h6d1elr _bfhk1j9a _p12f1osq _14regrf3 _4cvx1elr _irr31d5g _1a98zg3v",
|
|
14
|
+
compact: "_1tke1wug"
|
|
14
15
|
};
|
|
15
16
|
var Control = function Control(props) {
|
|
17
|
+
var isCompact = props.appearance === 'compact';
|
|
16
18
|
return /*#__PURE__*/React.createElement(components.Control, _extends({}, props, {
|
|
17
|
-
xcss: cx(controlStyles.root, (props.selectProps.subtle || props.selectProps.noBorder) && controlStyles.subtle, props.isFocused && controlStyles.focused, props.isInvalid && controlStyles.invalid, props.isDisabled && controlStyles.disabled)
|
|
19
|
+
xcss: cx(controlStyles.root, isCompact && controlStyles.compact, (props.selectProps.subtle || props.selectProps.noBorder) && controlStyles.subtle, props.isFocused && controlStyles.focused, props.isInvalid && controlStyles.invalid, props.isDisabled && controlStyles.disabled)
|
|
18
20
|
}));
|
|
19
21
|
};
|
|
20
22
|
export default Control;
|