@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
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
/** @jsx jsx */
|
|
3
5
|
import React from 'react';
|
|
4
6
|
import { FormattedMessage } from 'react-intl-next';
|
|
5
7
|
import { components } from '@atlaskit/select';
|
|
6
|
-
import
|
|
8
|
+
import { css, jsx } from '@emotion/core';
|
|
7
9
|
import { AddOptionAvatar } from './AddOptionAvatar';
|
|
8
10
|
import { SizeableAvatar } from './SizeableAvatar';
|
|
9
11
|
import { messages } from './i18n';
|
|
@@ -26,12 +28,12 @@ export const scrollToValue = (valueContainer, control) => {
|
|
|
26
28
|
valueContainer.scrollIntoView(false);
|
|
27
29
|
}
|
|
28
30
|
};
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const groupTagContainer = css({
|
|
32
|
+
paddingLeft: '2px'
|
|
33
|
+
});
|
|
34
|
+
const nameWrapper = css({
|
|
35
|
+
paddingLeft: '5px'
|
|
36
|
+
});
|
|
35
37
|
export class MultiValue extends React.Component {
|
|
36
38
|
constructor(props) {
|
|
37
39
|
super(props);
|
|
@@ -46,23 +48,25 @@ export class MultiValue extends React.Component {
|
|
|
46
48
|
} = this.props;
|
|
47
49
|
|
|
48
50
|
if (isEmail(data)) {
|
|
49
|
-
return selectProps.emailLabel ?
|
|
51
|
+
return selectProps.emailLabel ? jsx(AddOptionAvatar, {
|
|
50
52
|
isLozenge: true,
|
|
51
53
|
label: selectProps.emailLabel
|
|
52
|
-
}) :
|
|
54
|
+
}) : jsx(FormattedMessage, messages.addEmail, label => jsx(AddOptionAvatar, {
|
|
53
55
|
isLozenge: true,
|
|
54
56
|
label: label
|
|
55
57
|
}));
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
if (isGroup(data)) {
|
|
59
|
-
return
|
|
61
|
+
return jsx("div", {
|
|
62
|
+
css: groupTagContainer
|
|
63
|
+
}, jsx(PeopleIcon, {
|
|
60
64
|
label: "group-icon",
|
|
61
65
|
size: "small"
|
|
62
66
|
}));
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
return
|
|
69
|
+
return jsx(SizeableAvatar, {
|
|
66
70
|
appearance: "multi",
|
|
67
71
|
src: getAvatarUrl(data),
|
|
68
72
|
name: label
|
|
@@ -110,12 +114,14 @@ export class MultiValue extends React.Component {
|
|
|
110
114
|
innerProps,
|
|
111
115
|
...rest
|
|
112
116
|
} = this.props;
|
|
113
|
-
return
|
|
117
|
+
return jsx(components.MultiValue, _extends({}, rest, {
|
|
114
118
|
innerProps: {
|
|
115
119
|
ref: this.containerRef
|
|
116
120
|
},
|
|
117
121
|
cropWithEllipsis: false
|
|
118
|
-
}), this.getElemBefore(), " ",
|
|
122
|
+
}), this.getElemBefore(), " ", jsx("div", {
|
|
123
|
+
css: nameWrapper
|
|
124
|
+
}, children));
|
|
119
125
|
}
|
|
120
126
|
|
|
121
127
|
}
|
|
@@ -1,42 +1,41 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { themed } from '@atlaskit/theme/components';
|
|
3
4
|
import { token } from '@atlaskit/tokens';
|
|
4
5
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
5
6
|
import { components } from '@atlaskit/select';
|
|
6
|
-
import
|
|
7
|
+
import { css, jsx } from '@emotion/core';
|
|
7
8
|
import { N200, DN90 } from '@atlaskit/theme/colors';
|
|
8
9
|
const spacing = gridSize();
|
|
9
10
|
const fontSize = 12;
|
|
10
11
|
const innerHeight = spacing * 2; // 16px
|
|
11
12
|
|
|
12
13
|
const lineHeight = innerHeight / fontSize;
|
|
13
|
-
const
|
|
14
|
-
display: flex
|
|
15
|
-
|
|
16
|
-
padding: 0px ${spacing}px ${spacing}px
|
|
17
|
-
|
|
14
|
+
const controlWrapper = css({
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flexDirection: 'column',
|
|
17
|
+
padding: `0px ${spacing}px ${spacing}px`
|
|
18
|
+
});
|
|
18
19
|
const getColor = themed({
|
|
19
20
|
light: token('color.text.subtlest', N200),
|
|
20
21
|
dark: token('color.text.subtlest', DN90)
|
|
21
22
|
});
|
|
22
23
|
|
|
23
|
-
const
|
|
24
|
+
const getLabelStyle = () => {
|
|
24
25
|
const right = 0;
|
|
25
26
|
const bottom = spacing / 2;
|
|
26
27
|
const left = 0;
|
|
27
28
|
const top = spacing * 2.5;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const color = getColor();
|
|
30
|
+
return css({
|
|
31
|
+
color,
|
|
32
|
+
fontSize: `${fontSize}px`,
|
|
33
|
+
fontWeight: 600,
|
|
34
|
+
lineHeight: `${lineHeight}`,
|
|
35
|
+
padding: `${top}px ${right}px ${bottom}px ${left}px`
|
|
36
|
+
});
|
|
31
37
|
};
|
|
32
38
|
|
|
33
|
-
const Label = styled.div`
|
|
34
|
-
color: ${props => getColor(props)};
|
|
35
|
-
font-size: ${fontSize}px;
|
|
36
|
-
font-weight: 600;
|
|
37
|
-
line-height: ${lineHeight};
|
|
38
|
-
${getPadding}
|
|
39
|
-
`;
|
|
40
39
|
export class PopupControl extends React.PureComponent {
|
|
41
40
|
render() {
|
|
42
41
|
const {
|
|
@@ -44,7 +43,11 @@ export class PopupControl extends React.PureComponent {
|
|
|
44
43
|
popupTitle
|
|
45
44
|
}
|
|
46
45
|
} = this.props;
|
|
47
|
-
return
|
|
46
|
+
return jsx("div", {
|
|
47
|
+
css: controlWrapper
|
|
48
|
+
}, jsx("div", {
|
|
49
|
+
css: getLabelStyle()
|
|
50
|
+
}, popupTitle), jsx(components.Control, this.props));
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
1
4
|
import { AvatarItem } from '@atlaskit/avatar';
|
|
2
|
-
import
|
|
3
|
-
import styled from 'styled-components';
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
4
6
|
import { SizeableAvatar } from './SizeableAvatar';
|
|
5
7
|
import { getAvatarUrl } from './utils';
|
|
6
|
-
const
|
|
7
|
-
border: none !important
|
|
8
|
-
padding: 0 !important
|
|
9
|
-
width: auto
|
|
10
|
-
overflow: hidden
|
|
11
|
-
/* IE 11 needs this prop explicitly to flex items */
|
|
12
|
-
flex: 1 1 auto;
|
|
13
|
-
min-width: 100px;
|
|
8
|
+
const avatarItemComponent = css({
|
|
9
|
+
border: 'none !important',
|
|
10
|
+
padding: '0 !important',
|
|
11
|
+
width: 'auto',
|
|
12
|
+
overflow: 'hidden',
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
/* IE 11 needs this prop explicitly to flex items */
|
|
15
|
+
flex: '1 1 auto',
|
|
16
|
+
minWidth: '100px',
|
|
17
|
+
'& > span': {
|
|
18
|
+
boxSizing: 'border-box'
|
|
19
|
+
},
|
|
20
|
+
'&:hover': {
|
|
21
|
+
width: 'auto',
|
|
22
|
+
padding: 0,
|
|
23
|
+
border: 'none'
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
});
|
|
25
26
|
export const SingleValue = props => {
|
|
26
27
|
const {
|
|
27
28
|
data: {
|
|
@@ -33,9 +34,9 @@ export const SingleValue = props => {
|
|
|
33
34
|
isFocused
|
|
34
35
|
}
|
|
35
36
|
} = props;
|
|
36
|
-
return !isFocused ?
|
|
37
|
+
return !isFocused ? jsx(AvatarItem, {
|
|
37
38
|
backgroundColor: "transparent",
|
|
38
|
-
avatar:
|
|
39
|
+
avatar: jsx(SizeableAvatar, {
|
|
39
40
|
src: getAvatarUrl(data),
|
|
40
41
|
appearance: appearance,
|
|
41
42
|
name: label
|
|
@@ -44,5 +45,7 @@ export const SingleValue = props => {
|
|
|
44
45
|
}, ({
|
|
45
46
|
ref,
|
|
46
47
|
...props
|
|
47
|
-
}) =>
|
|
48
|
+
}) => jsx("div", _extends({
|
|
49
|
+
css: avatarItemComponent
|
|
50
|
+
}, props))) : null;
|
|
48
51
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
2
4
|
import React from 'react';
|
|
3
|
-
import
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
4
6
|
import { components } from '@atlaskit/select';
|
|
5
7
|
import { SizeableAvatar } from './SizeableAvatar';
|
|
6
8
|
import { BORDER_PADDING } from './styles';
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const placeholderIconContainer = css({
|
|
10
|
+
paddingLeft: `${BORDER_PADDING}px`,
|
|
11
|
+
lineHeight: 0
|
|
12
|
+
});
|
|
11
13
|
|
|
12
14
|
const showUserAvatar = (inputValue, value) => value && value.data && inputValue === value.label;
|
|
13
15
|
|
|
@@ -27,7 +29,7 @@ export class SingleValueContainer extends React.Component {
|
|
|
27
29
|
} = this.props;
|
|
28
30
|
|
|
29
31
|
if (isFocused || !hasValue) {
|
|
30
|
-
return
|
|
32
|
+
return jsx(SizeableAvatar, {
|
|
31
33
|
appearance: appearance,
|
|
32
34
|
src: showUserAvatar(inputValue, value) ? value.data.avatarUrl : undefined
|
|
33
35
|
});
|
|
@@ -42,7 +44,9 @@ export class SingleValueContainer extends React.Component {
|
|
|
42
44
|
children,
|
|
43
45
|
...valueContainerProps
|
|
44
46
|
} = this.props;
|
|
45
|
-
return
|
|
47
|
+
return jsx(components.ValueContainer, valueContainerProps, jsx("div", {
|
|
48
|
+
css: placeholderIconContainer
|
|
49
|
+
}, this.renderAvatar()), children);
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
/** @jsx jsx */
|
|
3
5
|
import { B400, N800, N200 } from '@atlaskit/theme/colors';
|
|
4
6
|
import { token } from '@atlaskit/tokens';
|
|
7
|
+
import { jsx } from '@emotion/core';
|
|
5
8
|
import React from 'react';
|
|
6
9
|
import { FormattedMessage } from 'react-intl-next';
|
|
7
|
-
import { AvatarItemOption,
|
|
10
|
+
import { AvatarItemOption, textWrapper } from '.././AvatarItemOption';
|
|
8
11
|
import { HighlightText } from '.././HighlightText';
|
|
9
12
|
import { messages } from '.././i18n';
|
|
10
13
|
import { SizeableAvatar } from '.././SizeableAvatar';
|
|
@@ -19,10 +22,10 @@ export class TeamOption extends React.PureComponent {
|
|
|
19
22
|
highlight
|
|
20
23
|
}
|
|
21
24
|
} = this.props;
|
|
22
|
-
return [
|
|
25
|
+
return [jsx("span", {
|
|
23
26
|
key: "name",
|
|
24
|
-
|
|
25
|
-
},
|
|
27
|
+
css: textWrapper(this.props.isSelected ? token('color.text.selected', B400) : token('color.text', N800))
|
|
28
|
+
}, jsx(HighlightText, {
|
|
26
29
|
highlights: highlight && highlight.name
|
|
27
30
|
}, name))];
|
|
28
31
|
});
|
|
@@ -41,9 +44,9 @@ export class TeamOption extends React.PureComponent {
|
|
|
41
44
|
} else {
|
|
42
45
|
if (includesYou === true) {
|
|
43
46
|
if (memberCount > 50) {
|
|
44
|
-
return this.getBylineComponent(isSelected,
|
|
47
|
+
return this.getBylineComponent(isSelected, jsx(FormattedMessage, messages.plus50MembersWithYou));
|
|
45
48
|
} else {
|
|
46
|
-
return this.getBylineComponent(isSelected,
|
|
49
|
+
return this.getBylineComponent(isSelected, jsx(FormattedMessage, _extends({}, messages.memberCountWithYou, {
|
|
47
50
|
values: {
|
|
48
51
|
count: memberCount
|
|
49
52
|
}
|
|
@@ -51,9 +54,9 @@ export class TeamOption extends React.PureComponent {
|
|
|
51
54
|
}
|
|
52
55
|
} else {
|
|
53
56
|
if (memberCount > 50) {
|
|
54
|
-
return this.getBylineComponent(isSelected,
|
|
57
|
+
return this.getBylineComponent(isSelected, jsx(FormattedMessage, messages.plus50MembersWithoutYou));
|
|
55
58
|
} else {
|
|
56
|
-
return this.getBylineComponent(isSelected,
|
|
59
|
+
return this.getBylineComponent(isSelected, jsx(FormattedMessage, _extends({}, messages.memberCountWithoutYou, {
|
|
57
60
|
values: {
|
|
58
61
|
count: memberCount
|
|
59
62
|
}
|
|
@@ -63,8 +66,8 @@ export class TeamOption extends React.PureComponent {
|
|
|
63
66
|
}
|
|
64
67
|
});
|
|
65
68
|
|
|
66
|
-
_defineProperty(this, "getBylineComponent", (isSelected, message) =>
|
|
67
|
-
|
|
69
|
+
_defineProperty(this, "getBylineComponent", (isSelected, message) => jsx("span", {
|
|
70
|
+
css: textWrapper(isSelected ? token('color.text.selected', B400) : token('color.text.subtlest', N200))
|
|
68
71
|
}, message));
|
|
69
72
|
|
|
70
73
|
_defineProperty(this, "renderAvatar", () => {
|
|
@@ -74,7 +77,7 @@ export class TeamOption extends React.PureComponent {
|
|
|
74
77
|
name
|
|
75
78
|
}
|
|
76
79
|
} = this.props;
|
|
77
|
-
return
|
|
80
|
+
return jsx(SizeableAvatar, {
|
|
78
81
|
appearance: "big",
|
|
79
82
|
src: avatarUrl,
|
|
80
83
|
name: name
|
|
@@ -87,7 +90,7 @@ export class TeamOption extends React.PureComponent {
|
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
render() {
|
|
90
|
-
return
|
|
93
|
+
return jsx(AvatarItemOption, {
|
|
91
94
|
avatar: this.renderAvatar(),
|
|
92
95
|
secondaryText: this.renderByline(),
|
|
93
96
|
primaryText: this.getPrimaryText(),
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
2
4
|
import { B400, N800, N200 } from '@atlaskit/theme/colors';
|
|
3
5
|
import { token } from '@atlaskit/tokens';
|
|
6
|
+
import { jsx } from '@emotion/core';
|
|
4
7
|
import React from 'react';
|
|
5
|
-
import { AvatarItemOption,
|
|
8
|
+
import { AvatarItemOption, textWrapper } from './AvatarItemOption';
|
|
6
9
|
import { HighlightText } from './HighlightText';
|
|
7
10
|
import { SizeableAvatar } from './SizeableAvatar';
|
|
8
11
|
import { hasValue } from './utils';
|
|
@@ -18,19 +21,19 @@ export class UserOption extends React.PureComponent {
|
|
|
18
21
|
highlight
|
|
19
22
|
}
|
|
20
23
|
} = this.props;
|
|
21
|
-
const result = [
|
|
24
|
+
const result = [jsx("span", {
|
|
22
25
|
key: "name",
|
|
23
|
-
|
|
24
|
-
},
|
|
26
|
+
css: textWrapper(this.props.isSelected ? token('color.text.selected', B400) : token('color.text', N800))
|
|
27
|
+
}, jsx(HighlightText, {
|
|
25
28
|
highlights: highlight && highlight.name
|
|
26
29
|
}, name))];
|
|
27
30
|
|
|
28
31
|
if (hasValue(publicName) && name.trim() !== publicName.trim()) {
|
|
29
|
-
result.push(
|
|
32
|
+
result.push(jsx(React.Fragment, {
|
|
30
33
|
key: "publicName"
|
|
31
|
-
}, ' ',
|
|
32
|
-
|
|
33
|
-
}, "(",
|
|
34
|
+
}, ' ', jsx("span", {
|
|
35
|
+
css: textWrapper(this.props.isSelected ? token('color.text.selected', B400) : token('color.text.subtlest', N200))
|
|
36
|
+
}, "(", jsx(HighlightText, {
|
|
34
37
|
highlights: highlight && highlight.publicName
|
|
35
38
|
}, publicName), ")")));
|
|
36
39
|
}
|
|
@@ -38,8 +41,8 @@ export class UserOption extends React.PureComponent {
|
|
|
38
41
|
return result;
|
|
39
42
|
});
|
|
40
43
|
|
|
41
|
-
_defineProperty(this, "renderSecondaryText", () => this.props.user.byline ?
|
|
42
|
-
|
|
44
|
+
_defineProperty(this, "renderSecondaryText", () => this.props.user.byline ? jsx("span", {
|
|
45
|
+
css: textWrapper(this.props.isSelected ? token('color.text.selected', B400) : token('color.text.subtlest', N200))
|
|
43
46
|
}, this.props.user.byline) : undefined);
|
|
44
47
|
|
|
45
48
|
_defineProperty(this, "renderAvatar", () => {
|
|
@@ -50,7 +53,7 @@ export class UserOption extends React.PureComponent {
|
|
|
50
53
|
},
|
|
51
54
|
status
|
|
52
55
|
} = this.props;
|
|
53
|
-
return
|
|
56
|
+
return jsx(SizeableAvatar, {
|
|
54
57
|
appearance: "big",
|
|
55
58
|
src: avatarUrl,
|
|
56
59
|
presence: status,
|
|
@@ -64,7 +67,7 @@ export class UserOption extends React.PureComponent {
|
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
render() {
|
|
67
|
-
return
|
|
70
|
+
return jsx(AvatarItemOption, {
|
|
68
71
|
avatar: this.renderAvatar(),
|
|
69
72
|
primaryText: this.getPrimaryText(),
|
|
70
73
|
secondaryText: this.renderSecondaryText(),
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _templateObject;
|
|
4
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
5
2
|
import EmailIcon from '@atlaskit/icon/glyph/email';
|
|
6
3
|
import { N40, N500 } from '@atlaskit/theme/colors';
|
|
7
4
|
import { token } from '@atlaskit/tokens';
|
|
8
5
|
import React from 'react';
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
import { css, jsx } from '@emotion/core';
|
|
7
|
+
|
|
8
|
+
var getEmailAvatarWrapperStyle = function getEmailAvatarWrapperStyle(isLozenge) {
|
|
9
|
+
var padding = isLozenge ? 0 : 4;
|
|
10
|
+
return css({
|
|
11
|
+
padding: "".concat(padding, "px"),
|
|
12
|
+
backgroundColor: token('color.background.neutral', N40),
|
|
13
|
+
borderRadius: '50%',
|
|
14
|
+
display: 'flex',
|
|
15
|
+
alignItems: 'center'
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
13
19
|
export var AddOptionAvatar = function AddOptionAvatar(_ref) {
|
|
14
20
|
var isLozenge = _ref.isLozenge,
|
|
15
21
|
label = _ref.label;
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
},
|
|
22
|
+
return jsx("div", {
|
|
23
|
+
css: getEmailAvatarWrapperStyle(isLozenge)
|
|
24
|
+
}, jsx(EmailIcon, {
|
|
19
25
|
label: label,
|
|
20
26
|
size: isLozenge ? 'small' : 'medium',
|
|
21
27
|
primaryColor: token('color.text.subtle', N500)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
4
|
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
|
|
7
|
+
/** @jsx jsx */
|
|
5
8
|
import React from 'react';
|
|
6
|
-
import
|
|
7
|
-
import { B400 } from '@atlaskit/theme/colors';
|
|
8
|
-
import { token } from '@atlaskit/tokens';
|
|
9
|
+
import { css, jsx } from '@emotion/core';
|
|
9
10
|
import Lozenge from '@atlaskit/lozenge';
|
|
10
11
|
var AsyncTooltip = /*#__PURE__*/React.lazy(function () {
|
|
11
12
|
return import(
|
|
@@ -16,22 +17,48 @@ var AsyncTooltip = /*#__PURE__*/React.lazy(function () {
|
|
|
16
17
|
};
|
|
17
18
|
});
|
|
18
19
|
});
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
var wrapper = css({
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
boxSizing: 'border-box',
|
|
23
|
+
display: 'flex',
|
|
24
|
+
lineHeight: 1,
|
|
25
|
+
outline: 'none',
|
|
26
|
+
margin: 0,
|
|
27
|
+
width: '100%',
|
|
28
|
+
cursor: 'pointer'
|
|
23
29
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
30
|
+
|
|
31
|
+
var getTextStyle = function getTextStyle(isSecondary) {
|
|
32
|
+
var secondaryCssArgs = isSecondary ? {
|
|
33
|
+
fontSize: '0.85em'
|
|
34
|
+
} : {};
|
|
35
|
+
return css(_objectSpread({
|
|
36
|
+
margin: 0,
|
|
37
|
+
overflowX: 'hidden',
|
|
38
|
+
textOverflow: 'ellipsis',
|
|
39
|
+
whiteSpace: 'nowrap'
|
|
40
|
+
}, secondaryCssArgs));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
var additionalInfo = css({
|
|
44
|
+
float: 'right'
|
|
28
45
|
});
|
|
29
|
-
export var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
46
|
+
export var textWrapper = function textWrapper(color) {
|
|
47
|
+
return css({
|
|
48
|
+
overflow: 'hidden',
|
|
49
|
+
textOverflow: 'ellipsis',
|
|
50
|
+
display: 'inline-block',
|
|
51
|
+
color: color
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
export var AvatarItemOption = function AvatarItemOption(_ref) {
|
|
55
|
+
var avatar = _ref.avatar,
|
|
56
|
+
primaryText = _ref.primaryText,
|
|
57
|
+
secondaryText = _ref.secondaryText,
|
|
58
|
+
lozenge = _ref.lozenge;
|
|
59
|
+
return jsx("span", {
|
|
60
|
+
css: wrapper
|
|
61
|
+
}, avatar, jsx("div", {
|
|
35
62
|
style: {
|
|
36
63
|
maxWidth: '100%',
|
|
37
64
|
minWidth: 0,
|
|
@@ -39,15 +66,17 @@ export var AvatarItemOption = function AvatarItemOption(_ref3) {
|
|
|
39
66
|
lineHeight: '1.4',
|
|
40
67
|
paddingLeft: '8px'
|
|
41
68
|
}
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
|
|
69
|
+
}, jsx("div", null, jsx("span", {
|
|
70
|
+
css: getTextStyle()
|
|
71
|
+
}, primaryText), jsx("span", {
|
|
72
|
+
css: additionalInfo
|
|
73
|
+
}, (lozenge === null || lozenge === void 0 ? void 0 : lozenge.text) && (lozenge !== null && lozenge !== void 0 && lozenge.tooltip ? // Note that entire Lozenge must be wrapped in the Tooltip (rather than just the
|
|
45
74
|
// Lozenge text) or tooltip won't work
|
|
46
|
-
|
|
47
|
-
fallback:
|
|
48
|
-
},
|
|
75
|
+
jsx(React.Suspense, {
|
|
76
|
+
fallback: jsx(Lozenge, lozenge, lozenge.text)
|
|
77
|
+
}, jsx(AsyncTooltip, {
|
|
49
78
|
content: lozenge.tooltip
|
|
50
|
-
},
|
|
51
|
-
|
|
79
|
+
}, jsx(Lozenge, lozenge, lozenge.text))) : jsx(Lozenge, lozenge, lozenge.text)))), jsx("div", null, jsx("span", {
|
|
80
|
+
css: getTextStyle(true)
|
|
52
81
|
}, secondaryText))));
|
|
53
82
|
};
|
|
@@ -10,12 +10,14 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
10
10
|
|
|
11
11
|
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; } }
|
|
12
12
|
|
|
13
|
+
/** @jsx jsx */
|
|
13
14
|
import React from 'react';
|
|
14
15
|
import { FormattedMessage } from 'react-intl-next';
|
|
15
16
|
import { B400, N200, N800 } from '@atlaskit/theme/colors';
|
|
16
17
|
import { token } from '@atlaskit/tokens';
|
|
18
|
+
import { jsx } from '@emotion/core';
|
|
17
19
|
import { AddOptionAvatar } from '../AddOptionAvatar';
|
|
18
|
-
import { AvatarItemOption,
|
|
20
|
+
import { AvatarItemOption, textWrapper } from '../AvatarItemOption';
|
|
19
21
|
import { messages } from '../i18n';
|
|
20
22
|
|
|
21
23
|
var getAddEmailMessage = function getAddEmailMessage(validity) {
|
|
@@ -46,21 +48,21 @@ export var EmailOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
46
48
|
|
|
47
49
|
_defineProperty(_assertThisInitialized(_this), "renderPrimaryText", function () {
|
|
48
50
|
var id = _this.props.email.id;
|
|
49
|
-
return
|
|
51
|
+
return jsx("span", {
|
|
50
52
|
key: "name",
|
|
51
|
-
|
|
53
|
+
css: textWrapper(_this.props.isSelected ? token('color.text.selected', B400) : token('color.text', N800))
|
|
52
54
|
}, id);
|
|
53
55
|
});
|
|
54
56
|
|
|
55
57
|
_defineProperty(_assertThisInitialized(_this), "renderSecondaryText", function (label) {
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
+
return jsx("span", {
|
|
59
|
+
css: textWrapper(_this.props.isSelected ? token('color.text.selected', B400) : token('color.text.subtlest', N200))
|
|
58
60
|
}, label);
|
|
59
61
|
});
|
|
60
62
|
|
|
61
63
|
_defineProperty(_assertThisInitialized(_this), "renderOption", function (label) {
|
|
62
|
-
return
|
|
63
|
-
avatar:
|
|
64
|
+
return jsx(AvatarItemOption, {
|
|
65
|
+
avatar: jsx(AddOptionAvatar, {
|
|
64
66
|
label: label
|
|
65
67
|
}),
|
|
66
68
|
primaryText: _this.renderPrimaryText(),
|
|
@@ -80,7 +82,7 @@ export var EmailOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
80
82
|
var _this$props = this.props,
|
|
81
83
|
label = _this$props.label,
|
|
82
84
|
emailValidity = _this$props.emailValidity;
|
|
83
|
-
return label !== undefined ? this.renderOption(label) :
|
|
85
|
+
return label !== undefined ? this.renderOption(label) : jsx(FormattedMessage, getAddEmailMessage(emailValidity), function (label) {
|
|
84
86
|
return _this2.renderOption(label);
|
|
85
87
|
});
|
|
86
88
|
}
|