@atlaskit/smart-card 46.1.12 → 46.1.14
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/common/ui/icons/blog-icon.js +0 -3
- package/dist/cjs/common/ui/icons/live-document-icon.js +0 -3
- package/dist/cjs/common/ui/icons/transform-smart-link-size-to-icon-tile-size.js +3 -16
- package/dist/cjs/extractors/common/icon/extractIcon.js +9 -19
- package/dist/cjs/extractors/common/icon/extractIconFromDocument.js +2 -4
- package/dist/cjs/extractors/common/icon/extractIconFromTask.js +10 -15
- package/dist/cjs/extractors/flexible/icon/extract-document-type-icon.js +14 -37
- package/dist/cjs/extractors/flexible/icon/extract-file-formatIcon.js +1 -4
- package/dist/cjs/extractors/flexible/icon/extract-jira-task-icon.js +15 -40
- package/dist/cjs/extractors/flexible/icon/extract-jsonld-data-icon.js +48 -127
- package/dist/cjs/extractors/inline/index.js +7 -11
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/get-icon-for-file-type.js +7 -20
- package/dist/cjs/utils/get-lazy-icons.js +10 -31
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +5 -13
- package/dist/cjs/view/FlexibleCard/components/elements/common/base-icon-element/index.js +15 -23
- package/dist/cjs/view/FlexibleCard/components/elements/link-icon-element/index.js +10 -25
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/image-icon/index.js +2 -14
- package/dist/es2019/common/ui/icons/blog-icon.js +0 -3
- package/dist/es2019/common/ui/icons/live-document-icon.js +0 -3
- package/dist/es2019/common/ui/icons/transform-smart-link-size-to-icon-tile-size.js +3 -16
- package/dist/es2019/extractors/common/icon/extractIcon.js +7 -13
- package/dist/es2019/extractors/common/icon/extractIconFromDocument.js +2 -4
- package/dist/es2019/extractors/common/icon/extractIconFromTask.js +10 -13
- package/dist/es2019/extractors/flexible/icon/extract-document-type-icon.js +13 -36
- package/dist/es2019/extractors/flexible/icon/extract-file-formatIcon.js +2 -5
- package/dist/es2019/extractors/flexible/icon/extract-jira-task-icon.js +14 -39
- package/dist/es2019/extractors/flexible/icon/extract-jsonld-data-icon.js +46 -131
- package/dist/es2019/extractors/inline/index.js +7 -11
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/get-icon-for-file-type.js +7 -20
- package/dist/es2019/utils/get-lazy-icons.js +20 -21
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +5 -12
- package/dist/es2019/view/FlexibleCard/components/elements/common/base-icon-element/index.js +15 -24
- package/dist/es2019/view/FlexibleCard/components/elements/link-icon-element/index.js +9 -24
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/image-icon/index.js +2 -15
- package/dist/esm/common/ui/icons/blog-icon.js +0 -3
- package/dist/esm/common/ui/icons/live-document-icon.js +0 -3
- package/dist/esm/common/ui/icons/transform-smart-link-size-to-icon-tile-size.js +3 -16
- package/dist/esm/extractors/common/icon/extractIcon.js +9 -19
- package/dist/esm/extractors/common/icon/extractIconFromDocument.js +2 -4
- package/dist/esm/extractors/common/icon/extractIconFromTask.js +10 -15
- package/dist/esm/extractors/flexible/icon/extract-document-type-icon.js +14 -37
- package/dist/esm/extractors/flexible/icon/extract-file-formatIcon.js +1 -4
- package/dist/esm/extractors/flexible/icon/extract-jira-task-icon.js +15 -40
- package/dist/esm/extractors/flexible/icon/extract-jsonld-data-icon.js +48 -127
- package/dist/esm/extractors/inline/index.js +7 -11
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/get-icon-for-file-type.js +7 -20
- package/dist/esm/utils/get-lazy-icons.js +20 -21
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +5 -13
- package/dist/esm/view/FlexibleCard/components/elements/common/base-icon-element/index.js +15 -24
- package/dist/esm/view/FlexibleCard/components/elements/link-icon-element/index.js +9 -24
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/image-icon/index.js +2 -14
- package/dist/types/extractors/common/icon/extractIcon.d.ts +0 -1
- package/dist/types/extractors/flexible/icon/extract-document-type-icon.d.ts +1 -3
- package/dist/types/extractors/flexible/icon/extract-jira-task-icon.d.ts +1 -1
- package/package.json +3 -15
- package/dist/cjs/common/ui/icons/priority-blocker-icon.compiled.css +0 -5
- package/dist/cjs/common/ui/icons/priority-blocker-icon.js +0 -50
- package/dist/cjs/common/ui/icons/priority-critical-icon.compiled.css +0 -5
- package/dist/cjs/common/ui/icons/priority-critical-icon.js +0 -50
- package/dist/cjs/common/ui/icons/priority-high-icon.compiled.css +0 -5
- package/dist/cjs/common/ui/icons/priority-high-icon.js +0 -50
- package/dist/cjs/common/ui/icons/priority-highest-icon.compiled.css +0 -5
- package/dist/cjs/common/ui/icons/priority-highest-icon.js +0 -56
- package/dist/cjs/common/ui/icons/priority-icon.compiled.css +0 -4
- package/dist/cjs/common/ui/icons/priority-icon.js +0 -49
- package/dist/cjs/common/ui/icons/priority-low-icon.compiled.css +0 -5
- package/dist/cjs/common/ui/icons/priority-low-icon.js +0 -50
- package/dist/cjs/common/ui/icons/priority-lowest-icon.compiled.css +0 -5
- package/dist/cjs/common/ui/icons/priority-lowest-icon.js +0 -56
- package/dist/cjs/common/ui/icons/priority-major-icon.compiled.css +0 -5
- package/dist/cjs/common/ui/icons/priority-major-icon.js +0 -62
- package/dist/cjs/common/ui/icons/priority-medium-icon.compiled.css +0 -5
- package/dist/cjs/common/ui/icons/priority-medium-icon.js +0 -50
- package/dist/cjs/common/ui/icons/priority-minor-icon.compiled.css +0 -5
- package/dist/cjs/common/ui/icons/priority-minor-icon.js +0 -62
- package/dist/cjs/common/ui/icons/priority-trivial-icon.compiled.css +0 -5
- package/dist/cjs/common/ui/icons/priority-trivial-icon.js +0 -50
- package/dist/es2019/common/ui/icons/priority-blocker-icon.compiled.css +0 -5
- package/dist/es2019/common/ui/icons/priority-blocker-icon.js +0 -38
- package/dist/es2019/common/ui/icons/priority-critical-icon.compiled.css +0 -5
- package/dist/es2019/common/ui/icons/priority-critical-icon.js +0 -38
- package/dist/es2019/common/ui/icons/priority-high-icon.compiled.css +0 -5
- package/dist/es2019/common/ui/icons/priority-high-icon.js +0 -38
- package/dist/es2019/common/ui/icons/priority-highest-icon.compiled.css +0 -5
- package/dist/es2019/common/ui/icons/priority-highest-icon.js +0 -44
- package/dist/es2019/common/ui/icons/priority-icon.compiled.css +0 -4
- package/dist/es2019/common/ui/icons/priority-icon.js +0 -35
- package/dist/es2019/common/ui/icons/priority-low-icon.compiled.css +0 -5
- package/dist/es2019/common/ui/icons/priority-low-icon.js +0 -38
- package/dist/es2019/common/ui/icons/priority-lowest-icon.compiled.css +0 -5
- package/dist/es2019/common/ui/icons/priority-lowest-icon.js +0 -44
- package/dist/es2019/common/ui/icons/priority-major-icon.compiled.css +0 -5
- package/dist/es2019/common/ui/icons/priority-major-icon.js +0 -50
- package/dist/es2019/common/ui/icons/priority-medium-icon.compiled.css +0 -5
- package/dist/es2019/common/ui/icons/priority-medium-icon.js +0 -38
- package/dist/es2019/common/ui/icons/priority-minor-icon.compiled.css +0 -5
- package/dist/es2019/common/ui/icons/priority-minor-icon.js +0 -50
- package/dist/es2019/common/ui/icons/priority-trivial-icon.compiled.css +0 -5
- package/dist/es2019/common/ui/icons/priority-trivial-icon.js +0 -38
- package/dist/esm/common/ui/icons/priority-blocker-icon.compiled.css +0 -5
- package/dist/esm/common/ui/icons/priority-blocker-icon.js +0 -41
- package/dist/esm/common/ui/icons/priority-critical-icon.compiled.css +0 -5
- package/dist/esm/common/ui/icons/priority-critical-icon.js +0 -41
- package/dist/esm/common/ui/icons/priority-high-icon.compiled.css +0 -5
- package/dist/esm/common/ui/icons/priority-high-icon.js +0 -41
- package/dist/esm/common/ui/icons/priority-highest-icon.compiled.css +0 -5
- package/dist/esm/common/ui/icons/priority-highest-icon.js +0 -47
- package/dist/esm/common/ui/icons/priority-icon.compiled.css +0 -4
- package/dist/esm/common/ui/icons/priority-icon.js +0 -40
- package/dist/esm/common/ui/icons/priority-low-icon.compiled.css +0 -5
- package/dist/esm/common/ui/icons/priority-low-icon.js +0 -41
- package/dist/esm/common/ui/icons/priority-lowest-icon.compiled.css +0 -5
- package/dist/esm/common/ui/icons/priority-lowest-icon.js +0 -47
- package/dist/esm/common/ui/icons/priority-major-icon.compiled.css +0 -5
- package/dist/esm/common/ui/icons/priority-major-icon.js +0 -53
- package/dist/esm/common/ui/icons/priority-medium-icon.compiled.css +0 -5
- package/dist/esm/common/ui/icons/priority-medium-icon.js +0 -41
- package/dist/esm/common/ui/icons/priority-minor-icon.compiled.css +0 -5
- package/dist/esm/common/ui/icons/priority-minor-icon.js +0 -53
- package/dist/esm/common/ui/icons/priority-trivial-icon.compiled.css +0 -5
- package/dist/esm/common/ui/icons/priority-trivial-icon.js +0 -41
- package/dist/types/common/ui/icons/priority-blocker-icon.d.ts +0 -13
- package/dist/types/common/ui/icons/priority-critical-icon.d.ts +0 -13
- package/dist/types/common/ui/icons/priority-high-icon.d.ts +0 -13
- package/dist/types/common/ui/icons/priority-highest-icon.d.ts +0 -13
- package/dist/types/common/ui/icons/priority-icon.d.ts +0 -13
- package/dist/types/common/ui/icons/priority-low-icon.d.ts +0 -13
- package/dist/types/common/ui/icons/priority-lowest-icon.d.ts +0 -13
- package/dist/types/common/ui/icons/priority-major-icon.d.ts +0 -13
- package/dist/types/common/ui/icons/priority-medium-icon.d.ts +0 -13
- package/dist/types/common/ui/icons/priority-minor-icon.d.ts +0 -13
- package/dist/types/common/ui/icons/priority-trivial-icon.d.ts +0 -13
|
@@ -7,40 +7,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
11
10
|
var _constants = require("../../../../../constants");
|
|
12
11
|
var _useFlexibleUiContext = require("../../../../../state/flexible-ui-context/useFlexibleUiContext");
|
|
13
12
|
var _common = require("../common");
|
|
14
|
-
var
|
|
13
|
+
var _resourceTypeToLabel = require("./resourceTypeToLabel");
|
|
15
14
|
var LinkIconElement = function LinkIconElement(props) {
|
|
15
|
+
var _context$meta, _context$type, _linkIconProps$label, _ref, _ref2, _context$meta2, _linkIconProps$label2;
|
|
16
16
|
var context = (0, _useFlexibleUiContext.useFlexibleUiContext)();
|
|
17
17
|
if (!context) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (!linkIconProps) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
if ((0, _fg.fg)('platform_navx_jira_issue_type_icon_label_a11y')) {
|
|
27
|
-
var _context$meta, _context$type, _linkIconProps$label, _ref, _ref2, _context$meta2, _linkIconProps$label2;
|
|
28
|
-
var jiraIssueTypeLabel = ((_context$meta = context.meta) === null || _context$meta === void 0 ? void 0 : _context$meta.resourceType) === 'issue' && (_context$type = context.type) !== null && _context$type !== void 0 && _context$type.includes('atlassian:Task') ? (_linkIconProps$label = linkIconProps.label) === null || _linkIconProps$label === void 0 ? void 0 : _linkIconProps$label.trim() : undefined;
|
|
29
|
-
var _label = (_ref = (_ref2 = jiraIssueTypeLabel !== null && jiraIssueTypeLabel !== void 0 ? jiraIssueTypeLabel : (0, _resourceTypeToLabel2.resourceTypeToLabel)((_context$meta2 = context.meta) === null || _context$meta2 === void 0 ? void 0 : _context$meta2.resourceType)) !== null && _ref2 !== void 0 ? _ref2 : (_linkIconProps$label2 = linkIconProps.label) === null || _linkIconProps$label2 === void 0 ? void 0 : _linkIconProps$label2.trim()) !== null && _ref !== void 0 ? _ref : props.label;
|
|
30
|
-
return /*#__PURE__*/_react.default.createElement(_common.BaseIconElement, (0, _extends2.default)({}, linkIconProps, props, {
|
|
31
|
-
label: _label,
|
|
32
|
-
name: _constants.ElementName.LinkIcon
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
var label = (_ref3 = (_resourceTypeToLabel = (0, _resourceTypeToLabel2.resourceTypeToLabel)((_context$meta3 = context.meta) === null || _context$meta3 === void 0 ? void 0 : _context$meta3.resourceType)) !== null && _resourceTypeToLabel !== void 0 ? _resourceTypeToLabel : (_linkIconProps$label3 = linkIconProps.label) === null || _linkIconProps$label3 === void 0 ? void 0 : _linkIconProps$label3.trim()) !== null && _ref3 !== void 0 ? _ref3 : props.label;
|
|
36
|
-
return /*#__PURE__*/_react.default.createElement(_common.BaseIconElement, (0, _extends2.default)({}, linkIconProps, props, {
|
|
37
|
-
label: label,
|
|
38
|
-
name: _constants.ElementName.LinkIcon
|
|
39
|
-
}));
|
|
20
|
+
var linkIconProps = (0, _common.toLinkIconProps)(context === null || context === void 0 ? void 0 : context.linkIcon, context.type);
|
|
21
|
+
if (!linkIconProps) {
|
|
22
|
+
return null;
|
|
40
23
|
}
|
|
41
|
-
var
|
|
42
|
-
|
|
24
|
+
var jiraIssueTypeLabel = ((_context$meta = context.meta) === null || _context$meta === void 0 ? void 0 : _context$meta.resourceType) === 'issue' && (_context$type = context.type) !== null && _context$type !== void 0 && _context$type.includes('atlassian:Task') ? (_linkIconProps$label = linkIconProps.label) === null || _linkIconProps$label === void 0 ? void 0 : _linkIconProps$label.trim() : undefined;
|
|
25
|
+
var label = (_ref = (_ref2 = jiraIssueTypeLabel !== null && jiraIssueTypeLabel !== void 0 ? jiraIssueTypeLabel : (0, _resourceTypeToLabel.resourceTypeToLabel)((_context$meta2 = context.meta) === null || _context$meta2 === void 0 ? void 0 : _context$meta2.resourceType)) !== null && _ref2 !== void 0 ? _ref2 : (_linkIconProps$label2 = linkIconProps.label) === null || _linkIconProps$label2 === void 0 ? void 0 : _linkIconProps$label2.trim()) !== null && _ref !== void 0 ? _ref : props.label;
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_common.BaseIconElement, (0, _extends2.default)({}, linkIconProps, props, {
|
|
27
|
+
label: label,
|
|
43
28
|
name: _constants.ElementName.LinkIcon
|
|
44
|
-
}))
|
|
29
|
+
}));
|
|
45
30
|
};
|
|
46
31
|
var _default = exports.default = LinkIconElement;
|
|
@@ -19,7 +19,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
19
19
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
20
20
|
var PACKAGE_DATA = {
|
|
21
21
|
packageName: "@atlaskit/smart-card",
|
|
22
|
-
packageVersion: "46.1.
|
|
22
|
+
packageVersion: "46.1.13",
|
|
23
23
|
componentName: 'linkUrl'
|
|
24
24
|
};
|
|
25
25
|
var LinkUrl = function LinkUrl(_ref) {
|
|
@@ -12,21 +12,12 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var React = _react;
|
|
13
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
var _reactIntl = require("react-intl");
|
|
16
15
|
var _reactRenderImage = _interopRequireDefault(require("react-render-image"));
|
|
17
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
18
16
|
var _loadingSkeleton = require("../loading-skeleton");
|
|
19
17
|
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); }
|
|
20
18
|
var styles = {
|
|
21
19
|
roundImg: "_2rko1rr0"
|
|
22
20
|
};
|
|
23
|
-
var messages = (0, _reactIntl.defineMessages)({
|
|
24
|
-
imageAltText: {
|
|
25
|
-
id: 'smart-link.image-icon.altText',
|
|
26
|
-
defaultMessage: 'Link Icon',
|
|
27
|
-
description: 'Alternative text for the link icon image displayed on a flexible smart link card, used by screen readers and when the image cannot be rendered.'
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
21
|
var ImageIcon = function ImageIcon(_ref) {
|
|
31
22
|
var label = _ref.label,
|
|
32
23
|
defaultIcon = _ref.defaultIcon,
|
|
@@ -44,9 +35,6 @@ var ImageIcon = function ImageIcon(_ref) {
|
|
|
44
35
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
45
36
|
hasImageErrored = _useState2[0],
|
|
46
37
|
setHasImageErrored = _useState2[1];
|
|
47
|
-
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
48
|
-
formatMessage = _useIntl.formatMessage;
|
|
49
|
-
|
|
50
38
|
// If url changes, reset state
|
|
51
39
|
(0, _react.useEffect)(function () {
|
|
52
40
|
setHasImageErrored(false);
|
|
@@ -59,7 +47,7 @@ var ImageIcon = function ImageIcon(_ref) {
|
|
|
59
47
|
return /*#__PURE__*/React.createElement("img", {
|
|
60
48
|
src: url,
|
|
61
49
|
"data-testid": "".concat(testId, "-image"),
|
|
62
|
-
alt: (
|
|
50
|
+
alt: (_label$trim = label === null || label === void 0 ? void 0 : label.trim()) !== null && _label$trim !== void 0 ? _label$trim : '',
|
|
63
51
|
style: {
|
|
64
52
|
width: width,
|
|
65
53
|
height: height
|
|
@@ -81,7 +69,7 @@ var ImageIcon = function ImageIcon(_ref) {
|
|
|
81
69
|
loaded: /*#__PURE__*/React.createElement("img", {
|
|
82
70
|
src: url,
|
|
83
71
|
"data-testid": "".concat(testId, "-image"),
|
|
84
|
-
alt: (
|
|
72
|
+
alt: (_label$trim2 = label === null || label === void 0 ? void 0 : label.trim()) !== null && _label$trim2 !== void 0 ? _label$trim2 : '',
|
|
85
73
|
style: {
|
|
86
74
|
width: width,
|
|
87
75
|
height: height
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// This file is the FG-OFF fallback for platform_sl_icons_refactor.
|
|
2
|
-
// Delete this file when platform_sl_icons_refactor is cleaned up.
|
|
3
|
-
|
|
4
1
|
import BlogObject from '@atlaskit/object/blog';
|
|
5
2
|
import BlogObjectTile from '@atlaskit/object/tile/blog';
|
|
6
3
|
import { renderIconPerSize } from './render-icon-per-size';
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// This file is the FG-OFF fallback for platform_sl_icons_refactor.
|
|
2
|
-
// Delete this file when platform_sl_icons_refactor is cleaned up.
|
|
3
|
-
|
|
4
1
|
import PageLiveDocObject from '@atlaskit/object/page-live-doc';
|
|
5
2
|
import PageLiveDocObjectTile from '@atlaskit/object/tile/page-live-doc';
|
|
6
3
|
import { renderIconPerSize } from './render-icon-per-size';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
1
|
import { SmartLinkSize } from '../../../constants';
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -8,26 +7,14 @@ import { SmartLinkSize } from '../../../constants';
|
|
|
8
7
|
* without a tile.
|
|
9
8
|
*/
|
|
10
9
|
export const transformSmartLinkSizeToIconTileSize = size => {
|
|
11
|
-
if (fg('platform_sl_icons_refactor')) {
|
|
12
|
-
switch (size) {
|
|
13
|
-
case SmartLinkSize.Small:
|
|
14
|
-
case SmartLinkSize.Medium:
|
|
15
|
-
return undefined;
|
|
16
|
-
case SmartLinkSize.XLarge:
|
|
17
|
-
case SmartLinkSize.Large:
|
|
18
|
-
return 'small';
|
|
19
|
-
default:
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
10
|
switch (size) {
|
|
11
|
+
case SmartLinkSize.Small:
|
|
12
|
+
case SmartLinkSize.Medium:
|
|
13
|
+
return undefined;
|
|
24
14
|
case SmartLinkSize.XLarge:
|
|
25
15
|
case SmartLinkSize.Large:
|
|
26
16
|
return 'small';
|
|
27
17
|
default:
|
|
28
|
-
// SmartLinkSize.Small, SmartLinkSize.Medium, and undefined all
|
|
29
|
-
// previously mapped to size="16" which has been removed. Render
|
|
30
|
-
// the icon directly (no tile) for these sizes.
|
|
31
18
|
return undefined;
|
|
32
19
|
}
|
|
33
20
|
};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PeopleGroupIcon from '@atlaskit/icon/core/people-group';
|
|
3
3
|
import { extractProvider } from '@atlaskit/link-extractors/extract-provider';
|
|
4
|
-
import { extractTitle } from '@atlaskit/link-extractors/extract-title';
|
|
5
4
|
import { extractUrlFromIconJsonLd } from '@atlaskit/link-extractors/extract-url-from-icon-json-ld';
|
|
6
5
|
import BranchObject from '@atlaskit/object/branch';
|
|
7
6
|
import CodeObject from '@atlaskit/object/code';
|
|
8
7
|
import CommitObject from '@atlaskit/object/commit';
|
|
9
8
|
import PullRequestObject from '@atlaskit/object/pull-request';
|
|
10
9
|
import TaskObject from '@atlaskit/object/task';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
12
10
|
import { getIconForFileType } from '../../../utils/get-icon-for-file-type';
|
|
13
11
|
import { extractTaskType } from '../lozenge/extractTaskType';
|
|
14
12
|
import { extractFileFormat } from './extractFileFormat';
|
|
@@ -19,9 +17,6 @@ import { extractorPriorityMap } from './priority';
|
|
|
19
17
|
export const extractIcon = (jsonLd, priority = 'type', showIconLabel = true) => {
|
|
20
18
|
const type = jsonLd['@type'];
|
|
21
19
|
const opts = {
|
|
22
|
-
...(fg('platform_navx_smart_link_icon_label_a11y') ? {} : {
|
|
23
|
-
title: extractTitle(jsonLd)
|
|
24
|
-
}),
|
|
25
20
|
provider: extractProvider(jsonLd),
|
|
26
21
|
fileFormat: extractFileFormat(jsonLd),
|
|
27
22
|
taskType: extractTaskType(jsonLd),
|
|
@@ -37,37 +32,36 @@ export const extractIcon = (jsonLd, priority = 'type', showIconLabel = true) =>
|
|
|
37
32
|
}
|
|
38
33
|
};
|
|
39
34
|
function typeToIcon(type, opts) {
|
|
40
|
-
const getLabel = title => fg('platform_navx_smart_link_icon_label_a11y') ? title : opts.title || title;
|
|
41
35
|
switch (type) {
|
|
42
36
|
case 'atlassian:SourceCodeCommit':
|
|
43
37
|
return /*#__PURE__*/React.createElement(CommitObject, {
|
|
44
|
-
label:
|
|
38
|
+
label: "commit",
|
|
45
39
|
testId: "commit-icon"
|
|
46
40
|
});
|
|
47
41
|
case 'atlassian:Project':
|
|
48
42
|
return /*#__PURE__*/React.createElement(PeopleGroupIcon, {
|
|
49
|
-
label:
|
|
43
|
+
label: "project",
|
|
50
44
|
testId: "project-icon",
|
|
51
45
|
color: "currentColor"
|
|
52
46
|
});
|
|
53
47
|
case 'atlassian:SourceCodePullRequest':
|
|
54
48
|
return /*#__PURE__*/React.createElement(PullRequestObject, {
|
|
55
|
-
label:
|
|
49
|
+
label: "pull request",
|
|
56
50
|
testId: "pull-request-icon"
|
|
57
51
|
});
|
|
58
52
|
case 'atlassian:SourceCodeReference':
|
|
59
53
|
return /*#__PURE__*/React.createElement(BranchObject, {
|
|
60
|
-
label:
|
|
54
|
+
label: "reference",
|
|
61
55
|
testId: "branch-icon"
|
|
62
56
|
});
|
|
63
57
|
case 'atlassian:SourceCodeRepository':
|
|
64
58
|
return /*#__PURE__*/React.createElement(CodeObject, {
|
|
65
|
-
label:
|
|
59
|
+
label: "repository",
|
|
66
60
|
testId: "repo-icon"
|
|
67
61
|
});
|
|
68
62
|
case 'atlassian:Goal':
|
|
69
63
|
return /*#__PURE__*/React.createElement(TaskObject, {
|
|
70
|
-
label:
|
|
64
|
+
label: "goal",
|
|
71
65
|
testId: "task-icon"
|
|
72
66
|
});
|
|
73
67
|
case 'atlassian:Task':
|
|
@@ -78,7 +72,7 @@ function typeToIcon(type, opts) {
|
|
|
78
72
|
}
|
|
79
73
|
function standardisedExtractIcon(type, opts) {
|
|
80
74
|
const iconFromType = typeToIcon(type, opts);
|
|
81
|
-
const iconFromFileFormat = opts.fileFormat ? getIconForFileType(opts.fileFormat,
|
|
75
|
+
const iconFromFileFormat = opts.fileFormat ? getIconForFileType(opts.fileFormat, opts.showIconLabel) : undefined;
|
|
82
76
|
const iconFromProvider = opts.provider && opts.provider.icon;
|
|
83
77
|
return prioritiseIcon({
|
|
84
78
|
fileFormatIcon: iconFromFileFormat,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import DocumentFilledIcon from '@atlaskit/icon/core/file';
|
|
3
3
|
import { isConfluenceGenerator } from '@atlaskit/link-extractors/is-confluence-generator';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
4
|
import { getIconForFileType } from '../../../utils/get-icon-for-file-type';
|
|
6
5
|
import { prioritiseIcon } from './prioritiseIcon';
|
|
7
6
|
const getBlogIconWrapped = () => require('../../../common/ui/icons/blog-icon').default;
|
|
@@ -31,15 +30,14 @@ export const extractIconFromDocument = (type, opts) => {
|
|
|
31
30
|
};
|
|
32
31
|
const documentFileFormatToIcon = opts => {
|
|
33
32
|
if (opts.fileFormat) {
|
|
34
|
-
return getIconForFileType(opts.fileFormat,
|
|
33
|
+
return getIconForFileType(opts.fileFormat, opts.showIconLabel);
|
|
35
34
|
}
|
|
36
35
|
};
|
|
37
36
|
const documentLabel = (opts, label) => {
|
|
38
|
-
// NAVX-4354 can be inlined during cleanup.
|
|
39
37
|
if (!opts.showIconLabel) {
|
|
40
38
|
return '';
|
|
41
39
|
}
|
|
42
|
-
return
|
|
40
|
+
return label;
|
|
43
41
|
};
|
|
44
42
|
const documentTypeToIcon = (type, opts) => {
|
|
45
43
|
switch (type) {
|
|
@@ -8,7 +8,6 @@ import StoryObject from '@atlaskit/object/story';
|
|
|
8
8
|
import SubtaskObject from '@atlaskit/object/subtask';
|
|
9
9
|
import TaskObject from '@atlaskit/object/task';
|
|
10
10
|
import WorkItemObject from '@atlaskit/object/work-item';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
12
11
|
import { JIRA_BUG, JIRA_CHANGE, JIRA_CUSTOM_TASK_TYPE, JIRA_EPIC, JIRA_GENERATOR_ID, JIRA_INCIDENT, JIRA_PROBLEM, JIRA_SERVICE_REQUEST, JIRA_STORY, JIRA_SUB_TASK, JIRA_TASK } from '../../constants';
|
|
13
12
|
const TaskIcon = TaskObject;
|
|
14
13
|
|
|
@@ -26,10 +25,8 @@ export const extractIconFromTask = opts => {
|
|
|
26
25
|
taskType,
|
|
27
26
|
provider
|
|
28
27
|
} = opts;
|
|
29
|
-
const legacyTaskLabel = opts.title || 'task';
|
|
30
|
-
const getLabel = semantic => fg('platform_navx_smart_link_icon_label_a11y') ? semantic : legacyTaskLabel;
|
|
31
28
|
const defaultIcon = /*#__PURE__*/React.createElement(TaskIcon, {
|
|
32
|
-
label:
|
|
29
|
+
label: "Task",
|
|
33
30
|
testId: "default-task-icon"
|
|
34
31
|
});
|
|
35
32
|
if (provider && provider.id === JIRA_GENERATOR_ID && taskType && taskType.id) {
|
|
@@ -38,47 +35,47 @@ export const extractIconFromTask = opts => {
|
|
|
38
35
|
switch (taskTypeName) {
|
|
39
36
|
case JIRA_TASK:
|
|
40
37
|
return /*#__PURE__*/React.createElement(TaskObject, {
|
|
41
|
-
label:
|
|
38
|
+
label: "Task",
|
|
42
39
|
testId: "jira-task-icon"
|
|
43
40
|
});
|
|
44
41
|
case JIRA_SUB_TASK:
|
|
45
42
|
return /*#__PURE__*/React.createElement(SubtaskObject, {
|
|
46
|
-
label:
|
|
43
|
+
label: "Sub-task",
|
|
47
44
|
testId: "jira-subtask-icon"
|
|
48
45
|
});
|
|
49
46
|
case JIRA_STORY:
|
|
50
47
|
return /*#__PURE__*/React.createElement(StoryObject, {
|
|
51
|
-
label:
|
|
48
|
+
label: "Story",
|
|
52
49
|
testId: "jira-story-icon"
|
|
53
50
|
});
|
|
54
51
|
case JIRA_BUG:
|
|
55
52
|
return /*#__PURE__*/React.createElement(BugObject, {
|
|
56
|
-
label:
|
|
53
|
+
label: "Bug",
|
|
57
54
|
testId: "jira-bug-icon"
|
|
58
55
|
});
|
|
59
56
|
case JIRA_EPIC:
|
|
60
57
|
return /*#__PURE__*/React.createElement(EpicObject, {
|
|
61
|
-
label:
|
|
58
|
+
label: "Epic",
|
|
62
59
|
testId: "jira-epic-icon"
|
|
63
60
|
});
|
|
64
61
|
case JIRA_INCIDENT:
|
|
65
62
|
return /*#__PURE__*/React.createElement(IncidentObject, {
|
|
66
|
-
label:
|
|
63
|
+
label: "Incident",
|
|
67
64
|
testId: "jira-incident-icon"
|
|
68
65
|
});
|
|
69
66
|
case JIRA_SERVICE_REQUEST:
|
|
70
67
|
return /*#__PURE__*/React.createElement(WorkItemObject, {
|
|
71
|
-
label:
|
|
68
|
+
label: "Service request",
|
|
72
69
|
testId: "jira-service-request-icon"
|
|
73
70
|
});
|
|
74
71
|
case JIRA_CHANGE:
|
|
75
72
|
return /*#__PURE__*/React.createElement(ChangesObject, {
|
|
76
|
-
label:
|
|
73
|
+
label: "Change",
|
|
77
74
|
testId: "jira-change-icon"
|
|
78
75
|
});
|
|
79
76
|
case JIRA_PROBLEM:
|
|
80
77
|
return /*#__PURE__*/React.createElement(ProblemObject, {
|
|
81
|
-
label:
|
|
78
|
+
label: "Problem",
|
|
82
79
|
testId: "jira-problem-icon"
|
|
83
80
|
});
|
|
84
81
|
case JIRA_CUSTOM_TASK_TYPE:
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isConfluenceGenerator } from '@atlaskit/link-extractors/is-confluence-generator';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
2
|
import { IconType } from '../../../constants';
|
|
4
3
|
/**
|
|
5
4
|
* Computes the relevant icon for a document type.
|
|
@@ -12,55 +11,33 @@ import { IconType } from '../../../constants';
|
|
|
12
11
|
* go/j/MODES-5864. Do not add more!
|
|
13
12
|
*
|
|
14
13
|
* @param documentType JSON-LD document type
|
|
15
|
-
* @param label human-readable label to be displayed on the icon
|
|
16
14
|
* @param providerId JSON-LD provider (generator ID)
|
|
17
15
|
* @returns an icon descriptor representing the document type
|
|
18
16
|
*/
|
|
19
|
-
const extractDocumentTypeIcon = (documentType,
|
|
20
|
-
const
|
|
17
|
+
const extractDocumentTypeIcon = (documentType, providerId) => {
|
|
18
|
+
const getIconDescriptor = (icon, label) => ({
|
|
19
|
+
icon,
|
|
20
|
+
label
|
|
21
|
+
});
|
|
21
22
|
switch (documentType) {
|
|
22
23
|
case 'schema:BlogPosting':
|
|
23
|
-
return
|
|
24
|
-
icon: IconType.Blog,
|
|
25
|
-
label: getLabel('blog')
|
|
26
|
-
};
|
|
24
|
+
return getIconDescriptor(IconType.Blog, 'blog');
|
|
27
25
|
case 'schema:DigitalDocument':
|
|
28
26
|
if (providerId && isConfluenceGenerator(providerId)) {
|
|
29
|
-
return
|
|
30
|
-
icon: IconType.LiveDocument,
|
|
31
|
-
label: getLabel('live document')
|
|
32
|
-
};
|
|
27
|
+
return getIconDescriptor(IconType.LiveDocument, 'live document');
|
|
33
28
|
} else {
|
|
34
|
-
return
|
|
35
|
-
icon: IconType.File,
|
|
36
|
-
label: getLabel('file')
|
|
37
|
-
};
|
|
29
|
+
return getIconDescriptor(IconType.File, 'file');
|
|
38
30
|
}
|
|
39
31
|
case 'schema:TextDigitalDocument':
|
|
40
|
-
return
|
|
41
|
-
icon: IconType.Document,
|
|
42
|
-
label: getLabel('document')
|
|
43
|
-
};
|
|
32
|
+
return getIconDescriptor(IconType.Document, 'document');
|
|
44
33
|
case 'schema:PresentationDigitalDocument':
|
|
45
|
-
return
|
|
46
|
-
icon: IconType.Presentation,
|
|
47
|
-
label: getLabel('presentation')
|
|
48
|
-
};
|
|
34
|
+
return getIconDescriptor(IconType.Presentation, 'presentation');
|
|
49
35
|
case 'schema:SpreadsheetDigitalDocument':
|
|
50
|
-
return
|
|
51
|
-
icon: IconType.Spreadsheet,
|
|
52
|
-
label: getLabel('spreadsheet')
|
|
53
|
-
};
|
|
36
|
+
return getIconDescriptor(IconType.Spreadsheet, 'spreadsheet');
|
|
54
37
|
case 'atlassian:Template':
|
|
55
|
-
return
|
|
56
|
-
icon: IconType.Template,
|
|
57
|
-
label: getLabel('template')
|
|
58
|
-
};
|
|
38
|
+
return getIconDescriptor(IconType.Template, 'template');
|
|
59
39
|
case 'atlassian:UndefinedLink':
|
|
60
|
-
return
|
|
61
|
-
icon: IconType.Document,
|
|
62
|
-
label: getLabel('document')
|
|
63
|
-
};
|
|
40
|
+
return getIconDescriptor(IconType.Document, 'document');
|
|
64
41
|
default:
|
|
65
42
|
return undefined;
|
|
66
43
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
1
|
import { IconType } from '../../../constants';
|
|
3
2
|
const extractFileFormatIcon = fileFormat => {
|
|
4
|
-
const getIconDescriptor = (icon, label) =>
|
|
3
|
+
const getIconDescriptor = (icon, label) => ({
|
|
5
4
|
icon,
|
|
6
5
|
label
|
|
7
|
-
}
|
|
8
|
-
icon
|
|
9
|
-
};
|
|
6
|
+
});
|
|
10
7
|
switch (fileFormat) {
|
|
11
8
|
// Generic documents
|
|
12
9
|
case 'folder':
|
|
@@ -1,54 +1,29 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
1
|
import { IconType } from '../../../constants';
|
|
3
|
-
const extractJiraTaskIcon =
|
|
4
|
-
const
|
|
2
|
+
const extractJiraTaskIcon = taskType => {
|
|
3
|
+
const getIconDescriptor = (icon, label) => ({
|
|
4
|
+
icon,
|
|
5
|
+
label
|
|
6
|
+
});
|
|
5
7
|
switch (taskType) {
|
|
6
8
|
case 'JiraBug':
|
|
7
|
-
return
|
|
8
|
-
icon: IconType.Bug,
|
|
9
|
-
label: getLabel('Bug')
|
|
10
|
-
};
|
|
9
|
+
return getIconDescriptor(IconType.Bug, 'Bug');
|
|
11
10
|
case 'JiraChange':
|
|
12
|
-
return
|
|
13
|
-
icon: IconType.Change,
|
|
14
|
-
label: getLabel('Change')
|
|
15
|
-
};
|
|
11
|
+
return getIconDescriptor(IconType.Change, 'Change');
|
|
16
12
|
case 'JiraEpic':
|
|
17
|
-
return
|
|
18
|
-
icon: IconType.Epic,
|
|
19
|
-
label: getLabel('Epic')
|
|
20
|
-
};
|
|
13
|
+
return getIconDescriptor(IconType.Epic, 'Epic');
|
|
21
14
|
case 'JiraIncident':
|
|
22
|
-
return
|
|
23
|
-
icon: IconType.Incident,
|
|
24
|
-
label: getLabel('Incident')
|
|
25
|
-
};
|
|
15
|
+
return getIconDescriptor(IconType.Incident, 'Incident');
|
|
26
16
|
case 'JiraProblem':
|
|
27
|
-
return
|
|
28
|
-
icon: IconType.Problem,
|
|
29
|
-
label: getLabel('Problem')
|
|
30
|
-
};
|
|
17
|
+
return getIconDescriptor(IconType.Problem, 'Problem');
|
|
31
18
|
case 'JiraServiceRequest':
|
|
32
|
-
return
|
|
33
|
-
icon: IconType.ServiceRequest,
|
|
34
|
-
label: getLabel('Service request')
|
|
35
|
-
};
|
|
19
|
+
return getIconDescriptor(IconType.ServiceRequest, 'Service request');
|
|
36
20
|
case 'JiraStory':
|
|
37
|
-
return
|
|
38
|
-
icon: IconType.Story,
|
|
39
|
-
label: getLabel('Story')
|
|
40
|
-
};
|
|
21
|
+
return getIconDescriptor(IconType.Story, 'Story');
|
|
41
22
|
case 'JiraSubTask':
|
|
42
|
-
return
|
|
43
|
-
icon: IconType.SubTask,
|
|
44
|
-
label: getLabel('Sub-task')
|
|
45
|
-
};
|
|
23
|
+
return getIconDescriptor(IconType.SubTask, 'Sub-task');
|
|
46
24
|
case 'JiraTask':
|
|
47
25
|
default:
|
|
48
|
-
return
|
|
49
|
-
icon: IconType.Task,
|
|
50
|
-
label: getLabel('Task')
|
|
51
|
-
};
|
|
26
|
+
return getIconDescriptor(IconType.Task, 'Task');
|
|
52
27
|
}
|
|
53
28
|
};
|
|
54
29
|
export default extractJiraTaskIcon;
|