@atlaskit/user-picker 8.3.4 → 8.5.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 +25 -0
- package/dist/cjs/clients/UserSourceProvider.js +27 -20
- package/dist/cjs/components/AvatarItemOption.js +10 -16
- package/dist/cjs/components/ExternalUserOption/ExternalAvatarItemOption.js +43 -0
- package/dist/cjs/components/ExternalUserOption/InfoIcon.js +57 -0
- package/dist/cjs/components/ExternalUserOption/main.js +32 -19
- package/dist/cjs/components/ExternalUserSourcesContainer.js +1 -2
- package/dist/cjs/components/i18n.js +10 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/clients/UserSourceProvider.js +20 -15
- package/dist/es2019/components/AvatarItemOption.js +3 -9
- package/dist/es2019/components/ExternalUserOption/ExternalAvatarItemOption.js +49 -0
- package/dist/es2019/components/ExternalUserOption/InfoIcon.js +22 -0
- package/dist/es2019/components/ExternalUserOption/main.js +30 -16
- package/dist/es2019/components/ExternalUserSourcesContainer.js +1 -1
- package/dist/es2019/components/i18n.js +10 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/clients/UserSourceProvider.js +27 -20
- package/dist/esm/components/AvatarItemOption.js +10 -16
- package/dist/esm/components/ExternalUserOption/ExternalAvatarItemOption.js +24 -0
- package/dist/esm/components/ExternalUserOption/InfoIcon.js +33 -0
- package/dist/esm/components/ExternalUserOption/main.js +26 -16
- package/dist/esm/components/ExternalUserSourcesContainer.js +1 -2
- package/dist/esm/components/i18n.js +10 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/AvatarItemOption.d.ts +1 -2
- package/dist/types/components/ExternalUserOption/ExternalAvatarItemOption.d.ts +8 -0
- package/dist/types/components/ExternalUserOption/InfoIcon.d.ts +3 -0
- package/dist/types/components/i18n.d.ts +10 -0
- package/dist/types/types.d.ts +1 -1
- package/package.json +4 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @atlaskit/user-picker
|
|
2
2
|
|
|
3
|
+
## 8.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`b74959620f2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b74959620f2) - added hover state for info icon, and updated primary color correspondingly
|
|
8
|
+
separated avatar item option for external users and applied different css settings
|
|
9
|
+
|
|
10
|
+
## 8.4.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`22928ac80d0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/22928ac80d0) - Fix: user sources would keep being fetched in a loop as long as the tooltip was displayed
|
|
15
|
+
|
|
16
|
+
## 8.4.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- [`29dd0cee8cf`](https://bitbucket.org/atlassian/atlassian-frontend/commits/29dd0cee8cf) - [ux] Add support for Jira and Confluence user sources
|
|
21
|
+
|
|
22
|
+
## 8.3.5
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
|
|
3
28
|
## 8.3.4
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -37,10 +37,10 @@ var useUserSource = function useUserSource(accountId, shouldFetchSources, existi
|
|
|
37
37
|
var _useContext = (0, _react.useContext)(ExusUserSourceContext),
|
|
38
38
|
fetchUserSource = _useContext.fetchUserSource;
|
|
39
39
|
|
|
40
|
-
var _useState = (0, _react.useState)(
|
|
40
|
+
var _useState = (0, _react.useState)([]),
|
|
41
41
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
externalSources = _useState2[0],
|
|
43
|
+
setExternalSources = _useState2[1];
|
|
44
44
|
|
|
45
45
|
var _useState3 = (0, _react.useState)(true),
|
|
46
46
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
@@ -72,26 +72,33 @@ var useUserSource = function useUserSource(accountId, shouldFetchSources, existi
|
|
|
72
72
|
return cleanup;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
setLoading(false);
|
|
84
|
-
setError(error);
|
|
75
|
+
fetchUserSource(accountId, abortController === null || abortController === void 0 ? void 0 : abortController.signal).then(function (externalSources) {
|
|
76
|
+
if (!isMounted) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
setLoading(false);
|
|
81
|
+
var externalSourceTypes = externalSources.map(function (source) {
|
|
82
|
+
return source.sourceType;
|
|
85
83
|
});
|
|
86
|
-
|
|
84
|
+
setExternalSources(externalSourceTypes);
|
|
85
|
+
}).catch(function (error) {
|
|
86
|
+
if (!isMounted) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
87
89
|
|
|
90
|
+
setLoading(false);
|
|
91
|
+
setError(error);
|
|
92
|
+
});
|
|
88
93
|
return cleanup;
|
|
89
|
-
}, [fetchUserSource, accountId,
|
|
90
|
-
return {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
}, [fetchUserSource, accountId, abortController, shouldFetchSources]);
|
|
95
|
+
return (0, _react.useMemo)(function () {
|
|
96
|
+
return {
|
|
97
|
+
sources: Array.from(new Set([].concat((0, _toConsumableArray2.default)(existingSources !== null && existingSources !== void 0 ? existingSources : []), (0, _toConsumableArray2.default)(externalSources)))),
|
|
98
|
+
loading: loading,
|
|
99
|
+
error: error
|
|
100
|
+
};
|
|
101
|
+
}, [error, existingSources, externalSources, loading]);
|
|
95
102
|
};
|
|
96
103
|
|
|
97
104
|
exports.useUserSource = useUserSource;
|
|
@@ -44,24 +44,20 @@ var Text = _styledComponents.default.span(_templateObject2 || (_templateObject2
|
|
|
44
44
|
return secondary && "color: ".concat((0, _tokens.token)('color.text.selected', _colors.B400), "; font-size: 0.85em;");
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
var AdditionalInfo = _styledComponents.default.span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n float: right;\n
|
|
48
|
-
var withTooltip = _ref2.withTooltip;
|
|
49
|
-
return withTooltip && " padding-top: 5px;";
|
|
50
|
-
});
|
|
47
|
+
var AdditionalInfo = _styledComponents.default.span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n float: right;\n"])));
|
|
51
48
|
|
|
52
|
-
var TextWrapper = _styledComponents.default.span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n"])), function (
|
|
53
|
-
var color =
|
|
49
|
+
var TextWrapper = _styledComponents.default.span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n"])), function (_ref2) {
|
|
50
|
+
var color = _ref2.color;
|
|
54
51
|
return color;
|
|
55
52
|
});
|
|
56
53
|
|
|
57
54
|
exports.TextWrapper = TextWrapper;
|
|
58
55
|
|
|
59
|
-
var AvatarItemOption = function AvatarItemOption(
|
|
60
|
-
var avatar =
|
|
61
|
-
primaryText =
|
|
62
|
-
secondaryText =
|
|
63
|
-
lozenge =
|
|
64
|
-
sourcesInfoTooltip = _ref4.sourcesInfoTooltip;
|
|
56
|
+
var AvatarItemOption = function AvatarItemOption(_ref3) {
|
|
57
|
+
var avatar = _ref3.avatar,
|
|
58
|
+
primaryText = _ref3.primaryText,
|
|
59
|
+
secondaryText = _ref3.secondaryText,
|
|
60
|
+
lozenge = _ref3.lozenge;
|
|
65
61
|
return /*#__PURE__*/_react.default.createElement(Wrapper, null, avatar, /*#__PURE__*/_react.default.createElement("div", {
|
|
66
62
|
style: {
|
|
67
63
|
maxWidth: '100%',
|
|
@@ -70,9 +66,7 @@ var AvatarItemOption = function AvatarItemOption(_ref4) {
|
|
|
70
66
|
lineHeight: '1.4',
|
|
71
67
|
paddingLeft: '8px'
|
|
72
68
|
}
|
|
73
|
-
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(Text, null, primaryText), /*#__PURE__*/_react.default.createElement(AdditionalInfo,
|
|
74
|
-
withTooltip: Boolean(sourcesInfoTooltip)
|
|
75
|
-
}, !sourcesInfoTooltip && (lozenge === null || lozenge === void 0 ? void 0 : lozenge.text) && (lozenge !== null && lozenge !== void 0 && lozenge.tooltip ?
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(Text, null, primaryText), /*#__PURE__*/_react.default.createElement(AdditionalInfo, null, (lozenge === null || lozenge === void 0 ? void 0 : lozenge.text) && (lozenge !== null && lozenge !== void 0 && lozenge.tooltip ?
|
|
76
70
|
/*#__PURE__*/
|
|
77
71
|
// Note that entire Lozenge must be wrapped in the Tooltip (rather than just the
|
|
78
72
|
// Lozenge text) or tooltip won't work
|
|
@@ -80,7 +74,7 @@ var AvatarItemOption = function AvatarItemOption(_ref4) {
|
|
|
80
74
|
fallback: /*#__PURE__*/_react.default.createElement(_lozenge.default, lozenge, lozenge.text)
|
|
81
75
|
}, /*#__PURE__*/_react.default.createElement(AsyncTooltip, {
|
|
82
76
|
content: lozenge.tooltip
|
|
83
|
-
}, /*#__PURE__*/_react.default.createElement(_lozenge.default, lozenge, lozenge.text))) : /*#__PURE__*/_react.default.createElement(_lozenge.default, lozenge, lozenge.text))
|
|
77
|
+
}, /*#__PURE__*/_react.default.createElement(_lozenge.default, lozenge, lozenge.text))) : /*#__PURE__*/_react.default.createElement(_lozenge.default, lozenge, lozenge.text)))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(Text, {
|
|
84
78
|
secondary: true
|
|
85
79
|
}, secondaryText))));
|
|
86
80
|
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ExternalAvatarItemOption = void 0;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
+
|
|
16
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
17
|
+
|
|
18
|
+
var _tokens = require("@atlaskit/tokens");
|
|
19
|
+
|
|
20
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
21
|
+
|
|
22
|
+
var OuterWrapper = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n box-sizing: border-box;\n display: flex;\n line-height: 1;\n outline: none;\n margin: 0;\n width: 100%;\n cursor: pointer;\n"])));
|
|
23
|
+
|
|
24
|
+
var DetailsWrapper = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n max-width: 100%;\n min-width: 0;\n flex: 1 1 100%;\n line-height: 1.4;\n padding-left: 8px;\n align-items: center;\n"])));
|
|
25
|
+
|
|
26
|
+
var TextSection = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n width: calc(100% - 32px);\n flex: auto;\n"])));
|
|
27
|
+
|
|
28
|
+
var Text = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n max-width: 100%;\n margin: 0;\n color: ", ";\n ", "\n white-space: nowrap;\n\n > span {\n max-width: inherit;\n }\n"])), (0, _tokens.token)('color.text.selected', _colors.B400), function (_ref) {
|
|
29
|
+
var secondary = _ref.secondary;
|
|
30
|
+
return secondary && "color: ".concat((0, _tokens.token)('color.text.selected', _colors.B400), "; font-size: 0.85em;");
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var ExternalAvatarItemOption = function ExternalAvatarItemOption(_ref2) {
|
|
34
|
+
var avatar = _ref2.avatar,
|
|
35
|
+
primaryText = _ref2.primaryText,
|
|
36
|
+
secondaryText = _ref2.secondaryText,
|
|
37
|
+
sourcesInfoTooltip = _ref2.sourcesInfoTooltip;
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(OuterWrapper, null, avatar, /*#__PURE__*/_react.default.createElement(DetailsWrapper, null, /*#__PURE__*/_react.default.createElement(TextSection, null, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(Text, null, primaryText)), secondaryText && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(Text, {
|
|
39
|
+
secondary: true
|
|
40
|
+
}, secondaryText))), /*#__PURE__*/_react.default.createElement("div", null, sourcesInfoTooltip)));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.ExternalAvatarItemOption = ExternalAvatarItemOption;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
|
+
|
|
20
|
+
var _panel = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/panel"));
|
|
21
|
+
|
|
22
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
23
|
+
|
|
24
|
+
var _tokens = require("@atlaskit/tokens");
|
|
25
|
+
|
|
26
|
+
var _templateObject;
|
|
27
|
+
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
32
|
+
var Wrapper = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n"])));
|
|
33
|
+
|
|
34
|
+
var _default = function _default() {
|
|
35
|
+
var _useState = (0, _react.useState)(false),
|
|
36
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
37
|
+
isMouseHovered = _useState2[0],
|
|
38
|
+
setHoverState = _useState2[1];
|
|
39
|
+
|
|
40
|
+
var onMouseEnter = (0, _react.useCallback)(function () {
|
|
41
|
+
return setHoverState(true);
|
|
42
|
+
}, [setHoverState]);
|
|
43
|
+
var onMouseLeave = (0, _react.useCallback)(function () {
|
|
44
|
+
return setHoverState(false);
|
|
45
|
+
}, [setHoverState]);
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement(Wrapper, {
|
|
47
|
+
onMouseEnter: onMouseEnter,
|
|
48
|
+
onMouseLeave: onMouseLeave
|
|
49
|
+
}, /*#__PURE__*/_react.default.createElement(_panel.default, {
|
|
50
|
+
testId: "source-icon",
|
|
51
|
+
label: "",
|
|
52
|
+
size: "large",
|
|
53
|
+
primaryColor: (0, _tokens.token)('color.text.lowEmphasis', isMouseHovered ? _colors.N200 : _colors.N50)
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
exports.default = _default;
|
|
@@ -25,23 +25,27 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
25
25
|
|
|
26
26
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _react = _interopRequireDefault(require("react"));
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _reactIntlNext = require("react-intl-next");
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _confluenceIcon = require("@atlaskit/logo/confluence-icon");
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _jiraIcon = require("@atlaskit/logo/jira-icon");
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
39
|
+
|
|
40
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
41
|
+
|
|
42
|
+
var _tokens = require("@atlaskit/tokens");
|
|
39
43
|
|
|
40
44
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
41
45
|
|
|
42
|
-
var
|
|
46
|
+
var _AvatarItemOption = require("../AvatarItemOption");
|
|
43
47
|
|
|
44
|
-
var
|
|
48
|
+
var _SizeableAvatar = require("../SizeableAvatar");
|
|
45
49
|
|
|
46
50
|
var _slack = require("../assets/slack");
|
|
47
51
|
|
|
@@ -51,23 +55,25 @@ var _microsoft = require("../assets/microsoft");
|
|
|
51
55
|
|
|
52
56
|
var _github = require("../assets/github");
|
|
53
57
|
|
|
54
|
-
var _reactIntlNext = require("react-intl-next");
|
|
55
|
-
|
|
56
58
|
var _i18n = require("../i18n");
|
|
57
59
|
|
|
58
60
|
var _ExternalUserSourcesContainer = require("../ExternalUserSourcesContainer");
|
|
59
61
|
|
|
62
|
+
var _InfoIcon = _interopRequireDefault(require("./InfoIcon"));
|
|
63
|
+
|
|
64
|
+
var _ExternalAvatarItemOption = require("./ExternalAvatarItemOption");
|
|
65
|
+
|
|
60
66
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
61
67
|
|
|
62
68
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
63
69
|
|
|
64
70
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
65
71
|
|
|
66
|
-
var ImageContainer = _styledComponents.default.span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n height:
|
|
72
|
+
var ImageContainer = _styledComponents.default.span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n height: 16px;\n width: 16px;\n padding-right: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n"])));
|
|
67
73
|
|
|
68
74
|
exports.ImageContainer = ImageContainer;
|
|
69
75
|
|
|
70
|
-
var SourcesTooltipContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n padding-bottom: 4px;\n"])));
|
|
76
|
+
var SourcesTooltipContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n padding-bottom: 4px;\n padding-right: 4px;\n"])));
|
|
71
77
|
|
|
72
78
|
exports.SourcesTooltipContainer = SourcesTooltipContainer;
|
|
73
79
|
|
|
@@ -94,6 +100,18 @@ var SourcesInfoMap = new Map([['slack', {
|
|
|
94
100
|
key: 'github',
|
|
95
101
|
icon: /*#__PURE__*/_react.default.createElement(_github.GitHubIcon, null),
|
|
96
102
|
label: _i18n.messages.gitHubProvider
|
|
103
|
+
}], ['jira', {
|
|
104
|
+
key: 'jira',
|
|
105
|
+
icon: /*#__PURE__*/_react.default.createElement(_jiraIcon.JiraIcon, {
|
|
106
|
+
size: 'xsmall'
|
|
107
|
+
}),
|
|
108
|
+
label: _i18n.messages.jiraSource
|
|
109
|
+
}], ['confluence', {
|
|
110
|
+
key: 'confluence',
|
|
111
|
+
icon: /*#__PURE__*/_react.default.createElement(_confluenceIcon.ConfluenceIcon, {
|
|
112
|
+
size: 'xsmall'
|
|
113
|
+
}),
|
|
114
|
+
label: _i18n.messages.confluenceSource
|
|
97
115
|
}]]);
|
|
98
116
|
|
|
99
117
|
var ExternalUserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
@@ -152,12 +170,7 @@ var ExternalUserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
152
170
|
return _this.props.user.isExternal ? /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
153
171
|
content: _this.formattedTooltipContent(),
|
|
154
172
|
position: 'right-start'
|
|
155
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
156
|
-
testId: "source-icon",
|
|
157
|
-
label: "",
|
|
158
|
-
size: "large",
|
|
159
|
-
primaryColor: (0, _tokens.token)('color.text.lowEmphasis', _colors.N200)
|
|
160
|
-
})) : undefined;
|
|
173
|
+
}, /*#__PURE__*/_react.default.createElement(_InfoIcon.default, null)) : undefined;
|
|
161
174
|
});
|
|
162
175
|
return _this;
|
|
163
176
|
}
|
|
@@ -165,7 +178,7 @@ var ExternalUserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
165
178
|
(0, _createClass2.default)(ExternalUserOption, [{
|
|
166
179
|
key: "render",
|
|
167
180
|
value: function render() {
|
|
168
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
181
|
+
return /*#__PURE__*/_react.default.createElement(_ExternalAvatarItemOption.ExternalAvatarItemOption, {
|
|
169
182
|
avatar: this.renderAvatar(),
|
|
170
183
|
primaryText: this.getPrimaryText(),
|
|
171
184
|
secondaryText: this.renderSecondaryText(),
|
|
@@ -15,8 +15,7 @@ var ExternalUserSourcesContainer = function ExternalUserSourcesContainer(_ref) {
|
|
|
15
15
|
var children = _ref.children,
|
|
16
16
|
accountId = _ref.accountId,
|
|
17
17
|
shouldFetchSources = _ref.shouldFetchSources,
|
|
18
|
-
|
|
19
|
-
initialSources = _ref$initialSources === void 0 ? [] : _ref$initialSources;
|
|
18
|
+
initialSources = _ref.initialSources;
|
|
20
19
|
|
|
21
20
|
var _useUserSource = (0, _UserSourceProvider.useUserSource)(accountId, shouldFetchSources, initialSources),
|
|
22
21
|
sources = _useUserSource.sources,
|
|
@@ -98,6 +98,16 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
98
98
|
defaultMessage: 'GitHub',
|
|
99
99
|
description: 'This external user is sourced from GitHub provider'
|
|
100
100
|
},
|
|
101
|
+
jiraSource: {
|
|
102
|
+
id: 'fabric.elements.user-picker.source.jira',
|
|
103
|
+
defaultMessage: 'Jira',
|
|
104
|
+
description: 'This external user is sourced from Jira'
|
|
105
|
+
},
|
|
106
|
+
confluenceSource: {
|
|
107
|
+
id: 'fabric.elements.user-picker.source.confluence',
|
|
108
|
+
defaultMessage: 'Confluence',
|
|
109
|
+
description: 'This external user is sourced from Confluence'
|
|
110
|
+
},
|
|
101
111
|
memberLozengeText: {
|
|
102
112
|
id: 'fabric.elements.user-picker.member.lozenge.text',
|
|
103
113
|
defaultMessage: 'MEMBER',
|
package/dist/cjs/version.json
CHANGED
|
@@ -12,7 +12,7 @@ export const useUserSource = (accountId, shouldFetchSources, existingSources) =>
|
|
|
12
12
|
const {
|
|
13
13
|
fetchUserSource
|
|
14
14
|
} = useContext(ExusUserSourceContext);
|
|
15
|
-
const [
|
|
15
|
+
const [externalSources, setExternalSources] = useState([]);
|
|
16
16
|
const [loading, setLoading] = useState(true);
|
|
17
17
|
const [error, setError] = useState(null);
|
|
18
18
|
const abortController = useMemo(() => {
|
|
@@ -35,22 +35,27 @@ export const useUserSource = (accountId, shouldFetchSources, existingSources) =>
|
|
|
35
35
|
return cleanup;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
fetchUserSource(accountId, abortController === null || abortController === void 0 ? void 0 : abortController.signal).then(externalSources => {
|
|
39
|
+
if (!isMounted) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
setLoading(false);
|
|
44
|
+
const externalSourceTypes = externalSources.map(source => source.sourceType);
|
|
45
|
+
setExternalSources(externalSourceTypes);
|
|
46
|
+
}).catch(error => {
|
|
47
|
+
if (!isMounted) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
48
50
|
|
|
51
|
+
setLoading(false);
|
|
52
|
+
setError(error);
|
|
53
|
+
});
|
|
49
54
|
return cleanup;
|
|
50
|
-
}, [fetchUserSource, accountId,
|
|
51
|
-
return {
|
|
52
|
-
sources: Array.from(
|
|
55
|
+
}, [fetchUserSource, accountId, abortController, shouldFetchSources]);
|
|
56
|
+
return useMemo(() => ({
|
|
57
|
+
sources: Array.from(new Set([...(existingSources !== null && existingSources !== void 0 ? existingSources : []), ...externalSources])),
|
|
53
58
|
loading,
|
|
54
59
|
error
|
|
55
|
-
};
|
|
60
|
+
}), [error, existingSources, externalSources, loading]);
|
|
56
61
|
};
|
|
@@ -32,9 +32,6 @@ const Text = styled.span`
|
|
|
32
32
|
`;
|
|
33
33
|
const AdditionalInfo = styled.span`
|
|
34
34
|
float: right;
|
|
35
|
-
${({
|
|
36
|
-
withTooltip
|
|
37
|
-
}) => withTooltip && ` padding-top: 5px;`}
|
|
38
35
|
`;
|
|
39
36
|
export const TextWrapper = styled.span`
|
|
40
37
|
color: ${({
|
|
@@ -48,8 +45,7 @@ export const AvatarItemOption = ({
|
|
|
48
45
|
avatar,
|
|
49
46
|
primaryText,
|
|
50
47
|
secondaryText,
|
|
51
|
-
lozenge
|
|
52
|
-
sourcesInfoTooltip
|
|
48
|
+
lozenge
|
|
53
49
|
}) => /*#__PURE__*/React.createElement(Wrapper, null, avatar, /*#__PURE__*/React.createElement("div", {
|
|
54
50
|
style: {
|
|
55
51
|
maxWidth: '100%',
|
|
@@ -58,9 +54,7 @@ export const AvatarItemOption = ({
|
|
|
58
54
|
lineHeight: '1.4',
|
|
59
55
|
paddingLeft: '8px'
|
|
60
56
|
}
|
|
61
|
-
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, null, primaryText), /*#__PURE__*/React.createElement(AdditionalInfo,
|
|
62
|
-
withTooltip: Boolean(sourcesInfoTooltip)
|
|
63
|
-
}, !sourcesInfoTooltip && (lozenge === null || lozenge === void 0 ? void 0 : lozenge.text) && (lozenge !== null && lozenge !== void 0 && lozenge.tooltip ?
|
|
57
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, null, primaryText), /*#__PURE__*/React.createElement(AdditionalInfo, null, (lozenge === null || lozenge === void 0 ? void 0 : lozenge.text) && (lozenge !== null && lozenge !== void 0 && lozenge.tooltip ?
|
|
64
58
|
/*#__PURE__*/
|
|
65
59
|
// Note that entire Lozenge must be wrapped in the Tooltip (rather than just the
|
|
66
60
|
// Lozenge text) or tooltip won't work
|
|
@@ -68,6 +62,6 @@ React.createElement(React.Suspense, {
|
|
|
68
62
|
fallback: /*#__PURE__*/React.createElement(Lozenge, lozenge, lozenge.text)
|
|
69
63
|
}, /*#__PURE__*/React.createElement(AsyncTooltip, {
|
|
70
64
|
content: lozenge.tooltip
|
|
71
|
-
}, /*#__PURE__*/React.createElement(Lozenge, lozenge, lozenge.text))) : /*#__PURE__*/React.createElement(Lozenge, lozenge, lozenge.text))
|
|
65
|
+
}, /*#__PURE__*/React.createElement(Lozenge, lozenge, lozenge.text))) : /*#__PURE__*/React.createElement(Lozenge, lozenge, lozenge.text)))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, {
|
|
72
66
|
secondary: true
|
|
73
67
|
}, secondaryText))));
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { B400 } from '@atlaskit/theme/colors';
|
|
4
|
+
import { token } from '@atlaskit/tokens';
|
|
5
|
+
const OuterWrapper = styled.div`
|
|
6
|
+
align-items: center;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
display: flex;
|
|
9
|
+
line-height: 1;
|
|
10
|
+
outline: none;
|
|
11
|
+
margin: 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
`;
|
|
15
|
+
const DetailsWrapper = styled.div`
|
|
16
|
+
display: flex;
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
min-width: 0;
|
|
19
|
+
flex: 1 1 100%;
|
|
20
|
+
line-height: 1.4;
|
|
21
|
+
padding-left: 8px;
|
|
22
|
+
align-items: center;
|
|
23
|
+
`;
|
|
24
|
+
const TextSection = styled.div`
|
|
25
|
+
width: calc(100% - 32px);
|
|
26
|
+
flex: auto;
|
|
27
|
+
`;
|
|
28
|
+
const Text = styled.div`
|
|
29
|
+
display: flex;
|
|
30
|
+
max-width: 100%;
|
|
31
|
+
margin: 0;
|
|
32
|
+
color: ${token('color.text.selected', B400)};
|
|
33
|
+
${({
|
|
34
|
+
secondary
|
|
35
|
+
}) => secondary && `color: ${token('color.text.selected', B400)}; font-size: 0.85em;`}
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
|
|
38
|
+
> span {
|
|
39
|
+
max-width: inherit;
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
export const ExternalAvatarItemOption = ({
|
|
43
|
+
avatar,
|
|
44
|
+
primaryText,
|
|
45
|
+
secondaryText,
|
|
46
|
+
sourcesInfoTooltip
|
|
47
|
+
}) => /*#__PURE__*/React.createElement(OuterWrapper, null, avatar, /*#__PURE__*/React.createElement(DetailsWrapper, null, /*#__PURE__*/React.createElement(TextSection, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, null, primaryText)), secondaryText && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, {
|
|
48
|
+
secondary: true
|
|
49
|
+
}, secondaryText))), /*#__PURE__*/React.createElement("div", null, sourcesInfoTooltip)));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import EditorPanelIcon from '@atlaskit/icon/glyph/editor/panel';
|
|
4
|
+
import { N50, N200 } from '@atlaskit/theme/colors';
|
|
5
|
+
import { token } from '@atlaskit/tokens';
|
|
6
|
+
const Wrapper = styled.div`
|
|
7
|
+
display: flex;
|
|
8
|
+
`;
|
|
9
|
+
export default (() => {
|
|
10
|
+
const [isMouseHovered, setHoverState] = useState(false);
|
|
11
|
+
const onMouseEnter = useCallback(() => setHoverState(true), [setHoverState]);
|
|
12
|
+
const onMouseLeave = useCallback(() => setHoverState(false), [setHoverState]);
|
|
13
|
+
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
14
|
+
onMouseEnter: onMouseEnter,
|
|
15
|
+
onMouseLeave: onMouseLeave
|
|
16
|
+
}, /*#__PURE__*/React.createElement(EditorPanelIcon, {
|
|
17
|
+
testId: "source-icon",
|
|
18
|
+
label: "",
|
|
19
|
+
size: "large",
|
|
20
|
+
primaryColor: token('color.text.lowEmphasis', isMouseHovered ? N200 : N50)
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { ConfluenceIcon } from '@atlaskit/logo/confluence-icon';
|
|
6
|
+
import { JiraIcon } from '@atlaskit/logo/jira-icon';
|
|
7
|
+
import Spinner from '@atlaskit/spinner';
|
|
2
8
|
import { B400, N200, N800 } from '@atlaskit/theme/colors';
|
|
3
9
|
import { token } from '@atlaskit/tokens';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { AvatarItemOption, TextWrapper } from '../AvatarItemOption';
|
|
6
|
-
import { SizeableAvatar } from '../SizeableAvatar';
|
|
7
|
-
import EditorPanelIcon from '@atlaskit/icon/glyph/editor/panel';
|
|
8
10
|
import Tooltip from '@atlaskit/tooltip';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
+
import { TextWrapper } from '../AvatarItemOption';
|
|
12
|
+
import { SizeableAvatar } from '../SizeableAvatar';
|
|
11
13
|
import { SlackIcon } from '../assets/slack';
|
|
12
14
|
import { GoogleIcon } from '../assets/google';
|
|
13
15
|
import { MicrosoftIcon } from '../assets/microsoft';
|
|
14
16
|
import { GitHubIcon } from '../assets/github';
|
|
15
|
-
import { FormattedMessage } from 'react-intl-next';
|
|
16
17
|
import { messages } from '../i18n';
|
|
17
18
|
import { ExternalUserSourcesContainer } from '../ExternalUserSourcesContainer';
|
|
19
|
+
import InfoIcon from './InfoIcon';
|
|
20
|
+
import { ExternalAvatarItemOption } from './ExternalAvatarItemOption';
|
|
18
21
|
export const ImageContainer = styled.span`
|
|
19
|
-
height:
|
|
20
|
-
width:
|
|
22
|
+
height: 16px;
|
|
23
|
+
width: 16px;
|
|
21
24
|
padding-right: 4px;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
22
28
|
`;
|
|
23
29
|
export const SourcesTooltipContainer = styled.div`
|
|
24
30
|
padding-bottom: 4px;
|
|
31
|
+
padding-right: 4px;
|
|
25
32
|
`;
|
|
26
33
|
export const SourceWrapper = styled.div`
|
|
27
34
|
padding-top: 4px;
|
|
@@ -47,6 +54,18 @@ const SourcesInfoMap = new Map([['slack', {
|
|
|
47
54
|
key: 'github',
|
|
48
55
|
icon: /*#__PURE__*/React.createElement(GitHubIcon, null),
|
|
49
56
|
label: messages.gitHubProvider
|
|
57
|
+
}], ['jira', {
|
|
58
|
+
key: 'jira',
|
|
59
|
+
icon: /*#__PURE__*/React.createElement(JiraIcon, {
|
|
60
|
+
size: 'xsmall'
|
|
61
|
+
}),
|
|
62
|
+
label: messages.jiraSource
|
|
63
|
+
}], ['confluence', {
|
|
64
|
+
key: 'confluence',
|
|
65
|
+
icon: /*#__PURE__*/React.createElement(ConfluenceIcon, {
|
|
66
|
+
size: 'xsmall'
|
|
67
|
+
}),
|
|
68
|
+
label: messages.confluenceSource
|
|
50
69
|
}]]);
|
|
51
70
|
export class ExternalUserOption extends React.PureComponent {
|
|
52
71
|
constructor(...args) {
|
|
@@ -99,16 +118,11 @@ export class ExternalUserOption extends React.PureComponent {
|
|
|
99
118
|
_defineProperty(this, "getSourcesInfoTooltip", () => this.props.user.isExternal ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
100
119
|
content: this.formattedTooltipContent(),
|
|
101
120
|
position: 'right-start'
|
|
102
|
-
}, /*#__PURE__*/React.createElement(
|
|
103
|
-
testId: "source-icon",
|
|
104
|
-
label: "",
|
|
105
|
-
size: "large",
|
|
106
|
-
primaryColor: token('color.text.lowEmphasis', N200)
|
|
107
|
-
})) : undefined);
|
|
121
|
+
}, /*#__PURE__*/React.createElement(InfoIcon, null)) : undefined);
|
|
108
122
|
}
|
|
109
123
|
|
|
110
124
|
render() {
|
|
111
|
-
return /*#__PURE__*/React.createElement(
|
|
125
|
+
return /*#__PURE__*/React.createElement(ExternalAvatarItemOption, {
|
|
112
126
|
avatar: this.renderAvatar(),
|
|
113
127
|
primaryText: this.getPrimaryText(),
|
|
114
128
|
secondaryText: this.renderSecondaryText(),
|
|
@@ -90,6 +90,16 @@ export const messages = defineMessages({
|
|
|
90
90
|
defaultMessage: 'GitHub',
|
|
91
91
|
description: 'This external user is sourced from GitHub provider'
|
|
92
92
|
},
|
|
93
|
+
jiraSource: {
|
|
94
|
+
id: 'fabric.elements.user-picker.source.jira',
|
|
95
|
+
defaultMessage: 'Jira',
|
|
96
|
+
description: 'This external user is sourced from Jira'
|
|
97
|
+
},
|
|
98
|
+
confluenceSource: {
|
|
99
|
+
id: 'fabric.elements.user-picker.source.confluence',
|
|
100
|
+
defaultMessage: 'Confluence',
|
|
101
|
+
description: 'This external user is sourced from Confluence'
|
|
102
|
+
},
|
|
93
103
|
memberLozengeText: {
|
|
94
104
|
id: 'fabric.elements.user-picker.member.lozenge.text',
|
|
95
105
|
defaultMessage: 'MEMBER',
|
package/dist/es2019/version.json
CHANGED
|
@@ -15,10 +15,10 @@ export var useUserSource = function useUserSource(accountId, shouldFetchSources,
|
|
|
15
15
|
var _useContext = useContext(ExusUserSourceContext),
|
|
16
16
|
fetchUserSource = _useContext.fetchUserSource;
|
|
17
17
|
|
|
18
|
-
var _useState = useState(
|
|
18
|
+
var _useState = useState([]),
|
|
19
19
|
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
externalSources = _useState2[0],
|
|
21
|
+
setExternalSources = _useState2[1];
|
|
22
22
|
|
|
23
23
|
var _useState3 = useState(true),
|
|
24
24
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
@@ -50,24 +50,31 @@ export var useUserSource = function useUserSource(accountId, shouldFetchSources,
|
|
|
50
50
|
return cleanup;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
setLoading(false);
|
|
62
|
-
setError(error);
|
|
53
|
+
fetchUserSource(accountId, abortController === null || abortController === void 0 ? void 0 : abortController.signal).then(function (externalSources) {
|
|
54
|
+
if (!isMounted) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
setLoading(false);
|
|
59
|
+
var externalSourceTypes = externalSources.map(function (source) {
|
|
60
|
+
return source.sourceType;
|
|
63
61
|
});
|
|
64
|
-
|
|
62
|
+
setExternalSources(externalSourceTypes);
|
|
63
|
+
}).catch(function (error) {
|
|
64
|
+
if (!isMounted) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
65
67
|
|
|
68
|
+
setLoading(false);
|
|
69
|
+
setError(error);
|
|
70
|
+
});
|
|
66
71
|
return cleanup;
|
|
67
|
-
}, [fetchUserSource, accountId,
|
|
68
|
-
return {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
}, [fetchUserSource, accountId, abortController, shouldFetchSources]);
|
|
73
|
+
return useMemo(function () {
|
|
74
|
+
return {
|
|
75
|
+
sources: Array.from(new Set([].concat(_toConsumableArray(existingSources !== null && existingSources !== void 0 ? existingSources : []), _toConsumableArray(externalSources)))),
|
|
76
|
+
loading: loading,
|
|
77
|
+
error: error
|
|
78
|
+
};
|
|
79
|
+
}, [error, existingSources, externalSources, loading]);
|
|
73
80
|
};
|
|
@@ -21,20 +21,16 @@ var Text = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLi
|
|
|
21
21
|
var secondary = _ref.secondary;
|
|
22
22
|
return secondary && "color: ".concat(token('color.text.selected', B400), "; font-size: 0.85em;");
|
|
23
23
|
});
|
|
24
|
-
var AdditionalInfo = styled.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n float: right;\n
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
export var TextWrapper = styled.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n"])), function (_ref3) {
|
|
29
|
-
var color = _ref3.color;
|
|
24
|
+
var AdditionalInfo = styled.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n float: right;\n"])));
|
|
25
|
+
export var TextWrapper = styled.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n"])), function (_ref2) {
|
|
26
|
+
var color = _ref2.color;
|
|
30
27
|
return color;
|
|
31
28
|
});
|
|
32
|
-
export var AvatarItemOption = function AvatarItemOption(
|
|
33
|
-
var avatar =
|
|
34
|
-
primaryText =
|
|
35
|
-
secondaryText =
|
|
36
|
-
lozenge =
|
|
37
|
-
sourcesInfoTooltip = _ref4.sourcesInfoTooltip;
|
|
29
|
+
export var AvatarItemOption = function AvatarItemOption(_ref3) {
|
|
30
|
+
var avatar = _ref3.avatar,
|
|
31
|
+
primaryText = _ref3.primaryText,
|
|
32
|
+
secondaryText = _ref3.secondaryText,
|
|
33
|
+
lozenge = _ref3.lozenge;
|
|
38
34
|
return /*#__PURE__*/React.createElement(Wrapper, null, avatar, /*#__PURE__*/React.createElement("div", {
|
|
39
35
|
style: {
|
|
40
36
|
maxWidth: '100%',
|
|
@@ -43,9 +39,7 @@ export var AvatarItemOption = function AvatarItemOption(_ref4) {
|
|
|
43
39
|
lineHeight: '1.4',
|
|
44
40
|
paddingLeft: '8px'
|
|
45
41
|
}
|
|
46
|
-
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, null, primaryText), /*#__PURE__*/React.createElement(AdditionalInfo,
|
|
47
|
-
withTooltip: Boolean(sourcesInfoTooltip)
|
|
48
|
-
}, !sourcesInfoTooltip && (lozenge === null || lozenge === void 0 ? void 0 : lozenge.text) && (lozenge !== null && lozenge !== void 0 && lozenge.tooltip ?
|
|
42
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, null, primaryText), /*#__PURE__*/React.createElement(AdditionalInfo, null, (lozenge === null || lozenge === void 0 ? void 0 : lozenge.text) && (lozenge !== null && lozenge !== void 0 && lozenge.tooltip ?
|
|
49
43
|
/*#__PURE__*/
|
|
50
44
|
// Note that entire Lozenge must be wrapped in the Tooltip (rather than just the
|
|
51
45
|
// Lozenge text) or tooltip won't work
|
|
@@ -53,7 +47,7 @@ export var AvatarItemOption = function AvatarItemOption(_ref4) {
|
|
|
53
47
|
fallback: /*#__PURE__*/React.createElement(Lozenge, lozenge, lozenge.text)
|
|
54
48
|
}, /*#__PURE__*/React.createElement(AsyncTooltip, {
|
|
55
49
|
content: lozenge.tooltip
|
|
56
|
-
}, /*#__PURE__*/React.createElement(Lozenge, lozenge, lozenge.text))) : /*#__PURE__*/React.createElement(Lozenge, lozenge, lozenge.text))
|
|
50
|
+
}, /*#__PURE__*/React.createElement(Lozenge, lozenge, lozenge.text))) : /*#__PURE__*/React.createElement(Lozenge, lozenge, lozenge.text)))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, {
|
|
57
51
|
secondary: true
|
|
58
52
|
}, secondaryText))));
|
|
59
53
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
import { B400 } from '@atlaskit/theme/colors';
|
|
8
|
+
import { token } from '@atlaskit/tokens';
|
|
9
|
+
var OuterWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n box-sizing: border-box;\n display: flex;\n line-height: 1;\n outline: none;\n margin: 0;\n width: 100%;\n cursor: pointer;\n"])));
|
|
10
|
+
var DetailsWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n max-width: 100%;\n min-width: 0;\n flex: 1 1 100%;\n line-height: 1.4;\n padding-left: 8px;\n align-items: center;\n"])));
|
|
11
|
+
var TextSection = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: calc(100% - 32px);\n flex: auto;\n"])));
|
|
12
|
+
var Text = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n max-width: 100%;\n margin: 0;\n color: ", ";\n ", "\n white-space: nowrap;\n\n > span {\n max-width: inherit;\n }\n"])), token('color.text.selected', B400), function (_ref) {
|
|
13
|
+
var secondary = _ref.secondary;
|
|
14
|
+
return secondary && "color: ".concat(token('color.text.selected', B400), "; font-size: 0.85em;");
|
|
15
|
+
});
|
|
16
|
+
export var ExternalAvatarItemOption = function ExternalAvatarItemOption(_ref2) {
|
|
17
|
+
var avatar = _ref2.avatar,
|
|
18
|
+
primaryText = _ref2.primaryText,
|
|
19
|
+
secondaryText = _ref2.secondaryText,
|
|
20
|
+
sourcesInfoTooltip = _ref2.sourcesInfoTooltip;
|
|
21
|
+
return /*#__PURE__*/React.createElement(OuterWrapper, null, avatar, /*#__PURE__*/React.createElement(DetailsWrapper, null, /*#__PURE__*/React.createElement(TextSection, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, null, primaryText)), secondaryText && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, {
|
|
22
|
+
secondary: true
|
|
23
|
+
}, secondaryText))), /*#__PURE__*/React.createElement("div", null, sourcesInfoTooltip)));
|
|
24
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
3
|
+
|
|
4
|
+
var _templateObject;
|
|
5
|
+
|
|
6
|
+
import React, { useCallback, useState } from 'react';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import EditorPanelIcon from '@atlaskit/icon/glyph/editor/panel';
|
|
9
|
+
import { N50, N200 } from '@atlaskit/theme/colors';
|
|
10
|
+
import { token } from '@atlaskit/tokens';
|
|
11
|
+
var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n"])));
|
|
12
|
+
export default (function () {
|
|
13
|
+
var _useState = useState(false),
|
|
14
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15
|
+
isMouseHovered = _useState2[0],
|
|
16
|
+
setHoverState = _useState2[1];
|
|
17
|
+
|
|
18
|
+
var onMouseEnter = useCallback(function () {
|
|
19
|
+
return setHoverState(true);
|
|
20
|
+
}, [setHoverState]);
|
|
21
|
+
var onMouseLeave = useCallback(function () {
|
|
22
|
+
return setHoverState(false);
|
|
23
|
+
}, [setHoverState]);
|
|
24
|
+
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
25
|
+
onMouseEnter: onMouseEnter,
|
|
26
|
+
onMouseLeave: onMouseLeave
|
|
27
|
+
}, /*#__PURE__*/React.createElement(EditorPanelIcon, {
|
|
28
|
+
testId: "source-icon",
|
|
29
|
+
label: "",
|
|
30
|
+
size: "large",
|
|
31
|
+
primaryColor: token('color.text.lowEmphasis', isMouseHovered ? N200 : N50)
|
|
32
|
+
}));
|
|
33
|
+
});
|
|
@@ -14,24 +14,27 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
14
14
|
|
|
15
15
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
16
|
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
19
|
+
import styled from 'styled-components';
|
|
20
|
+
import { ConfluenceIcon } from '@atlaskit/logo/confluence-icon';
|
|
21
|
+
import { JiraIcon } from '@atlaskit/logo/jira-icon';
|
|
22
|
+
import Spinner from '@atlaskit/spinner';
|
|
17
23
|
import { B400, N200, N800 } from '@atlaskit/theme/colors';
|
|
18
24
|
import { token } from '@atlaskit/tokens';
|
|
19
|
-
import React from 'react';
|
|
20
|
-
import { AvatarItemOption, TextWrapper } from '../AvatarItemOption';
|
|
21
|
-
import { SizeableAvatar } from '../SizeableAvatar';
|
|
22
|
-
import EditorPanelIcon from '@atlaskit/icon/glyph/editor/panel';
|
|
23
25
|
import Tooltip from '@atlaskit/tooltip';
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
+
import { TextWrapper } from '../AvatarItemOption';
|
|
27
|
+
import { SizeableAvatar } from '../SizeableAvatar';
|
|
26
28
|
import { SlackIcon } from '../assets/slack';
|
|
27
29
|
import { GoogleIcon } from '../assets/google';
|
|
28
30
|
import { MicrosoftIcon } from '../assets/microsoft';
|
|
29
31
|
import { GitHubIcon } from '../assets/github';
|
|
30
|
-
import { FormattedMessage } from 'react-intl-next';
|
|
31
32
|
import { messages } from '../i18n';
|
|
32
33
|
import { ExternalUserSourcesContainer } from '../ExternalUserSourcesContainer';
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
import InfoIcon from './InfoIcon';
|
|
35
|
+
import { ExternalAvatarItemOption } from './ExternalAvatarItemOption';
|
|
36
|
+
export var ImageContainer = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 16px;\n width: 16px;\n padding-right: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n"])));
|
|
37
|
+
export var SourcesTooltipContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding-bottom: 4px;\n padding-right: 4px;\n"])));
|
|
35
38
|
export var SourceWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding-top: 4px;\n display: flex;\n align-items: center;\n"])));
|
|
36
39
|
export var EmailDomainWrapper = styled.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-weight: bold;\n"])));
|
|
37
40
|
var SourcesInfoMap = new Map([['slack', {
|
|
@@ -50,6 +53,18 @@ var SourcesInfoMap = new Map([['slack', {
|
|
|
50
53
|
key: 'github',
|
|
51
54
|
icon: /*#__PURE__*/React.createElement(GitHubIcon, null),
|
|
52
55
|
label: messages.gitHubProvider
|
|
56
|
+
}], ['jira', {
|
|
57
|
+
key: 'jira',
|
|
58
|
+
icon: /*#__PURE__*/React.createElement(JiraIcon, {
|
|
59
|
+
size: 'xsmall'
|
|
60
|
+
}),
|
|
61
|
+
label: messages.jiraSource
|
|
62
|
+
}], ['confluence', {
|
|
63
|
+
key: 'confluence',
|
|
64
|
+
icon: /*#__PURE__*/React.createElement(ConfluenceIcon, {
|
|
65
|
+
size: 'xsmall'
|
|
66
|
+
}),
|
|
67
|
+
label: messages.confluenceSource
|
|
53
68
|
}]]);
|
|
54
69
|
export var ExternalUserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
55
70
|
_inherits(ExternalUserOption, _React$PureComponent);
|
|
@@ -111,12 +126,7 @@ export var ExternalUserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
111
126
|
return _this.props.user.isExternal ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
112
127
|
content: _this.formattedTooltipContent(),
|
|
113
128
|
position: 'right-start'
|
|
114
|
-
}, /*#__PURE__*/React.createElement(
|
|
115
|
-
testId: "source-icon",
|
|
116
|
-
label: "",
|
|
117
|
-
size: "large",
|
|
118
|
-
primaryColor: token('color.text.lowEmphasis', N200)
|
|
119
|
-
})) : undefined;
|
|
129
|
+
}, /*#__PURE__*/React.createElement(InfoIcon, null)) : undefined;
|
|
120
130
|
});
|
|
121
131
|
|
|
122
132
|
return _this;
|
|
@@ -125,7 +135,7 @@ export var ExternalUserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
125
135
|
_createClass(ExternalUserOption, [{
|
|
126
136
|
key: "render",
|
|
127
137
|
value: function render() {
|
|
128
|
-
return /*#__PURE__*/React.createElement(
|
|
138
|
+
return /*#__PURE__*/React.createElement(ExternalAvatarItemOption, {
|
|
129
139
|
avatar: this.renderAvatar(),
|
|
130
140
|
primaryText: this.getPrimaryText(),
|
|
131
141
|
secondaryText: this.renderSecondaryText(),
|
|
@@ -4,8 +4,7 @@ export var ExternalUserSourcesContainer = function ExternalUserSourcesContainer(
|
|
|
4
4
|
var children = _ref.children,
|
|
5
5
|
accountId = _ref.accountId,
|
|
6
6
|
shouldFetchSources = _ref.shouldFetchSources,
|
|
7
|
-
|
|
8
|
-
initialSources = _ref$initialSources === void 0 ? [] : _ref$initialSources;
|
|
7
|
+
initialSources = _ref.initialSources;
|
|
9
8
|
|
|
10
9
|
var _useUserSource = useUserSource(accountId, shouldFetchSources, initialSources),
|
|
11
10
|
sources = _useUserSource.sources,
|
|
@@ -90,6 +90,16 @@ export var messages = defineMessages({
|
|
|
90
90
|
defaultMessage: 'GitHub',
|
|
91
91
|
description: 'This external user is sourced from GitHub provider'
|
|
92
92
|
},
|
|
93
|
+
jiraSource: {
|
|
94
|
+
id: 'fabric.elements.user-picker.source.jira',
|
|
95
|
+
defaultMessage: 'Jira',
|
|
96
|
+
description: 'This external user is sourced from Jira'
|
|
97
|
+
},
|
|
98
|
+
confluenceSource: {
|
|
99
|
+
id: 'fabric.elements.user-picker.source.confluence',
|
|
100
|
+
defaultMessage: 'Confluence',
|
|
101
|
+
description: 'This external user is sourced from Confluence'
|
|
102
|
+
},
|
|
93
103
|
memberLozengeText: {
|
|
94
104
|
id: 'fabric.elements.user-picker.member.lozenge.text',
|
|
95
105
|
defaultMessage: 'MEMBER',
|
package/dist/esm/version.json
CHANGED
|
@@ -6,6 +6,5 @@ export declare type AvatarItemOptionProps = {
|
|
|
6
6
|
primaryText?: ReactNode;
|
|
7
7
|
secondaryText?: ReactNode;
|
|
8
8
|
lozenge?: LozengeProps;
|
|
9
|
-
sourcesInfoTooltip?: ReactNode;
|
|
10
9
|
};
|
|
11
|
-
export declare const AvatarItemOption: ({ avatar, primaryText, secondaryText, lozenge,
|
|
10
|
+
export declare const AvatarItemOption: ({ avatar, primaryText, secondaryText, lozenge, }: AvatarItemOptionProps) => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare type ExternalAvatarItemOptionProps = {
|
|
3
|
+
avatar: ReactNode;
|
|
4
|
+
primaryText: ReactNode;
|
|
5
|
+
secondaryText?: ReactNode;
|
|
6
|
+
sourcesInfoTooltip?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export declare const ExternalAvatarItemOption: ({ avatar, primaryText, secondaryText, sourcesInfoTooltip, }: ExternalAvatarItemOptionProps) => JSX.Element;
|
|
@@ -89,6 +89,16 @@ export declare const messages: {
|
|
|
89
89
|
defaultMessage: string;
|
|
90
90
|
description: string;
|
|
91
91
|
};
|
|
92
|
+
jiraSource: {
|
|
93
|
+
id: string;
|
|
94
|
+
defaultMessage: string;
|
|
95
|
+
description: string;
|
|
96
|
+
};
|
|
97
|
+
confluenceSource: {
|
|
98
|
+
id: string;
|
|
99
|
+
defaultMessage: string;
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
92
102
|
memberLozengeText: {
|
|
93
103
|
id: string;
|
|
94
104
|
defaultMessage: string;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -208,7 +208,7 @@ export interface OptionData {
|
|
|
208
208
|
lozenge?: string | LozengeProps;
|
|
209
209
|
}
|
|
210
210
|
export declare const UserType = "user";
|
|
211
|
-
export declare type UserSource = 'google' | 'slack' | 'microsoft' | 'github';
|
|
211
|
+
export declare type UserSource = 'google' | 'slack' | 'microsoft' | 'github' | 'jira' | 'confluence';
|
|
212
212
|
export interface ExternalUser extends User {
|
|
213
213
|
requiresSourceHydration?: boolean;
|
|
214
214
|
sources: UserSource[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/user-picker",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.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/"
|
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
30
30
|
"@atlaskit/avatar": "^20.5.0",
|
|
31
31
|
"@atlaskit/icon": "^21.10.0",
|
|
32
|
+
"@atlaskit/logo": "^13.5.4",
|
|
32
33
|
"@atlaskit/lozenge": "^11.0.0",
|
|
33
34
|
"@atlaskit/popper": "^5.0.0",
|
|
34
35
|
"@atlaskit/select": "^15.2.0",
|
|
35
36
|
"@atlaskit/spinner": "^15.1.4",
|
|
36
37
|
"@atlaskit/theme": "^12.1.0",
|
|
37
|
-
"@atlaskit/tokens": "^0.
|
|
38
|
+
"@atlaskit/tokens": "^0.6.0",
|
|
38
39
|
"@atlaskit/tooltip": "^17.5.0",
|
|
39
40
|
"@babel/runtime": "^7.0.0",
|
|
40
41
|
"lodash": "^4.17.21",
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
"@atlaskit/range": "^5.0.11",
|
|
58
59
|
"@atlaskit/section-message": "^6.0.0",
|
|
59
60
|
"@atlaskit/textfield": "^5.0.0",
|
|
60
|
-
"@atlaskit/util-data-test": "^17.
|
|
61
|
+
"@atlaskit/util-data-test": "^17.2.0",
|
|
61
62
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
62
63
|
"@testing-library/dom": "^7.7.3",
|
|
63
64
|
"@testing-library/jest-dom": "^4.1.0",
|
|
@@ -76,10 +77,5 @@
|
|
|
76
77
|
"fabric",
|
|
77
78
|
"ui"
|
|
78
79
|
],
|
|
79
|
-
"techstack": {
|
|
80
|
-
"@repo/internal": {
|
|
81
|
-
"theming": "tokens"
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
80
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
85
81
|
}
|