@atlaskit/user-picker 9.0.0 → 9.0.1
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 +6 -0
- package/dist/cjs/components/AddOptionAvatar.js +16 -12
- package/dist/cjs/components/AvatarItemOption.js +56 -32
- package/dist/cjs/components/EmailOption/main.js +9 -7
- package/dist/cjs/components/ExternalUserOption/ExternalAvatarItemOption.js +62 -21
- package/dist/cjs/components/ExternalUserOption/InfoIcon.js +9 -15
- package/dist/cjs/components/ExternalUserOption/SourcesTooltipContent.js +29 -23
- package/dist/cjs/components/ExternalUserOption/main.js +28 -24
- package/dist/cjs/components/GroupOption/main.js +23 -19
- package/dist/cjs/components/MultiValue.js +18 -16
- package/dist/cjs/components/PopupControl.js +20 -21
- package/dist/cjs/components/SingleValue.js +25 -11
- package/dist/cjs/components/SingleValueContainer.js +9 -8
- package/dist/cjs/components/TeamOption/main.js +13 -11
- package/dist/cjs/components/UserOption.js +13 -11
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/AddOptionAvatar.js +16 -11
- package/dist/es2019/components/AvatarItemOption.js +47 -42
- package/dist/es2019/components/EmailOption/main.js +11 -8
- package/dist/es2019/components/ExternalUserOption/ExternalAvatarItemOption.js +56 -41
- package/dist/es2019/components/ExternalUserOption/InfoIcon.js +9 -7
- package/dist/es2019/components/ExternalUserOption/SourcesTooltipContent.js +27 -21
- package/dist/es2019/components/ExternalUserOption/main.js +28 -24
- package/dist/es2019/components/GroupOption/main.js +22 -19
- package/dist/es2019/components/MultiValue.js +19 -13
- package/dist/es2019/components/PopupControl.js +21 -18
- package/dist/es2019/components/SingleValue.js +25 -22
- package/dist/es2019/components/SingleValueContainer.js +11 -7
- package/dist/es2019/components/TeamOption/main.js +15 -12
- package/dist/es2019/components/UserOption.js +15 -12
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/AddOptionAvatar.js +17 -11
- package/dist/esm/components/AvatarItemOption.js +56 -27
- package/dist/esm/components/EmailOption/main.js +10 -8
- package/dist/esm/components/ExternalUserOption/ExternalAvatarItemOption.js +65 -18
- package/dist/esm/components/ExternalUserOption/InfoIcon.js +9 -8
- package/dist/esm/components/ExternalUserOption/SourcesTooltipContent.js +27 -18
- package/dist/esm/components/ExternalUserOption/main.js +27 -18
- package/dist/esm/components/GroupOption/main.js +22 -15
- package/dist/esm/components/MultiValue.js +19 -13
- package/dist/esm/components/PopupControl.js +21 -11
- package/dist/esm/components/SingleValue.js +26 -9
- package/dist/esm/components/SingleValueContainer.js +10 -7
- package/dist/esm/components/TeamOption/main.js +14 -12
- package/dist/esm/components/UserOption.js +14 -12
- package/dist/esm/version.json +1 -1
- package/dist/types/components/AvatarItemOption.d.ts +3 -2
- package/dist/types/components/EmailOption/main.d.ts +1 -0
- package/dist/types/components/ExternalUserOption/ExternalAvatarItemOption.d.ts +1 -0
- package/dist/types/components/ExternalUserOption/SourcesTooltipContent.d.ts +3 -2
- package/dist/types/components/ExternalUserOption/main.d.ts +3 -2
- package/dist/types/components/GroupOption/main.d.ts +2 -1
- package/dist/types/components/MultiValue.d.ts +1 -0
- package/dist/types/components/PopupControl.d.ts +1 -0
- package/dist/types/components/SingleValueContainer.d.ts +1 -0
- package/package.json +4 -3
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.groupOptionIconWrapper = exports.GroupOption = void 0;
|
|
9
9
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
|
|
@@ -21,13 +21,11 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
21
21
|
|
|
22
22
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
23
|
|
|
24
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
25
|
-
|
|
26
24
|
var _react = _interopRequireDefault(require("react"));
|
|
27
25
|
|
|
28
26
|
var _reactIntlNext = require("react-intl-next");
|
|
29
27
|
|
|
30
|
-
var
|
|
28
|
+
var _core = require("@emotion/core");
|
|
31
29
|
|
|
32
30
|
var _colors = require("@atlaskit/theme/colors");
|
|
33
31
|
|
|
@@ -35,21 +33,25 @@ var _tokens = require("@atlaskit/tokens");
|
|
|
35
33
|
|
|
36
34
|
var _people = _interopRequireDefault(require("@atlaskit/icon/glyph/people"));
|
|
37
35
|
|
|
38
|
-
var _AvatarItemOption = require("
|
|
36
|
+
var _AvatarItemOption = require("../AvatarItemOption");
|
|
39
37
|
|
|
40
38
|
var _i18n = require(".././i18n");
|
|
41
39
|
|
|
42
|
-
var _HighlightText = require("
|
|
43
|
-
|
|
44
|
-
var _templateObject;
|
|
40
|
+
var _HighlightText = require("../HighlightText");
|
|
45
41
|
|
|
46
42
|
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); }; }
|
|
47
43
|
|
|
48
44
|
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; } }
|
|
49
45
|
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
var groupOptionIconWrapper = (0, _core.css)({
|
|
47
|
+
padding: '2px',
|
|
48
|
+
'> span': {
|
|
49
|
+
backgroundColor: (0, _tokens.token)('color.background.neutral', _colors.N20),
|
|
50
|
+
borderRadius: '50%',
|
|
51
|
+
padding: '4px'
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
exports.groupOptionIconWrapper = groupOptionIconWrapper;
|
|
53
55
|
|
|
54
56
|
var GroupOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
55
57
|
(0, _inherits2.default)(GroupOption, _React$PureComponent);
|
|
@@ -72,24 +74,26 @@ var GroupOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
72
74
|
_this$props$group = _this$props.group,
|
|
73
75
|
name = _this$props$group.name,
|
|
74
76
|
highlight = _this$props$group.highlight;
|
|
75
|
-
return [
|
|
77
|
+
return [(0, _core.jsx)("span", {
|
|
76
78
|
key: "name",
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
+
css: (0, _AvatarItemOption.textWrapper)(isSelected ? (0, _tokens.token)('color.text.selected', _colors.B400) : (0, _tokens.token)('color.text', _colors.N800))
|
|
80
|
+
}, (0, _core.jsx)(_HighlightText.HighlightText, {
|
|
79
81
|
highlights: highlight && highlight.name
|
|
80
82
|
}, name))];
|
|
81
83
|
});
|
|
82
84
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderAvatar", function () {
|
|
83
|
-
return
|
|
85
|
+
return (0, _core.jsx)("span", {
|
|
86
|
+
css: groupOptionIconWrapper
|
|
87
|
+
}, (0, _core.jsx)(_people.default, {
|
|
84
88
|
label: "group-icon",
|
|
85
89
|
size: "medium"
|
|
86
90
|
}));
|
|
87
91
|
});
|
|
88
92
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderByline", function () {
|
|
89
93
|
var isSelected = _this.props.isSelected;
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
},
|
|
94
|
+
return (0, _core.jsx)("span", {
|
|
95
|
+
css: (0, _AvatarItemOption.textWrapper)(isSelected ? (0, _tokens.token)('color.text.selected', _colors.B400) : (0, _tokens.token)('color.text.subtlest', _colors.N200))
|
|
96
|
+
}, (0, _core.jsx)(_reactIntlNext.FormattedMessage, _i18n.messages.groupByline));
|
|
93
97
|
});
|
|
94
98
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getLozengeProps", function () {
|
|
95
99
|
return typeof _this.props.group.lozenge === 'string' ? {
|
|
@@ -102,7 +106,7 @@ var GroupOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
102
106
|
(0, _createClass2.default)(GroupOption, [{
|
|
103
107
|
key: "render",
|
|
104
108
|
value: function render() {
|
|
105
|
-
return
|
|
109
|
+
return (0, _core.jsx)(_AvatarItemOption.AvatarItemOption, {
|
|
106
110
|
avatar: this.renderAvatar(),
|
|
107
111
|
secondaryText: this.renderByline(),
|
|
108
112
|
primaryText: this.getPrimaryText(),
|
|
@@ -25,15 +25,13 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
25
25
|
|
|
26
26
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
27
|
|
|
28
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
29
|
-
|
|
30
28
|
var _react = _interopRequireDefault(require("react"));
|
|
31
29
|
|
|
32
30
|
var _reactIntlNext = require("react-intl-next");
|
|
33
31
|
|
|
34
32
|
var _select = require("@atlaskit/select");
|
|
35
33
|
|
|
36
|
-
var
|
|
34
|
+
var _core = require("@emotion/core");
|
|
37
35
|
|
|
38
36
|
var _AddOptionAvatar = require("./AddOptionAvatar");
|
|
39
37
|
|
|
@@ -47,8 +45,6 @@ var _people = _interopRequireDefault(require("@atlaskit/icon/glyph/people"));
|
|
|
47
45
|
|
|
48
46
|
var _excluded = ["children", "innerProps"];
|
|
49
47
|
|
|
50
|
-
var _templateObject, _templateObject2;
|
|
51
|
-
|
|
52
48
|
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); }; }
|
|
53
49
|
|
|
54
50
|
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; } }
|
|
@@ -71,10 +67,12 @@ var scrollToValue = function scrollToValue(valueContainer, control) {
|
|
|
71
67
|
};
|
|
72
68
|
|
|
73
69
|
exports.scrollToValue = scrollToValue;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var
|
|
70
|
+
var groupTagContainer = (0, _core.css)({
|
|
71
|
+
paddingLeft: '2px'
|
|
72
|
+
});
|
|
73
|
+
var nameWrapper = (0, _core.css)({
|
|
74
|
+
paddingLeft: '5px'
|
|
75
|
+
});
|
|
78
76
|
|
|
79
77
|
var MultiValue = /*#__PURE__*/function (_React$Component) {
|
|
80
78
|
(0, _inherits2.default)(MultiValue, _React$Component);
|
|
@@ -94,11 +92,11 @@ var MultiValue = /*#__PURE__*/function (_React$Component) {
|
|
|
94
92
|
selectProps = _this$props.selectProps;
|
|
95
93
|
|
|
96
94
|
if ((0, _utils.isEmail)(data)) {
|
|
97
|
-
return selectProps.emailLabel ?
|
|
95
|
+
return selectProps.emailLabel ? (0, _core.jsx)(_AddOptionAvatar.AddOptionAvatar, {
|
|
98
96
|
isLozenge: true,
|
|
99
97
|
label: selectProps.emailLabel
|
|
100
|
-
}) :
|
|
101
|
-
return
|
|
98
|
+
}) : (0, _core.jsx)(_reactIntlNext.FormattedMessage, _i18n.messages.addEmail, function (label) {
|
|
99
|
+
return (0, _core.jsx)(_AddOptionAvatar.AddOptionAvatar, {
|
|
102
100
|
isLozenge: true,
|
|
103
101
|
label: label
|
|
104
102
|
});
|
|
@@ -106,13 +104,15 @@ var MultiValue = /*#__PURE__*/function (_React$Component) {
|
|
|
106
104
|
}
|
|
107
105
|
|
|
108
106
|
if ((0, _utils.isGroup)(data)) {
|
|
109
|
-
return
|
|
107
|
+
return (0, _core.jsx)("div", {
|
|
108
|
+
css: groupTagContainer
|
|
109
|
+
}, (0, _core.jsx)(_people.default, {
|
|
110
110
|
label: "group-icon",
|
|
111
111
|
size: "small"
|
|
112
112
|
}));
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
return
|
|
115
|
+
return (0, _core.jsx)(_SizeableAvatar.SizeableAvatar, {
|
|
116
116
|
appearance: "multi",
|
|
117
117
|
src: (0, _utils.getAvatarUrl)(data),
|
|
118
118
|
name: label
|
|
@@ -156,12 +156,14 @@ var MultiValue = /*#__PURE__*/function (_React$Component) {
|
|
|
156
156
|
children = _this$props3.children,
|
|
157
157
|
innerProps = _this$props3.innerProps,
|
|
158
158
|
rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
159
|
-
return
|
|
159
|
+
return (0, _core.jsx)(_select.components.MultiValue, (0, _extends2.default)({}, rest, {
|
|
160
160
|
innerProps: {
|
|
161
161
|
ref: this.containerRef
|
|
162
162
|
},
|
|
163
163
|
cropWithEllipsis: false
|
|
164
|
-
}), this.getElemBefore(), " ",
|
|
164
|
+
}), this.getElemBefore(), " ", (0, _core.jsx)("div", {
|
|
165
|
+
css: nameWrapper
|
|
166
|
+
}, children));
|
|
165
167
|
}
|
|
166
168
|
}]);
|
|
167
169
|
return MultiValue;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -19,8 +17,6 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
19
17
|
|
|
20
18
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
19
|
|
|
22
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
23
|
-
|
|
24
20
|
var _react = _interopRequireDefault(require("react"));
|
|
25
21
|
|
|
26
22
|
var _components = require("@atlaskit/theme/components");
|
|
@@ -31,16 +27,10 @@ var _constants = require("@atlaskit/theme/constants");
|
|
|
31
27
|
|
|
32
28
|
var _select = require("@atlaskit/select");
|
|
33
29
|
|
|
34
|
-
var
|
|
30
|
+
var _core = require("@emotion/core");
|
|
35
31
|
|
|
36
32
|
var _colors = require("@atlaskit/theme/colors");
|
|
37
33
|
|
|
38
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
39
|
-
|
|
40
|
-
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); }
|
|
41
|
-
|
|
42
|
-
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; }
|
|
43
|
-
|
|
44
34
|
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); }; }
|
|
45
35
|
|
|
46
36
|
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; } }
|
|
@@ -50,26 +40,31 @@ var fontSize = 12;
|
|
|
50
40
|
var innerHeight = spacing * 2; // 16px
|
|
51
41
|
|
|
52
42
|
var lineHeight = innerHeight / fontSize;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
var controlWrapper = (0, _core.css)({
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexDirection: 'column',
|
|
46
|
+
padding: "0px ".concat(spacing, "px ").concat(spacing, "px")
|
|
47
|
+
});
|
|
56
48
|
var getColor = (0, _components.themed)({
|
|
57
49
|
light: (0, _tokens.token)('color.text.subtlest', _colors.N200),
|
|
58
50
|
dark: (0, _tokens.token)('color.text.subtlest', _colors.DN90)
|
|
59
51
|
});
|
|
60
52
|
|
|
61
|
-
var
|
|
53
|
+
var getLabelStyle = function getLabelStyle() {
|
|
62
54
|
var right = 0;
|
|
63
55
|
var bottom = spacing / 2;
|
|
64
56
|
var left = 0;
|
|
65
57
|
var top = spacing * 2.5;
|
|
66
|
-
|
|
58
|
+
var color = getColor();
|
|
59
|
+
return (0, _core.css)({
|
|
60
|
+
color: color,
|
|
61
|
+
fontSize: "".concat(fontSize, "px"),
|
|
62
|
+
fontWeight: 600,
|
|
63
|
+
lineHeight: "".concat(lineHeight),
|
|
64
|
+
padding: "".concat(top, "px ").concat(right, "px ").concat(bottom, "px ").concat(left, "px")
|
|
65
|
+
});
|
|
67
66
|
};
|
|
68
67
|
|
|
69
|
-
var Label = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-size: ", "px;\n font-weight: 600;\n line-height: ", ";\n ", "\n"])), function (props) {
|
|
70
|
-
return getColor(props);
|
|
71
|
-
}, fontSize, lineHeight, getPadding);
|
|
72
|
-
|
|
73
68
|
var PopupControl = /*#__PURE__*/function (_React$PureComponent) {
|
|
74
69
|
(0, _inherits2.default)(PopupControl, _React$PureComponent);
|
|
75
70
|
|
|
@@ -84,7 +79,11 @@ var PopupControl = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
84
79
|
key: "render",
|
|
85
80
|
value: function render() {
|
|
86
81
|
var popupTitle = this.props.selectProps.popupTitle;
|
|
87
|
-
return
|
|
82
|
+
return (0, _core.jsx)("div", {
|
|
83
|
+
css: controlWrapper
|
|
84
|
+
}, (0, _core.jsx)("div", {
|
|
85
|
+
css: getLabelStyle()
|
|
86
|
+
}, popupTitle), (0, _core.jsx)(_select.components.Control, this.props));
|
|
88
87
|
}
|
|
89
88
|
}]);
|
|
90
89
|
return PopupControl;
|
|
@@ -7,25 +7,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.SingleValue = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
13
|
|
|
14
14
|
var _avatar = require("@atlaskit/avatar");
|
|
15
15
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
16
|
+
var _core = require("@emotion/core");
|
|
19
17
|
|
|
20
18
|
var _SizeableAvatar = require("./SizeableAvatar");
|
|
21
19
|
|
|
22
20
|
var _utils = require("./utils");
|
|
23
21
|
|
|
24
22
|
var _excluded = ["ref"];
|
|
23
|
+
var avatarItemComponent = (0, _core.css)({
|
|
24
|
+
border: 'none !important',
|
|
25
|
+
padding: '0 !important',
|
|
26
|
+
width: 'auto',
|
|
27
|
+
overflow: 'hidden',
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
/* IE 11 needs this prop explicitly to flex items */
|
|
30
|
+
flex: '1 1 auto',
|
|
31
|
+
minWidth: '100px',
|
|
32
|
+
'& > span': {
|
|
33
|
+
boxSizing: 'border-box'
|
|
34
|
+
},
|
|
35
|
+
'&:hover': {
|
|
36
|
+
width: 'auto',
|
|
37
|
+
padding: 0,
|
|
38
|
+
border: 'none'
|
|
39
|
+
}
|
|
40
|
+
});
|
|
29
41
|
|
|
30
42
|
var SingleValue = function SingleValue(props) {
|
|
31
43
|
var _props$data = props.data,
|
|
@@ -34,9 +46,9 @@ var SingleValue = function SingleValue(props) {
|
|
|
34
46
|
_props$selectProps = props.selectProps,
|
|
35
47
|
appearance = _props$selectProps.appearance,
|
|
36
48
|
isFocused = _props$selectProps.isFocused;
|
|
37
|
-
return !isFocused ?
|
|
49
|
+
return !isFocused ? (0, _core.jsx)(_avatar.AvatarItem, {
|
|
38
50
|
backgroundColor: "transparent",
|
|
39
|
-
avatar:
|
|
51
|
+
avatar: (0, _core.jsx)(_SizeableAvatar.SizeableAvatar, {
|
|
40
52
|
src: (0, _utils.getAvatarUrl)(data),
|
|
41
53
|
appearance: appearance,
|
|
42
54
|
name: label
|
|
@@ -45,7 +57,9 @@ var SingleValue = function SingleValue(props) {
|
|
|
45
57
|
}, function (_ref) {
|
|
46
58
|
var ref = _ref.ref,
|
|
47
59
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
48
|
-
return
|
|
60
|
+
return (0, _core.jsx)("div", (0, _extends2.default)({
|
|
61
|
+
css: avatarItemComponent
|
|
62
|
+
}, props));
|
|
49
63
|
}) : null;
|
|
50
64
|
};
|
|
51
65
|
|
|
@@ -23,11 +23,9 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
23
23
|
|
|
24
24
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
25
|
|
|
26
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
27
|
-
|
|
28
26
|
var _react = _interopRequireDefault(require("react"));
|
|
29
27
|
|
|
30
|
-
var
|
|
28
|
+
var _core = require("@emotion/core");
|
|
31
29
|
|
|
32
30
|
var _select = require("@atlaskit/select");
|
|
33
31
|
|
|
@@ -37,13 +35,14 @@ var _styles = require("./styles");
|
|
|
37
35
|
|
|
38
36
|
var _excluded = ["children"];
|
|
39
37
|
|
|
40
|
-
var _templateObject;
|
|
41
|
-
|
|
42
38
|
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); }; }
|
|
43
39
|
|
|
44
40
|
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; } }
|
|
45
41
|
|
|
46
|
-
var
|
|
42
|
+
var placeholderIconContainer = (0, _core.css)({
|
|
43
|
+
paddingLeft: "".concat(_styles.BORDER_PADDING, "px"),
|
|
44
|
+
lineHeight: 0
|
|
45
|
+
});
|
|
47
46
|
|
|
48
47
|
var showUserAvatar = function showUserAvatar(inputValue, value) {
|
|
49
48
|
return value && value.data && inputValue === value.label;
|
|
@@ -74,7 +73,7 @@ var SingleValueContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
74
73
|
value = _this$props$selectPro.value;
|
|
75
74
|
|
|
76
75
|
if (isFocused || !hasValue) {
|
|
77
|
-
return
|
|
76
|
+
return (0, _core.jsx)(_SizeableAvatar.SizeableAvatar, {
|
|
78
77
|
appearance: appearance,
|
|
79
78
|
src: showUserAvatar(inputValue, value) ? value.data.avatarUrl : undefined
|
|
80
79
|
});
|
|
@@ -91,7 +90,9 @@ var SingleValueContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
91
90
|
var _this$props2 = this.props,
|
|
92
91
|
children = _this$props2.children,
|
|
93
92
|
valueContainerProps = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
|
|
94
|
-
return
|
|
93
|
+
return (0, _core.jsx)(_select.components.ValueContainer, valueContainerProps, (0, _core.jsx)("div", {
|
|
94
|
+
css: placeholderIconContainer
|
|
95
|
+
}, this.renderAvatar()), children);
|
|
95
96
|
}
|
|
96
97
|
}]);
|
|
97
98
|
return SingleValueContainer;
|
|
@@ -27,6 +27,8 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
27
27
|
|
|
28
28
|
var _tokens = require("@atlaskit/tokens");
|
|
29
29
|
|
|
30
|
+
var _core = require("@emotion/core");
|
|
31
|
+
|
|
30
32
|
var _react = _interopRequireDefault(require("react"));
|
|
31
33
|
|
|
32
34
|
var _reactIntlNext = require("react-intl-next");
|
|
@@ -62,10 +64,10 @@ var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
62
64
|
var _this$props$team = _this.props.team,
|
|
63
65
|
name = _this$props$team.name,
|
|
64
66
|
highlight = _this$props$team.highlight;
|
|
65
|
-
return [
|
|
67
|
+
return [(0, _core.jsx)("span", {
|
|
66
68
|
key: "name",
|
|
67
|
-
|
|
68
|
-
},
|
|
69
|
+
css: (0, _AvatarItemOption.textWrapper)(_this.props.isSelected ? (0, _tokens.token)('color.text.selected', _colors.B400) : (0, _tokens.token)('color.text', _colors.N800))
|
|
70
|
+
}, (0, _core.jsx)(_HighlightText.HighlightText, {
|
|
69
71
|
highlights: highlight && highlight.name
|
|
70
72
|
}, name))];
|
|
71
73
|
});
|
|
@@ -81,9 +83,9 @@ var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
81
83
|
} else {
|
|
82
84
|
if (includesYou === true) {
|
|
83
85
|
if (memberCount > 50) {
|
|
84
|
-
return _this.getBylineComponent(isSelected,
|
|
86
|
+
return _this.getBylineComponent(isSelected, (0, _core.jsx)(_reactIntlNext.FormattedMessage, _i18n.messages.plus50MembersWithYou));
|
|
85
87
|
} else {
|
|
86
|
-
return _this.getBylineComponent(isSelected,
|
|
88
|
+
return _this.getBylineComponent(isSelected, (0, _core.jsx)(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _i18n.messages.memberCountWithYou, {
|
|
87
89
|
values: {
|
|
88
90
|
count: memberCount
|
|
89
91
|
}
|
|
@@ -91,9 +93,9 @@ var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
91
93
|
}
|
|
92
94
|
} else {
|
|
93
95
|
if (memberCount > 50) {
|
|
94
|
-
return _this.getBylineComponent(isSelected,
|
|
96
|
+
return _this.getBylineComponent(isSelected, (0, _core.jsx)(_reactIntlNext.FormattedMessage, _i18n.messages.plus50MembersWithoutYou));
|
|
95
97
|
} else {
|
|
96
|
-
return _this.getBylineComponent(isSelected,
|
|
98
|
+
return _this.getBylineComponent(isSelected, (0, _core.jsx)(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _i18n.messages.memberCountWithoutYou, {
|
|
97
99
|
values: {
|
|
98
100
|
count: memberCount
|
|
99
101
|
}
|
|
@@ -103,15 +105,15 @@ var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
103
105
|
}
|
|
104
106
|
});
|
|
105
107
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getBylineComponent", function (isSelected, message) {
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
+
return (0, _core.jsx)("span", {
|
|
109
|
+
css: (0, _AvatarItemOption.textWrapper)(isSelected ? (0, _tokens.token)('color.text.selected', _colors.B400) : (0, _tokens.token)('color.text.subtlest', _colors.N200))
|
|
108
110
|
}, message);
|
|
109
111
|
});
|
|
110
112
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderAvatar", function () {
|
|
111
113
|
var _this$props$team3 = _this.props.team,
|
|
112
114
|
avatarUrl = _this$props$team3.avatarUrl,
|
|
113
115
|
name = _this$props$team3.name;
|
|
114
|
-
return
|
|
116
|
+
return (0, _core.jsx)(_SizeableAvatar.SizeableAvatar, {
|
|
115
117
|
appearance: "big",
|
|
116
118
|
src: avatarUrl,
|
|
117
119
|
name: name
|
|
@@ -128,7 +130,7 @@ var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
128
130
|
(0, _createClass2.default)(TeamOption, [{
|
|
129
131
|
key: "render",
|
|
130
132
|
value: function render() {
|
|
131
|
-
return
|
|
133
|
+
return (0, _core.jsx)(_AvatarItemOption.AvatarItemOption, {
|
|
132
134
|
avatar: this.renderAvatar(),
|
|
133
135
|
secondaryText: this.renderByline(),
|
|
134
136
|
primaryText: this.getPrimaryText(),
|
|
@@ -25,6 +25,8 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
25
25
|
|
|
26
26
|
var _tokens = require("@atlaskit/tokens");
|
|
27
27
|
|
|
28
|
+
var _core = require("@emotion/core");
|
|
29
|
+
|
|
28
30
|
var _react = _interopRequireDefault(require("react"));
|
|
29
31
|
|
|
30
32
|
var _AvatarItemOption = require("./AvatarItemOption");
|
|
@@ -59,19 +61,19 @@ var UserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
59
61
|
name = _this$props$user.name,
|
|
60
62
|
publicName = _this$props$user.publicName,
|
|
61
63
|
highlight = _this$props$user.highlight;
|
|
62
|
-
var result = [
|
|
64
|
+
var result = [(0, _core.jsx)("span", {
|
|
63
65
|
key: "name",
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
+
css: (0, _AvatarItemOption.textWrapper)(_this.props.isSelected ? (0, _tokens.token)('color.text.selected', _colors.B400) : (0, _tokens.token)('color.text', _colors.N800))
|
|
67
|
+
}, (0, _core.jsx)(_HighlightText.HighlightText, {
|
|
66
68
|
highlights: highlight && highlight.name
|
|
67
69
|
}, name))];
|
|
68
70
|
|
|
69
71
|
if ((0, _utils.hasValue)(publicName) && name.trim() !== publicName.trim()) {
|
|
70
|
-
result.push(
|
|
72
|
+
result.push((0, _core.jsx)(_react.default.Fragment, {
|
|
71
73
|
key: "publicName"
|
|
72
|
-
}, ' ',
|
|
73
|
-
|
|
74
|
-
}, "(",
|
|
74
|
+
}, ' ', (0, _core.jsx)("span", {
|
|
75
|
+
css: (0, _AvatarItemOption.textWrapper)(_this.props.isSelected ? (0, _tokens.token)('color.text.selected', _colors.B400) : (0, _tokens.token)('color.text.subtlest', _colors.N200))
|
|
76
|
+
}, "(", (0, _core.jsx)(_HighlightText.HighlightText, {
|
|
75
77
|
highlights: highlight && highlight.publicName
|
|
76
78
|
}, publicName), ")")));
|
|
77
79
|
}
|
|
@@ -79,8 +81,8 @@ var UserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
79
81
|
return result;
|
|
80
82
|
});
|
|
81
83
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderSecondaryText", function () {
|
|
82
|
-
return _this.props.user.byline ?
|
|
83
|
-
|
|
84
|
+
return _this.props.user.byline ? (0, _core.jsx)("span", {
|
|
85
|
+
css: (0, _AvatarItemOption.textWrapper)(_this.props.isSelected ? (0, _tokens.token)('color.text.selected', _colors.B400) : (0, _tokens.token)('color.text.subtlest', _colors.N200))
|
|
84
86
|
}, _this.props.user.byline) : undefined;
|
|
85
87
|
});
|
|
86
88
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderAvatar", function () {
|
|
@@ -89,7 +91,7 @@ var UserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
89
91
|
avatarUrl = _this$props$user2.avatarUrl,
|
|
90
92
|
name = _this$props$user2.name,
|
|
91
93
|
status = _this$props.status;
|
|
92
|
-
return
|
|
94
|
+
return (0, _core.jsx)(_SizeableAvatar.SizeableAvatar, {
|
|
93
95
|
appearance: "big",
|
|
94
96
|
src: avatarUrl,
|
|
95
97
|
presence: status,
|
|
@@ -107,7 +109,7 @@ var UserOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
107
109
|
(0, _createClass2.default)(UserOption, [{
|
|
108
110
|
key: "render",
|
|
109
111
|
value: function render() {
|
|
110
|
-
return
|
|
112
|
+
return (0, _core.jsx)(_AvatarItemOption.AvatarItemOption, {
|
|
111
113
|
avatar: this.renderAvatar(),
|
|
112
114
|
primaryText: this.getPrimaryText(),
|
|
113
115
|
secondaryText: this.renderSecondaryText(),
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import EmailIcon from '@atlaskit/icon/glyph/email';
|
|
2
3
|
import { N40, N500 } from '@atlaskit/theme/colors';
|
|
3
4
|
import { token } from '@atlaskit/tokens';
|
|
4
5
|
import React from 'react';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { css, jsx } from '@emotion/core';
|
|
7
|
+
|
|
8
|
+
const getEmailAvatarWrapperStyle = isLozenge => {
|
|
9
|
+
const padding = isLozenge ? 0 : 4;
|
|
10
|
+
return css({
|
|
11
|
+
padding: `${padding}px`,
|
|
12
|
+
backgroundColor: token('color.background.neutral', N40),
|
|
13
|
+
borderRadius: '50%',
|
|
14
|
+
display: 'flex',
|
|
15
|
+
alignItems: 'center'
|
|
16
|
+
});
|
|
17
|
+
};
|
|
8
18
|
|
|
9
|
-
background-color: ${token('color.background.neutral', N40)};
|
|
10
|
-
border-radius: 50%;
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
`;
|
|
14
19
|
export const AddOptionAvatar = ({
|
|
15
20
|
isLozenge,
|
|
16
21
|
label
|
|
17
22
|
}) => {
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
},
|
|
23
|
+
return jsx("div", {
|
|
24
|
+
css: getEmailAvatarWrapperStyle(isLozenge)
|
|
25
|
+
}, jsx(EmailIcon, {
|
|
21
26
|
label: label,
|
|
22
27
|
size: isLozenge ? 'small' : 'medium',
|
|
23
28
|
primaryColor: token('color.text.subtle', N500)
|