@atlaskit/profilecard 24.22.1 → 24.23.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 +11 -0
- package/__tests__/vr-tests/__snapshots__/user-profilecard/alternate-actions--default.png +0 -0
- package/__tests__/vr-tests/__snapshots__/user-profilecard/best-case-profile--default.png +0 -0
- package/__tests__/vr-tests/__snapshots__/user-profilecard/bot-case-profile--default.png +0 -0
- package/__tests__/vr-tests/__snapshots__/user-profilecard/worst-case-profile--default.png +0 -0
- package/afm-cc/tsconfig.json +0 -6
- package/afm-jira/tsconfig.json +0 -6
- package/afm-products/tsconfig.json +0 -6
- package/dist/cjs/components/User/ProfileCardDetails.js +25 -4
- package/dist/cjs/styled/Card.compiled.css +1 -1
- package/dist/cjs/styled/Card.js +24 -4
- package/dist/es2019/components/User/ProfileCardDetails.js +23 -4
- package/dist/es2019/styled/Card.compiled.css +1 -1
- package/dist/es2019/styled/Card.js +31 -11
- package/dist/esm/components/User/ProfileCardDetails.js +23 -4
- package/dist/esm/styled/Card.compiled.css +1 -1
- package/dist/esm/styled/Card.js +22 -4
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 24.23.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`829b6192f8717`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/829b6192f8717) -
|
|
8
|
+
[ux] In profile card, add tooltip for truncated text
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 24.22.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -59,12 +59,6 @@
|
|
|
59
59
|
{
|
|
60
60
|
"path": "../../../design-system/icon/afm-cc/tsconfig.json"
|
|
61
61
|
},
|
|
62
|
-
{
|
|
63
|
-
"path": "../../../design-system/link/afm-cc/tsconfig.json"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"path": "../../../design-system/logo/afm-cc/tsconfig.json"
|
|
67
|
-
},
|
|
68
62
|
{
|
|
69
63
|
"path": "../../../design-system/lozenge/afm-cc/tsconfig.json"
|
|
70
64
|
},
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -59,12 +59,6 @@
|
|
|
59
59
|
{
|
|
60
60
|
"path": "../../../design-system/icon/afm-jira/tsconfig.json"
|
|
61
61
|
},
|
|
62
|
-
{
|
|
63
|
-
"path": "../../../design-system/link/afm-jira/tsconfig.json"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"path": "../../../design-system/logo/afm-jira/tsconfig.json"
|
|
67
|
-
},
|
|
68
62
|
{
|
|
69
63
|
"path": "../../../design-system/lozenge/afm-jira/tsconfig.json"
|
|
70
64
|
},
|
|
@@ -59,12 +59,6 @@
|
|
|
59
59
|
{
|
|
60
60
|
"path": "../../../design-system/icon/afm-products/tsconfig.json"
|
|
61
61
|
},
|
|
62
|
-
{
|
|
63
|
-
"path": "../../../design-system/link/afm-products/tsconfig.json"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"path": "../../../design-system/logo/afm-products/tsconfig.json"
|
|
67
|
-
},
|
|
68
62
|
{
|
|
69
63
|
"path": "../../../design-system/lozenge/afm-products/tsconfig.json"
|
|
70
64
|
},
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
6
|
Object.defineProperty(exports, "__esModule", {
|
|
6
7
|
value: true
|
|
7
8
|
});
|
|
@@ -10,18 +11,20 @@ require("./ProfileCardDetails.compiled.css");
|
|
|
10
11
|
var _runtime = require("@compiled/react/runtime");
|
|
11
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
13
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
var _react =
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
15
|
var _react2 = require("@compiled/react");
|
|
15
16
|
var _reactIntlNext = require("react-intl-next");
|
|
16
17
|
var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
|
|
17
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
19
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
19
21
|
var _relativeDate = _interopRequireDefault(require("../../internal/relative-date"));
|
|
20
22
|
var _messages = _interopRequireDefault(require("../../messages"));
|
|
21
23
|
var _Card = require("../../styled/Card");
|
|
22
24
|
var _Icon = require("../Icon");
|
|
23
25
|
var _ReportingLinesDetails = _interopRequireDefault(require("./ReportingLinesDetails"));
|
|
24
26
|
var _excluded = ["text"];
|
|
27
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
25
28
|
var styles = {
|
|
26
29
|
detailedListWrapperNext: "_19pkxy5q _2hwxze3t _otyrze3t _18u0ze3t _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t",
|
|
27
30
|
fullNameLabel: "_1reo15vq _18m915vq _11c81ixg _1bto1l2s _o5721q9c",
|
|
@@ -32,14 +35,31 @@ var styles = {
|
|
|
32
35
|
disabledAccount: "_syazi7uo",
|
|
33
36
|
activeAccount: "_syaz15cr"
|
|
34
37
|
};
|
|
35
|
-
var renderName = function renderName(nickname, fullName, meta) {
|
|
38
|
+
var renderName = function renderName(nickname, fullName, meta, nameRef) {
|
|
36
39
|
if (!fullName && !nickname) {
|
|
37
40
|
return null;
|
|
38
41
|
}
|
|
39
42
|
var isNicknameRedundant = !nickname || nickname === fullName;
|
|
40
43
|
var shownNickname = " (".concat(nickname, ") ");
|
|
41
44
|
var displayName = isNicknameRedundant ? fullName : "".concat(fullName).concat(shownNickname);
|
|
42
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
45
|
+
return (0, _platformFeatureFlags.fg)('enable_profilecard_text_truncation_tooltip') ? /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
46
|
+
content: displayName,
|
|
47
|
+
position: "top",
|
|
48
|
+
isScreenReaderAnnouncementDisabled: true,
|
|
49
|
+
canAppear: function canAppear() {
|
|
50
|
+
if (!(nameRef !== null && nameRef !== void 0 && nameRef.current)) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
// Only showing the tooltip when the element has been truncated (ellipsis)
|
|
54
|
+
return nameRef.current.scrollWidth > nameRef.current.clientWidth;
|
|
55
|
+
}
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
57
|
+
ref: nameRef,
|
|
58
|
+
as: "h2",
|
|
59
|
+
xcss: (0, _react2.cx)(styles.fullNameLabel, styles.activeAccount, meta ? (0, _platformFeatureFlags.fg)('enable_absolute_positioning_profile_card') ? styles.metaLabelWithHighSpecificity : styles.metaLabel : (0, _platformFeatureFlags.fg)('enable_absolute_positioning_profile_card') ? styles.noMetaLabelWithHighSpecificity : styles.noMetaLabel),
|
|
60
|
+
testId: "profilecard-name",
|
|
61
|
+
id: "profilecard-name-label"
|
|
62
|
+
}, displayName)) : /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
43
63
|
as: "h2",
|
|
44
64
|
xcss: (0, _react2.cx)(styles.fullNameLabel, styles.activeAccount, meta ? (0, _platformFeatureFlags.fg)('enable_absolute_positioning_profile_card') ? styles.metaLabelWithHighSpecificity : styles.metaLabel : (0, _platformFeatureFlags.fg)('enable_absolute_positioning_profile_card') ? styles.noMetaLabelWithHighSpecificity : styles.noMetaLabel),
|
|
45
65
|
testId: "profilecard-name",
|
|
@@ -110,6 +130,7 @@ var DisabledProfileCardDetails = function DisabledProfileCardDetails(props) {
|
|
|
110
130
|
var ProfileCardDetails = exports.ProfileCardDetails = function ProfileCardDetails(props) {
|
|
111
131
|
var meta = props.meta,
|
|
112
132
|
status = props.status;
|
|
133
|
+
var nameRef = (0, _react.useRef)(null);
|
|
113
134
|
if (props.isServiceAccount) {
|
|
114
135
|
return /*#__PURE__*/_react.default.createElement(ServiceAccountProfileCardDetails, props);
|
|
115
136
|
}
|
|
@@ -121,7 +142,7 @@ var ProfileCardDetails = exports.ProfileCardDetails = function ProfileCardDetail
|
|
|
121
142
|
status: status
|
|
122
143
|
}));
|
|
123
144
|
}
|
|
124
|
-
return /*#__PURE__*/_react.default.createElement(_Card.DetailsGroup, null, renderName(props.nickname, props.fullName, meta), meta && /*#__PURE__*/_react.default.createElement(_Card.JobTitleLabel, null, meta), /*#__PURE__*/_react.default.createElement(CustomLozenges, {
|
|
145
|
+
return /*#__PURE__*/_react.default.createElement(_Card.DetailsGroup, null, renderName(props.nickname, props.fullName, meta, nameRef), meta && /*#__PURE__*/_react.default.createElement(_Card.JobTitleLabel, null, meta), /*#__PURE__*/_react.default.createElement(CustomLozenges, {
|
|
125
146
|
lozenges: props.customLozenges
|
|
126
147
|
}), /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
127
148
|
xcss: styles.detailedListWrapperNext
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
._zulp12x7{gap:var(--ds-space-075,6px)}
|
|
5
5
|
._zulpu2gc{gap:var(--ds-space-100,8px)}
|
|
6
6
|
._12vemgnk{background-repeat:no-repeat}
|
|
7
|
-
.
|
|
7
|
+
._154i1jfw{top:var(--ds-space-500,40px)}
|
|
8
8
|
._154ixy5q{top:var(--ds-space-400,2pc)}
|
|
9
9
|
._154ize3t{top:var(--ds-space-0,0)}
|
|
10
10
|
._16jlkb7n{flex-grow:1}
|
package/dist/cjs/styled/Card.js
CHANGED
|
@@ -3,19 +3,22 @@
|
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
5
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
7
|
Object.defineProperty(exports, "__esModule", {
|
|
7
8
|
value: true
|
|
8
9
|
});
|
|
9
10
|
exports.ProfileImage = exports.OverflowActionButtonsWrapper = exports.LozengeWrapper = exports.KudosBlobAnimationStyle = exports.KudosBlobAnimation = exports.JobTitleLabel = exports.DisabledInfo = exports.DetailsLabelText = exports.DetailsLabelIcon = exports.DetailsLabel = exports.DetailsGroup = exports.CustomLozengeContainer = exports.CardContent = exports.CardContainer = exports.AppTitleLabel = exports.AnimationWrapper = exports.AnimatedKudosButton = exports.ActionsFlexSpacer = exports.ActionButtonGroup = void 0;
|
|
10
11
|
require("./Card.compiled.css");
|
|
11
12
|
var _runtime = require("@compiled/react/runtime");
|
|
12
|
-
var _react =
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
14
|
var _css = require("@atlaskit/css");
|
|
14
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
17
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
16
19
|
var kudosButtonAnimationTransformationCompiled = null;
|
|
17
20
|
var styles = {
|
|
18
|
-
profileImage: "_kqswstnw
|
|
21
|
+
profileImage: "_kqswstnw _154i1jfw _1ltv1ejb",
|
|
19
22
|
actionsFlexSpacer: "_16jlkb7n _1o9zidpf _i0dl1wug",
|
|
20
23
|
kudosBlobAnimationStyle: "_1e0cglyw _4t3i1w81 _1bsb1w81 _1pby1mrw _kqswstnw _154ixy5q",
|
|
21
24
|
animationWrapper: "_mkrz1rip _kqswstnw _154ize3t _1ltvze3t _94n5ze3t _1xi2ze3t",
|
|
@@ -37,11 +40,11 @@ var styles = {
|
|
|
37
40
|
detailsLabelIcon: "_1e0c1txw _1o9zidpf _syaz1rpy _1bsb7vkz _4t3i7vkz _s7n4jp4b _19pkze3t",
|
|
38
41
|
detailsLabelText: "_1reo15vq _18m915vq _11c8dcr7 _1bto1l2s _syazi7uo _19pkze3t _18u0ze3t",
|
|
39
42
|
kudosBlobAnimation: "_1e0cglyw _4t3i1w81 _1bsb1w81 _1pby1mrw _kqswstnw _j7hq1q51 _tip8kb7n _5sagi11n _1itkdsyg",
|
|
40
|
-
jobTitleLabel: "_19pkze3t _otyrze3t
|
|
43
|
+
jobTitleLabel: "_19pkze3t _otyrze3t _18u0ze3t _2hwxze3t",
|
|
41
44
|
appTitleLabel: "_2rko12b0 _syazi7uo _u5f312x7 _19bv12x7 _1bsb1ns9 _19pk1b66 _otyrze3t _18u0utpp _2hwxze3t"
|
|
42
45
|
};
|
|
43
46
|
var stylesCompiled = {
|
|
44
|
-
jobTitleLabel: "_19pkze3t _otyrze3t
|
|
47
|
+
jobTitleLabel: "_19pkze3t _otyrze3t _18u0ze3t _2hwxze3t _1br315cr",
|
|
45
48
|
actionButtonGroup: "_zulp12x7 _uiztglyw _19pkpxbi _2hwxze3t _18u0ze3t _otyrze3t _y3gnusic _1bahesu3 _1e0c1txw _1oqbazsu"
|
|
46
49
|
};
|
|
47
50
|
var ProfileImage = exports.ProfileImage = function ProfileImage(_ref) {
|
|
@@ -126,9 +129,26 @@ var CustomLozengeContainer = exports.CustomLozengeContainer = function CustomLoz
|
|
|
126
129
|
};
|
|
127
130
|
var JobTitleLabel = exports.JobTitleLabel = function JobTitleLabel(_ref1) {
|
|
128
131
|
var children = _ref1.children;
|
|
132
|
+
var textRef = (0, _react.useRef)(null);
|
|
129
133
|
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
130
134
|
xcss: (0, _css.cx)((0, _platformFeatureFlags.fg)('enable_absolute_positioning_profile_card') ? stylesCompiled.jobTitleLabel : styles.jobTitleLabel)
|
|
135
|
+
}, (0, _platformFeatureFlags.fg)('enable_profilecard_text_truncation_tooltip') ? /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
136
|
+
content: children,
|
|
137
|
+
position: "bottom",
|
|
138
|
+
isScreenReaderAnnouncementDisabled: true,
|
|
139
|
+
canAppear: function canAppear() {
|
|
140
|
+
if (!textRef.current) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
// Only showing the tooltip when the element has been truncated (ellipsis)
|
|
144
|
+
return textRef.current.scrollHeight > textRef.current.clientHeight;
|
|
145
|
+
}
|
|
131
146
|
}, /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
147
|
+
ref: textRef,
|
|
148
|
+
maxLines: 1,
|
|
149
|
+
color: "color.text.inverse",
|
|
150
|
+
id: "profile-card-job-title-label-text"
|
|
151
|
+
}, children)) : /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
132
152
|
maxLines: 1,
|
|
133
153
|
color: "color.text.inverse",
|
|
134
154
|
id: "profile-card-job-title-label-text"
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import "./ProfileCardDetails.compiled.css";
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useRef } from 'react';
|
|
6
6
|
import { cx } from '@compiled/react';
|
|
7
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
8
|
import Lozenge from '@atlaskit/lozenge';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
11
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
11
12
|
import relativeDate from '../../internal/relative-date';
|
|
12
13
|
import messages from '../../messages';
|
|
13
14
|
import { AppTitleLabel, CustomLozengeContainer, DetailsGroup, DisabledInfo, JobTitleLabel, LozengeWrapper } from '../../styled/Card';
|
|
@@ -23,14 +24,31 @@ const styles = {
|
|
|
23
24
|
disabledAccount: "_syazi7uo",
|
|
24
25
|
activeAccount: "_syaz15cr"
|
|
25
26
|
};
|
|
26
|
-
const renderName = (nickname, fullName, meta) => {
|
|
27
|
+
const renderName = (nickname, fullName, meta, nameRef) => {
|
|
27
28
|
if (!fullName && !nickname) {
|
|
28
29
|
return null;
|
|
29
30
|
}
|
|
30
31
|
const isNicknameRedundant = !nickname || nickname === fullName;
|
|
31
32
|
const shownNickname = ` (${nickname}) `;
|
|
32
33
|
const displayName = isNicknameRedundant ? fullName : `${fullName}${shownNickname}`;
|
|
33
|
-
return /*#__PURE__*/React.createElement(
|
|
34
|
+
return fg('enable_profilecard_text_truncation_tooltip') ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
35
|
+
content: displayName,
|
|
36
|
+
position: "top",
|
|
37
|
+
isScreenReaderAnnouncementDisabled: true,
|
|
38
|
+
canAppear: () => {
|
|
39
|
+
if (!(nameRef !== null && nameRef !== void 0 && nameRef.current)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
// Only showing the tooltip when the element has been truncated (ellipsis)
|
|
43
|
+
return nameRef.current.scrollWidth > nameRef.current.clientWidth;
|
|
44
|
+
}
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
46
|
+
ref: nameRef,
|
|
47
|
+
as: "h2",
|
|
48
|
+
xcss: cx(styles.fullNameLabel, styles.activeAccount, meta ? fg('enable_absolute_positioning_profile_card') ? styles.metaLabelWithHighSpecificity : styles.metaLabel : fg('enable_absolute_positioning_profile_card') ? styles.noMetaLabelWithHighSpecificity : styles.noMetaLabel),
|
|
49
|
+
testId: "profilecard-name",
|
|
50
|
+
id: "profilecard-name-label"
|
|
51
|
+
}, displayName)) : /*#__PURE__*/React.createElement(Box, {
|
|
34
52
|
as: "h2",
|
|
35
53
|
xcss: cx(styles.fullNameLabel, styles.activeAccount, meta ? fg('enable_absolute_positioning_profile_card') ? styles.metaLabelWithHighSpecificity : styles.metaLabel : fg('enable_absolute_positioning_profile_card') ? styles.noMetaLabelWithHighSpecificity : styles.noMetaLabel),
|
|
36
54
|
testId: "profilecard-name",
|
|
@@ -106,6 +124,7 @@ export const ProfileCardDetails = props => {
|
|
|
106
124
|
meta,
|
|
107
125
|
status
|
|
108
126
|
} = props;
|
|
127
|
+
const nameRef = useRef(null);
|
|
109
128
|
if (props.isServiceAccount) {
|
|
110
129
|
return /*#__PURE__*/React.createElement(ServiceAccountProfileCardDetails, props);
|
|
111
130
|
}
|
|
@@ -117,7 +136,7 @@ export const ProfileCardDetails = props => {
|
|
|
117
136
|
status: status
|
|
118
137
|
}));
|
|
119
138
|
}
|
|
120
|
-
return /*#__PURE__*/React.createElement(DetailsGroup, null, renderName(props.nickname, props.fullName, meta), meta && /*#__PURE__*/React.createElement(JobTitleLabel, null, meta), /*#__PURE__*/React.createElement(CustomLozenges, {
|
|
139
|
+
return /*#__PURE__*/React.createElement(DetailsGroup, null, renderName(props.nickname, props.fullName, meta, nameRef), meta && /*#__PURE__*/React.createElement(JobTitleLabel, null, meta), /*#__PURE__*/React.createElement(CustomLozenges, {
|
|
121
140
|
lozenges: props.customLozenges
|
|
122
141
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
123
142
|
xcss: styles.detailedListWrapperNext
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
._zulp12x7{gap:var(--ds-space-075,6px)}
|
|
5
5
|
._zulpu2gc{gap:var(--ds-space-100,8px)}
|
|
6
6
|
._12vemgnk{background-repeat:no-repeat}
|
|
7
|
-
.
|
|
7
|
+
._154i1jfw{top:var(--ds-space-500,40px)}
|
|
8
8
|
._154ixy5q{top:var(--ds-space-400,2pc)}
|
|
9
9
|
._154ize3t{top:var(--ds-space-0,0)}
|
|
10
10
|
._16jlkb7n{flex-grow:1}
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/no-styled-tagged-template-expression -- needs manual remediation */
|
|
3
3
|
import "./Card.compiled.css";
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useRef } from 'react';
|
|
6
6
|
import { cx } from '@atlaskit/css';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
9
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
9
10
|
const kudosButtonAnimationTransformationCompiled = null;
|
|
10
11
|
const styles = {
|
|
11
|
-
profileImage: "_kqswstnw
|
|
12
|
+
profileImage: "_kqswstnw _154i1jfw _1ltv1ejb",
|
|
12
13
|
actionsFlexSpacer: "_16jlkb7n _1o9zidpf _i0dl1wug",
|
|
13
14
|
kudosBlobAnimationStyle: "_1e0cglyw _4t3i1w81 _1bsb1w81 _1pby1mrw _kqswstnw _154ixy5q",
|
|
14
15
|
animationWrapper: "_mkrz1rip _kqswstnw _154ize3t _1ltvze3t _94n5ze3t _1xi2ze3t",
|
|
@@ -30,11 +31,11 @@ const styles = {
|
|
|
30
31
|
detailsLabelIcon: "_1e0c1txw _1o9zidpf _syaz1rpy _1bsb7vkz _4t3i7vkz _s7n4jp4b _19pkze3t",
|
|
31
32
|
detailsLabelText: "_1reo15vq _18m915vq _11c8dcr7 _1bto1l2s _syazi7uo _19pkze3t _18u0ze3t",
|
|
32
33
|
kudosBlobAnimation: "_1e0cglyw _4t3i1w81 _1bsb1w81 _1pby1mrw _kqswstnw _j7hq1q51 _tip8kb7n _5sagi11n _1itkdsyg",
|
|
33
|
-
jobTitleLabel: "_19pkze3t _otyrze3t
|
|
34
|
+
jobTitleLabel: "_19pkze3t _otyrze3t _18u0ze3t _2hwxze3t",
|
|
34
35
|
appTitleLabel: "_2rko12b0 _syazi7uo _u5f312x7 _19bv12x7 _1bsb1ns9 _19pk1b66 _otyrze3t _18u0utpp _2hwxze3t"
|
|
35
36
|
};
|
|
36
37
|
const stylesCompiled = {
|
|
37
|
-
jobTitleLabel: "_19pkze3t _otyrze3t
|
|
38
|
+
jobTitleLabel: "_19pkze3t _otyrze3t _18u0ze3t _2hwxze3t _1br315cr",
|
|
38
39
|
actionButtonGroup: "_zulp12x7 _uiztglyw _19pkpxbi _2hwxze3t _18u0ze3t _otyrze3t _y3gnusic _1bahesu3 _1e0c1txw _1oqbazsu"
|
|
39
40
|
};
|
|
40
41
|
export const ProfileImage = ({
|
|
@@ -103,13 +104,32 @@ export const CustomLozengeContainer = ({
|
|
|
103
104
|
}, children);
|
|
104
105
|
export const JobTitleLabel = ({
|
|
105
106
|
children
|
|
106
|
-
}) =>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
}) => {
|
|
108
|
+
const textRef = useRef(null);
|
|
109
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
110
|
+
xcss: cx(fg('enable_absolute_positioning_profile_card') ? stylesCompiled.jobTitleLabel : styles.jobTitleLabel)
|
|
111
|
+
}, fg('enable_profilecard_text_truncation_tooltip') ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
112
|
+
content: children,
|
|
113
|
+
position: "bottom",
|
|
114
|
+
isScreenReaderAnnouncementDisabled: true,
|
|
115
|
+
canAppear: () => {
|
|
116
|
+
if (!textRef.current) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
// Only showing the tooltip when the element has been truncated (ellipsis)
|
|
120
|
+
return textRef.current.scrollHeight > textRef.current.clientHeight;
|
|
121
|
+
}
|
|
122
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
123
|
+
ref: textRef,
|
|
124
|
+
maxLines: 1,
|
|
125
|
+
color: "color.text.inverse",
|
|
126
|
+
id: "profile-card-job-title-label-text"
|
|
127
|
+
}, children)) : /*#__PURE__*/React.createElement(Text, {
|
|
128
|
+
maxLines: 1,
|
|
129
|
+
color: "color.text.inverse",
|
|
130
|
+
id: "profile-card-job-title-label-text"
|
|
131
|
+
}, children));
|
|
132
|
+
};
|
|
113
133
|
export const AppTitleLabel = ({
|
|
114
134
|
children
|
|
115
135
|
}) => /*#__PURE__*/React.createElement(Box, {
|
|
@@ -4,12 +4,13 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
4
4
|
var _excluded = ["text"];
|
|
5
5
|
import "./ProfileCardDetails.compiled.css";
|
|
6
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
|
-
import React from 'react';
|
|
7
|
+
import React, { useRef } from 'react';
|
|
8
8
|
import { cx } from '@compiled/react';
|
|
9
9
|
import { FormattedMessage } from 'react-intl-next';
|
|
10
10
|
import Lozenge from '@atlaskit/lozenge';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
13
14
|
import relativeDate from '../../internal/relative-date';
|
|
14
15
|
import messages from '../../messages';
|
|
15
16
|
import { AppTitleLabel, CustomLozengeContainer, DetailsGroup, DisabledInfo, JobTitleLabel, LozengeWrapper } from '../../styled/Card';
|
|
@@ -25,14 +26,31 @@ var styles = {
|
|
|
25
26
|
disabledAccount: "_syazi7uo",
|
|
26
27
|
activeAccount: "_syaz15cr"
|
|
27
28
|
};
|
|
28
|
-
var renderName = function renderName(nickname, fullName, meta) {
|
|
29
|
+
var renderName = function renderName(nickname, fullName, meta, nameRef) {
|
|
29
30
|
if (!fullName && !nickname) {
|
|
30
31
|
return null;
|
|
31
32
|
}
|
|
32
33
|
var isNicknameRedundant = !nickname || nickname === fullName;
|
|
33
34
|
var shownNickname = " (".concat(nickname, ") ");
|
|
34
35
|
var displayName = isNicknameRedundant ? fullName : "".concat(fullName).concat(shownNickname);
|
|
35
|
-
return /*#__PURE__*/React.createElement(
|
|
36
|
+
return fg('enable_profilecard_text_truncation_tooltip') ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
37
|
+
content: displayName,
|
|
38
|
+
position: "top",
|
|
39
|
+
isScreenReaderAnnouncementDisabled: true,
|
|
40
|
+
canAppear: function canAppear() {
|
|
41
|
+
if (!(nameRef !== null && nameRef !== void 0 && nameRef.current)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
// Only showing the tooltip when the element has been truncated (ellipsis)
|
|
45
|
+
return nameRef.current.scrollWidth > nameRef.current.clientWidth;
|
|
46
|
+
}
|
|
47
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
48
|
+
ref: nameRef,
|
|
49
|
+
as: "h2",
|
|
50
|
+
xcss: cx(styles.fullNameLabel, styles.activeAccount, meta ? fg('enable_absolute_positioning_profile_card') ? styles.metaLabelWithHighSpecificity : styles.metaLabel : fg('enable_absolute_positioning_profile_card') ? styles.noMetaLabelWithHighSpecificity : styles.noMetaLabel),
|
|
51
|
+
testId: "profilecard-name",
|
|
52
|
+
id: "profilecard-name-label"
|
|
53
|
+
}, displayName)) : /*#__PURE__*/React.createElement(Box, {
|
|
36
54
|
as: "h2",
|
|
37
55
|
xcss: cx(styles.fullNameLabel, styles.activeAccount, meta ? fg('enable_absolute_positioning_profile_card') ? styles.metaLabelWithHighSpecificity : styles.metaLabel : fg('enable_absolute_positioning_profile_card') ? styles.noMetaLabelWithHighSpecificity : styles.noMetaLabel),
|
|
38
56
|
testId: "profilecard-name",
|
|
@@ -103,6 +121,7 @@ var DisabledProfileCardDetails = function DisabledProfileCardDetails(props) {
|
|
|
103
121
|
export var ProfileCardDetails = function ProfileCardDetails(props) {
|
|
104
122
|
var meta = props.meta,
|
|
105
123
|
status = props.status;
|
|
124
|
+
var nameRef = useRef(null);
|
|
106
125
|
if (props.isServiceAccount) {
|
|
107
126
|
return /*#__PURE__*/React.createElement(ServiceAccountProfileCardDetails, props);
|
|
108
127
|
}
|
|
@@ -114,7 +133,7 @@ export var ProfileCardDetails = function ProfileCardDetails(props) {
|
|
|
114
133
|
status: status
|
|
115
134
|
}));
|
|
116
135
|
}
|
|
117
|
-
return /*#__PURE__*/React.createElement(DetailsGroup, null, renderName(props.nickname, props.fullName, meta), meta && /*#__PURE__*/React.createElement(JobTitleLabel, null, meta), /*#__PURE__*/React.createElement(CustomLozenges, {
|
|
136
|
+
return /*#__PURE__*/React.createElement(DetailsGroup, null, renderName(props.nickname, props.fullName, meta, nameRef), meta && /*#__PURE__*/React.createElement(JobTitleLabel, null, meta), /*#__PURE__*/React.createElement(CustomLozenges, {
|
|
118
137
|
lozenges: props.customLozenges
|
|
119
138
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
120
139
|
xcss: styles.detailedListWrapperNext
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
._zulp12x7{gap:var(--ds-space-075,6px)}
|
|
5
5
|
._zulpu2gc{gap:var(--ds-space-100,8px)}
|
|
6
6
|
._12vemgnk{background-repeat:no-repeat}
|
|
7
|
-
.
|
|
7
|
+
._154i1jfw{top:var(--ds-space-500,40px)}
|
|
8
8
|
._154ixy5q{top:var(--ds-space-400,2pc)}
|
|
9
9
|
._154ize3t{top:var(--ds-space-0,0)}
|
|
10
10
|
._16jlkb7n{flex-grow:1}
|
package/dist/esm/styled/Card.js
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/no-styled-tagged-template-expression -- needs manual remediation */
|
|
3
3
|
import "./Card.compiled.css";
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useRef } from 'react';
|
|
6
6
|
import { cx } from '@atlaskit/css';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
9
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
9
10
|
var kudosButtonAnimationTransformationCompiled = null;
|
|
10
11
|
var styles = {
|
|
11
|
-
profileImage: "_kqswstnw
|
|
12
|
+
profileImage: "_kqswstnw _154i1jfw _1ltv1ejb",
|
|
12
13
|
actionsFlexSpacer: "_16jlkb7n _1o9zidpf _i0dl1wug",
|
|
13
14
|
kudosBlobAnimationStyle: "_1e0cglyw _4t3i1w81 _1bsb1w81 _1pby1mrw _kqswstnw _154ixy5q",
|
|
14
15
|
animationWrapper: "_mkrz1rip _kqswstnw _154ize3t _1ltvze3t _94n5ze3t _1xi2ze3t",
|
|
@@ -30,11 +31,11 @@ var styles = {
|
|
|
30
31
|
detailsLabelIcon: "_1e0c1txw _1o9zidpf _syaz1rpy _1bsb7vkz _4t3i7vkz _s7n4jp4b _19pkze3t",
|
|
31
32
|
detailsLabelText: "_1reo15vq _18m915vq _11c8dcr7 _1bto1l2s _syazi7uo _19pkze3t _18u0ze3t",
|
|
32
33
|
kudosBlobAnimation: "_1e0cglyw _4t3i1w81 _1bsb1w81 _1pby1mrw _kqswstnw _j7hq1q51 _tip8kb7n _5sagi11n _1itkdsyg",
|
|
33
|
-
jobTitleLabel: "_19pkze3t _otyrze3t
|
|
34
|
+
jobTitleLabel: "_19pkze3t _otyrze3t _18u0ze3t _2hwxze3t",
|
|
34
35
|
appTitleLabel: "_2rko12b0 _syazi7uo _u5f312x7 _19bv12x7 _1bsb1ns9 _19pk1b66 _otyrze3t _18u0utpp _2hwxze3t"
|
|
35
36
|
};
|
|
36
37
|
var stylesCompiled = {
|
|
37
|
-
jobTitleLabel: "_19pkze3t _otyrze3t
|
|
38
|
+
jobTitleLabel: "_19pkze3t _otyrze3t _18u0ze3t _2hwxze3t _1br315cr",
|
|
38
39
|
actionButtonGroup: "_zulp12x7 _uiztglyw _19pkpxbi _2hwxze3t _18u0ze3t _otyrze3t _y3gnusic _1bahesu3 _1e0c1txw _1oqbazsu"
|
|
39
40
|
};
|
|
40
41
|
export var ProfileImage = function ProfileImage(_ref) {
|
|
@@ -119,9 +120,26 @@ export var CustomLozengeContainer = function CustomLozengeContainer(_ref0) {
|
|
|
119
120
|
};
|
|
120
121
|
export var JobTitleLabel = function JobTitleLabel(_ref1) {
|
|
121
122
|
var children = _ref1.children;
|
|
123
|
+
var textRef = useRef(null);
|
|
122
124
|
return /*#__PURE__*/React.createElement(Box, {
|
|
123
125
|
xcss: cx(fg('enable_absolute_positioning_profile_card') ? stylesCompiled.jobTitleLabel : styles.jobTitleLabel)
|
|
126
|
+
}, fg('enable_profilecard_text_truncation_tooltip') ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
127
|
+
content: children,
|
|
128
|
+
position: "bottom",
|
|
129
|
+
isScreenReaderAnnouncementDisabled: true,
|
|
130
|
+
canAppear: function canAppear() {
|
|
131
|
+
if (!textRef.current) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
// Only showing the tooltip when the element has been truncated (ellipsis)
|
|
135
|
+
return textRef.current.scrollHeight > textRef.current.clientHeight;
|
|
136
|
+
}
|
|
124
137
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
138
|
+
ref: textRef,
|
|
139
|
+
maxLines: 1,
|
|
140
|
+
color: "color.text.inverse",
|
|
141
|
+
id: "profile-card-job-title-label-text"
|
|
142
|
+
}, children)) : /*#__PURE__*/React.createElement(Text, {
|
|
125
143
|
maxLines: 1,
|
|
126
144
|
color: "color.text.inverse",
|
|
127
145
|
id: "profile-card-job-title-label-text"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/profilecard",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.23.0",
|
|
4
4
|
"description": "A React component to display a card with user information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -52,8 +52,6 @@
|
|
|
52
52
|
"@atlaskit/give-kudos": "^4.4.0",
|
|
53
53
|
"@atlaskit/heading": "^5.2.0",
|
|
54
54
|
"@atlaskit/icon": "^29.0.0",
|
|
55
|
-
"@atlaskit/link": "^3.2.0",
|
|
56
|
-
"@atlaskit/logo": "^19.9.0",
|
|
57
55
|
"@atlaskit/lozenge": "^13.1.0",
|
|
58
56
|
"@atlaskit/menu": "^8.4.0",
|
|
59
57
|
"@atlaskit/modal-dialog": "^14.7.0",
|
|
@@ -62,8 +60,8 @@
|
|
|
62
60
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
63
61
|
"@atlaskit/popup": "^4.6.0",
|
|
64
62
|
"@atlaskit/primitives": "^16.4.0",
|
|
65
|
-
"@atlaskit/rovo-agent-components": "^3.
|
|
66
|
-
"@atlaskit/rovo-triggers": "^4.
|
|
63
|
+
"@atlaskit/rovo-agent-components": "^3.15.0",
|
|
64
|
+
"@atlaskit/rovo-triggers": "^4.8.0",
|
|
67
65
|
"@atlaskit/spinner": "^19.0.0",
|
|
68
66
|
"@atlaskit/teams-app-config": "^1.12.0",
|
|
69
67
|
"@atlaskit/teams-app-internal-analytics": "^1.20.0",
|
|
@@ -168,6 +166,9 @@
|
|
|
168
166
|
},
|
|
169
167
|
"rovo_agent_empty_state_refresh": {
|
|
170
168
|
"type": "boolean"
|
|
169
|
+
},
|
|
170
|
+
"enable_profilecard_text_truncation_tooltip": {
|
|
171
|
+
"type": "boolean"
|
|
171
172
|
}
|
|
172
173
|
},
|
|
173
174
|
"sideEffects": [
|