@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
|
@@ -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 React from 'react';
|
|
5
5
|
import { N20A, N30A, B200, N40A, N50A } from '@atlaskit/theme/colors';
|
|
6
6
|
import { gs, br, mq } from '../../common/utils';
|
|
@@ -9,10 +9,14 @@ export const Frame = (props = {
|
|
|
9
9
|
isHoverable: false,
|
|
10
10
|
isFluidHeight: false
|
|
11
11
|
}) => props.compact ? jsx(CompactFrame, props) : jsx(ExpandedFrame, props);
|
|
12
|
+
const sharedBaseFrameStyles = css({
|
|
13
|
+
width: '100%',
|
|
14
|
+
display: 'flex'
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
12
18
|
const sharedFrameStyles = {
|
|
13
19
|
maxWidth: gs(95),
|
|
14
|
-
width: '100%',
|
|
15
|
-
display: 'flex',
|
|
16
20
|
backgroundColor: "var(--ds-surface-raised, white)"
|
|
17
21
|
};
|
|
18
22
|
export const ExpandedFrame = ({
|
|
@@ -24,9 +28,9 @@ export const ExpandedFrame = ({
|
|
|
24
28
|
isFluidHeight
|
|
25
29
|
}) => {
|
|
26
30
|
return jsx("div", {
|
|
31
|
+
css: [sharedBaseFrameStyles, sharedFrameStyles,
|
|
27
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
|
|
28
|
-
|
|
29
|
-
...sharedFrameStyles,
|
|
33
|
+
mq({
|
|
30
34
|
'&:hover': isHoverable ? {
|
|
31
35
|
// TODO: https://product-fabric.atlassian.net/browse/DSP-4064
|
|
32
36
|
backgroundColor: `var(--ds-background-neutral-subtle-hovered, ${N20A})`,
|
|
@@ -40,7 +44,7 @@ export const ExpandedFrame = ({
|
|
|
40
44
|
justifyContent: 'space-between',
|
|
41
45
|
overflow: 'hidden',
|
|
42
46
|
boxShadow: `var(--ds-shadow-raised, ${`0 1px 1px ${N50A}, 0 0 1px 1px ${N40A}`})`
|
|
43
|
-
}),
|
|
47
|
+
})],
|
|
44
48
|
"data-testid": testId
|
|
45
49
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
46
50
|
,
|
|
@@ -57,9 +61,9 @@ export const CompactFrame = ({
|
|
|
57
61
|
inheritDimensions
|
|
58
62
|
}) => {
|
|
59
63
|
return jsx("div", {
|
|
64
|
+
css: [sharedBaseFrameStyles, sharedFrameStyles,
|
|
60
65
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
61
|
-
|
|
62
|
-
...sharedFrameStyles,
|
|
66
|
+
mq({
|
|
63
67
|
'&:hover': isHoverable ? {
|
|
64
68
|
backgroundColor: `var(--ds-background-neutral-hovered, ${N30A})`
|
|
65
69
|
} : undefined,
|
|
@@ -74,7 +78,7 @@ export const CompactFrame = ({
|
|
|
74
78
|
width: ['calc(100% - 16px)', '100%'],
|
|
75
79
|
// 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
|
|
76
80
|
padding: [`0px ${gs(1)}`, '0']
|
|
77
|
-
}),
|
|
81
|
+
})],
|
|
78
82
|
"data-testid": testId
|
|
79
83
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
80
84
|
,
|
|
@@ -24,6 +24,13 @@ const styles = css({
|
|
|
24
24
|
justifyContent: 'space-between',
|
|
25
25
|
alignItems: 'flex-start'
|
|
26
26
|
});
|
|
27
|
+
const lozengeStyles = {
|
|
28
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
29
|
+
height: gs(2.5),
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
justifyContent: 'center'
|
|
33
|
+
};
|
|
27
34
|
/**
|
|
28
35
|
* Class name for selecting non-flexible resolved block card
|
|
29
36
|
*
|
|
@@ -88,13 +95,7 @@ export const ResolvedView = ({
|
|
|
88
95
|
name: title,
|
|
89
96
|
textColor: titleTextColor
|
|
90
97
|
}), lozenge && jsx(LozengeBlockWrapper, {
|
|
91
|
-
css:
|
|
92
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
93
|
-
height: gs(2.5),
|
|
94
|
-
display: 'flex',
|
|
95
|
-
alignItems: 'center',
|
|
96
|
-
justifyContent: 'center'
|
|
97
|
-
}
|
|
98
|
+
css: lozengeStyles
|
|
98
99
|
}, jsx(Lozenge, _extends({
|
|
99
100
|
style: lozenge.style
|
|
100
101
|
}, lozenge), lozenge.text))), jsx(CollaboratorList, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
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
|
-
import Button from '@atlaskit/button
|
|
4
|
+
import Button from '@atlaskit/button';
|
|
5
5
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
6
6
|
import { fontSize } from '@atlaskit/theme/constants';
|
|
7
7
|
import { R300 } from '@atlaskit/theme/colors';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Tooltip from '@atlaskit/tooltip';
|
|
3
|
-
import Button from '@atlaskit/button
|
|
3
|
+
import Button from '@atlaskit/button';
|
|
4
4
|
import { useMouseDownEvent } from '../../../../../state/analytics/useLinkClicked';
|
|
5
5
|
const LinkInfoButton = ({
|
|
6
6
|
content,
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import { TrackQuickActionFailureReason, TrackQuickActionType } from '../../../../../../utils/analytics/analytics';
|
|
2
1
|
export const unknownLoadErrorAnalyticsPayload = {
|
|
3
|
-
smartLinkActionType:
|
|
4
|
-
reason:
|
|
2
|
+
smartLinkActionType: 'StatusUpdate',
|
|
3
|
+
reason: 'UnknownError',
|
|
5
4
|
step: 'load'
|
|
6
5
|
};
|
|
7
6
|
export const permissionLoadErrorAnalyticsPayload = {
|
|
8
|
-
smartLinkActionType:
|
|
9
|
-
reason:
|
|
7
|
+
smartLinkActionType: 'StatusUpdate',
|
|
8
|
+
reason: 'PermissionError',
|
|
10
9
|
step: 'load'
|
|
11
10
|
};
|
|
12
11
|
export const unknownUpdateErrorAnalyticsPayload = {
|
|
13
|
-
smartLinkActionType:
|
|
14
|
-
reason:
|
|
12
|
+
smartLinkActionType: 'StatusUpdate',
|
|
13
|
+
reason: 'UnknownError',
|
|
15
14
|
step: 'update'
|
|
16
15
|
};
|
|
17
16
|
export const validationUpdateErrorAnalyticsPayload = {
|
|
18
|
-
smartLinkActionType:
|
|
19
|
-
reason:
|
|
17
|
+
smartLinkActionType: 'StatusUpdate',
|
|
18
|
+
reason: 'ValidationError',
|
|
20
19
|
step: 'update'
|
|
21
20
|
};
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { R300 } from '@atlaskit/theme/colors';
|
|
4
4
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
5
|
-
import Button from '@atlaskit/button
|
|
5
|
+
import Button from '@atlaskit/button';
|
|
6
6
|
import { Frame } from '../Frame';
|
|
7
7
|
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
8
8
|
import { AKIconWrapper } from '../Icon';
|
|
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { R400, N500 } from '@atlaskit/theme/colors';
|
|
5
5
|
import LockIcon from '@atlaskit/icon/glyph/lock-filled';
|
|
6
|
-
import Button from '@atlaskit/button
|
|
6
|
+
import Button from '@atlaskit/button';
|
|
7
7
|
import { Frame } from '../Frame';
|
|
8
8
|
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
9
9
|
import { AKIconWrapper } from '../Icon';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import Button from '@atlaskit/button
|
|
3
|
+
import Button from '@atlaskit/button';
|
|
4
4
|
import LockIcon from '@atlaskit/icon/glyph/lock-filled';
|
|
5
5
|
import { N500, R400 } from '@atlaskit/theme/colors';
|
|
6
6
|
import withFrameStyleControl from '../utils/withFrameStyleControl';
|
|
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
7
7
|
import LinkWarningModal from './LinkWarningModal';
|
|
8
8
|
const PACKAGE_DATA = {
|
|
9
9
|
packageName: "@atlaskit/smart-card",
|
|
10
|
-
packageVersion: "27.
|
|
10
|
+
packageVersion: "27.7.1",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -1,39 +1,39 @@
|
|
|
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 { N300 } from '@atlaskit/theme/colors';
|
|
5
5
|
import { gs, mq } from './utils';
|
|
6
|
+
const baseStyles = css({
|
|
7
|
+
// Spec: only allow two lines MAX to be shown.
|
|
8
|
+
display: '-webkit-box',
|
|
9
|
+
overflow: 'hidden',
|
|
10
|
+
textOverflow: 'ellipsis',
|
|
11
|
+
WebkitLineClamp: 2,
|
|
12
|
+
WebkitBoxOrient: 'vertical',
|
|
13
|
+
wordBreak: 'break-word',
|
|
14
|
+
whiteSpace: 'pre-line',
|
|
15
|
+
// EDM-713: fixes copy-paste from renderer to editor for Firefox
|
|
16
|
+
// due to HTML its unwrapping behaviour on paste.
|
|
17
|
+
MozUserSelect: 'none'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
21
|
+
const styles = mq({
|
|
22
|
+
fontSize: gs(1.5),
|
|
23
|
+
lineHeight: gs(2.5),
|
|
24
|
+
color: `${`var(--ds-text-subtlest, ${N300})`}`,
|
|
25
|
+
fontWeight: 'normal',
|
|
26
|
+
marginTop: gs(0.5),
|
|
27
|
+
// Fallback options.
|
|
28
|
+
maxHeight: gs(5)
|
|
29
|
+
});
|
|
6
30
|
export const Byline = ({
|
|
7
31
|
text,
|
|
8
32
|
children,
|
|
9
33
|
testId,
|
|
10
34
|
className
|
|
11
35
|
}) => jsx("span", {
|
|
12
|
-
|
|
13
|
-
css: mq({
|
|
14
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
15
|
-
fontSize: gs(1.5),
|
|
16
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
17
|
-
lineHeight: gs(2.5),
|
|
18
|
-
color: `${`var(--ds-text-subtlest, ${N300})`}`,
|
|
19
|
-
fontWeight: 'normal',
|
|
20
|
-
// 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
|
|
21
|
-
marginTop: gs(0.5),
|
|
22
|
-
// Spec: only allow two lines MAX to be shown.
|
|
23
|
-
display: '-webkit-box',
|
|
24
|
-
overflow: 'hidden',
|
|
25
|
-
textOverflow: 'ellipsis',
|
|
26
|
-
WebkitLineClamp: 2,
|
|
27
|
-
WebkitBoxOrient: 'vertical',
|
|
28
|
-
wordBreak: 'break-word',
|
|
29
|
-
// Fallback options.
|
|
30
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
31
|
-
maxHeight: gs(5),
|
|
32
|
-
whiteSpace: 'pre-line',
|
|
33
|
-
// EDM-713: fixes copy-paste from renderer to editor for Firefox
|
|
34
|
-
// due to HTML its unwrapping behaviour on paste.
|
|
35
|
-
MozUserSelect: 'none'
|
|
36
|
-
}),
|
|
36
|
+
css: [baseStyles, styles],
|
|
37
37
|
"data-testid": testId
|
|
38
38
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
39
39
|
,
|
|
@@ -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';
|
|
@@ -33,6 +34,56 @@ export var extractIcon = function extractIcon(jsonLd) {
|
|
|
33
34
|
return extractIconByType(type, opts);
|
|
34
35
|
}
|
|
35
36
|
};
|
|
37
|
+
function typeToIcon(type, opts) {
|
|
38
|
+
switch (type) {
|
|
39
|
+
case 'atlassian:SourceCodeCommit':
|
|
40
|
+
return /*#__PURE__*/React.createElement(CommitIcon, {
|
|
41
|
+
label: opts.title || 'commit',
|
|
42
|
+
testId: "commit-icon"
|
|
43
|
+
});
|
|
44
|
+
case 'atlassian:Project':
|
|
45
|
+
return /*#__PURE__*/React.createElement(ProjectIcon, {
|
|
46
|
+
label: opts.title || 'project',
|
|
47
|
+
size: "small",
|
|
48
|
+
testId: "project-icon"
|
|
49
|
+
});
|
|
50
|
+
case 'atlassian:SourceCodePullRequest':
|
|
51
|
+
return /*#__PURE__*/React.createElement(PullRequestIcon, {
|
|
52
|
+
label: opts.title || 'pullRequest',
|
|
53
|
+
testId: "pull-request-icon"
|
|
54
|
+
});
|
|
55
|
+
case 'atlassian:SourceCodeReference':
|
|
56
|
+
return /*#__PURE__*/React.createElement(BranchIcon, {
|
|
57
|
+
label: opts.title || 'reference',
|
|
58
|
+
testId: "branch-icon"
|
|
59
|
+
});
|
|
60
|
+
case 'atlassian:SourceCodeRepository':
|
|
61
|
+
return /*#__PURE__*/React.createElement(RepoIcon, {
|
|
62
|
+
label: opts.title || 'repository',
|
|
63
|
+
testId: "repo-icon"
|
|
64
|
+
});
|
|
65
|
+
case 'atlassian:Goal':
|
|
66
|
+
return /*#__PURE__*/React.createElement(TaskIcon, {
|
|
67
|
+
label: opts.title || 'goal',
|
|
68
|
+
testId: "task-icon"
|
|
69
|
+
});
|
|
70
|
+
case 'atlassian:Task':
|
|
71
|
+
return extractIconFromTask(opts);
|
|
72
|
+
default:
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function standardisedExtractIcon(type, opts) {
|
|
77
|
+
var iconFromType = typeToIcon(type, opts);
|
|
78
|
+
var iconFromFileFormat = opts.fileFormat ? getIconForFileType(opts.fileFormat) : undefined;
|
|
79
|
+
var iconFromProvider = opts.provider && opts.provider.icon;
|
|
80
|
+
return prioritiseIcon({
|
|
81
|
+
fileFormatIcon: iconFromFileFormat,
|
|
82
|
+
documentTypeIcon: iconFromType,
|
|
83
|
+
urlIcon: opts.icon,
|
|
84
|
+
providerIcon: iconFromProvider
|
|
85
|
+
});
|
|
86
|
+
}
|
|
36
87
|
|
|
37
88
|
/**
|
|
38
89
|
* Extracts an icon based on the given type.
|
|
@@ -45,6 +96,21 @@ export var extractIcon = function extractIcon(jsonLd) {
|
|
|
45
96
|
* @returns The extracted icon as a React node, or `undefined` if no icon is found.
|
|
46
97
|
*/
|
|
47
98
|
var extractIconByType = function extractIconByType(type, opts) {
|
|
99
|
+
if (getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
100
|
+
switch (type) {
|
|
101
|
+
case 'Document':
|
|
102
|
+
case 'schema:BlogPosting':
|
|
103
|
+
case 'schema:DigitalDocument':
|
|
104
|
+
case 'schema:TextDigitalDocument':
|
|
105
|
+
case 'schema:PresentationDigitalDocument':
|
|
106
|
+
case 'schema:SpreadsheetDigitalDocument':
|
|
107
|
+
case 'atlassian:Template':
|
|
108
|
+
case 'atlassian:UndefinedLink':
|
|
109
|
+
return extractIconFromDocument(type, opts);
|
|
110
|
+
default:
|
|
111
|
+
return standardisedExtractIcon(type, opts);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
48
114
|
switch (type) {
|
|
49
115
|
case 'Document':
|
|
50
116
|
case 'schema:BlogPosting':
|
|
@@ -89,22 +155,6 @@ var extractIconByType = function extractIconByType(type, opts) {
|
|
|
89
155
|
case 'atlassian:Task':
|
|
90
156
|
return extractIconFromTask(opts);
|
|
91
157
|
default:
|
|
92
|
-
return
|
|
158
|
+
return opts.provider && opts.provider.icon;
|
|
93
159
|
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Choose which icon to show when the type is not recognized.
|
|
98
|
-
*/
|
|
99
|
-
var extractDefaultIcon = function extractDefaultIcon(opts) {
|
|
100
|
-
var _opts$provider;
|
|
101
|
-
var provider = opts.provider;
|
|
102
|
-
var providerId = provider === null || provider === void 0 ? void 0 : provider.id;
|
|
103
|
-
return prioritiseIcon({
|
|
104
|
-
providerId: providerId,
|
|
105
|
-
fileFormatIcon: undefined,
|
|
106
|
-
documentTypeIcon: undefined,
|
|
107
|
-
urlIcon: opts.icon,
|
|
108
|
-
providerIcon: (_opts$provider = opts.provider) === null || _opts$provider === void 0 ? void 0 : _opts$provider.icon
|
|
109
|
-
});
|
|
110
160
|
};
|
|
@@ -16,14 +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 var extractIconFromDocument = function extractIconFromDocument(type, opts) {
|
|
19
|
-
var provider = opts.provider;
|
|
20
19
|
var iconFromType = documentTypeToIcon(type, opts);
|
|
21
20
|
var iconFromFileFormat = documentFileFormatToIcon(opts);
|
|
22
21
|
var iconFromProvider = opts.provider && opts.provider.icon;
|
|
23
22
|
if (getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
24
|
-
var providerId = provider === null || provider === void 0 ? void 0 : provider.id;
|
|
25
23
|
return prioritiseIcon({
|
|
26
|
-
providerId: providerId,
|
|
27
24
|
fileFormatIcon: iconFromFileFormat,
|
|
28
25
|
documentTypeIcon: iconFromType,
|
|
29
26
|
urlIcon: opts.icon,
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import { CONFLUENCE_GENERATOR_ID, JIRA_GENERATOR_ID } from '../../constants';
|
|
2
|
-
var isConfluenceProvider = function isConfluenceProvider(provider) {
|
|
3
|
-
return provider === CONFLUENCE_GENERATOR_ID;
|
|
4
|
-
};
|
|
5
|
-
var isJiraProvider = function isJiraProvider(provider) {
|
|
6
|
-
return provider === JIRA_GENERATOR_ID;
|
|
7
|
-
};
|
|
8
|
-
var isNativeProvider = function isNativeProvider(provider) {
|
|
9
|
-
return isConfluenceProvider(provider) || isJiraProvider(provider);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
1
|
/**
|
|
13
2
|
* Represents an icon. Should either contain a label and url, or a an icon type and label.
|
|
14
3
|
*/
|
|
@@ -22,13 +11,9 @@ var isNativeProvider = function isNativeProvider(provider) {
|
|
|
22
11
|
* Generic so it can be used to prioritise strings, or React components depending on the usage.
|
|
23
12
|
*/
|
|
24
13
|
export function prioritiseIcon(_ref) {
|
|
25
|
-
var
|
|
26
|
-
fileFormatIcon = _ref.fileFormatIcon,
|
|
14
|
+
var fileFormatIcon = _ref.fileFormatIcon,
|
|
27
15
|
documentTypeIcon = _ref.documentTypeIcon,
|
|
28
16
|
urlIcon = _ref.urlIcon,
|
|
29
17
|
providerIcon = _ref.providerIcon;
|
|
30
|
-
if (isNativeProvider(providerId)) {
|
|
31
|
-
return fileFormatIcon || documentTypeIcon || urlIcon || providerIcon;
|
|
32
|
-
}
|
|
33
18
|
return urlIcon || fileFormatIcon || documentTypeIcon || providerIcon;
|
|
34
19
|
}
|
|
@@ -26,7 +26,6 @@ function generateContext(jsonLd) {
|
|
|
26
26
|
}
|
|
27
27
|
var generator = jsonLd.generator;
|
|
28
28
|
var icon = prioritiseIcon({
|
|
29
|
-
providerId: generator && typeof generator !== 'string' && generator['@type'] !== 'Link' ? generator['@id'] : undefined,
|
|
30
29
|
fileFormatIcon: undefined,
|
|
31
30
|
documentTypeIcon: undefined,
|
|
32
31
|
urlIcon: extractUrlFromIconJsonLd(jsonLd.icon),
|
|
@@ -39,6 +39,82 @@ var isJiraProvider = function isJiraProvider(provider) {
|
|
|
39
39
|
var isNativeProvider = function isNativeProvider(provider) {
|
|
40
40
|
return isConfluenceProvider(provider) || isJiraProvider(provider);
|
|
41
41
|
};
|
|
42
|
+
function chooseIcon(_ref2) {
|
|
43
|
+
var _data$generator;
|
|
44
|
+
var urlIcon = _ref2.urlIcon,
|
|
45
|
+
type = _ref2.type,
|
|
46
|
+
label = _ref2.label,
|
|
47
|
+
data = _ref2.data,
|
|
48
|
+
providerIcon = _ref2.providerIcon;
|
|
49
|
+
var providerId = (_data$generator = data.generator) === null || _data$generator === void 0 ? void 0 : _data$generator['@id'];
|
|
50
|
+
var fileFormat = data === null || data === void 0 ? void 0 : data['schema:fileFormat'];
|
|
51
|
+
var fileFormatIcon = extractFileFormatIcon(fileFormat);
|
|
52
|
+
var documentTypeIcon = typeToIconDescriptor({
|
|
53
|
+
type: type,
|
|
54
|
+
label: label,
|
|
55
|
+
providerId: providerId,
|
|
56
|
+
data: data
|
|
57
|
+
}) || extractDocumentTypeIcon(type, label);
|
|
58
|
+
return prioritiseIcon({
|
|
59
|
+
fileFormatIcon: fileFormatIcon,
|
|
60
|
+
documentTypeIcon: documentTypeIcon,
|
|
61
|
+
urlIcon: urlIcon,
|
|
62
|
+
providerIcon: providerIcon
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function typeToIconDescriptor(_ref3) {
|
|
66
|
+
var type = _ref3.type,
|
|
67
|
+
label = _ref3.label,
|
|
68
|
+
providerId = _ref3.providerId,
|
|
69
|
+
data = _ref3.data;
|
|
70
|
+
switch (type) {
|
|
71
|
+
case 'atlassian:Goal':
|
|
72
|
+
return {
|
|
73
|
+
icon: IconType.Task,
|
|
74
|
+
label: label || 'Goal'
|
|
75
|
+
};
|
|
76
|
+
case 'atlassian:Project':
|
|
77
|
+
return {
|
|
78
|
+
icon: IconType.Project,
|
|
79
|
+
label: label || 'Project'
|
|
80
|
+
};
|
|
81
|
+
case 'atlassian:SourceCodeCommit':
|
|
82
|
+
return {
|
|
83
|
+
icon: IconType.Commit,
|
|
84
|
+
label: label || 'Commit'
|
|
85
|
+
};
|
|
86
|
+
case 'atlassian:SourceCodePullRequest':
|
|
87
|
+
return {
|
|
88
|
+
icon: IconType.PullRequest,
|
|
89
|
+
label: label || 'Pull request'
|
|
90
|
+
};
|
|
91
|
+
case 'atlassian:SourceCodeReference':
|
|
92
|
+
return {
|
|
93
|
+
icon: IconType.Branch,
|
|
94
|
+
label: label || 'Reference'
|
|
95
|
+
};
|
|
96
|
+
case 'atlassian:SourceCodeRepository':
|
|
97
|
+
return {
|
|
98
|
+
icon: IconType.Repo,
|
|
99
|
+
label: label || 'Repository'
|
|
100
|
+
};
|
|
101
|
+
case 'atlassian:Task':
|
|
102
|
+
var taskLabel = label || 'Task';
|
|
103
|
+
var taskIconDescriptor = {
|
|
104
|
+
icon: IconType.Task,
|
|
105
|
+
label: taskLabel
|
|
106
|
+
};
|
|
107
|
+
if (isJiraProvider(providerId)) {
|
|
108
|
+
var _extractTask = extractTask(data),
|
|
109
|
+
taskType = _extractTask.taskType,
|
|
110
|
+
taskIcon = _extractTask.taskIcon;
|
|
111
|
+
return taskType === 'JiraCustomTaskType' ? taskIcon || taskIconDescriptor : extractJiraTaskIcon(taskType, taskLabel);
|
|
112
|
+
}
|
|
113
|
+
return taskIconDescriptor;
|
|
114
|
+
default:
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
42
118
|
|
|
43
119
|
/**
|
|
44
120
|
* Return the icon object given a JSON-LD data object.
|
|
@@ -50,6 +126,15 @@ var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
|
|
|
50
126
|
var urlIcon = extractUrlIcon(data.icon, label);
|
|
51
127
|
var provider = generator === null || generator === void 0 ? void 0 : generator['@id'];
|
|
52
128
|
var providerIcon = extractProviderIcon(data);
|
|
129
|
+
if (getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
130
|
+
return chooseIcon({
|
|
131
|
+
urlIcon: urlIcon,
|
|
132
|
+
providerIcon: providerIcon,
|
|
133
|
+
type: type,
|
|
134
|
+
label: label,
|
|
135
|
+
data: data
|
|
136
|
+
});
|
|
137
|
+
}
|
|
53
138
|
switch (type) {
|
|
54
139
|
case 'Document':
|
|
55
140
|
case 'schema:BlogPosting':
|
|
@@ -67,22 +152,13 @@ var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
|
|
|
67
152
|
var fileFormat = documentData === null || documentData === void 0 ? void 0 : documentData['schema:fileFormat'];
|
|
68
153
|
var fileFormatIcon = extractFileFormatIcon(fileFormat);
|
|
69
154
|
var documentTypeIcon = extractDocumentTypeIcon(type, label);
|
|
70
|
-
if (getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
71
|
-
return prioritiseIcon({
|
|
72
|
-
providerId: provider,
|
|
73
|
-
fileFormatIcon: fileFormatIcon,
|
|
74
|
-
documentTypeIcon: documentTypeIcon,
|
|
75
|
-
urlIcon: urlIcon,
|
|
76
|
-
providerIcon: providerIcon
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
155
|
return isNativeProvider(provider) ? fileFormatIcon || documentTypeIcon || urlIcon || providerIcon : providerIcon || fileFormatIcon || documentTypeIcon;
|
|
80
156
|
case 'atlassian:Task':
|
|
81
157
|
var taskLabel = label || 'Task';
|
|
82
158
|
if (isJiraProvider(provider)) {
|
|
83
|
-
var
|
|
84
|
-
taskType =
|
|
85
|
-
taskIcon =
|
|
159
|
+
var _extractTask2 = extractTask(data),
|
|
160
|
+
taskType = _extractTask2.taskType,
|
|
161
|
+
taskIcon = _extractTask2.taskIcon;
|
|
86
162
|
return taskType === 'JiraCustomTaskType' ? taskIcon || urlIcon || providerIcon || {
|
|
87
163
|
icon: IconType.Task,
|
|
88
164
|
label: taskLabel
|
|
@@ -123,37 +199,7 @@ var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
|
|
|
123
199
|
label: label || 'Repository'
|
|
124
200
|
};
|
|
125
201
|
default:
|
|
126
|
-
return
|
|
127
|
-
data: data,
|
|
128
|
-
type: type,
|
|
129
|
-
label: label,
|
|
130
|
-
provider: provider,
|
|
131
|
-
urlIcon: urlIcon,
|
|
132
|
-
providerIcon: providerIcon
|
|
133
|
-
}) : providerIcon;
|
|
202
|
+
return providerIcon;
|
|
134
203
|
}
|
|
135
204
|
};
|
|
136
|
-
export default extractJsonldDataIcon;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Choose which icon to show when the type is not recognized.
|
|
140
|
-
*/
|
|
141
|
-
var extractDefaultIcon = function extractDefaultIcon(_ref2) {
|
|
142
|
-
var data = _ref2.data,
|
|
143
|
-
type = _ref2.type,
|
|
144
|
-
label = _ref2.label,
|
|
145
|
-
provider = _ref2.provider,
|
|
146
|
-
urlIcon = _ref2.urlIcon,
|
|
147
|
-
providerIcon = _ref2.providerIcon;
|
|
148
|
-
var documentData = data;
|
|
149
|
-
var fileFormat = documentData === null || documentData === void 0 ? void 0 : documentData['schema:fileFormat'];
|
|
150
|
-
var fileFormatIcon = extractFileFormatIcon(fileFormat);
|
|
151
|
-
var documentTypeIcon = extractDocumentTypeIcon(type, label);
|
|
152
|
-
return prioritiseIcon({
|
|
153
|
-
providerId: provider,
|
|
154
|
-
fileFormatIcon: fileFormatIcon,
|
|
155
|
-
documentTypeIcon: documentTypeIcon,
|
|
156
|
-
urlIcon: urlIcon,
|
|
157
|
-
providerIcon: providerIcon
|
|
158
|
-
});
|
|
159
|
-
};
|
|
205
|
+
export default extractJsonldDataIcon;
|
|
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
15
15
|
export var context = {
|
|
16
16
|
componentName: 'smart-cards',
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "27.
|
|
18
|
+
packageVersion: "27.7.1"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { useState } from 'react';
|
|
6
|
-
import Button from '@atlaskit/button
|
|
6
|
+
import { LoadingButton as Button } from '@atlaskit/button';
|
|
7
7
|
import { ActionIcon } from './ActionIcon';
|
|
8
8
|
export var spinnerDelay = 1000;
|
|
9
9
|
var baseTextStyles = css({
|
|
@@ -11,20 +11,27 @@ import MoreIcon from '@atlaskit/icon/glyph/more';
|
|
|
11
11
|
import { Action } from './Action';
|
|
12
12
|
import { gs, mq } from '../../common/utils';
|
|
13
13
|
import { di } from 'react-magnetic-di';
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
16
|
+
var wrapperStyles = mq({
|
|
17
|
+
display: 'flex',
|
|
18
|
+
marginTop: [gs(2), 0]
|
|
19
|
+
});
|
|
14
20
|
var buttonStyles = css({
|
|
15
21
|
height: 'auto'
|
|
16
22
|
});
|
|
23
|
+
|
|
24
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
25
|
+
var actionsWrapperStyles = {
|
|
26
|
+
marginLeft: gs(0.5)
|
|
27
|
+
};
|
|
17
28
|
export var ActionList = function ActionList(_ref) {
|
|
18
29
|
var items = _ref.items;
|
|
19
30
|
var actionsToShow = items.slice(0, 2);
|
|
20
31
|
var actionsToList = items.slice(2, items.length);
|
|
21
32
|
return jsx("div", {
|
|
22
33
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
23
|
-
css:
|
|
24
|
-
display: 'flex',
|
|
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
|
|
26
|
-
marginTop: [gs(2), 0]
|
|
27
|
-
})
|
|
34
|
+
css: wrapperStyles
|
|
28
35
|
}, jsx(ButtonGroup, null, actionsToShow.map(function (action) {
|
|
29
36
|
return jsx(Action, _extends({
|
|
30
37
|
key: action.id
|
|
@@ -32,9 +39,7 @@ export var ActionList = function ActionList(_ref) {
|
|
|
32
39
|
})), actionsToList.length ?
|
|
33
40
|
// 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
|
|
34
41
|
jsx("div", {
|
|
35
|
-
css:
|
|
36
|
-
marginLeft: gs(0.5)
|
|
37
|
-
}
|
|
42
|
+
css: actionsWrapperStyles
|
|
38
43
|
}, jsx(DropdownMenu, {
|
|
39
44
|
trigger: function trigger(_ref2) {
|
|
40
45
|
var triggerRef = _ref2.triggerRef,
|