@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
|
@@ -6,6 +6,7 @@ import styled from '@emotion/styled';
|
|
|
6
6
|
import { size as csssize, borderRadius, size, ellipsis } from '@atlaskit/media-ui';
|
|
7
7
|
import { fontFamily } from '@atlaskit/theme/constants';
|
|
8
8
|
import * as colors from '@atlaskit/theme/colors';
|
|
9
|
+
import { token } from '@atlaskit/tokens';
|
|
9
10
|
import { gs as gridSize } from '../../common/utils';
|
|
10
11
|
export var className = 'media-card-frame';
|
|
11
12
|
export var cardShadow = "";
|
|
@@ -34,13 +35,13 @@ function getinteractiveStyles(_ref3) {
|
|
|
34
35
|
var isInteractive = _ref3.isInteractive,
|
|
35
36
|
isFrameVisible = _ref3.isFrameVisible;
|
|
36
37
|
var visibleFrameStyles = isFrameVisible ? visibleStyles : '';
|
|
37
|
-
var interactiveFrameStyles = isInteractive ? "\n &:hover {\n ".concat(visibleStyles, "\n }\n &:active {\n background-color: ").concat(colors.B50, ";\n }\n") : '';
|
|
38
|
+
var interactiveFrameStyles = isInteractive ? "\n &:hover {\n ".concat(visibleStyles, "\n }\n &:active {\n background-color: ").concat(token('color.background.selected', colors.B50), ";\n }\n") : '';
|
|
38
39
|
return "".concat(visibleFrameStyles).concat(interactiveFrameStyles);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
function selected(_ref4) {
|
|
42
43
|
var isSelected = _ref4.isSelected;
|
|
43
|
-
return isSelected ? "\n ".concat(visibleStyles, "\n &::after {\n cursor: pointer;\n box-shadow: 0 0 0 3px ").concat(colors.B100, ";\n content: '';\n outline: none;\n position: absolute;\n height: 100%;\n width: 100%;\n left: 0;\n ").concat(borderRadius, "\n }\n ") : '';
|
|
44
|
+
return isSelected ? "\n ".concat(visibleStyles, "\n &::after {\n cursor: pointer;\n box-shadow: 0 0 0 3px ").concat(token('color.border.selected', colors.B100), ";\n content: '';\n outline: none;\n position: absolute;\n height: 100%;\n width: 100%;\n left: 0;\n ").concat(borderRadius, "\n }\n ") : '';
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
var height = function height(_ref5) {
|
|
@@ -52,7 +53,7 @@ var wrapperStyles = function wrapperStyles(props) {
|
|
|
52
53
|
return "\n ".concat(borderRadius, "\n ").concat(minWidth(props), "\n ").concat(maxWidth(props), "\n ").concat(getinteractiveStyles(props), "\n ").concat(visible(props), "\n display: inline-flex;\n flex-direction: column;\n box-sizing: border-box;\n font-family: ").concat(fontFamily(), ";\n width: 100%;\n user-select: none;\n line-height: initial;\n transition: background 0.3s;\n position: relative;\n ").concat(height(props), ";\n ").concat(selected(props), "\n\n &:after {\n content: '';\n background: transparent;\n transition: background 0.3s, box-shadow 0.3s;\n position: absolute;\n width: calc(100% + ").concat(gridSize(2), ");\n height: calc(100% + ").concat(gridSize(1), ");\n left: -").concat(gridSize(1), ";\n ").concat(borderRadius, "\n }\n");
|
|
53
54
|
};
|
|
54
55
|
|
|
55
|
-
var visibleStyles = "\n background-color: ".concat(colors.N30, ";\n\n &:after {\n background: ").concat(colors.N30, " !important;\n }\n .embed-header {\n opacity: 1;\n }");
|
|
56
|
+
var visibleStyles = "\n background-color: ".concat(token('color.background.neutral.subtle', colors.N30), ";\n\n &:after {\n background: ").concat(token('color.background.neutral', colors.N30), " !important;\n }\n .embed-header {\n opacity: 1;\n }");
|
|
56
57
|
|
|
57
58
|
function visible(_ref6) {
|
|
58
59
|
var isVisible = _ref6.isVisible;
|
|
@@ -66,12 +67,12 @@ export var Wrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedT
|
|
|
66
67
|
return wrapperStyles(props);
|
|
67
68
|
});
|
|
68
69
|
export var embedHeaderHeight = 32;
|
|
69
|
-
export var Header = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: ", "px;\n position: absolute;\n z-index: 1;\n width: 100%;\n display: flex;\n align-items: center;\n color: ", ";\n opacity: 0;\n transition: 300ms opacity cubic-bezier(0.15, 1, 0.3, 1);\n"])), embedHeaderHeight, colors.N300);
|
|
70
|
+
export var Header = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: ", "px;\n position: absolute;\n z-index: 1;\n width: 100%;\n display: flex;\n align-items: center;\n color: ", ";\n opacity: 0;\n transition: 300ms opacity cubic-bezier(0.15, 1, 0.3, 1);\n"])), embedHeaderHeight, token('color.icon', colors.N300));
|
|
70
71
|
export var IconWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n ", "\n ", " margin-right: 4px;\n"])), borderRadius, size(16), function (_ref7) {
|
|
71
72
|
var isPlaceholder = _ref7.isPlaceholder;
|
|
72
73
|
|
|
73
74
|
if (isPlaceholder) {
|
|
74
|
-
return "\n background-color: ".concat(colors.N30, ";\n ");
|
|
75
|
+
return "\n background-color: ".concat(token('color.skeleton', colors.N30), ";\n ");
|
|
75
76
|
} else {
|
|
76
77
|
return '';
|
|
77
78
|
}
|
|
@@ -80,19 +81,19 @@ export var TextWrapper = styled.div(_templateObject5 || (_templateObject5 = _tag
|
|
|
80
81
|
var isPlaceholder = _ref8.isPlaceholder;
|
|
81
82
|
|
|
82
83
|
if (isPlaceholder) {
|
|
83
|
-
return "\n ".concat(borderRadius, "\n width: 125px;\n height: 12px;\n background-color: ").concat(colors.N30, ";\n ");
|
|
84
|
+
return "\n ".concat(borderRadius, "\n width: 125px;\n height: 12px;\n background-color: ").concat(token('color.skeleton', colors.N30), ";\n ");
|
|
84
85
|
} else {
|
|
85
86
|
return '';
|
|
86
87
|
}
|
|
87
|
-
}, colors.N300, ellipsis('none'));
|
|
88
|
+
}, token('color.text.subtlest', colors.N300), ellipsis('none'));
|
|
88
89
|
// NB: `overflow` is kept as `hidden` since
|
|
89
90
|
// the internal contents of the `iframe` should
|
|
90
91
|
// manage scrolling behaviour.
|
|
91
|
-
export var Content = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n background-color:
|
|
92
|
+
export var Content = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n background-color: ", ";\n position: absolute;\n z-index: 1;\n width: 100%;\n top: ", ";\n overflow: hidden;\n height: calc(100% - ", ");\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n"])), borderRadius, cardShadow, token('elevation.surface', 'white'), gridSize(4), gridSize(4), function (_ref9) {
|
|
92
93
|
var isInteractive = _ref9.isInteractive;
|
|
93
94
|
|
|
94
95
|
if (isInteractive) {
|
|
95
|
-
return "\n .".concat(className, ":hover & {\n box-shadow: 0 4px 8px -2px rgba(23, 43, 77, 0.32)
|
|
96
|
+
return "\n .".concat(className, ":hover & {\n box-shadow: ").concat(token('elevation.shadow.overlay', '0 4px 8px -2px rgba(23, 43, 77, 0.32), 0 0 1px rgba(23, 43, 77, 0.25)'), ";\n }\n ");
|
|
96
97
|
} else {
|
|
97
98
|
return '';
|
|
98
99
|
}
|
|
@@ -103,11 +104,11 @@ export var Image = styled.img(_templateObject7 || (_templateObject7 = _taggedTem
|
|
|
103
104
|
}, borderRadius);
|
|
104
105
|
export var maxAvatarCount = 6;
|
|
105
106
|
export var ContentWrapper = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n padding: 8px 12px 12px 12px;\n"])));
|
|
106
|
-
export var Title = styled.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 16px;\n font-weight: 500;\n line-height: ", ";\n max-height: ", "px;\n overflow: hidden;\n"])), colors.N900, 20 / 16, 20 * 4);
|
|
107
|
-
export var Byline = styled.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin-top: 4px;\n color: ", ";\n font-size: 12px;\n font-weight: normal;\n line-height: ", ";\n ", ";\n"])), colors.N300, 16 / 12, ellipsis('100%'));
|
|
108
|
-
export var Description = styled.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-top: 7px;\n color: ", ";\n font-size: 12px;\n font-weight: normal;\n line-height: ", ";\n max-height: ", "px;\n overflow: hidden;\n"])), colors.N800, 18 / 12, 18 * 3);
|
|
107
|
+
export var Title = styled.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 16px;\n font-weight: 500;\n line-height: ", ";\n max-height: ", "px;\n overflow: hidden;\n"])), token('color.text', colors.N900), 20 / 16, 20 * 4);
|
|
108
|
+
export var Byline = styled.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin-top: 4px;\n color: ", ";\n font-size: 12px;\n font-weight: normal;\n line-height: ", ";\n ", ";\n"])), token('color.text.subtlest', colors.N300), 16 / 12, ellipsis('100%'));
|
|
109
|
+
export var Description = styled.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-top: 7px;\n color: ", ";\n font-size: 12px;\n font-weight: normal;\n line-height: ", ";\n max-height: ", "px;\n overflow: hidden;\n"])), token('color.text', colors.N800), 18 / 12, 18 * 3);
|
|
109
110
|
export var ResolvedViewIconWrapper = styled.div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-top: 4px;\n"])));
|
|
110
|
-
export var Thumbnail = styled.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n ", "\n ", "\n float: right;\n margin: 4px 0 12px 12px;\n background-color: ", ";\n background-image: url(", ");\n background-size: cover;\n"])), borderRadius, size(48), colors.N30, function (_ref11) {
|
|
111
|
+
export var Thumbnail = styled.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n ", "\n ", "\n float: right;\n margin: 4px 0 12px 12px;\n background-color: ", ";\n background-image: url(", ");\n background-size: cover;\n"])), borderRadius, size(48), token('color.skeleton', colors.N30), function (_ref11) {
|
|
111
112
|
var src = _ref11.src;
|
|
112
113
|
return src;
|
|
113
114
|
});
|
|
@@ -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';
|
|
@@ -22,7 +23,7 @@ export var EmbedCardErroredView = function EmbedCardErroredView(_ref) {
|
|
|
22
23
|
testId: testId
|
|
23
24
|
}, jsx(ErrorIcon, {
|
|
24
25
|
size: "small",
|
|
25
|
-
primaryColor: R300,
|
|
26
|
+
primaryColor: token('color.icon.danger', R300),
|
|
26
27
|
label: "error-icon"
|
|
27
28
|
}), jsx("span", {
|
|
28
29
|
css: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
3
3
|
|
|
4
|
-
var _templateObject, _templateObject2, _sizeToSpacing;
|
|
4
|
+
var _templateObject, _templateObject2, _templateObject3, _sizeToSpacing;
|
|
5
5
|
|
|
6
6
|
/** @jsx jsx */
|
|
7
7
|
import React from 'react';
|
|
@@ -32,7 +32,18 @@ var getIconStyles = function getIconStyles(size) {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
var getButtonStyle = function getButtonStyle(size, iconOnly) {
|
|
35
|
-
|
|
35
|
+
switch (size) {
|
|
36
|
+
case SmartLinkSize.Large:
|
|
37
|
+
return iconOnly ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n button,\n button:hover,\n button:focus,\n button:active {\n padding: 0;\n > span {\n margin: 0;\n }\n }\n "]))) : '';
|
|
38
|
+
|
|
39
|
+
case SmartLinkSize.Small:
|
|
40
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: 0.75rem;\n font-weight: 500;\n line-height: 1rem;\n button,\n button:hover,\n button:focus,\n button:active {\n line-height: 1rem;\n ", "\n }\n "])), iconOnly ? "\n padding: 0.125rem;\n " : "\n padding-left: 0.25rem;\n padding-right: 0.25rem;\n ");
|
|
41
|
+
|
|
42
|
+
case SmartLinkSize.XLarge:
|
|
43
|
+
case SmartLinkSize.Medium:
|
|
44
|
+
default:
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
36
47
|
};
|
|
37
48
|
|
|
38
49
|
var ActionIcon = function ActionIcon(_ref) {
|
|
@@ -46,6 +57,14 @@ var ActionIcon = function ActionIcon(_ref) {
|
|
|
46
57
|
};
|
|
47
58
|
|
|
48
59
|
export var sizeToSpacing = (_sizeToSpacing = {}, _defineProperty(_sizeToSpacing, SmartLinkSize.Small, 'none'), _defineProperty(_sizeToSpacing, SmartLinkSize.Medium, 'compact'), _defineProperty(_sizeToSpacing, SmartLinkSize.Large, 'compact'), _defineProperty(_sizeToSpacing, SmartLinkSize.XLarge, 'default'), _sizeToSpacing);
|
|
60
|
+
/**
|
|
61
|
+
* An action that can be triggered with an on click.
|
|
62
|
+
* @public
|
|
63
|
+
* @param {ActionProps} ActionProps - The props necessary for the Action.
|
|
64
|
+
* @see DeleteAction
|
|
65
|
+
* @see EditAction
|
|
66
|
+
* @see CustomAction
|
|
67
|
+
*/
|
|
49
68
|
|
|
50
69
|
var Action = function Action(_ref2) {
|
|
51
70
|
var _ref2$appearance = _ref2.appearance,
|
|
@@ -60,7 +79,8 @@ var Action = function Action(_ref2) {
|
|
|
60
79
|
_ref2$iconPosition = _ref2.iconPosition,
|
|
61
80
|
iconPosition = _ref2$iconPosition === void 0 ? 'before' : _ref2$iconPosition,
|
|
62
81
|
tooltipMessage = _ref2.tooltipMessage,
|
|
63
|
-
asDropDownItem = _ref2.asDropDownItem
|
|
82
|
+
asDropDownItem = _ref2.asDropDownItem,
|
|
83
|
+
overrideCss = _ref2.overrideCss;
|
|
64
84
|
|
|
65
85
|
if (!onClick) {
|
|
66
86
|
return null;
|
|
@@ -89,7 +109,8 @@ var Action = function Action(_ref2) {
|
|
|
89
109
|
return jsx(Tooltip, {
|
|
90
110
|
content: tooltipMessage
|
|
91
111
|
}, jsx("div", {
|
|
92
|
-
css: getButtonStyle(size, iconOnly)
|
|
112
|
+
css: [getButtonStyle(size, iconOnly), overrideCss],
|
|
113
|
+
"data-testid": "".concat(testId, "-button-wrapper")
|
|
93
114
|
}, jsx(Button, {
|
|
94
115
|
spacing: sizeToSpacing[size],
|
|
95
116
|
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 var 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 var 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 var CustomAction = createUIAction(ActionName.CustomAction);
|
|
@@ -15,6 +15,12 @@ import Button from '@atlaskit/button/standard-button';
|
|
|
15
15
|
import MoreIcon from '@atlaskit/icon/glyph/more';
|
|
16
16
|
import { sizeToSpacing } from '../../actions/action';
|
|
17
17
|
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n line-height: 1rem;\n"])));
|
|
18
|
+
/**
|
|
19
|
+
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
20
|
+
* preferences.
|
|
21
|
+
* @param {ActionGroupProps} ActionGroupProps
|
|
22
|
+
* @see Action
|
|
23
|
+
*/
|
|
18
24
|
|
|
19
25
|
var ActionGroup = function ActionGroup(_ref) {
|
|
20
26
|
var _ref$items = _ref.items,
|
|
@@ -11,6 +11,13 @@ import { getBaseStyles, getGapSize, renderChildren } from '../utils';
|
|
|
11
11
|
var getBlockStyles = function getBlockStyles(direction, size) {
|
|
12
12
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n justify-content: flex-start;\n [data-separator] + [data-separator]:before {\n content: '\u2022';\n margin-right: ", "rem;\n }\n"])), getBaseStyles(direction, size), getGapSize(size));
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* A block represents a collection of elements and actions that are arranged in a row.
|
|
16
|
+
* All elements and actions should be contained within a Block.
|
|
17
|
+
* @param {ActionGroupProps} ActionGroupProps
|
|
18
|
+
* @see Action
|
|
19
|
+
*/
|
|
20
|
+
|
|
14
21
|
|
|
15
22
|
var Block = function Block(_ref) {
|
|
16
23
|
var children = _ref.children,
|
|
@@ -20,9 +27,9 @@ var Block = function Block(_ref) {
|
|
|
20
27
|
size = _ref$size === void 0 ? SmartLinkSize.Medium : _ref$size,
|
|
21
28
|
_ref$testId = _ref.testId,
|
|
22
29
|
testId = _ref$testId === void 0 ? 'smart-block' : _ref$testId,
|
|
23
|
-
|
|
30
|
+
overrideCss = _ref.overrideCss;
|
|
24
31
|
return jsx("div", {
|
|
25
|
-
css: [getBlockStyles(direction, size),
|
|
32
|
+
css: [getBlockStyles(direction, size), overrideCss],
|
|
26
33
|
"data-smart-block": true,
|
|
27
34
|
"data-testid": testId
|
|
28
35
|
}, renderChildren(children, size));
|
|
@@ -22,12 +22,18 @@ var getAlignmentStyles = function getAlignmentStyles(align) {
|
|
|
22
22
|
export var getElementGroupStyles = function getElementGroupStyles(direction, size, align, width) {
|
|
23
23
|
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n ", "\n min-width: 10%;\n ", "\n"])), getBaseStyles(direction, size), getAlignmentStyles(align), width === SmartLinkWidth.Flexible ? "flex: 1 3;" : '');
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
27
|
+
* preferences.
|
|
28
|
+
* @param {ActionGroupProps} ActionGroupProps
|
|
29
|
+
* @see Action
|
|
30
|
+
*/
|
|
25
31
|
|
|
26
32
|
var ElementGroup = function ElementGroup(_ref) {
|
|
27
33
|
var _ref$align = _ref.align,
|
|
28
34
|
align = _ref$align === void 0 ? SmartLinkAlignment.Left : _ref$align,
|
|
29
35
|
children = _ref.children,
|
|
30
|
-
|
|
36
|
+
overrideCss = _ref.overrideCss,
|
|
31
37
|
_ref$direction = _ref.direction,
|
|
32
38
|
direction = _ref$direction === void 0 ? SmartLinkDirection.Horizontal : _ref$direction,
|
|
33
39
|
_ref$size = _ref.size,
|
|
@@ -37,7 +43,7 @@ var ElementGroup = function ElementGroup(_ref) {
|
|
|
37
43
|
_ref$width = _ref.width,
|
|
38
44
|
width = _ref$width === void 0 ? SmartLinkWidth.FitToContent : _ref$width;
|
|
39
45
|
return 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
|
var FooterBlock = function FooterBlock(props) {
|
|
10
16
|
var status = props.status,
|
|
@@ -56,6 +56,13 @@ var getMaxLines = function getMaxLines(maxLines) {
|
|
|
56
56
|
|
|
57
57
|
return maxLines;
|
|
58
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* Represents a MetadataBlock, designed to contain groups of metadata in the form of elements.
|
|
61
|
+
* Accepts an array of elements to be shown either primary (left hand side) or secondary (right hand side).
|
|
62
|
+
* @param {MetadataBlockProps} MetadataBlockProps
|
|
63
|
+
* @see Block
|
|
64
|
+
*/
|
|
65
|
+
|
|
59
66
|
|
|
60
67
|
var MetadataBlock = function MetadataBlock(_ref) {
|
|
61
68
|
var _ref$maxLines = _ref.maxLines,
|
|
@@ -83,12 +90,12 @@ var MetadataBlock = function MetadataBlock(_ref) {
|
|
|
83
90
|
testId: "".concat(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));
|
|
@@ -5,6 +5,11 @@ import React from 'react';
|
|
|
5
5
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
6
6
|
import Block from '../block';
|
|
7
7
|
import { Preview } from '../../elements';
|
|
8
|
+
/**
|
|
9
|
+
* Represents a PreviewBlock, which typically contains media or other large format content.
|
|
10
|
+
* @param {PreviewBlock} PreviewBlock
|
|
11
|
+
* @see Block
|
|
12
|
+
*/
|
|
8
13
|
|
|
9
14
|
var PreviewBlock = function PreviewBlock(_ref) {
|
|
10
15
|
var _ref$status = _ref.status,
|
|
@@ -9,6 +9,11 @@ import { getMaxLines } from '../../utils';
|
|
|
9
9
|
var DEFAULT_MAX_LINES = 3;
|
|
10
10
|
var MAXIMUM_MAX_LINES = 3;
|
|
11
11
|
var MINIMUM_MAX_LINES = 1;
|
|
12
|
+
/**
|
|
13
|
+
* Represents a SnippetBlock, which is used to display longer form text content, like descriptions.
|
|
14
|
+
* @param {SnippetBlock} SnippetBlock
|
|
15
|
+
* @see Block
|
|
16
|
+
*/
|
|
12
17
|
|
|
13
18
|
var SnippetBlock = function SnippetBlock(_ref) {
|
|
14
19
|
var _ref$maxLines = _ref.maxLines,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
3
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
4
|
+
var _excluded = ["actionGroup", "retry", "position", "testId", "title"];
|
|
3
5
|
|
|
4
6
|
var _templateObject, _templateObject2;
|
|
5
7
|
|
|
@@ -7,42 +9,57 @@ var _templateObject, _templateObject2;
|
|
|
7
9
|
import React from 'react';
|
|
8
10
|
import { FormattedMessage } from 'react-intl-next';
|
|
9
11
|
import { css, jsx } from '@emotion/core';
|
|
12
|
+
import { LinkIcon } from '../../../elements';
|
|
13
|
+
import Block from '../../block';
|
|
10
14
|
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize } from '../../../../../../constants';
|
|
11
15
|
import { getLinkLineHeight, getLinkSizeStyles, getTruncateStyles } from '../../../utils';
|
|
12
16
|
import ElementGroup from '../../element-group';
|
|
13
17
|
import { tokens } from '../../../../../../utils/token';
|
|
14
|
-
import { BaseTitleBlockComponent } from '../utils';
|
|
15
18
|
var actionStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n :hover {\n color: ", ";\n text-decoration: underline;\n }\n"])), tokens.errorMessageHover);
|
|
16
19
|
|
|
17
20
|
var getMessageStyles = function getMessageStyles(size, hasAction) {
|
|
18
21
|
var sizeStyles = getLinkSizeStyles(size);
|
|
19
22
|
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n justify-content: flex-end;\n ", "\n ", "\n ", "\n color: ", ";\n "])), hasAction ? actionStyles : '', sizeStyles, getTruncateStyles(1, getLinkLineHeight(size)), tokens.errorMessage);
|
|
20
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Represents an Errored TitleBlock view.
|
|
26
|
+
* This will render when a Smart Link did not successfully resolve.
|
|
27
|
+
* This may be a result of a Smart Link not having the correct credentials,
|
|
28
|
+
* or the backend response was errored or malformed.
|
|
29
|
+
* @see TitleBlock
|
|
30
|
+
*/
|
|
21
31
|
|
|
22
|
-
var TitleBlockErroredView = function TitleBlockErroredView(props) {
|
|
23
|
-
var _props$size = props.size,
|
|
24
|
-
size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size,
|
|
25
|
-
retry = props.retry,
|
|
26
|
-
testId = props.testId;
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
var TitleBlockErroredView = function TitleBlockErroredView(_ref) {
|
|
34
|
+
var actionGroup = _ref.actionGroup,
|
|
35
|
+
retry = _ref.retry,
|
|
36
|
+
position = _ref.position,
|
|
37
|
+
testId = _ref.testId,
|
|
38
|
+
title = _ref.title,
|
|
39
|
+
blockProps = _objectWithoutProperties(_ref, _excluded);
|
|
32
40
|
|
|
41
|
+
var _ref2 = retry || {},
|
|
42
|
+
descriptor = _ref2.descriptor,
|
|
43
|
+
onClick = _ref2.onClick,
|
|
44
|
+
values = _ref2.values;
|
|
45
|
+
|
|
46
|
+
var _blockProps$size = blockProps.size,
|
|
47
|
+
size = _blockProps$size === void 0 ? SmartLinkSize.Medium : _blockProps$size;
|
|
33
48
|
var hasAction = onClick !== undefined;
|
|
34
|
-
return jsx(
|
|
35
|
-
|
|
36
|
-
}),
|
|
49
|
+
return jsx(Block, _extends({}, blockProps, {
|
|
50
|
+
testId: "".concat(testId, "-errored-view")
|
|
51
|
+
}), jsx(LinkIcon, {
|
|
52
|
+
position: position
|
|
53
|
+
}), title, descriptor && jsx(ElementGroup, {
|
|
37
54
|
direction: SmartLinkDirection.Horizontal,
|
|
38
55
|
align: SmartLinkAlignment.Right
|
|
39
56
|
}, jsx("span", {
|
|
40
57
|
css: getMessageStyles(size, hasAction),
|
|
41
58
|
onClick: onClick,
|
|
42
59
|
"data-testid": "".concat(testId, "-errored-view-message")
|
|
43
|
-
}, jsx(FormattedMessage, _extends({},
|
|
44
|
-
values:
|
|
45
|
-
})))));
|
|
60
|
+
}, jsx(FormattedMessage, _extends({}, descriptor, {
|
|
61
|
+
values: values
|
|
62
|
+
})))), actionGroup);
|
|
46
63
|
};
|
|
47
64
|
|
|
48
65
|
export default TitleBlockErroredView;
|
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
5
|
+
var _excluded = ["actions", "anchorTarget", "maxLines", "onClick", "overrideCss", "status", "showActionOnHover", "testId", "text", "theme"];
|
|
6
|
+
|
|
7
|
+
var _templateObject, _templateObject2;
|
|
8
|
+
|
|
9
|
+
import React, { useState } from 'react';
|
|
10
|
+
import { css } from '@emotion/core';
|
|
5
11
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
6
12
|
import TitleBlockResolvedView from './resolved';
|
|
7
13
|
import TitleBlockErroredView from './errored';
|
|
8
14
|
import TitleBlockResolvingView from './resolving';
|
|
15
|
+
import ActionGroup from '../action-group';
|
|
16
|
+
import { Title } from '../../elements';
|
|
9
17
|
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
+
var getActionStyles = function getActionStyles(showOnHover, isOpen) {
|
|
19
|
+
if (showOnHover && !isOpen) {
|
|
20
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .actions-button-group {\n visibility: hidden;\n }\n\n &:hover {\n .actions-button-group {\n visibility: visible;\n }\n }\n "])));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
16
23
|
|
|
24
|
+
var getTitleBlockViewComponent = function getTitleBlockViewComponent(status) {
|
|
17
25
|
switch (status) {
|
|
18
26
|
case SmartLinkStatus.Pending:
|
|
19
27
|
case SmartLinkStatus.Resolving:
|
|
20
|
-
return
|
|
21
|
-
testId: testId
|
|
22
|
-
}));
|
|
28
|
+
return TitleBlockResolvingView;
|
|
23
29
|
|
|
24
30
|
case SmartLinkStatus.Resolved:
|
|
25
|
-
return
|
|
26
|
-
testId: testId
|
|
27
|
-
}));
|
|
31
|
+
return TitleBlockResolvedView;
|
|
28
32
|
|
|
29
33
|
case SmartLinkStatus.Unauthorized:
|
|
30
34
|
case SmartLinkStatus.Forbidden:
|
|
@@ -32,10 +36,68 @@ var TitleBlock = function TitleBlock(_ref) {
|
|
|
32
36
|
case SmartLinkStatus.Errored:
|
|
33
37
|
case SmartLinkStatus.Fallback:
|
|
34
38
|
default:
|
|
35
|
-
return
|
|
36
|
-
testId: testId
|
|
37
|
-
}));
|
|
39
|
+
return TitleBlockErroredView;
|
|
38
40
|
}
|
|
39
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Represents a TitleBlock, which is the foundation of all Flexible Smart Links.
|
|
44
|
+
* This contains an icon, the link, and any associated metadata and actions in one block.
|
|
45
|
+
* The TitleBlock will also render differently given the state of the smart link.
|
|
46
|
+
* This can be found in the corresponding Resolving, Resolved and Errored views.
|
|
47
|
+
* @param {TitleBlockProps} TitleBlockProps
|
|
48
|
+
* @see Block
|
|
49
|
+
* @see TitleBlockResolvingView
|
|
50
|
+
* @see TitleBlockResolvedView
|
|
51
|
+
* @see TitleBlockErroredView
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
var TitleBlock = function TitleBlock(_ref) {
|
|
56
|
+
var _ref$actions = _ref.actions,
|
|
57
|
+
actions = _ref$actions === void 0 ? [] : _ref$actions,
|
|
58
|
+
anchorTarget = _ref.anchorTarget,
|
|
59
|
+
maxLines = _ref.maxLines,
|
|
60
|
+
onClick = _ref.onClick,
|
|
61
|
+
overrideCss = _ref.overrideCss,
|
|
62
|
+
_ref$status = _ref.status,
|
|
63
|
+
status = _ref$status === void 0 ? SmartLinkStatus.Fallback : _ref$status,
|
|
64
|
+
showActionOnHover = _ref.showActionOnHover,
|
|
65
|
+
_ref$testId = _ref.testId,
|
|
66
|
+
testId = _ref$testId === void 0 ? 'smart-block-title' : _ref$testId,
|
|
67
|
+
text = _ref.text,
|
|
68
|
+
theme = _ref.theme,
|
|
69
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
70
|
+
|
|
71
|
+
var _useState = useState(false),
|
|
72
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
73
|
+
actionDropdownOpen = _useState2[0],
|
|
74
|
+
setActionDropdownOpen = _useState2[1];
|
|
75
|
+
|
|
76
|
+
var actionGroup = actions.length > 0 && /*#__PURE__*/React.createElement(ActionGroup, {
|
|
77
|
+
items: actions,
|
|
78
|
+
visibleButtonsNum: showActionOnHover ? 1 : 2,
|
|
79
|
+
onDropdownOpenChange: function onDropdownOpenChange(isOpen) {
|
|
80
|
+
return setActionDropdownOpen(isOpen);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
var actionStyles = getActionStyles(showActionOnHover, actionDropdownOpen);
|
|
84
|
+
var combinedCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", " ", "\n "])), actionStyles, overrideCss);
|
|
85
|
+
var overrideText = !!text ? {
|
|
86
|
+
text: text
|
|
87
|
+
} : {};
|
|
88
|
+
var title = /*#__PURE__*/React.createElement(Title, _extends({
|
|
89
|
+
maxLines: maxLines,
|
|
90
|
+
onClick: onClick,
|
|
91
|
+
target: anchorTarget,
|
|
92
|
+
theme: theme
|
|
93
|
+
}, overrideText));
|
|
94
|
+
var Component = getTitleBlockViewComponent(status);
|
|
95
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
96
|
+
actionGroup: actionGroup,
|
|
97
|
+
overrideCss: combinedCss,
|
|
98
|
+
testId: testId,
|
|
99
|
+
title: title
|
|
100
|
+
}));
|
|
101
|
+
};
|
|
40
102
|
|
|
41
103
|
export default TitleBlock;
|
|
@@ -1,14 +1,45 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["actionGroup", "metadata", "position", "subtitle", "testId", "text", "title"];
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
5
|
+
import { LinkIcon } from '../../../elements';
|
|
6
|
+
import Block from '../../block';
|
|
7
|
+
import ElementGroup from '../../element-group';
|
|
8
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkWidth } from '../../../../../../constants';
|
|
9
|
+
import { renderElementItems } from '../../utils';
|
|
10
|
+
/**
|
|
11
|
+
* This renders a fully resolved TitleBlock.
|
|
12
|
+
* This should render when a Smart Link returns a valid response.
|
|
13
|
+
* @see TitleBlock
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
|
|
17
|
+
var actionGroup = _ref.actionGroup,
|
|
18
|
+
_ref$metadata = _ref.metadata,
|
|
19
|
+
metadata = _ref$metadata === void 0 ? [] : _ref$metadata,
|
|
20
|
+
position = _ref.position,
|
|
21
|
+
_ref$subtitle = _ref.subtitle,
|
|
22
|
+
subtitle = _ref$subtitle === void 0 ? [] : _ref$subtitle,
|
|
23
|
+
testId = _ref.testId,
|
|
24
|
+
text = _ref.text,
|
|
25
|
+
title = _ref.title,
|
|
26
|
+
blockProps = _objectWithoutProperties(_ref, _excluded);
|
|
7
27
|
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
28
|
+
var metadataElements = renderElementItems(metadata);
|
|
29
|
+
var subtitleElements = renderElementItems(subtitle);
|
|
30
|
+
return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
|
|
31
|
+
testId: "".concat(testId, "-resolved-view")
|
|
32
|
+
}), /*#__PURE__*/React.createElement(LinkIcon, {
|
|
33
|
+
position: position
|
|
34
|
+
}), /*#__PURE__*/React.createElement(ElementGroup, {
|
|
35
|
+
direction: SmartLinkDirection.Vertical,
|
|
36
|
+
width: SmartLinkWidth.Flexible
|
|
37
|
+
}, title, subtitleElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
38
|
+
direction: SmartLinkDirection.Horizontal
|
|
39
|
+
}, subtitleElements)), metadataElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
40
|
+
direction: SmartLinkDirection.Horizontal,
|
|
41
|
+
align: SmartLinkAlignment.Right
|
|
42
|
+
}, metadataElements), actionGroup);
|
|
12
43
|
};
|
|
13
44
|
|
|
14
45
|
export default TitleBlockResolvedView;
|