@atlaskit/smart-card 27.6.5 → 27.7.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 +21 -0
- package/dist/cjs/extractors/common/icon/extractIcon.js +67 -17
- package/dist/cjs/extractors/common/icon/extractIconFromDocument.js +0 -3
- package/dist/cjs/extractors/common/icon/prioritiseIcon.js +1 -16
- package/dist/cjs/extractors/embed/index.js +0 -1
- package/dist/cjs/extractors/flexible/icon/extract-jsonld-data-icon.js +90 -43
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/components/Action.js +2 -2
- package/dist/cjs/view/BlockCard/components/ActionList.js +12 -8
- package/dist/cjs/view/BlockCard/components/Content.js +10 -6
- package/dist/cjs/view/BlockCard/components/ContentFooter.js +15 -9
- package/dist/cjs/view/BlockCard/components/Frame.js +15 -9
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +8 -7
- package/dist/cjs/view/EmbedCard/views/ErroredView.js +2 -2
- package/dist/cjs/view/EmbedModal/components/link-info/link-info-button/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-analytics.js +8 -9
- package/dist/cjs/view/InlineCard/ErroredView/index.js +2 -2
- package/dist/cjs/view/InlineCard/ForbiddenView/index.js +3 -3
- package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +2 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/Byline.js +25 -25
- package/dist/es2019/extractors/common/icon/extractIcon.js +67 -19
- package/dist/es2019/extractors/common/icon/extractIconFromDocument.js +0 -5
- package/dist/es2019/extractors/common/icon/prioritiseIcon.js +0 -9
- package/dist/es2019/extractors/embed/index.js +0 -1
- package/dist/es2019/extractors/flexible/icon/extract-jsonld-data-icon.js +90 -42
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/components/Action.js +1 -1
- package/dist/es2019/view/BlockCard/components/ActionList.js +13 -8
- package/dist/es2019/view/BlockCard/components/Content.js +11 -7
- package/dist/es2019/view/BlockCard/components/ContentFooter.js +16 -10
- package/dist/es2019/view/BlockCard/components/Frame.js +13 -9
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +8 -7
- package/dist/es2019/view/EmbedCard/views/ErroredView.js +1 -1
- package/dist/es2019/view/EmbedModal/components/link-info/link-info-button/index.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-analytics.js +8 -9
- package/dist/es2019/view/InlineCard/ErroredView/index.js +1 -1
- package/dist/es2019/view/InlineCard/ForbiddenView/index.js +1 -1
- package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +1 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/Byline.js +26 -26
- package/dist/esm/extractors/common/icon/extractIcon.js +67 -17
- package/dist/esm/extractors/common/icon/extractIconFromDocument.js +0 -3
- package/dist/esm/extractors/common/icon/prioritiseIcon.js +1 -16
- package/dist/esm/extractors/embed/index.js +0 -1
- package/dist/esm/extractors/flexible/icon/extract-jsonld-data-icon.js +90 -44
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/components/Action.js +1 -1
- package/dist/esm/view/BlockCard/components/ActionList.js +13 -8
- package/dist/esm/view/BlockCard/components/Content.js +11 -7
- package/dist/esm/view/BlockCard/components/ContentFooter.js +16 -10
- package/dist/esm/view/BlockCard/components/Frame.js +13 -10
- package/dist/esm/view/BlockCard/views/ResolvedView.js +8 -7
- package/dist/esm/view/EmbedCard/views/ErroredView.js +1 -1
- package/dist/esm/view/EmbedModal/components/link-info/link-info-button/index.js +1 -1
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-analytics.js +8 -9
- package/dist/esm/view/InlineCard/ErroredView/index.js +1 -1
- package/dist/esm/view/InlineCard/ForbiddenView/index.js +1 -1
- package/dist/esm/view/InlineCard/UnauthorisedView/index.js +1 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/Byline.js +26 -26
- package/dist/types/extractors/common/icon/prioritiseIcon.d.ts +1 -5
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +8 -1
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-analytics.d.ts +1 -1
- package/dist/types-ts4.5/extractors/common/icon/prioritiseIcon.d.ts +1 -5
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +8 -1
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/view/Card/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-analytics.d.ts +1 -1
- package/package.json +3 -3
|
@@ -4,24 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.validationUpdateErrorAnalyticsPayload = exports.unknownUpdateErrorAnalyticsPayload = exports.unknownLoadErrorAnalyticsPayload = exports.permissionLoadErrorAnalyticsPayload = void 0;
|
|
7
|
-
var _analytics = require("../../../../../../utils/analytics/analytics");
|
|
8
7
|
var unknownLoadErrorAnalyticsPayload = exports.unknownLoadErrorAnalyticsPayload = {
|
|
9
|
-
smartLinkActionType:
|
|
10
|
-
reason:
|
|
8
|
+
smartLinkActionType: 'StatusUpdate',
|
|
9
|
+
reason: 'UnknownError',
|
|
11
10
|
step: 'load'
|
|
12
11
|
};
|
|
13
12
|
var permissionLoadErrorAnalyticsPayload = exports.permissionLoadErrorAnalyticsPayload = {
|
|
14
|
-
smartLinkActionType:
|
|
15
|
-
reason:
|
|
13
|
+
smartLinkActionType: 'StatusUpdate',
|
|
14
|
+
reason: 'PermissionError',
|
|
16
15
|
step: 'load'
|
|
17
16
|
};
|
|
18
17
|
var unknownUpdateErrorAnalyticsPayload = exports.unknownUpdateErrorAnalyticsPayload = {
|
|
19
|
-
smartLinkActionType:
|
|
20
|
-
reason:
|
|
18
|
+
smartLinkActionType: 'StatusUpdate',
|
|
19
|
+
reason: 'UnknownError',
|
|
21
20
|
step: 'update'
|
|
22
21
|
};
|
|
23
22
|
var validationUpdateErrorAnalyticsPayload = exports.validationUpdateErrorAnalyticsPayload = {
|
|
24
|
-
smartLinkActionType:
|
|
25
|
-
reason:
|
|
23
|
+
smartLinkActionType: 'StatusUpdate',
|
|
24
|
+
reason: 'ValidationError',
|
|
26
25
|
step: 'update'
|
|
27
26
|
};
|
|
@@ -15,7 +15,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
16
|
var _colors = require("@atlaskit/theme/colors");
|
|
17
17
|
var _error = _interopRequireDefault(require("@atlaskit/icon/glyph/error"));
|
|
18
|
-
var
|
|
18
|
+
var _button = _interopRequireDefault(require("@atlaskit/button"));
|
|
19
19
|
var _Frame = require("../Frame");
|
|
20
20
|
var _IconAndTitleLayout = require("../IconAndTitleLayout");
|
|
21
21
|
var _Icon = require("../Icon");
|
|
@@ -47,7 +47,7 @@ var InlineCardErroredView = exports.InlineCardErroredView = /*#__PURE__*/functio
|
|
|
47
47
|
});
|
|
48
48
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderActionButton", function () {
|
|
49
49
|
var onRetry = _this.props.onRetry;
|
|
50
|
-
var ActionButton = (0, _withFrameStyleControl.default)(
|
|
50
|
+
var ActionButton = (0, _withFrameStyleControl.default)(_button.default, _this.frameRef);
|
|
51
51
|
return onRetry && /*#__PURE__*/_react.default.createElement(ActionButton, {
|
|
52
52
|
spacing: "none",
|
|
53
53
|
component: _styled.IconStyledButton,
|
|
@@ -16,7 +16,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
var _colors = require("@atlaskit/theme/colors");
|
|
18
18
|
var _lockFilled = _interopRequireDefault(require("@atlaskit/icon/glyph/lock-filled"));
|
|
19
|
-
var
|
|
19
|
+
var _button = _interopRequireDefault(require("@atlaskit/button"));
|
|
20
20
|
var _Frame = require("../Frame");
|
|
21
21
|
var _IconAndTitleLayout = require("../IconAndTitleLayout");
|
|
22
22
|
var _Icon = require("../Icon");
|
|
@@ -78,7 +78,7 @@ var InlineCardForbiddenView = exports.InlineCardForbiddenView = /*#__PURE__*/fun
|
|
|
78
78
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderActionButton", function () {
|
|
79
79
|
var _this$props$requestAc;
|
|
80
80
|
var onAuthorise = _this.props.onAuthorise;
|
|
81
|
-
var ActionButton = (0, _withFrameStyleControl.default)(
|
|
81
|
+
var ActionButton = (0, _withFrameStyleControl.default)(_button.default, _this.frameRef);
|
|
82
82
|
var accessType = (_this$props$requestAc = _this.props.requestAccessContext) === null || _this$props$requestAc === void 0 ? void 0 : _this$props$requestAc.accessType;
|
|
83
83
|
if (_this.state.hasRequestAccessContextMessage) {
|
|
84
84
|
return /*#__PURE__*/_react.default.createElement(ActionButton, {
|
|
@@ -91,7 +91,7 @@ var InlineCardForbiddenView = exports.InlineCardForbiddenView = /*#__PURE__*/fun
|
|
|
91
91
|
}, _this.renderForbiddenAccessMessage());
|
|
92
92
|
}
|
|
93
93
|
if (onAuthorise) {
|
|
94
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
95
95
|
spacing: "none",
|
|
96
96
|
onClick: _this.handleRetry,
|
|
97
97
|
appearance: "subtle-link",
|
|
@@ -13,7 +13,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
13
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
var
|
|
16
|
+
var _button = _interopRequireDefault(require("@atlaskit/button"));
|
|
17
17
|
var _lockFilled = _interopRequireDefault(require("@atlaskit/icon/glyph/lock-filled"));
|
|
18
18
|
var _colors = require("@atlaskit/theme/colors");
|
|
19
19
|
var _withFrameStyleControl = _interopRequireDefault(require("../utils/withFrameStyleControl"));
|
|
@@ -61,7 +61,7 @@ var InlineCardUnauthorizedView = exports.InlineCardUnauthorizedView = /*#__PURE_
|
|
|
61
61
|
var _this$props2 = _this.props,
|
|
62
62
|
onAuthorise = _this$props2.onAuthorise,
|
|
63
63
|
context = _this$props2.context;
|
|
64
|
-
var ActionButton = (0, _withFrameStyleControl.default)(
|
|
64
|
+
var ActionButton = (0, _withFrameStyleControl.default)(_button.default, _this.frameRef);
|
|
65
65
|
return onAuthorise ? /*#__PURE__*/_react.default.createElement(ActionButton, {
|
|
66
66
|
spacing: "none",
|
|
67
67
|
component: _styled.IconStyledButton,
|
|
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
17
17
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
18
18
|
var PACKAGE_DATA = {
|
|
19
19
|
packageName: "@atlaskit/smart-card",
|
|
20
|
-
packageVersion: "27.
|
|
20
|
+
packageVersion: "27.7.1",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -10,37 +10,37 @@ var _utils = require("./utils");
|
|
|
10
10
|
/** @jsx jsx */
|
|
11
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
12
12
|
|
|
13
|
+
var baseStyles = (0, _react.css)({
|
|
14
|
+
// Spec: only allow two lines MAX to be shown.
|
|
15
|
+
display: '-webkit-box',
|
|
16
|
+
overflow: 'hidden',
|
|
17
|
+
textOverflow: 'ellipsis',
|
|
18
|
+
WebkitLineClamp: 2,
|
|
19
|
+
WebkitBoxOrient: 'vertical',
|
|
20
|
+
wordBreak: 'break-word',
|
|
21
|
+
whiteSpace: 'pre-line',
|
|
22
|
+
// EDM-713: fixes copy-paste from renderer to editor for Firefox
|
|
23
|
+
// due to HTML its unwrapping behaviour on paste.
|
|
24
|
+
MozUserSelect: 'none'
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
28
|
+
var styles = (0, _utils.mq)({
|
|
29
|
+
fontSize: (0, _utils.gs)(1.5),
|
|
30
|
+
lineHeight: (0, _utils.gs)(2.5),
|
|
31
|
+
color: "".concat("var(--ds-text-subtlest, ".concat(_colors.N300, ")")),
|
|
32
|
+
fontWeight: 'normal',
|
|
33
|
+
marginTop: (0, _utils.gs)(0.5),
|
|
34
|
+
// Fallback options.
|
|
35
|
+
maxHeight: (0, _utils.gs)(5)
|
|
36
|
+
});
|
|
13
37
|
var Byline = exports.Byline = function Byline(_ref) {
|
|
14
38
|
var text = _ref.text,
|
|
15
39
|
children = _ref.children,
|
|
16
40
|
testId = _ref.testId,
|
|
17
41
|
className = _ref.className;
|
|
18
42
|
return (0, _react.jsx)("span", {
|
|
19
|
-
|
|
20
|
-
css: (0, _utils.mq)({
|
|
21
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
22
|
-
fontSize: (0, _utils.gs)(1.5),
|
|
23
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
24
|
-
lineHeight: (0, _utils.gs)(2.5),
|
|
25
|
-
color: "".concat("var(--ds-text-subtlest, ".concat(_colors.N300, ")")),
|
|
26
|
-
fontWeight: 'normal',
|
|
27
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
28
|
-
marginTop: (0, _utils.gs)(0.5),
|
|
29
|
-
// Spec: only allow two lines MAX to be shown.
|
|
30
|
-
display: '-webkit-box',
|
|
31
|
-
overflow: 'hidden',
|
|
32
|
-
textOverflow: 'ellipsis',
|
|
33
|
-
WebkitLineClamp: 2,
|
|
34
|
-
WebkitBoxOrient: 'vertical',
|
|
35
|
-
wordBreak: 'break-word',
|
|
36
|
-
// Fallback options.
|
|
37
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
38
|
-
maxHeight: (0, _utils.gs)(5),
|
|
39
|
-
whiteSpace: 'pre-line',
|
|
40
|
-
// EDM-713: fixes copy-paste from renderer to editor for Firefox
|
|
41
|
-
// due to HTML its unwrapping behaviour on paste.
|
|
42
|
-
MozUserSelect: 'none'
|
|
43
|
-
}),
|
|
43
|
+
css: [baseStyles, styles],
|
|
44
44
|
"data-testid": testId
|
|
45
45
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
46
46
|
,
|
|
@@ -6,6 +6,7 @@ import PullRequestIcon from '@atlaskit/icon-object/glyph/pull-request/16';
|
|
|
6
6
|
import BranchIcon from '@atlaskit/icon-object/glyph/branch/16';
|
|
7
7
|
import RepoIcon from '@atlaskit/icon-object/glyph/code/16';
|
|
8
8
|
import TaskIcon from '@atlaskit/icon-object/glyph/task/16';
|
|
9
|
+
import { getIconForFileType } from '../../../utils';
|
|
9
10
|
import { extractorPriorityMap } from './priority';
|
|
10
11
|
import { extractProvider, extractUrlFromIconJsonLd, extractTitle } from '@atlaskit/link-extractors';
|
|
11
12
|
import { extractFileFormat } from './extractFileFormat';
|
|
@@ -30,6 +31,56 @@ export const extractIcon = (jsonLd, priority = 'type') => {
|
|
|
30
31
|
return extractIconByType(type, opts);
|
|
31
32
|
}
|
|
32
33
|
};
|
|
34
|
+
function typeToIcon(type, opts) {
|
|
35
|
+
switch (type) {
|
|
36
|
+
case 'atlassian:SourceCodeCommit':
|
|
37
|
+
return /*#__PURE__*/React.createElement(CommitIcon, {
|
|
38
|
+
label: opts.title || 'commit',
|
|
39
|
+
testId: "commit-icon"
|
|
40
|
+
});
|
|
41
|
+
case 'atlassian:Project':
|
|
42
|
+
return /*#__PURE__*/React.createElement(ProjectIcon, {
|
|
43
|
+
label: opts.title || 'project',
|
|
44
|
+
size: "small",
|
|
45
|
+
testId: "project-icon"
|
|
46
|
+
});
|
|
47
|
+
case 'atlassian:SourceCodePullRequest':
|
|
48
|
+
return /*#__PURE__*/React.createElement(PullRequestIcon, {
|
|
49
|
+
label: opts.title || 'pullRequest',
|
|
50
|
+
testId: "pull-request-icon"
|
|
51
|
+
});
|
|
52
|
+
case 'atlassian:SourceCodeReference':
|
|
53
|
+
return /*#__PURE__*/React.createElement(BranchIcon, {
|
|
54
|
+
label: opts.title || 'reference',
|
|
55
|
+
testId: "branch-icon"
|
|
56
|
+
});
|
|
57
|
+
case 'atlassian:SourceCodeRepository':
|
|
58
|
+
return /*#__PURE__*/React.createElement(RepoIcon, {
|
|
59
|
+
label: opts.title || 'repository',
|
|
60
|
+
testId: "repo-icon"
|
|
61
|
+
});
|
|
62
|
+
case 'atlassian:Goal':
|
|
63
|
+
return /*#__PURE__*/React.createElement(TaskIcon, {
|
|
64
|
+
label: opts.title || 'goal',
|
|
65
|
+
testId: "task-icon"
|
|
66
|
+
});
|
|
67
|
+
case 'atlassian:Task':
|
|
68
|
+
return extractIconFromTask(opts);
|
|
69
|
+
default:
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function standardisedExtractIcon(type, opts) {
|
|
74
|
+
const iconFromType = typeToIcon(type, opts);
|
|
75
|
+
const iconFromFileFormat = opts.fileFormat ? getIconForFileType(opts.fileFormat) : undefined;
|
|
76
|
+
const iconFromProvider = opts.provider && opts.provider.icon;
|
|
77
|
+
return prioritiseIcon({
|
|
78
|
+
fileFormatIcon: iconFromFileFormat,
|
|
79
|
+
documentTypeIcon: iconFromType,
|
|
80
|
+
urlIcon: opts.icon,
|
|
81
|
+
providerIcon: iconFromProvider
|
|
82
|
+
});
|
|
83
|
+
}
|
|
33
84
|
|
|
34
85
|
/**
|
|
35
86
|
* Extracts an icon based on the given type.
|
|
@@ -42,6 +93,21 @@ export const extractIcon = (jsonLd, priority = 'type') => {
|
|
|
42
93
|
* @returns The extracted icon as a React node, or `undefined` if no icon is found.
|
|
43
94
|
*/
|
|
44
95
|
const extractIconByType = (type, opts) => {
|
|
96
|
+
if (getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
97
|
+
switch (type) {
|
|
98
|
+
case 'Document':
|
|
99
|
+
case 'schema:BlogPosting':
|
|
100
|
+
case 'schema:DigitalDocument':
|
|
101
|
+
case 'schema:TextDigitalDocument':
|
|
102
|
+
case 'schema:PresentationDigitalDocument':
|
|
103
|
+
case 'schema:SpreadsheetDigitalDocument':
|
|
104
|
+
case 'atlassian:Template':
|
|
105
|
+
case 'atlassian:UndefinedLink':
|
|
106
|
+
return extractIconFromDocument(type, opts);
|
|
107
|
+
default:
|
|
108
|
+
return standardisedExtractIcon(type, opts);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
45
111
|
switch (type) {
|
|
46
112
|
case 'Document':
|
|
47
113
|
case 'schema:BlogPosting':
|
|
@@ -86,24 +152,6 @@ const extractIconByType = (type, opts) => {
|
|
|
86
152
|
case 'atlassian:Task':
|
|
87
153
|
return extractIconFromTask(opts);
|
|
88
154
|
default:
|
|
89
|
-
return
|
|
155
|
+
return opts.provider && opts.provider.icon;
|
|
90
156
|
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Choose which icon to show when the type is not recognized.
|
|
95
|
-
*/
|
|
96
|
-
const extractDefaultIcon = opts => {
|
|
97
|
-
var _opts$provider;
|
|
98
|
-
const {
|
|
99
|
-
provider
|
|
100
|
-
} = opts;
|
|
101
|
-
const providerId = provider === null || provider === void 0 ? void 0 : provider.id;
|
|
102
|
-
return prioritiseIcon({
|
|
103
|
-
providerId,
|
|
104
|
-
fileFormatIcon: undefined,
|
|
105
|
-
documentTypeIcon: undefined,
|
|
106
|
-
urlIcon: opts.icon,
|
|
107
|
-
providerIcon: (_opts$provider = opts.provider) === null || _opts$provider === void 0 ? void 0 : _opts$provider.icon
|
|
108
|
-
});
|
|
109
157
|
};
|
|
@@ -16,16 +16,11 @@ import { prioritiseIcon } from './prioritiseIcon';
|
|
|
16
16
|
* @returns The React node representing the extracted icon, or `undefined` if no icon is found.
|
|
17
17
|
*/
|
|
18
18
|
export const extractIconFromDocument = (type, opts) => {
|
|
19
|
-
const {
|
|
20
|
-
provider
|
|
21
|
-
} = opts;
|
|
22
19
|
const iconFromType = documentTypeToIcon(type, opts);
|
|
23
20
|
const iconFromFileFormat = documentFileFormatToIcon(opts);
|
|
24
21
|
const iconFromProvider = opts.provider && opts.provider.icon;
|
|
25
22
|
if (getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
26
|
-
const providerId = provider === null || provider === void 0 ? void 0 : provider.id;
|
|
27
23
|
return prioritiseIcon({
|
|
28
|
-
providerId,
|
|
29
24
|
fileFormatIcon: iconFromFileFormat,
|
|
30
25
|
documentTypeIcon: iconFromType,
|
|
31
26
|
urlIcon: opts.icon,
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { CONFLUENCE_GENERATOR_ID, JIRA_GENERATOR_ID } from '../../constants';
|
|
2
|
-
const isConfluenceProvider = provider => provider === CONFLUENCE_GENERATOR_ID;
|
|
3
|
-
const isJiraProvider = provider => provider === JIRA_GENERATOR_ID;
|
|
4
|
-
const isNativeProvider = provider => isConfluenceProvider(provider) || isJiraProvider(provider);
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* Represents an icon. Should either contain a label and url, or a an icon type and label.
|
|
8
3
|
*/
|
|
@@ -16,14 +11,10 @@ const isNativeProvider = provider => isConfluenceProvider(provider) || isJiraPro
|
|
|
16
11
|
* Generic so it can be used to prioritise strings, or React components depending on the usage.
|
|
17
12
|
*/
|
|
18
13
|
export function prioritiseIcon({
|
|
19
|
-
providerId,
|
|
20
14
|
fileFormatIcon,
|
|
21
15
|
documentTypeIcon,
|
|
22
16
|
urlIcon,
|
|
23
17
|
providerIcon
|
|
24
18
|
}) {
|
|
25
|
-
if (isNativeProvider(providerId)) {
|
|
26
|
-
return fileFormatIcon || documentTypeIcon || urlIcon || providerIcon;
|
|
27
|
-
}
|
|
28
19
|
return urlIcon || fileFormatIcon || documentTypeIcon || providerIcon;
|
|
29
20
|
}
|
|
@@ -24,7 +24,6 @@ function generateContext(jsonLd) {
|
|
|
24
24
|
}
|
|
25
25
|
const generator = jsonLd.generator;
|
|
26
26
|
const icon = prioritiseIcon({
|
|
27
|
-
providerId: generator && typeof generator !== 'string' && generator['@type'] !== 'Link' ? generator['@id'] : undefined,
|
|
28
27
|
fileFormatIcon: undefined,
|
|
29
28
|
documentTypeIcon: undefined,
|
|
30
29
|
urlIcon: extractUrlFromIconJsonLd(jsonLd.icon),
|
|
@@ -32,6 +32,85 @@ const extractType = jsonLd => {
|
|
|
32
32
|
const isConfluenceProvider = provider => provider === CONFLUENCE_GENERATOR_ID;
|
|
33
33
|
const isJiraProvider = provider => provider === JIRA_GENERATOR_ID;
|
|
34
34
|
const isNativeProvider = provider => isConfluenceProvider(provider) || isJiraProvider(provider);
|
|
35
|
+
function chooseIcon({
|
|
36
|
+
urlIcon,
|
|
37
|
+
type,
|
|
38
|
+
label,
|
|
39
|
+
data,
|
|
40
|
+
providerIcon
|
|
41
|
+
}) {
|
|
42
|
+
var _data$generator;
|
|
43
|
+
const providerId = (_data$generator = data.generator) === null || _data$generator === void 0 ? void 0 : _data$generator['@id'];
|
|
44
|
+
const fileFormat = data === null || data === void 0 ? void 0 : data['schema:fileFormat'];
|
|
45
|
+
const fileFormatIcon = extractFileFormatIcon(fileFormat);
|
|
46
|
+
const documentTypeIcon = typeToIconDescriptor({
|
|
47
|
+
type,
|
|
48
|
+
label,
|
|
49
|
+
providerId,
|
|
50
|
+
data
|
|
51
|
+
}) || extractDocumentTypeIcon(type, label);
|
|
52
|
+
return prioritiseIcon({
|
|
53
|
+
fileFormatIcon,
|
|
54
|
+
documentTypeIcon,
|
|
55
|
+
urlIcon,
|
|
56
|
+
providerIcon
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function typeToIconDescriptor({
|
|
60
|
+
type,
|
|
61
|
+
label,
|
|
62
|
+
providerId,
|
|
63
|
+
data
|
|
64
|
+
}) {
|
|
65
|
+
switch (type) {
|
|
66
|
+
case 'atlassian:Goal':
|
|
67
|
+
return {
|
|
68
|
+
icon: IconType.Task,
|
|
69
|
+
label: label || 'Goal'
|
|
70
|
+
};
|
|
71
|
+
case 'atlassian:Project':
|
|
72
|
+
return {
|
|
73
|
+
icon: IconType.Project,
|
|
74
|
+
label: label || 'Project'
|
|
75
|
+
};
|
|
76
|
+
case 'atlassian:SourceCodeCommit':
|
|
77
|
+
return {
|
|
78
|
+
icon: IconType.Commit,
|
|
79
|
+
label: label || 'Commit'
|
|
80
|
+
};
|
|
81
|
+
case 'atlassian:SourceCodePullRequest':
|
|
82
|
+
return {
|
|
83
|
+
icon: IconType.PullRequest,
|
|
84
|
+
label: label || 'Pull request'
|
|
85
|
+
};
|
|
86
|
+
case 'atlassian:SourceCodeReference':
|
|
87
|
+
return {
|
|
88
|
+
icon: IconType.Branch,
|
|
89
|
+
label: label || 'Reference'
|
|
90
|
+
};
|
|
91
|
+
case 'atlassian:SourceCodeRepository':
|
|
92
|
+
return {
|
|
93
|
+
icon: IconType.Repo,
|
|
94
|
+
label: label || 'Repository'
|
|
95
|
+
};
|
|
96
|
+
case 'atlassian:Task':
|
|
97
|
+
const taskLabel = label || 'Task';
|
|
98
|
+
const taskIconDescriptor = {
|
|
99
|
+
icon: IconType.Task,
|
|
100
|
+
label: taskLabel
|
|
101
|
+
};
|
|
102
|
+
if (isJiraProvider(providerId)) {
|
|
103
|
+
const {
|
|
104
|
+
taskType,
|
|
105
|
+
taskIcon
|
|
106
|
+
} = extractTask(data);
|
|
107
|
+
return taskType === 'JiraCustomTaskType' ? taskIcon || taskIconDescriptor : extractJiraTaskIcon(taskType, taskLabel);
|
|
108
|
+
}
|
|
109
|
+
return taskIconDescriptor;
|
|
110
|
+
default:
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
35
114
|
|
|
36
115
|
/**
|
|
37
116
|
* Return the icon object given a JSON-LD data object.
|
|
@@ -43,6 +122,15 @@ const extractJsonldDataIcon = data => {
|
|
|
43
122
|
const urlIcon = extractUrlIcon(data.icon, label);
|
|
44
123
|
const provider = generator === null || generator === void 0 ? void 0 : generator['@id'];
|
|
45
124
|
const providerIcon = extractProviderIcon(data);
|
|
125
|
+
if (getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
126
|
+
return chooseIcon({
|
|
127
|
+
urlIcon,
|
|
128
|
+
providerIcon,
|
|
129
|
+
type,
|
|
130
|
+
label,
|
|
131
|
+
data
|
|
132
|
+
});
|
|
133
|
+
}
|
|
46
134
|
switch (type) {
|
|
47
135
|
case 'Document':
|
|
48
136
|
case 'schema:BlogPosting':
|
|
@@ -60,15 +148,6 @@ const extractJsonldDataIcon = data => {
|
|
|
60
148
|
const fileFormat = documentData === null || documentData === void 0 ? void 0 : documentData['schema:fileFormat'];
|
|
61
149
|
const fileFormatIcon = extractFileFormatIcon(fileFormat);
|
|
62
150
|
const documentTypeIcon = extractDocumentTypeIcon(type, label);
|
|
63
|
-
if (getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
64
|
-
return prioritiseIcon({
|
|
65
|
-
providerId: provider,
|
|
66
|
-
fileFormatIcon,
|
|
67
|
-
documentTypeIcon,
|
|
68
|
-
urlIcon,
|
|
69
|
-
providerIcon
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
151
|
return isNativeProvider(provider) ? fileFormatIcon || documentTypeIcon || urlIcon || providerIcon : providerIcon || fileFormatIcon || documentTypeIcon;
|
|
73
152
|
case 'atlassian:Task':
|
|
74
153
|
const taskLabel = label || 'Task';
|
|
@@ -117,38 +196,7 @@ const extractJsonldDataIcon = data => {
|
|
|
117
196
|
label: label || 'Repository'
|
|
118
197
|
};
|
|
119
198
|
default:
|
|
120
|
-
return
|
|
121
|
-
data,
|
|
122
|
-
type,
|
|
123
|
-
label,
|
|
124
|
-
provider,
|
|
125
|
-
urlIcon,
|
|
126
|
-
providerIcon
|
|
127
|
-
}) : providerIcon;
|
|
199
|
+
return providerIcon;
|
|
128
200
|
}
|
|
129
201
|
};
|
|
130
|
-
export default extractJsonldDataIcon;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Choose which icon to show when the type is not recognized.
|
|
134
|
-
*/
|
|
135
|
-
const extractDefaultIcon = ({
|
|
136
|
-
data,
|
|
137
|
-
type,
|
|
138
|
-
label,
|
|
139
|
-
provider,
|
|
140
|
-
urlIcon,
|
|
141
|
-
providerIcon
|
|
142
|
-
}) => {
|
|
143
|
-
const documentData = data;
|
|
144
|
-
const fileFormat = documentData === null || documentData === void 0 ? void 0 : documentData['schema:fileFormat'];
|
|
145
|
-
const fileFormatIcon = extractFileFormatIcon(fileFormat);
|
|
146
|
-
const documentTypeIcon = extractDocumentTypeIcon(type, label);
|
|
147
|
-
return prioritiseIcon({
|
|
148
|
-
providerId: provider,
|
|
149
|
-
fileFormatIcon,
|
|
150
|
-
documentTypeIcon,
|
|
151
|
-
urlIcon,
|
|
152
|
-
providerIcon
|
|
153
|
-
});
|
|
154
|
-
};
|
|
202
|
+
export default extractJsonldDataIcon;
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "27.
|
|
7
|
+
packageVersion: "27.7.1"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { useState } from 'react';
|
|
5
|
-
import Button from '@atlaskit/button
|
|
5
|
+
import { LoadingButton as Button } from '@atlaskit/button';
|
|
6
6
|
import { ActionIcon } from './ActionIcon';
|
|
7
7
|
export const spinnerDelay = 1000;
|
|
8
8
|
const baseTextStyles = css({
|
|
@@ -9,9 +9,20 @@ import MoreIcon from '@atlaskit/icon/glyph/more';
|
|
|
9
9
|
import { Action } from './Action';
|
|
10
10
|
import { gs, mq } from '../../common/utils';
|
|
11
11
|
import { di } from 'react-magnetic-di';
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
14
|
+
const wrapperStyles = mq({
|
|
15
|
+
display: 'flex',
|
|
16
|
+
marginTop: [gs(2), 0]
|
|
17
|
+
});
|
|
12
18
|
const buttonStyles = css({
|
|
13
19
|
height: 'auto'
|
|
14
20
|
});
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
23
|
+
const actionsWrapperStyles = {
|
|
24
|
+
marginLeft: gs(0.5)
|
|
25
|
+
};
|
|
15
26
|
export const ActionList = ({
|
|
16
27
|
items
|
|
17
28
|
}) => {
|
|
@@ -19,19 +30,13 @@ export const ActionList = ({
|
|
|
19
30
|
const actionsToList = items.slice(2, items.length);
|
|
20
31
|
return jsx("div", {
|
|
21
32
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
22
|
-
css:
|
|
23
|
-
display: 'flex',
|
|
24
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
25
|
-
marginTop: [gs(2), 0]
|
|
26
|
-
})
|
|
33
|
+
css: wrapperStyles
|
|
27
34
|
}, jsx(ButtonGroup, null, actionsToShow.map(action => jsx(Action, _extends({
|
|
28
35
|
key: action.id
|
|
29
36
|
}, action)))), actionsToList.length ?
|
|
30
37
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
31
38
|
jsx("div", {
|
|
32
|
-
css:
|
|
33
|
-
marginLeft: gs(0.5)
|
|
34
|
-
}
|
|
39
|
+
css: actionsWrapperStyles
|
|
35
40
|
}, jsx(DropdownMenu, {
|
|
36
41
|
trigger: ({
|
|
37
42
|
triggerRef,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
|
-
import { jsx } from '@emotion/react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { gs, mq } from '../../common/utils';
|
|
5
5
|
/**
|
|
6
6
|
* Class name for selecting non-flexible block card content
|
|
@@ -9,19 +9,23 @@ import { gs, mq } from '../../common/utils';
|
|
|
9
9
|
* Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
|
|
10
10
|
*/
|
|
11
11
|
export const blockCardContentClassName = 'block-card-content';
|
|
12
|
+
const baseStyles = css({
|
|
13
|
+
display: 'flex',
|
|
14
|
+
flexDirection: 'column',
|
|
15
|
+
flexGrow: 1
|
|
16
|
+
});
|
|
12
17
|
export const Content = ({
|
|
13
18
|
children,
|
|
14
19
|
isCompact = false
|
|
15
20
|
}) => jsx("div", {
|
|
16
21
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
17
|
-
css:
|
|
22
|
+
css: [baseStyles,
|
|
23
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
24
|
+
mq({
|
|
18
25
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
19
26
|
padding: isCompact ? gs(1) : gs(2),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
justifyContent: isCompact ? 'unset' : ['unset', 'space-between'],
|
|
23
|
-
flexGrow: 1
|
|
24
|
-
}),
|
|
27
|
+
justifyContent: isCompact ? 'unset' : ['unset', 'space-between']
|
|
28
|
+
})],
|
|
25
29
|
"data-trello-do-not-use-override": "block-card-content"
|
|
26
30
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
27
31
|
,
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
|
-
import { jsx } from '@emotion/react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { gs, mq } from '../../common/utils';
|
|
5
5
|
export const contentFooterClassName = 'smart-link-content-footer';
|
|
6
|
+
const flexStyles = css({
|
|
7
|
+
display: 'flex'
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
11
|
+
const baseStyles = mq({
|
|
12
|
+
flexDirection: ['column', 'row'],
|
|
13
|
+
flexGrow: [1, 'unset'],
|
|
14
|
+
alignItems: ['unset', 'center'],
|
|
15
|
+
marginTop: [gs(1), gs(1.5)]
|
|
16
|
+
});
|
|
6
17
|
export const ContentFooter = ({
|
|
7
18
|
children,
|
|
8
19
|
hasSpaceBetween = false
|
|
9
20
|
}) => jsx("div", {
|
|
21
|
+
css: [flexStyles, baseStyles,
|
|
10
22
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
flexGrow: [1, 'unset'],
|
|
15
|
-
justifyContent: [hasSpaceBetween ? 'space-between' : 'flex-end', 'space-between'],
|
|
16
|
-
alignItems: ['unset', 'center'],
|
|
17
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
18
|
-
marginTop: [gs(1), gs(1.5)]
|
|
19
|
-
})
|
|
23
|
+
mq({
|
|
24
|
+
justifyContent: [hasSpaceBetween ? 'space-between' : 'flex-end', 'space-between']
|
|
25
|
+
})]
|
|
20
26
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
21
27
|
,
|
|
22
28
|
className: contentFooterClassName
|