@jetbrains/ring-ui 5.0.98 → 5.0.100
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/components/user-card/card.d.ts +1 -0
- package/components/user-card/card.js +23 -18
- package/components/user-card/tooltip.d.ts +2 -2
- package/components/user-card/tooltip.js +10 -4
- package/components/user-card/user-card.css +11 -1
- package/dist/_helpers/card.js +8 -3
- package/dist/style.css +1 -1
- package/dist/user-card/card.d.ts +1 -0
- package/dist/user-card/tooltip.d.ts +2 -2
- package/dist/user-card/tooltip.js +10 -12
- package/package.json +7 -7
|
@@ -24,6 +24,7 @@ export interface UserCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
24
24
|
user: UserCardUser;
|
|
25
25
|
wording: UserCardWording;
|
|
26
26
|
info?: ReactElement | readonly ReactElement[] | string;
|
|
27
|
+
avatarInfo?: ReactElement | readonly ReactElement[] | string;
|
|
27
28
|
'data-test'?: string | null | undefined;
|
|
28
29
|
}
|
|
29
30
|
export default class UserCard extends PureComponent<UserCardProps> {
|
|
@@ -50,32 +50,37 @@ export default class UserCard extends PureComponent {
|
|
|
50
50
|
clipboard.copyText(user.email || '', wording.copiedToClipboard, wording.copingToClipboardError);
|
|
51
51
|
};
|
|
52
52
|
render() {
|
|
53
|
-
const { children, info, className, user, wording, ...restProps } = this.props;
|
|
53
|
+
const { children, info, className, user, wording, avatarInfo, ...restProps } = this.props;
|
|
54
54
|
const classes = classNames(className, {});
|
|
55
55
|
const userActiveStatusClasses = classNames(styles.userActiveStatus, user.online ? styles.online : '');
|
|
56
56
|
return (<div className={classes} {...restProps}>
|
|
57
57
|
<div className={styles.userInformationContainer}>
|
|
58
|
-
<
|
|
58
|
+
<div className={styles.userAvatar}>
|
|
59
|
+
<Avatar size={AvatarSize.Size56} url={user.avatarUrl}/>
|
|
60
|
+
{!!avatarInfo && avatarInfo}
|
|
61
|
+
</div>
|
|
59
62
|
<div className={styles.userInformation}>
|
|
60
|
-
<div className={styles.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
<div className={styles.userInformationGeneral}>
|
|
64
|
+
<div className={styles.userNameLine}>
|
|
65
|
+
{user.href && (<Link href={user.href} className={styles.userName}>
|
|
66
|
+
{user.name}
|
|
67
|
+
</Link>)}
|
|
68
|
+
{!user.href && <span className={styles.userName}>{user.name}</span>}
|
|
69
|
+
{typeof user.online === 'boolean' &&
|
|
66
70
|
(<span className={userActiveStatusClasses} title={user.online ? wording.online : wording.offline}/>)}
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
{!!info && <span className={styles.userNameInfo}>{info}</span>}
|
|
72
|
+
{user.banned &&
|
|
69
73
|
(<span className={classNames(badgeStyles.badge, badgeStyles.invalid)} title={user.banReason}>{wording.banned}</span>)}
|
|
74
|
+
</div>
|
|
75
|
+
<div className={styles.userLogin}>{user.login}</div>
|
|
76
|
+
{user.email && (<span className={styles.userEmailWrapper}>
|
|
77
|
+
<Link pseudo onClick={this.copyEmail} className={styles.userEmail}>
|
|
78
|
+
{user.email}
|
|
79
|
+
</Link>
|
|
80
|
+
{user.unverifiedEmail && (<span className={styles.unverifiedLabel}>{wording.unverified}</span>)}
|
|
81
|
+
<Icon title={wording.copyToClipboard} className={styles.userCopyIcon} onClick={this.copyEmail} glyph={copyIcon} size={IconSize.Size14} suppressSizeWarning/>
|
|
82
|
+
</span>)}
|
|
70
83
|
</div>
|
|
71
|
-
<div className={styles.userLogin}>{user.login}</div>
|
|
72
|
-
{user.email && (<span className={styles.userEmailWrapper}>
|
|
73
|
-
<Link pseudo onClick={this.copyEmail} className={styles.userEmail}>
|
|
74
|
-
{user.email}
|
|
75
|
-
</Link>
|
|
76
|
-
{user.unverifiedEmail && (<span className={styles.unverifiedLabel}>{wording.unverified}</span>)}
|
|
77
|
-
<Icon title={wording.copyToClipboard} className={styles.userCopyIcon} onClick={this.copyEmail} glyph={copyIcon} size={IconSize.Size14} suppressSizeWarning/>
|
|
78
|
-
</span>)}
|
|
79
84
|
{children}
|
|
80
85
|
</div>
|
|
81
86
|
</div>
|
|
@@ -6,7 +6,7 @@ export interface UserCardTooltipProps extends Omit<UserCardAttrs, 'user'> {
|
|
|
6
6
|
user?: UserCardUser | null | undefined;
|
|
7
7
|
children: ReactElement | readonly ReactElement[] | string;
|
|
8
8
|
dropdownProps: Partial<DropdownAttrs>;
|
|
9
|
-
renderUserCard: (props:
|
|
9
|
+
renderUserCard: (props: UserCardAttrs) => ReactNode;
|
|
10
10
|
renderNoUser: () => ReactNode;
|
|
11
11
|
}
|
|
12
12
|
export default class UserCardTooltip extends Component<UserCardTooltipProps> {
|
|
@@ -19,7 +19,7 @@ export default class UserCardTooltip extends Component<UserCardTooltipProps> {
|
|
|
19
19
|
renderNoUser: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
20
|
};
|
|
21
21
|
static defaultProps: {
|
|
22
|
-
renderUserCard: (props:
|
|
22
|
+
renderUserCard: (props: UserCardAttrs) => JSX.Element;
|
|
23
23
|
renderNoUser: () => string;
|
|
24
24
|
dropdownProps: {
|
|
25
25
|
hoverShowTimeOut: number;
|
|
@@ -17,8 +17,8 @@ export default class UserCardTooltip extends Component {
|
|
|
17
17
|
};
|
|
18
18
|
static defaultProps = {
|
|
19
19
|
renderUserCard: (props) => {
|
|
20
|
-
const {
|
|
21
|
-
return user && (<UserCard user={user} {...restProps}
|
|
20
|
+
const { user, ...restProps } = props;
|
|
21
|
+
return user && (<UserCard user={user} {...restProps}/>);
|
|
22
22
|
},
|
|
23
23
|
renderNoUser: () => '',
|
|
24
24
|
dropdownProps: {
|
|
@@ -27,10 +27,16 @@ export default class UserCardTooltip extends Component {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
render() {
|
|
30
|
-
const { children,
|
|
30
|
+
const { children, renderUserCard, renderNoUser, dropdownProps, user, ...restProps } = this.props;
|
|
31
31
|
return (<Dropdown anchor={children} hoverMode clickMode={false} {...dropdownProps}>
|
|
32
32
|
<Popup attached={false}>
|
|
33
|
-
{user
|
|
33
|
+
{user
|
|
34
|
+
? renderUserCard({
|
|
35
|
+
...restProps,
|
|
36
|
+
user,
|
|
37
|
+
className: classNames(styles.userCardSpaced, this.props.className)
|
|
38
|
+
})
|
|
39
|
+
: renderNoUser()}
|
|
34
40
|
</Popup>
|
|
35
41
|
</Dropdown>);
|
|
36
42
|
}
|
|
@@ -8,7 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
.userInformationContainer {
|
|
10
10
|
display: flex;
|
|
11
|
-
align-items: start;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.userAvatar {
|
|
15
|
+
position: relative;
|
|
16
|
+
|
|
17
|
+
display: flex;
|
|
12
18
|
}
|
|
13
19
|
|
|
14
20
|
.userInformation {
|
|
@@ -22,6 +28,10 @@
|
|
|
22
28
|
line-height: 18px;
|
|
23
29
|
}
|
|
24
30
|
|
|
31
|
+
.userInformationGeneral {
|
|
32
|
+
height: 56px;
|
|
33
|
+
}
|
|
34
|
+
|
|
25
35
|
.userNameLine {
|
|
26
36
|
height: var(--ring-line-height-lowest);
|
|
27
37
|
|
package/dist/_helpers/card.js
CHANGED
|
@@ -10,7 +10,7 @@ import { m as modules_6c9187df } from './badge.js';
|
|
|
10
10
|
import Icon from '../icon/icon.js';
|
|
11
11
|
import { Size as Size$1 } from '../icon/icon__constants.js';
|
|
12
12
|
|
|
13
|
-
var modules_a4196c17 = {"unit":"8px","light":"light_rui_6e59","userCardSpaced":"userCardSpaced_rui_6e59","userInformationContainer":"userInformationContainer_rui_6e59","userInformation":"userInformation_rui_6e59","userNameLine":"userNameLine_rui_6e59","userName":"userName_rui_6e59","userLogin":"userLogin_rui_6e59","userEmail":"userEmail_rui_6e59","userCopyIcon":"userCopyIcon_rui_6e59","userEmailWrapper":"userEmailWrapper_rui_6e59","unverifiedLabel":"unverifiedLabel_rui_6e59","userNameInfo":"userNameInfo_rui_6e59","userActiveStatus":"userActiveStatus_rui_6e59","online":"online_rui_6e59"};
|
|
13
|
+
var modules_a4196c17 = {"unit":"8px","light":"light_rui_6e59","userCardSpaced":"userCardSpaced_rui_6e59","userInformationContainer":"userInformationContainer_rui_6e59","userAvatar":"userAvatar_rui_6e59","userInformation":"userInformation_rui_6e59","userInformationGeneral":"userInformationGeneral_rui_6e59","userNameLine":"userNameLine_rui_6e59","userName":"userName_rui_6e59","userLogin":"userLogin_rui_6e59","userEmail":"userEmail_rui_6e59","userCopyIcon":"userCopyIcon_rui_6e59","userEmailWrapper":"userEmailWrapper_rui_6e59","unverifiedLabel":"unverifiedLabel_rui_6e59","userNameInfo":"userNameInfo_rui_6e59","userActiveStatus":"userActiveStatus_rui_6e59","online":"online_rui_6e59"};
|
|
14
14
|
|
|
15
15
|
class UserCard extends PureComponent {
|
|
16
16
|
constructor() {
|
|
@@ -30,6 +30,7 @@ class UserCard extends PureComponent {
|
|
|
30
30
|
className,
|
|
31
31
|
user,
|
|
32
32
|
wording,
|
|
33
|
+
avatarInfo,
|
|
33
34
|
...restProps
|
|
34
35
|
} = this.props;
|
|
35
36
|
const classes = classNames(className, {});
|
|
@@ -38,11 +39,15 @@ class UserCard extends PureComponent {
|
|
|
38
39
|
className: classes
|
|
39
40
|
}, restProps), /*#__PURE__*/React.createElement("div", {
|
|
40
41
|
className: modules_a4196c17.userInformationContainer
|
|
42
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: modules_a4196c17.userAvatar
|
|
41
44
|
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
42
45
|
size: Size.Size56,
|
|
43
46
|
url: user.avatarUrl
|
|
44
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
}), !!avatarInfo && avatarInfo), /*#__PURE__*/React.createElement("div", {
|
|
45
48
|
className: modules_a4196c17.userInformation
|
|
49
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: modules_a4196c17.userInformationGeneral
|
|
46
51
|
}, /*#__PURE__*/React.createElement("div", {
|
|
47
52
|
className: modules_a4196c17.userNameLine
|
|
48
53
|
}, user.href && /*#__PURE__*/React.createElement(Link, {
|
|
@@ -75,7 +80,7 @@ class UserCard extends PureComponent {
|
|
|
75
80
|
glyph: copyIcon,
|
|
76
81
|
size: Size$1.Size14,
|
|
77
82
|
suppressSizeWarning: true
|
|
78
|
-
})), children)));
|
|
83
|
+
}))), children)));
|
|
79
84
|
}
|
|
80
85
|
}
|
|
81
86
|
_defineProperty(UserCard, "propTypes", {
|