@atlaskit/smart-card 18.0.13 → 18.0.16
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 +28 -0
- package/dist/cjs/extractors/common/context/extractProvider.js +14 -4
- package/dist/cjs/extractors/common/detail/extractCommentCount.js +3 -1
- package/dist/cjs/extractors/common/detail/extractProgrammingLanguage.js +3 -1
- package/dist/cjs/extractors/common/detail/extractSubscriberCount.js +3 -1
- package/dist/cjs/extractors/common/primitives/extractTitleTextColor.js +3 -1
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +9 -0
- package/dist/cjs/state/flexible-ui-context/index.js +4 -0
- package/dist/cjs/utils/analytics/analytics.js +52 -2
- package/dist/cjs/utils/analytics/index.js +18 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/components/Frame.js +10 -7
- package/dist/cjs/view/BlockCard/components/Link.js +3 -1
- package/dist/cjs/view/BlockCard/components/Provider.js +3 -1
- package/dist/cjs/view/BlockCard/views/ErroredView.js +3 -1
- package/dist/cjs/view/BlockCard/views/ForbiddenView.js +3 -1
- package/dist/cjs/view/BlockCard/views/NotFoundView.js +3 -1
- package/dist/cjs/view/BlockCard/views/ResolvingView.js +4 -2
- package/dist/cjs/view/CardWithUrl/component.js +4 -2
- package/dist/cjs/view/CardWithUrl/loader.js +4 -2
- package/dist/cjs/view/EmbedCard/components/styled.js +15 -13
- package/dist/cjs/view/EmbedCard/views/ErroredView.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +26 -4
- package/dist/cjs/view/FlexibleCard/components/actions/index.js +18 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +6 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +6 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/index.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/index.js +39 -19
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +92 -17
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +45 -9
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.js +23 -12
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +8 -2
- package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/container/index.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +12 -1
- package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +18 -3
- package/dist/cjs/view/FlexibleCard/components/elements/date-time/index.js +9 -1
- package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +9 -1
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +96 -0
- package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +10 -1
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +11 -3
- package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +12 -6
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +7 -3
- package/dist/cjs/view/FlexibleCard/index.js +6 -0
- package/dist/cjs/view/HoverCard/index.js +48 -10
- package/dist/cjs/view/HoverCard/styled.js +3 -1
- package/dist/cjs/view/InlineCard/ErroredView/index.js +3 -1
- package/dist/cjs/view/InlineCard/ForbiddenView/index.js +4 -2
- package/dist/cjs/view/InlineCard/Frame/styled.js +16 -13
- package/dist/cjs/view/InlineCard/Icon.js +3 -1
- package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +4 -2
- package/dist/cjs/view/InlineCard/styled.js +6 -4
- package/dist/cjs/view/common/Byline.js +3 -1
- package/dist/cjs/view/common/Metadata.js +3 -1
- package/dist/cjs/view/common/ModalHeader.js +4 -2
- package/dist/es2019/extractors/common/context/extractProvider.js +13 -4
- package/dist/es2019/extractors/common/detail/extractCommentCount.js +2 -1
- package/dist/es2019/extractors/common/detail/extractProgrammingLanguage.js +2 -1
- package/dist/es2019/extractors/common/detail/extractSubscriberCount.js +2 -1
- package/dist/es2019/extractors/common/primitives/extractTitleTextColor.js +2 -1
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +7 -2
- package/dist/es2019/state/flexible-ui-context/index.js +5 -0
- package/dist/es2019/utils/analytics/analytics.js +35 -0
- package/dist/es2019/utils/analytics/index.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/components/Frame.js +9 -7
- package/dist/es2019/view/BlockCard/components/Link.js +2 -1
- package/dist/es2019/view/BlockCard/components/Provider.js +2 -1
- package/dist/es2019/view/BlockCard/views/ErroredView.js +2 -1
- package/dist/es2019/view/BlockCard/views/ForbiddenView.js +2 -1
- package/dist/es2019/view/BlockCard/views/NotFoundView.js +2 -1
- package/dist/es2019/view/BlockCard/views/ResolvingView.js +3 -2
- package/dist/es2019/view/CardWithUrl/component.js +4 -2
- package/dist/es2019/view/CardWithUrl/loader.js +4 -2
- package/dist/es2019/view/EmbedCard/components/styled.js +15 -15
- package/dist/es2019/view/EmbedCard/views/ErroredView.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +37 -4
- package/dist/es2019/view/FlexibleCard/components/actions/index.js +18 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +6 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +9 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +8 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +6 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.js +9 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +5 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/index.js +5 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/index.js +31 -15
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +77 -15
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +35 -8
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.js +20 -11
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +8 -3
- package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +7 -6
- package/dist/es2019/view/FlexibleCard/components/container/index.js +5 -0
- package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +12 -1
- package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +18 -3
- package/dist/es2019/view/FlexibleCard/components/elements/date-time/index.js +9 -1
- package/dist/es2019/view/FlexibleCard/components/elements/icon/index.js +9 -1
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +96 -0
- package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +10 -1
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +11 -3
- package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +8 -1
- package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +11 -4
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +5 -2
- package/dist/es2019/view/FlexibleCard/index.js +6 -0
- package/dist/es2019/view/HoverCard/index.js +40 -10
- package/dist/es2019/view/HoverCard/styled.js +6 -1
- package/dist/es2019/view/InlineCard/ErroredView/index.js +2 -1
- package/dist/es2019/view/InlineCard/ForbiddenView/index.js +3 -2
- package/dist/es2019/view/InlineCard/Frame/styled.js +15 -12
- package/dist/es2019/view/InlineCard/Icon.js +7 -6
- package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +3 -2
- package/dist/es2019/view/InlineCard/styled.js +5 -4
- package/dist/es2019/view/common/Byline.js +2 -1
- package/dist/es2019/view/common/Metadata.js +2 -1
- package/dist/es2019/view/common/ModalHeader.js +3 -2
- package/dist/esm/extractors/common/context/extractProvider.js +13 -4
- package/dist/esm/extractors/common/detail/extractCommentCount.js +2 -1
- package/dist/esm/extractors/common/detail/extractProgrammingLanguage.js +2 -1
- package/dist/esm/extractors/common/detail/extractSubscriberCount.js +2 -1
- package/dist/esm/extractors/common/primitives/extractTitleTextColor.js +2 -1
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +10 -1
- package/dist/esm/state/flexible-ui-context/index.js +5 -0
- package/dist/esm/utils/analytics/analytics.js +41 -0
- package/dist/esm/utils/analytics/index.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/components/Frame.js +9 -7
- package/dist/esm/view/BlockCard/components/Link.js +2 -1
- package/dist/esm/view/BlockCard/components/Provider.js +2 -1
- package/dist/esm/view/BlockCard/views/ErroredView.js +2 -1
- package/dist/esm/view/BlockCard/views/ForbiddenView.js +2 -1
- package/dist/esm/view/BlockCard/views/NotFoundView.js +2 -1
- package/dist/esm/view/BlockCard/views/ResolvingView.js +3 -2
- package/dist/esm/view/CardWithUrl/component.js +4 -2
- package/dist/esm/view/CardWithUrl/loader.js +4 -2
- package/dist/esm/view/EmbedCard/components/styled.js +14 -13
- package/dist/esm/view/EmbedCard/views/ErroredView.js +2 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +25 -4
- package/dist/esm/view/FlexibleCard/components/actions/index.js +18 -2
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +6 -0
- package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +9 -2
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +8 -2
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +6 -0
- package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.js +9 -2
- package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +5 -0
- package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/index.js +5 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/index.js +33 -16
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +79 -17
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +39 -8
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.js +22 -11
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +8 -3
- package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/container/index.js +5 -0
- package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +12 -1
- package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +18 -3
- package/dist/esm/view/FlexibleCard/components/elements/date-time/index.js +9 -1
- package/dist/esm/view/FlexibleCard/components/elements/icon/index.js +9 -1
- package/dist/esm/view/FlexibleCard/components/elements/index.js +96 -0
- package/dist/esm/view/FlexibleCard/components/elements/link/index.js +10 -1
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +11 -3
- package/dist/esm/view/FlexibleCard/components/elements/media/index.js +9 -2
- package/dist/esm/view/FlexibleCard/components/elements/text/index.js +12 -6
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +5 -3
- package/dist/esm/view/FlexibleCard/index.js +6 -0
- package/dist/esm/view/HoverCard/index.js +42 -10
- package/dist/esm/view/HoverCard/styled.js +2 -1
- package/dist/esm/view/InlineCard/ErroredView/index.js +2 -1
- package/dist/esm/view/InlineCard/ForbiddenView/index.js +3 -2
- package/dist/esm/view/InlineCard/Frame/styled.js +16 -13
- package/dist/esm/view/InlineCard/Icon.js +2 -1
- package/dist/esm/view/InlineCard/UnauthorisedView/index.js +3 -2
- package/dist/esm/view/InlineCard/styled.js +5 -4
- package/dist/esm/view/common/Byline.js +2 -1
- package/dist/esm/view/common/Metadata.js +2 -1
- package/dist/esm/view/common/ModalHeader.js +3 -2
- package/dist/types/client/errors.d.ts +3 -2
- package/dist/types/extractors/block/index.d.ts +2 -2
- package/dist/types/extractors/common/__mocks__/jsonld.d.ts +46 -66
- package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +1 -1
- package/dist/types/extractors/common/title-prefix/extractTitlePrefix.d.ts +2 -1
- package/dist/types/extractors/embed/index.d.ts +1 -1
- package/dist/types/extractors/flexible/icon/extract-url-icon.d.ts +1 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +4 -0
- package/dist/types/state/flexible-ui-context/index.d.ts +4 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +102 -0
- package/dist/types/state/hooks/useSmartLink.d.ts +3 -0
- package/dist/types/utils/analytics/analytics.d.ts +5 -1
- package/dist/types/utils/analytics/index.d.ts +1 -1
- package/dist/types/utils/types.d.ts +2 -2
- package/dist/types/view/BlockCard/utils/handlers.d.ts +1 -1
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/Card/types.d.ts +1 -0
- package/dist/types/view/CardWithUrl/component.d.ts +1 -1
- package/dist/types/view/CardWithUrl/types.d.ts +1 -0
- package/dist/types/view/EmbedCard/components/styled.d.ts +9 -9
- package/dist/types/view/FlexibleCard/components/actions/action/index.d.ts +8 -0
- package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +4 -2
- package/dist/types/view/FlexibleCard/components/actions/index.d.ts +15 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-group/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-group/types.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/block/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/element-group/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/element-group/types.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/blocks/footer-block/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/metadata-block/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/preview-block/index.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/blocks/snippet-block/index.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/errored/index.d.ts +9 -2
- package/dist/types/view/FlexibleCard/components/blocks/title-block/index.d.ts +11 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +7 -3
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +8 -2
- package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +10 -1
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +7 -5
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +2 -1
- package/dist/types/view/FlexibleCard/components/container/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/container/types.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/elements/avatar-group/index.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/elements/badge/index.d.ts +13 -0
- package/dist/types/view/FlexibleCard/components/elements/date-time/index.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/elements/icon/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/icon/types.d.ts +5 -1
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +77 -0
- package/dist/types/view/FlexibleCard/components/elements/link/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/lozenge/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/media/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/text/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/text/types.d.ts +1 -2
- package/dist/types/view/FlexibleCard/components/elements/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/index.d.ts +6 -0
- package/dist/types/view/HoverCard/index.d.ts +3 -2
- package/dist/types/view/HoverCard/types.d.ts +5 -2
- package/dist/types/view/InlineCard/Icon.d.ts +3 -3
- package/dist/types/view/InlineCard/IconAndTitleLayout/styled.d.ts +9 -9
- package/dist/types/view/InlineCard/ResolvingView/styled.d.ts +3 -3
- package/dist/types/view/InlineCard/styled.d.ts +4 -4
- package/package.json +9 -4
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/utils.js +0 -105
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/utils.js +0 -71
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/utils.js +0 -76
- package/dist/types/view/FlexibleCard/components/blocks/title-block/utils.d.ts +0 -11
|
@@ -2,6 +2,7 @@ import styled from '@emotion/styled';
|
|
|
2
2
|
import { size as csssize, borderRadius, size, ellipsis } from '@atlaskit/media-ui';
|
|
3
3
|
import { fontFamily } from '@atlaskit/theme/constants';
|
|
4
4
|
import * as colors from '@atlaskit/theme/colors';
|
|
5
|
+
import { token } from '@atlaskit/tokens';
|
|
5
6
|
import { gs as gridSize } from '../../common/utils';
|
|
6
7
|
export const className = 'media-card-frame';
|
|
7
8
|
export const cardShadow = ``;
|
|
@@ -36,7 +37,7 @@ function getinteractiveStyles({
|
|
|
36
37
|
${visibleStyles}
|
|
37
38
|
}
|
|
38
39
|
&:active {
|
|
39
|
-
background-color: ${colors.B50};
|
|
40
|
+
background-color: ${token('color.background.selected', colors.B50)};
|
|
40
41
|
}
|
|
41
42
|
` : '';
|
|
42
43
|
return `${visibleFrameStyles}${interactiveFrameStyles}`;
|
|
@@ -49,7 +50,7 @@ function selected({
|
|
|
49
50
|
${visibleStyles}
|
|
50
51
|
&::after {
|
|
51
52
|
cursor: pointer;
|
|
52
|
-
box-shadow: 0 0 0 3px ${colors.B100};
|
|
53
|
+
box-shadow: 0 0 0 3px ${token('color.border.selected', colors.B100)};
|
|
53
54
|
content: '';
|
|
54
55
|
outline: none;
|
|
55
56
|
position: absolute;
|
|
@@ -96,10 +97,10 @@ const wrapperStyles = props => `
|
|
|
96
97
|
`;
|
|
97
98
|
|
|
98
99
|
const visibleStyles = `
|
|
99
|
-
background-color: ${colors.N30};
|
|
100
|
+
background-color: ${token('color.background.neutral.subtle', colors.N30)};
|
|
100
101
|
|
|
101
102
|
&:after {
|
|
102
|
-
background: ${colors.N30} !important;
|
|
103
|
+
background: ${token('color.background.neutral', colors.N30)} !important;
|
|
103
104
|
}
|
|
104
105
|
.embed-header {
|
|
105
106
|
opacity: 1;
|
|
@@ -128,7 +129,7 @@ export const Header = styled.div`
|
|
|
128
129
|
width: 100%;
|
|
129
130
|
display: flex;
|
|
130
131
|
align-items: center;
|
|
131
|
-
color: ${colors.N300};
|
|
132
|
+
color: ${token('color.icon', colors.N300)};
|
|
132
133
|
opacity: 0;
|
|
133
134
|
transition: 300ms opacity cubic-bezier(0.15, 1, 0.3, 1);
|
|
134
135
|
`;
|
|
@@ -140,7 +141,7 @@ export const IconWrapper = styled.div`
|
|
|
140
141
|
}) => {
|
|
141
142
|
if (isPlaceholder) {
|
|
142
143
|
return `
|
|
143
|
-
background-color: ${colors.N30};
|
|
144
|
+
background-color: ${token('color.skeleton', colors.N30)};
|
|
144
145
|
`;
|
|
145
146
|
} else {
|
|
146
147
|
return '';
|
|
@@ -156,12 +157,12 @@ export const TextWrapper = styled.div`
|
|
|
156
157
|
${borderRadius}
|
|
157
158
|
width: 125px;
|
|
158
159
|
height: 12px;
|
|
159
|
-
background-color: ${colors.N30};
|
|
160
|
+
background-color: ${token('color.skeleton', colors.N30)};
|
|
160
161
|
`;
|
|
161
162
|
} else {
|
|
162
163
|
return '';
|
|
163
164
|
}
|
|
164
|
-
}} color: ${colors.N300};
|
|
165
|
+
}} color: ${token('color.text.subtlest', colors.N300)};
|
|
165
166
|
font-size: 12px;
|
|
166
167
|
line-height: 16px;
|
|
167
168
|
${ellipsis('none')};
|
|
@@ -172,7 +173,7 @@ export const TextWrapper = styled.div`
|
|
|
172
173
|
export const Content = styled.div`
|
|
173
174
|
${borderRadius}
|
|
174
175
|
${cardShadow}
|
|
175
|
-
background-color: white;
|
|
176
|
+
background-color: ${token('elevation.surface', 'white')};
|
|
176
177
|
position: absolute;
|
|
177
178
|
z-index: 1;
|
|
178
179
|
width: 100%;
|
|
@@ -198,8 +199,7 @@ export const Content = styled.div`
|
|
|
198
199
|
if (isInteractive) {
|
|
199
200
|
return `
|
|
200
201
|
.${className}:hover & {
|
|
201
|
-
box-shadow: 0 4px 8px -2px rgba(23, 43, 77, 0.32),
|
|
202
|
-
0 0 1px rgba(23, 43, 77, 0.25);
|
|
202
|
+
box-shadow: ${token('elevation.shadow.overlay', '0 4px 8px -2px rgba(23, 43, 77, 0.32), 0 0 1px rgba(23, 43, 77, 0.25)')};
|
|
203
203
|
}
|
|
204
204
|
`;
|
|
205
205
|
} else {
|
|
@@ -224,7 +224,7 @@ export const ContentWrapper = styled.div`
|
|
|
224
224
|
padding: 8px 12px 12px 12px;
|
|
225
225
|
`;
|
|
226
226
|
export const Title = styled.div`
|
|
227
|
-
color: ${colors.N900};
|
|
227
|
+
color: ${token('color.text', colors.N900)};
|
|
228
228
|
font-size: 16px;
|
|
229
229
|
font-weight: 500;
|
|
230
230
|
line-height: ${20 / 16};
|
|
@@ -233,7 +233,7 @@ export const Title = styled.div`
|
|
|
233
233
|
`;
|
|
234
234
|
export const Byline = styled.div`
|
|
235
235
|
margin-top: 4px;
|
|
236
|
-
color: ${colors.N300};
|
|
236
|
+
color: ${token('color.text.subtlest', colors.N300)};
|
|
237
237
|
font-size: 12px;
|
|
238
238
|
font-weight: normal;
|
|
239
239
|
line-height: ${16 / 12};
|
|
@@ -241,7 +241,7 @@ export const Byline = styled.div`
|
|
|
241
241
|
`;
|
|
242
242
|
export const Description = styled.div`
|
|
243
243
|
margin-top: 7px;
|
|
244
|
-
color: ${colors.N800};
|
|
244
|
+
color: ${token('color.text', colors.N800)};
|
|
245
245
|
font-size: 12px;
|
|
246
246
|
font-weight: normal;
|
|
247
247
|
line-height: ${18 / 12};
|
|
@@ -256,7 +256,7 @@ export const Thumbnail = styled.div`
|
|
|
256
256
|
${size(48)}
|
|
257
257
|
float: right;
|
|
258
258
|
margin: 4px 0 12px 12px;
|
|
259
|
-
background-color: ${colors.N30};
|
|
259
|
+
background-color: ${token('color.skeleton', colors.N30)};
|
|
260
260
|
background-image: url(${({
|
|
261
261
|
src
|
|
262
262
|
}) => src});
|
|
@@ -4,6 +4,7 @@ import Button from '@atlaskit/button/custom-theme-button';
|
|
|
4
4
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
5
5
|
import { fontSize } from '@atlaskit/theme/constants';
|
|
6
6
|
import { R300 } from '@atlaskit/theme/colors';
|
|
7
|
+
import { token } from '@atlaskit/tokens';
|
|
7
8
|
import { Frame } from '../../BlockCard/components/Frame';
|
|
8
9
|
import { FormattedMessage } from 'react-intl-next';
|
|
9
10
|
import { messages } from '@atlaskit/media-ui/messages';
|
|
@@ -20,7 +21,7 @@ export const EmbedCardErroredView = ({
|
|
|
20
21
|
testId: testId
|
|
21
22
|
}, jsx(ErrorIcon, {
|
|
22
23
|
size: "small",
|
|
23
|
-
primaryColor: R300,
|
|
24
|
+
primaryColor: token('color.icon.danger', R300),
|
|
24
25
|
label: "error-icon"
|
|
25
26
|
}), jsx("span", {
|
|
26
27
|
css: {
|
|
@@ -27,7 +27,23 @@ const getIconStyles = size => css`
|
|
|
27
27
|
${getIconSizeStyles(getIconWidth(size))};
|
|
28
28
|
`;
|
|
29
29
|
|
|
30
|
-
const getButtonStyle = (size, iconOnly) =>
|
|
30
|
+
const getButtonStyle = (size, iconOnly) => {
|
|
31
|
+
switch (size) {
|
|
32
|
+
case SmartLinkSize.Large:
|
|
33
|
+
return iconOnly ? css`
|
|
34
|
+
button,
|
|
35
|
+
button:hover,
|
|
36
|
+
button:focus,
|
|
37
|
+
button:active {
|
|
38
|
+
padding: 0;
|
|
39
|
+
> span {
|
|
40
|
+
margin: 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
` : '';
|
|
44
|
+
|
|
45
|
+
case SmartLinkSize.Small:
|
|
46
|
+
return css`
|
|
31
47
|
font-size: 0.75rem;
|
|
32
48
|
font-weight: 500;
|
|
33
49
|
line-height: 1rem;
|
|
@@ -43,7 +59,14 @@ const getButtonStyle = (size, iconOnly) => size === SmartLinkSize.Small ? css`
|
|
|
43
59
|
padding-right: 0.25rem;
|
|
44
60
|
`}
|
|
45
61
|
}
|
|
46
|
-
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
case SmartLinkSize.XLarge:
|
|
65
|
+
case SmartLinkSize.Medium:
|
|
66
|
+
default:
|
|
67
|
+
return '';
|
|
68
|
+
}
|
|
69
|
+
};
|
|
47
70
|
|
|
48
71
|
const ActionIcon = ({
|
|
49
72
|
size,
|
|
@@ -60,6 +83,14 @@ export const sizeToSpacing = {
|
|
|
60
83
|
[SmartLinkSize.Large]: 'compact',
|
|
61
84
|
[SmartLinkSize.XLarge]: 'default'
|
|
62
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* An action that can be triggered with an on click.
|
|
88
|
+
* @public
|
|
89
|
+
* @param {ActionProps} ActionProps - The props necessary for the Action.
|
|
90
|
+
* @see DeleteAction
|
|
91
|
+
* @see EditAction
|
|
92
|
+
* @see CustomAction
|
|
93
|
+
*/
|
|
63
94
|
|
|
64
95
|
const Action = ({
|
|
65
96
|
appearance = 'subtle',
|
|
@@ -70,7 +101,8 @@ const Action = ({
|
|
|
70
101
|
icon,
|
|
71
102
|
iconPosition = 'before',
|
|
72
103
|
tooltipMessage,
|
|
73
|
-
asDropDownItem
|
|
104
|
+
asDropDownItem,
|
|
105
|
+
overrideCss
|
|
74
106
|
}) => {
|
|
75
107
|
if (!onClick) {
|
|
76
108
|
return null;
|
|
@@ -99,7 +131,8 @@ const Action = ({
|
|
|
99
131
|
return jsx(Tooltip, {
|
|
100
132
|
content: tooltipMessage
|
|
101
133
|
}, jsx("div", {
|
|
102
|
-
css: getButtonStyle(size, iconOnly)
|
|
134
|
+
css: [getButtonStyle(size, iconOnly), overrideCss],
|
|
135
|
+
"data-testid": `${testId}-button-wrapper`
|
|
103
136
|
}, jsx(Button, {
|
|
104
137
|
spacing: sizeToSpacing[size],
|
|
105
138
|
appearance: appearance,
|
|
@@ -2,9 +2,25 @@ import { ActionName } from '../../../../constants';
|
|
|
2
2
|
import { createUIAction } from './utils'; // Attention: Keep the export name and action name the same.
|
|
3
3
|
// This will help reducing the code for mapping action inside
|
|
4
4
|
// createAction and renderActionItems
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a DeleteAction component. Accepts default ActionProps, but defaults
|
|
8
|
+
* the icon to a cross icon.
|
|
9
|
+
* @see Action
|
|
10
|
+
*/
|
|
7
11
|
|
|
8
12
|
export const DeleteAction = createUIAction(ActionName.DeleteAction);
|
|
13
|
+
/**
|
|
14
|
+
* Creates a EditAction component. Accepts default ActionProps, but defaults
|
|
15
|
+
* the icon to an edit (pencil) icon.
|
|
16
|
+
* @see Action
|
|
17
|
+
*/
|
|
18
|
+
|
|
9
19
|
export const EditAction = createUIAction(ActionName.EditAction);
|
|
20
|
+
/**
|
|
21
|
+
* Creates a CustomAction component. Accepts default ActionProps. Required to provide
|
|
22
|
+
* your own icon or text.
|
|
23
|
+
* @see Action
|
|
24
|
+
*/
|
|
25
|
+
|
|
10
26
|
export const CustomAction = createUIAction(ActionName.CustomAction);
|
|
@@ -13,6 +13,12 @@ const styles = css`
|
|
|
13
13
|
display: inline-flex;
|
|
14
14
|
line-height: 1rem;
|
|
15
15
|
`;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
18
|
+
* preferences.
|
|
19
|
+
* @param {ActionGroupProps} ActionGroupProps
|
|
20
|
+
* @see Action
|
|
21
|
+
*/
|
|
16
22
|
|
|
17
23
|
const ActionGroup = ({
|
|
18
24
|
items = [],
|
|
@@ -12,15 +12,22 @@ const getBlockStyles = (direction, size) => css`
|
|
|
12
12
|
margin-right: ${getGapSize(size)}rem;
|
|
13
13
|
}
|
|
14
14
|
`;
|
|
15
|
+
/**
|
|
16
|
+
* A block represents a collection of elements and actions that are arranged in a row.
|
|
17
|
+
* All elements and actions should be contained within a Block.
|
|
18
|
+
* @param {ActionGroupProps} ActionGroupProps
|
|
19
|
+
* @see Action
|
|
20
|
+
*/
|
|
21
|
+
|
|
15
22
|
|
|
16
23
|
const Block = ({
|
|
17
24
|
children,
|
|
18
25
|
direction = SmartLinkDirection.Horizontal,
|
|
19
26
|
size = SmartLinkSize.Medium,
|
|
20
27
|
testId = 'smart-block',
|
|
21
|
-
|
|
28
|
+
overrideCss
|
|
22
29
|
}) => jsx("div", {
|
|
23
|
-
css: [getBlockStyles(direction, size),
|
|
30
|
+
css: [getBlockStyles(direction, size), overrideCss],
|
|
24
31
|
"data-smart-block": true,
|
|
25
32
|
"data-testid": testId
|
|
26
33
|
}, renderChildren(children, size));
|
|
@@ -27,17 +27,23 @@ export const getElementGroupStyles = (direction, size, align, width) => css`
|
|
|
27
27
|
min-width: 10%;
|
|
28
28
|
${width === SmartLinkWidth.Flexible ? `flex: 1 3;` : ''}
|
|
29
29
|
`;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
32
|
+
* preferences.
|
|
33
|
+
* @param {ActionGroupProps} ActionGroupProps
|
|
34
|
+
* @see Action
|
|
35
|
+
*/
|
|
30
36
|
|
|
31
37
|
const ElementGroup = ({
|
|
32
38
|
align = SmartLinkAlignment.Left,
|
|
33
39
|
children,
|
|
34
|
-
|
|
40
|
+
overrideCss,
|
|
35
41
|
direction = SmartLinkDirection.Horizontal,
|
|
36
42
|
size = SmartLinkSize.Medium,
|
|
37
43
|
testId = 'smart-element-group',
|
|
38
44
|
width = SmartLinkWidth.FitToContent
|
|
39
45
|
}) => jsx("div", {
|
|
40
|
-
css: [getElementGroupStyles(direction, size, align, width),
|
|
46
|
+
css: [getElementGroupStyles(direction, size, align, width), overrideCss],
|
|
41
47
|
"data-smart-element-group": true,
|
|
42
48
|
"data-testid": testId
|
|
43
49
|
}, renderChildren(children, size));
|
|
@@ -5,6 +5,12 @@ import Block from '../block';
|
|
|
5
5
|
import ElementGroup from '../element-group';
|
|
6
6
|
import { Provider } from '../../elements';
|
|
7
7
|
import ActionGroup from '../action-group';
|
|
8
|
+
/**
|
|
9
|
+
* Represents a FooterBlock, designed to contain elements and actions that should appear
|
|
10
|
+
* at the bottom of a link card.
|
|
11
|
+
* @param {FooterBlockProps} FooterBlockProps
|
|
12
|
+
* @see Block
|
|
13
|
+
*/
|
|
8
14
|
|
|
9
15
|
const FooterBlock = props => {
|
|
10
16
|
const {
|
|
@@ -60,6 +60,13 @@ const getMaxLines = maxLines => {
|
|
|
60
60
|
|
|
61
61
|
return maxLines;
|
|
62
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* Represents a MetadataBlock, designed to contain groups of metadata in the form of elements.
|
|
65
|
+
* Accepts an array of elements to be shown either primary (left hand side) or secondary (right hand side).
|
|
66
|
+
* @param {MetadataBlockProps} MetadataBlockProps
|
|
67
|
+
* @see Block
|
|
68
|
+
*/
|
|
69
|
+
|
|
63
70
|
|
|
64
71
|
const MetadataBlock = ({
|
|
65
72
|
maxLines = DEFAULT_MAX_LINES,
|
|
@@ -83,12 +90,12 @@ const MetadataBlock = ({
|
|
|
83
90
|
testId: `${testId}-resolved-view`
|
|
84
91
|
}), primaryElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
85
92
|
align: SmartLinkAlignment.Left,
|
|
86
|
-
|
|
93
|
+
overrideCss: elementGroupStyles,
|
|
87
94
|
direction: SmartLinkDirection.Horizontal,
|
|
88
95
|
width: SmartLinkWidth.Flexible
|
|
89
96
|
}, primaryElements), secondaryElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
90
97
|
align: SmartLinkAlignment.Right,
|
|
91
|
-
|
|
98
|
+
overrideCss: elementGroupStyles,
|
|
92
99
|
direction: SmartLinkDirection.Horizontal,
|
|
93
100
|
width: SmartLinkWidth.Flexible
|
|
94
101
|
}, secondaryElements));
|
|
@@ -3,6 +3,11 @@ import React from 'react';
|
|
|
3
3
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
4
4
|
import Block from '../block';
|
|
5
5
|
import { Preview } from '../../elements';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a PreviewBlock, which typically contains media or other large format content.
|
|
8
|
+
* @param {PreviewBlock} PreviewBlock
|
|
9
|
+
* @see Block
|
|
10
|
+
*/
|
|
6
11
|
|
|
7
12
|
const PreviewBlock = ({
|
|
8
13
|
status = SmartLinkStatus.Fallback,
|
|
@@ -7,6 +7,11 @@ import { getMaxLines } from '../../utils';
|
|
|
7
7
|
const DEFAULT_MAX_LINES = 3;
|
|
8
8
|
const MAXIMUM_MAX_LINES = 3;
|
|
9
9
|
const MINIMUM_MAX_LINES = 1;
|
|
10
|
+
/**
|
|
11
|
+
* Represents a SnippetBlock, which is used to display longer form text content, like descriptions.
|
|
12
|
+
* @param {SnippetBlock} SnippetBlock
|
|
13
|
+
* @see Block
|
|
14
|
+
*/
|
|
10
15
|
|
|
11
16
|
const SnippetBlock = ({
|
|
12
17
|
maxLines = DEFAULT_MAX_LINES,
|
|
@@ -4,11 +4,12 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
6
6
|
import { css, jsx } from '@emotion/core';
|
|
7
|
+
import { LinkIcon } from '../../../elements';
|
|
8
|
+
import Block from '../../block';
|
|
7
9
|
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize } from '../../../../../../constants';
|
|
8
10
|
import { getLinkLineHeight, getLinkSizeStyles, getTruncateStyles } from '../../../utils';
|
|
9
11
|
import ElementGroup from '../../element-group';
|
|
10
12
|
import { tokens } from '../../../../../../utils/token';
|
|
11
|
-
import { BaseTitleBlockComponent } from '../utils';
|
|
12
13
|
const actionStyles = css`
|
|
13
14
|
cursor: pointer;
|
|
14
15
|
:hover {
|
|
@@ -28,31 +29,46 @@ const getMessageStyles = (size, hasAction) => {
|
|
|
28
29
|
color: ${tokens.errorMessage};
|
|
29
30
|
`;
|
|
30
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Represents an Errored TitleBlock view.
|
|
34
|
+
* This will render when a Smart Link did not successfully resolve.
|
|
35
|
+
* This may be a result of a Smart Link not having the correct credentials,
|
|
36
|
+
* or the backend response was errored or malformed.
|
|
37
|
+
* @see TitleBlock
|
|
38
|
+
*/
|
|
31
39
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
|
|
41
|
+
const TitleBlockErroredView = ({
|
|
42
|
+
actionGroup,
|
|
43
|
+
retry,
|
|
44
|
+
position,
|
|
45
|
+
testId,
|
|
46
|
+
title,
|
|
47
|
+
...blockProps
|
|
48
|
+
}) => {
|
|
38
49
|
const {
|
|
39
|
-
descriptor
|
|
50
|
+
descriptor,
|
|
40
51
|
onClick,
|
|
41
|
-
values
|
|
52
|
+
values
|
|
42
53
|
} = retry || {};
|
|
54
|
+
const {
|
|
55
|
+
size = SmartLinkSize.Medium
|
|
56
|
+
} = blockProps;
|
|
43
57
|
const hasAction = onClick !== undefined;
|
|
44
|
-
return jsx(
|
|
45
|
-
|
|
46
|
-
}),
|
|
58
|
+
return jsx(Block, _extends({}, blockProps, {
|
|
59
|
+
testId: `${testId}-errored-view`
|
|
60
|
+
}), jsx(LinkIcon, {
|
|
61
|
+
position: position
|
|
62
|
+
}), title, descriptor && jsx(ElementGroup, {
|
|
47
63
|
direction: SmartLinkDirection.Horizontal,
|
|
48
64
|
align: SmartLinkAlignment.Right
|
|
49
65
|
}, jsx("span", {
|
|
50
66
|
css: getMessageStyles(size, hasAction),
|
|
51
67
|
onClick: onClick,
|
|
52
68
|
"data-testid": `${testId}-errored-view-message`
|
|
53
|
-
}, jsx(FormattedMessage, _extends({},
|
|
54
|
-
values:
|
|
55
|
-
})))));
|
|
69
|
+
}, jsx(FormattedMessage, _extends({}, descriptor, {
|
|
70
|
+
values: values
|
|
71
|
+
})))), actionGroup);
|
|
56
72
|
};
|
|
57
73
|
|
|
58
74
|
export default TitleBlockErroredView;
|
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { css } from '@emotion/core';
|
|
3
4
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
4
5
|
import TitleBlockResolvedView from './resolved';
|
|
5
6
|
import TitleBlockErroredView from './errored';
|
|
6
7
|
import TitleBlockResolvingView from './resolving';
|
|
8
|
+
import ActionGroup from '../action-group';
|
|
9
|
+
import { Title } from '../../elements';
|
|
7
10
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const getActionStyles = (showOnHover, isOpen) => {
|
|
12
|
+
if (showOnHover && !isOpen) {
|
|
13
|
+
return css`
|
|
14
|
+
.actions-button-group {
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&:hover {
|
|
19
|
+
.actions-button-group {
|
|
20
|
+
visibility: visible;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const getTitleBlockViewComponent = status => {
|
|
13
28
|
switch (status) {
|
|
14
29
|
case SmartLinkStatus.Pending:
|
|
15
30
|
case SmartLinkStatus.Resolving:
|
|
16
|
-
return
|
|
17
|
-
testId: testId
|
|
18
|
-
}));
|
|
31
|
+
return TitleBlockResolvingView;
|
|
19
32
|
|
|
20
33
|
case SmartLinkStatus.Resolved:
|
|
21
|
-
return
|
|
22
|
-
testId: testId
|
|
23
|
-
}));
|
|
34
|
+
return TitleBlockResolvedView;
|
|
24
35
|
|
|
25
36
|
case SmartLinkStatus.Unauthorized:
|
|
26
37
|
case SmartLinkStatus.Forbidden:
|
|
@@ -28,10 +39,61 @@ const TitleBlock = ({
|
|
|
28
39
|
case SmartLinkStatus.Errored:
|
|
29
40
|
case SmartLinkStatus.Fallback:
|
|
30
41
|
default:
|
|
31
|
-
return
|
|
32
|
-
testId: testId
|
|
33
|
-
}));
|
|
42
|
+
return TitleBlockErroredView;
|
|
34
43
|
}
|
|
35
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Represents a TitleBlock, which is the foundation of all Flexible Smart Links.
|
|
47
|
+
* This contains an icon, the link, and any associated metadata and actions in one block.
|
|
48
|
+
* The TitleBlock will also render differently given the state of the smart link.
|
|
49
|
+
* This can be found in the corresponding Resolving, Resolved and Errored views.
|
|
50
|
+
* @param {TitleBlockProps} TitleBlockProps
|
|
51
|
+
* @see Block
|
|
52
|
+
* @see TitleBlockResolvingView
|
|
53
|
+
* @see TitleBlockResolvedView
|
|
54
|
+
* @see TitleBlockErroredView
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
const TitleBlock = ({
|
|
59
|
+
actions = [],
|
|
60
|
+
anchorTarget,
|
|
61
|
+
maxLines,
|
|
62
|
+
onClick,
|
|
63
|
+
overrideCss,
|
|
64
|
+
status = SmartLinkStatus.Fallback,
|
|
65
|
+
showActionOnHover,
|
|
66
|
+
testId = 'smart-block-title',
|
|
67
|
+
text,
|
|
68
|
+
theme,
|
|
69
|
+
...props
|
|
70
|
+
}) => {
|
|
71
|
+
const [actionDropdownOpen, setActionDropdownOpen] = useState(false);
|
|
72
|
+
const actionGroup = actions.length > 0 && /*#__PURE__*/React.createElement(ActionGroup, {
|
|
73
|
+
items: actions,
|
|
74
|
+
visibleButtonsNum: showActionOnHover ? 1 : 2,
|
|
75
|
+
onDropdownOpenChange: isOpen => setActionDropdownOpen(isOpen)
|
|
76
|
+
});
|
|
77
|
+
const actionStyles = getActionStyles(showActionOnHover, actionDropdownOpen);
|
|
78
|
+
const combinedCss = css`
|
|
79
|
+
${actionStyles} ${overrideCss}
|
|
80
|
+
`;
|
|
81
|
+
const overrideText = !!text ? {
|
|
82
|
+
text
|
|
83
|
+
} : {};
|
|
84
|
+
const title = /*#__PURE__*/React.createElement(Title, _extends({
|
|
85
|
+
maxLines: maxLines,
|
|
86
|
+
onClick: onClick,
|
|
87
|
+
target: anchorTarget,
|
|
88
|
+
theme: theme
|
|
89
|
+
}, overrideText));
|
|
90
|
+
const Component = getTitleBlockViewComponent(status);
|
|
91
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
92
|
+
actionGroup: actionGroup,
|
|
93
|
+
overrideCss: combinedCss,
|
|
94
|
+
testId: testId,
|
|
95
|
+
title: title
|
|
96
|
+
}));
|
|
97
|
+
};
|
|
36
98
|
|
|
37
99
|
export default TitleBlock;
|
|
@@ -1,14 +1,41 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
/** @jsx jsx */
|
|
4
2
|
import React from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
3
|
+
import { LinkIcon } from '../../../elements';
|
|
4
|
+
import Block from '../../block';
|
|
5
|
+
import ElementGroup from '../../element-group';
|
|
6
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkWidth } from '../../../../../../constants';
|
|
7
|
+
import { renderElementItems } from '../../utils';
|
|
8
|
+
/**
|
|
9
|
+
* This renders a fully resolved TitleBlock.
|
|
10
|
+
* This should render when a Smart Link returns a valid response.
|
|
11
|
+
* @see TitleBlock
|
|
12
|
+
*/
|
|
7
13
|
|
|
8
|
-
const TitleBlockResolvedView =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
const TitleBlockResolvedView = ({
|
|
15
|
+
actionGroup,
|
|
16
|
+
metadata = [],
|
|
17
|
+
position,
|
|
18
|
+
subtitle = [],
|
|
19
|
+
testId,
|
|
20
|
+
text,
|
|
21
|
+
title,
|
|
22
|
+
...blockProps
|
|
23
|
+
}) => {
|
|
24
|
+
const metadataElements = renderElementItems(metadata);
|
|
25
|
+
const subtitleElements = renderElementItems(subtitle);
|
|
26
|
+
return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
|
|
27
|
+
testId: `${testId}-resolved-view`
|
|
28
|
+
}), /*#__PURE__*/React.createElement(LinkIcon, {
|
|
29
|
+
position: position
|
|
30
|
+
}), /*#__PURE__*/React.createElement(ElementGroup, {
|
|
31
|
+
direction: SmartLinkDirection.Vertical,
|
|
32
|
+
width: SmartLinkWidth.Flexible
|
|
33
|
+
}, title, subtitleElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
34
|
+
direction: SmartLinkDirection.Horizontal
|
|
35
|
+
}, subtitleElements)), metadataElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
36
|
+
direction: SmartLinkDirection.Horizontal,
|
|
37
|
+
align: SmartLinkAlignment.Right
|
|
38
|
+
}, metadataElements), actionGroup);
|
|
12
39
|
};
|
|
13
40
|
|
|
14
41
|
export default TitleBlockResolvedView;
|
|
@@ -4,8 +4,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { jsx } from '@emotion/core';
|
|
6
6
|
import Spinner from '@atlaskit/spinner';
|
|
7
|
+
import Block from '../../block';
|
|
7
8
|
import { SmartLinkSize } from '../../../../../../constants';
|
|
8
|
-
import { BaseTitleBlockComponent } from '../utils';
|
|
9
9
|
|
|
10
10
|
const getSpinnerSize = size => {
|
|
11
11
|
// Spinner sizes should be equivalent or smaller than Icon size
|
|
@@ -25,20 +25,29 @@ const getSpinnerSize = size => {
|
|
|
25
25
|
return 12;
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* This represents a TitleBlock for a Smart Link that is currently waiting
|
|
30
|
+
* for a request to finish.
|
|
31
|
+
* This should render when a Smart Link has sent a request.
|
|
32
|
+
* @see TitleBlock
|
|
33
|
+
*/
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
|
|
36
|
+
const TitleBlockResolvingView = ({
|
|
37
|
+
actionGroup,
|
|
38
|
+
testId,
|
|
39
|
+
title,
|
|
40
|
+
...blockProps
|
|
41
|
+
}) => {
|
|
30
42
|
const {
|
|
31
|
-
size = SmartLinkSize.Medium
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
43
|
+
size = SmartLinkSize.Medium
|
|
44
|
+
} = blockProps;
|
|
45
|
+
return jsx(Block, _extends({}, blockProps, {
|
|
46
|
+
testId: `${testId}-resolving-view`
|
|
47
|
+
}), jsx(Spinner, {
|
|
35
48
|
size: getSpinnerSize(size),
|
|
36
49
|
testId: `${testId}-resolving-spinner`
|
|
37
|
-
});
|
|
38
|
-
return jsx(BaseTitleBlockComponent, _extends({}, props, {
|
|
39
|
-
blockIcon: spinnerIcon,
|
|
40
|
-
blockTestIdPostfix: "resolving-view"
|
|
41
|
-
}));
|
|
50
|
+
}), title, actionGroup);
|
|
42
51
|
};
|
|
43
52
|
|
|
44
53
|
export default TitleBlockResolvingView;
|