@atlaskit/smart-card 23.7.2 → 23.8.0
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 +12 -0
- package/dist/cjs/constants.js +14 -2
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +3 -1
- package/dist/cjs/i18n/cs.js +6 -1
- package/dist/cjs/i18n/da.js +7 -1
- package/dist/cjs/i18n/de.js +6 -1
- package/dist/cjs/i18n/en.js +8 -1
- package/dist/cjs/i18n/en_GB.js +8 -1
- package/dist/cjs/i18n/es.js +5 -1
- package/dist/cjs/i18n/fi.js +7 -1
- package/dist/cjs/i18n/fr.js +7 -1
- package/dist/cjs/i18n/hu.js +6 -1
- package/dist/cjs/i18n/it.js +7 -1
- package/dist/cjs/i18n/ja.js +11 -5
- package/dist/cjs/i18n/ko.js +7 -1
- package/dist/cjs/i18n/nb.js +6 -1
- package/dist/cjs/i18n/nl.js +7 -1
- package/dist/cjs/i18n/pl.js +6 -1
- package/dist/cjs/i18n/pt_BR.js +7 -1
- package/dist/cjs/i18n/ru.js +7 -1
- package/dist/cjs/i18n/sv.js +7 -1
- package/dist/cjs/i18n/th.js +7 -1
- package/dist/cjs/i18n/tr.js +6 -1
- package/dist/cjs/i18n/uk.js +6 -1
- package/dist/cjs/i18n/vi.js +7 -1
- package/dist/cjs/i18n/zh.js +6 -1
- package/dist/cjs/i18n/zh_TW.js +6 -1
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +41 -13
- package/dist/cjs/utils/analytics/analytics.js +128 -96
- package/dist/cjs/utils/analytics/index.js +12 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/components/flexible/footer/index.js +1 -1
- package/dist/cjs/view/BlockCard/index.js +4 -2
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleNotFoundView.js +1 -1
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +3 -3
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +17 -4
- package/dist/cjs/view/CardWithUrl/component.js +3 -1
- package/dist/cjs/view/EmbedCard/index.js +6 -2
- package/dist/cjs/view/EmbedCard/views/UnauthorisedView.js +21 -4
- package/dist/cjs/view/EmbedModal/components/analytics/index.js +4 -2
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +11 -10
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +6 -4
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +1 -1
- package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +26 -7
- package/dist/cjs/view/HoverCard/index.js +6 -3
- package/dist/cjs/view/HoverCard/utils.js +1 -4
- package/dist/cjs/view/InlineCard/ErroredView/index.js +6 -11
- package/dist/cjs/view/InlineCard/ForbiddenView/index.js +17 -21
- package/dist/cjs/view/InlineCard/Frame/index.js +4 -4
- package/dist/cjs/view/InlineCard/Frame/styled.js +22 -34
- package/dist/cjs/view/InlineCard/IconAndTitleLayout/index.js +52 -7
- package/dist/cjs/view/InlineCard/ResolvingView/index.js +3 -5
- package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +10 -12
- package/dist/cjs/view/InlineCard/index.js +2 -1
- package/dist/cjs/view/InlineCard/styled.js +2 -2
- package/dist/cjs/view/common/UnauthorisedViewContent.js +14 -3
- package/dist/es2019/constants.js +12 -1
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +2 -1
- package/dist/es2019/i18n/cs.js +6 -1
- package/dist/es2019/i18n/da.js +7 -1
- package/dist/es2019/i18n/de.js +6 -1
- package/dist/es2019/i18n/en.js +8 -1
- package/dist/es2019/i18n/en_GB.js +8 -1
- package/dist/es2019/i18n/es.js +5 -1
- package/dist/es2019/i18n/fi.js +7 -1
- package/dist/es2019/i18n/fr.js +7 -1
- package/dist/es2019/i18n/hu.js +6 -1
- package/dist/es2019/i18n/it.js +7 -1
- package/dist/es2019/i18n/ja.js +11 -5
- package/dist/es2019/i18n/ko.js +7 -1
- package/dist/es2019/i18n/nb.js +6 -1
- package/dist/es2019/i18n/nl.js +7 -1
- package/dist/es2019/i18n/pl.js +6 -1
- package/dist/es2019/i18n/pt_BR.js +7 -1
- package/dist/es2019/i18n/ru.js +7 -1
- package/dist/es2019/i18n/sv.js +7 -1
- package/dist/es2019/i18n/th.js +7 -1
- package/dist/es2019/i18n/tr.js +6 -1
- package/dist/es2019/i18n/uk.js +6 -1
- package/dist/es2019/i18n/vi.js +7 -1
- package/dist/es2019/i18n/zh.js +6 -1
- package/dist/es2019/i18n/zh_TW.js +6 -1
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +33 -8
- package/dist/es2019/utils/analytics/analytics.js +28 -4
- package/dist/es2019/utils/analytics/index.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/components/flexible/footer/index.js +1 -1
- package/dist/es2019/view/BlockCard/index.js +4 -2
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleNotFoundView.js +1 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -4
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +15 -3
- package/dist/es2019/view/CardWithUrl/component.js +2 -1
- package/dist/es2019/view/EmbedCard/index.js +6 -2
- package/dist/es2019/view/EmbedCard/views/UnauthorisedView.js +14 -3
- package/dist/es2019/view/EmbedModal/components/analytics/index.js +3 -2
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +11 -10
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +8 -6
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +3 -3
- package/dist/es2019/view/HoverCard/components/views/unauthorised/index.js +23 -7
- package/dist/es2019/view/HoverCard/index.js +6 -3
- package/dist/es2019/view/HoverCard/utils.js +0 -1
- package/dist/es2019/view/InlineCard/ErroredView/index.js +7 -9
- package/dist/es2019/view/InlineCard/ForbiddenView/index.js +8 -9
- package/dist/es2019/view/InlineCard/Frame/index.js +4 -4
- package/dist/es2019/view/InlineCard/Frame/styled.js +18 -31
- package/dist/es2019/view/InlineCard/IconAndTitleLayout/index.js +47 -6
- package/dist/es2019/view/InlineCard/ResolvingView/index.js +3 -5
- package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +11 -11
- package/dist/es2019/view/InlineCard/index.js +2 -1
- package/dist/es2019/view/InlineCard/styled.js +1 -6
- package/dist/es2019/view/common/UnauthorisedViewContent.js +18 -11
- package/dist/esm/constants.js +12 -1
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +2 -1
- package/dist/esm/i18n/cs.js +6 -1
- package/dist/esm/i18n/da.js +7 -1
- package/dist/esm/i18n/de.js +6 -1
- package/dist/esm/i18n/en.js +8 -1
- package/dist/esm/i18n/en_GB.js +8 -1
- package/dist/esm/i18n/es.js +5 -1
- package/dist/esm/i18n/fi.js +7 -1
- package/dist/esm/i18n/fr.js +7 -1
- package/dist/esm/i18n/hu.js +6 -1
- package/dist/esm/i18n/it.js +7 -1
- package/dist/esm/i18n/ja.js +11 -5
- package/dist/esm/i18n/ko.js +7 -1
- package/dist/esm/i18n/nb.js +6 -1
- package/dist/esm/i18n/nl.js +7 -1
- package/dist/esm/i18n/pl.js +6 -1
- package/dist/esm/i18n/pt_BR.js +7 -1
- package/dist/esm/i18n/ru.js +7 -1
- package/dist/esm/i18n/sv.js +7 -1
- package/dist/esm/i18n/th.js +7 -1
- package/dist/esm/i18n/tr.js +6 -1
- package/dist/esm/i18n/uk.js +6 -1
- package/dist/esm/i18n/vi.js +7 -1
- package/dist/esm/i18n/zh.js +6 -1
- package/dist/esm/i18n/zh_TW.js +6 -1
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +42 -14
- package/dist/esm/utils/analytics/analytics.js +118 -92
- package/dist/esm/utils/analytics/index.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/components/flexible/footer/index.js +1 -1
- package/dist/esm/view/BlockCard/index.js +4 -2
- package/dist/esm/view/BlockCard/views/flexible/FlexibleNotFoundView.js +1 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -4
- package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +18 -5
- package/dist/esm/view/CardWithUrl/component.js +2 -1
- package/dist/esm/view/EmbedCard/index.js +6 -2
- package/dist/esm/view/EmbedCard/views/UnauthorisedView.js +15 -4
- package/dist/esm/view/EmbedModal/components/analytics/index.js +3 -2
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +11 -10
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +8 -6
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +3 -3
- package/dist/esm/view/HoverCard/components/views/unauthorised/index.js +27 -9
- package/dist/esm/view/HoverCard/index.js +6 -3
- package/dist/esm/view/HoverCard/utils.js +0 -1
- package/dist/esm/view/InlineCard/ErroredView/index.js +7 -9
- package/dist/esm/view/InlineCard/ForbiddenView/index.js +18 -20
- package/dist/esm/view/InlineCard/Frame/index.js +4 -4
- package/dist/esm/view/InlineCard/Frame/styled.js +17 -31
- package/dist/esm/view/InlineCard/IconAndTitleLayout/index.js +49 -7
- package/dist/esm/view/InlineCard/ResolvingView/index.js +3 -5
- package/dist/esm/view/InlineCard/UnauthorisedView/index.js +11 -11
- package/dist/esm/view/InlineCard/index.js +2 -1
- package/dist/esm/view/InlineCard/styled.js +2 -2
- package/dist/esm/view/common/UnauthorisedViewContent.js +8 -3
- package/dist/types/constants.d.ts +8 -0
- package/dist/types/i18n/cs.d.ts +5 -0
- package/dist/types/i18n/da.d.ts +6 -0
- package/dist/types/i18n/de.d.ts +5 -0
- package/dist/types/i18n/en.d.ts +7 -0
- package/dist/types/i18n/en_GB.d.ts +7 -0
- package/dist/types/i18n/es.d.ts +4 -0
- package/dist/types/i18n/fi.d.ts +6 -0
- package/dist/types/i18n/fr.d.ts +6 -0
- package/dist/types/i18n/hu.d.ts +5 -0
- package/dist/types/i18n/it.d.ts +6 -0
- package/dist/types/i18n/ja.d.ts +6 -0
- package/dist/types/i18n/ko.d.ts +6 -0
- package/dist/types/i18n/nb.d.ts +5 -0
- package/dist/types/i18n/nl.d.ts +6 -0
- package/dist/types/i18n/pl.d.ts +5 -0
- package/dist/types/i18n/pt_BR.d.ts +6 -0
- package/dist/types/i18n/ru.d.ts +6 -0
- package/dist/types/i18n/sv.d.ts +6 -0
- package/dist/types/i18n/th.d.ts +6 -0
- package/dist/types/i18n/tr.d.ts +5 -0
- package/dist/types/i18n/uk.d.ts +5 -0
- package/dist/types/i18n/vi.d.ts +6 -0
- package/dist/types/i18n/zh.d.ts +5 -0
- package/dist/types/i18n/zh_TW.d.ts +5 -0
- package/dist/types/state/actions/index.d.ts +1 -2
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +17 -4
- package/dist/types/state/flexible-ui-context/index.d.ts +8 -4
- package/dist/types/state/hooks/useSmartLink.d.ts +5 -3
- package/dist/types/utils/analytics/analytics.d.ts +4 -2
- package/dist/types/utils/analytics/index.d.ts +1 -1
- package/dist/types/utils/analytics/types.d.ts +2 -0
- package/dist/types/utils/mocks.d.ts +4 -2
- package/dist/types/utils/types.d.ts +1 -1
- package/dist/types/view/BlockCard/components/flexible/footer/index.d.ts +1 -1
- package/dist/types/view/BlockCard/views/flexible/FlexibleUnauthorisedView.d.ts +1 -1
- package/dist/types/view/BlockCard/views/flexible/types.d.ts +17 -13
- package/dist/types/view/Card/types.d.ts +1 -1
- package/dist/types/view/EmbedCard/views/UnauthorisedView.d.ts +3 -0
- package/dist/types/view/HoverCard/components/views/unauthorised/types.d.ts +15 -4
- package/dist/types/view/HoverCard/types.d.ts +0 -2
- package/dist/types/view/HoverCard/utils.d.ts +0 -1
- package/dist/types/view/InlineCard/ErroredView/index.d.ts +1 -1
- package/dist/types/view/InlineCard/ForbiddenView/index.d.ts +1 -1
- package/dist/types/view/InlineCard/Frame/index.d.ts +0 -1
- package/dist/types/view/InlineCard/Frame/styled.d.ts +3 -2
- package/dist/types/view/InlineCard/IconAndTitleLayout/index.d.ts +5 -0
- package/dist/types/view/InlineCard/ResolvingView/index.d.ts +0 -1
- package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +3 -1
- package/dist/types/view/InlineCard/styled.d.ts +1 -1
- package/dist/types/view/common/UnauthorisedViewContent.d.ts +7 -1
- package/package.json +5 -5
- package/report.api.md +15 -1
- package/tmp/api-report-tmp.d.ts +8 -4
|
@@ -10,14 +10,13 @@ import { useSmartLinkRenderers } from '../../../state/renderers';
|
|
|
10
10
|
import { useSmartCardState as useLinkState } from '../../../state/store';
|
|
11
11
|
import HoverCardContent from '../components/HoverCardContent';
|
|
12
12
|
import { HoverCardContainer, CARD_GAP_PX } from '../styled';
|
|
13
|
-
import {
|
|
13
|
+
import { CardDisplay } from '../../../constants';
|
|
14
14
|
export var hoverCardClassName = 'smart-links-hover-preview';
|
|
15
15
|
export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
16
16
|
var children = _ref.children,
|
|
17
17
|
url = _ref.url,
|
|
18
18
|
analyticsHandler = _ref.analyticsHandler,
|
|
19
|
-
analytics = _ref.analytics
|
|
20
|
-
onAuthorize = _ref.onAuthorize;
|
|
19
|
+
analytics = _ref.analytics;
|
|
21
20
|
var delay = 300;
|
|
22
21
|
|
|
23
22
|
var _React$useState = React.useState(false),
|
|
@@ -33,6 +32,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
33
32
|
var parentSpan = useRef(null);
|
|
34
33
|
var renderers = useSmartLinkRenderers();
|
|
35
34
|
var linkState = useLinkState(url);
|
|
35
|
+
var linkStatus = linkState.status;
|
|
36
36
|
var hoverDisplay = 'card';
|
|
37
37
|
var invokeMethod = 'mouse_hover';
|
|
38
38
|
var setMousePosition = useCallback(function (event) {
|
|
@@ -52,12 +52,13 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
52
52
|
analytics.ui.hoverCardDismissedEvent({
|
|
53
53
|
previewDisplay: 'card',
|
|
54
54
|
hoverTime: hoverTime,
|
|
55
|
-
previewInvokeMethod: 'mouse_hover'
|
|
55
|
+
previewInvokeMethod: 'mouse_hover',
|
|
56
|
+
status: linkStatus
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
setIsOpen(false);
|
|
60
|
-
}, [analytics.ui, isOpen]);
|
|
61
|
+
}, [analytics.ui, isOpen, linkStatus]);
|
|
61
62
|
var initHideCard = useCallback(function () {
|
|
62
63
|
if (fadeInTimeoutId.current) {
|
|
63
64
|
clearTimeout(fadeInTimeoutId.current);
|
|
@@ -80,7 +81,8 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
80
81
|
cardOpenTime.current = Date.now();
|
|
81
82
|
analytics.ui.hoverCardViewedEvent({
|
|
82
83
|
previewDisplay: hoverDisplay,
|
|
83
|
-
previewInvokeMethod: invokeMethod
|
|
84
|
+
previewInvokeMethod: invokeMethod,
|
|
85
|
+
status: linkStatus
|
|
84
86
|
});
|
|
85
87
|
} //If these are undefined then popupOffset is undefined and we fallback to default bottom-start placement
|
|
86
88
|
|
|
@@ -95,10 +97,10 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
95
97
|
|
|
96
98
|
setIsOpen(true);
|
|
97
99
|
}, delay);
|
|
98
|
-
}, [isOpen, setMousePosition, analytics.ui]);
|
|
100
|
+
}, [isOpen, setMousePosition, analytics.ui, linkStatus]);
|
|
99
101
|
var linkActions = useSmartLinkActions({
|
|
100
102
|
url: url,
|
|
101
|
-
appearance:
|
|
103
|
+
appearance: CardDisplay.HoverCardPreview,
|
|
102
104
|
analyticsHandler: analyticsHandler,
|
|
103
105
|
origin: 'smartLinkPreviewHoverCard'
|
|
104
106
|
});
|
|
@@ -134,8 +136,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
134
136
|
onActionClick: onActionClick,
|
|
135
137
|
onResolve: update,
|
|
136
138
|
renderers: renderers,
|
|
137
|
-
url: url
|
|
138
|
-
onAuthorize: onAuthorize
|
|
139
|
+
url: url
|
|
139
140
|
}));
|
|
140
141
|
},
|
|
141
142
|
trigger: function trigger(triggerProps) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
2
2
|
import { extractType } from '@atlaskit/linking-common/extractors';
|
|
3
3
|
import React, { useCallback, useMemo } from 'react';
|
|
4
|
-
import { ActionName, SmartLinkPosition, SmartLinkSize } from '../../../constants';
|
|
4
|
+
import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
|
|
5
5
|
import { extractMetadata } from '../../../extractors/hover/extractMetadata';
|
|
6
6
|
import { getExtensionKey } from '../../../state/helpers';
|
|
7
7
|
import { isSpecialEvent } from '../../../utils';
|
|
8
8
|
import { flexibleUiOptions, titleBlockCss } from '../styled';
|
|
9
|
-
import { getSimulatedMetadata
|
|
9
|
+
import { getSimulatedMetadata } from '../utils';
|
|
10
10
|
import HoverCardLoadingView from './views/resolving';
|
|
11
11
|
import HoverCardUnauthorisedView from './views/unauthorised';
|
|
12
12
|
import HoverCardResolvedView from './views/resolved';
|
|
@@ -47,8 +47,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
47
47
|
onActionClick = _ref.onActionClick,
|
|
48
48
|
onResolve = _ref.onResolve,
|
|
49
49
|
renderers = _ref.renderers,
|
|
50
|
-
url = _ref.url
|
|
51
|
-
onAuthorize = _ref.onAuthorize;
|
|
50
|
+
url = _ref.url;
|
|
52
51
|
var extensionKey = useMemo(function () {
|
|
53
52
|
return getExtensionKey(cardState.details);
|
|
54
53
|
}, [cardState.details]);
|
|
@@ -56,7 +55,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
56
55
|
var isModifierKeyPressed = isSpecialEvent(event);
|
|
57
56
|
analytics.ui.cardClickedEvent({
|
|
58
57
|
id: id,
|
|
59
|
-
display:
|
|
58
|
+
display: CardDisplay.HoverCardPreview,
|
|
60
59
|
status: cardState.status,
|
|
61
60
|
isModifierKeyPressed: isModifierKeyPressed,
|
|
62
61
|
actionSubjectId: 'titleGoToLink'
|
|
@@ -99,8 +98,11 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
99
98
|
|
|
100
99
|
if (cardState.status === 'unauthorized') {
|
|
101
100
|
return /*#__PURE__*/React.createElement(HoverCardUnauthorisedView, {
|
|
101
|
+
analytics: analytics,
|
|
102
|
+
extensionKey: extensionKey,
|
|
103
|
+
id: id,
|
|
102
104
|
flexibleCardProps: flexibleCardProps,
|
|
103
|
-
|
|
105
|
+
url: url
|
|
104
106
|
});
|
|
105
107
|
} // if metadataStatus is 'errored' simply render using data available (normal path)
|
|
106
108
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
3
3
|
import { extractType } from '@atlaskit/linking-common/extractors';
|
|
4
|
-
import { ActionName, SmartLinkSize } from '../../../../../constants';
|
|
4
|
+
import { ActionName, CardDisplay, SmartLinkSize } from '../../../../../constants';
|
|
5
5
|
import { FooterBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
|
|
6
6
|
import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
7
7
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
8
8
|
import { useSmartCardActions } from '../../../../../state/actions';
|
|
9
|
-
import { getSimulatedMetadata, toActionableMetadata
|
|
9
|
+
import { getSimulatedMetadata, toActionableMetadata } from '../../../utils';
|
|
10
10
|
import SnippetOrPreview from '../../SnippetOrPreview';
|
|
11
11
|
import { extractMetadata } from '../../../../../extractors/hover/extractMetadata';
|
|
12
12
|
export var toFooterActions = function toFooterActions(cardActions, onActionClick) {
|
|
@@ -49,7 +49,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
49
49
|
// Since this hover view is only rendered on resolved status,
|
|
50
50
|
// there is no need to check for statuses.
|
|
51
51
|
analytics.ui.renderSuccessEvent({
|
|
52
|
-
display:
|
|
52
|
+
display: CardDisplay.HoverCardPreview,
|
|
53
53
|
status: cardState.status
|
|
54
54
|
});
|
|
55
55
|
}, [analytics.ui, cardState.status]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useMemo } from 'react';
|
|
2
|
+
import React, { useCallback, useMemo } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
5
5
|
import { messages } from '../../../../../messages';
|
|
@@ -9,29 +9,46 @@ import { connectButtonStyles, mainTextStyles, titleBlockStyles } from './styled'
|
|
|
9
9
|
import UnauthorisedViewContent from '../../../../common/UnauthorisedViewContent';
|
|
10
10
|
import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group';
|
|
11
11
|
import { LinkIcon } from '../../../../FlexibleCard/components/elements';
|
|
12
|
-
import { ActionName } from '../../../../../constants';
|
|
12
|
+
import { ActionName, CardDisplay } from '../../../../../constants';
|
|
13
|
+
import { useSmartCardActions } from '../../../../../state/actions';
|
|
13
14
|
|
|
14
15
|
var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
|
|
15
16
|
var _cardState$details, _extractProvider;
|
|
16
17
|
|
|
17
|
-
var
|
|
18
|
+
var analytics = _ref.analytics,
|
|
19
|
+
extensionKey = _ref.extensionKey,
|
|
20
|
+
_ref$id = _ref.id,
|
|
21
|
+
id = _ref$id === void 0 ? '' : _ref$id,
|
|
22
|
+
flexibleCardProps = _ref.flexibleCardProps,
|
|
18
23
|
_ref$testId = _ref.testId,
|
|
19
24
|
testId = _ref$testId === void 0 ? 'hover-card-unauthorised-view' : _ref$testId,
|
|
20
|
-
|
|
25
|
+
url = _ref.url;
|
|
21
26
|
var cardState = flexibleCardProps.cardState;
|
|
22
27
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
23
28
|
var providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
29
|
+
|
|
30
|
+
var _useSmartCardActions = useSmartCardActions(id, url, analytics),
|
|
31
|
+
authorize = _useSmartCardActions.authorize;
|
|
32
|
+
|
|
33
|
+
var handleAuthorize = useCallback(function () {
|
|
34
|
+
if (authorize) {
|
|
35
|
+
analytics.track.appAccountAuthStarted({
|
|
36
|
+
extensionKey: extensionKey
|
|
37
|
+
});
|
|
38
|
+
authorize(CardDisplay.HoverCardPreview);
|
|
39
|
+
}
|
|
40
|
+
}, [authorize, extensionKey, analytics.track]);
|
|
24
41
|
var actions = useMemo(function () {
|
|
25
|
-
return
|
|
42
|
+
return [{
|
|
26
43
|
name: ActionName.CustomAction,
|
|
27
44
|
content: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_action, {
|
|
28
45
|
values: {
|
|
29
46
|
context: providerName
|
|
30
47
|
}
|
|
31
48
|
})),
|
|
32
|
-
onClick:
|
|
33
|
-
}]
|
|
34
|
-
}, [
|
|
49
|
+
onClick: handleAuthorize
|
|
50
|
+
}];
|
|
51
|
+
}, [handleAuthorize, providerName]);
|
|
35
52
|
return /*#__PURE__*/React.createElement(FlexibleCard, _extends({}, flexibleCardProps, {
|
|
36
53
|
testId: testId
|
|
37
54
|
}), /*#__PURE__*/React.createElement(CustomBlock, {
|
|
@@ -45,7 +62,8 @@ var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
|
|
|
45
62
|
overrideCss: mainTextStyles,
|
|
46
63
|
testId: "".concat(testId, "-content")
|
|
47
64
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
|
|
48
|
-
providerName: providerName
|
|
65
|
+
providerName: providerName,
|
|
66
|
+
analytics: analytics
|
|
49
67
|
}))), /*#__PURE__*/React.createElement(CustomBlock, {
|
|
50
68
|
overrideCss: connectButtonStyles,
|
|
51
69
|
testId: "".concat(testId, "-button")
|
|
@@ -8,7 +8,7 @@ import { ErrorBoundary } from 'react-error-boundary';
|
|
|
8
8
|
import { useSmartLinkAnalytics } from '../../state/analytics';
|
|
9
9
|
import { fireSmartLinkEvent } from '../../utils/analytics';
|
|
10
10
|
import { HoverCardComponent } from './components/HoverCardComponent';
|
|
11
|
-
import {
|
|
11
|
+
import { CardDisplay } from '../../constants';
|
|
12
12
|
|
|
13
13
|
var HoverCardWithErrorBoundary = function HoverCardWithErrorBoundary(props) {
|
|
14
14
|
var url = props.url,
|
|
@@ -21,7 +21,7 @@ var HoverCardWithErrorBoundary = function HoverCardWithErrorBoundary(props) {
|
|
|
21
21
|
var analytics = useSmartLinkAnalytics(url, analyticsHandler, id);
|
|
22
22
|
var onError = useCallback(function (error, info) {
|
|
23
23
|
analytics.ui.renderFailedEvent({
|
|
24
|
-
display:
|
|
24
|
+
display: CardDisplay.HoverCardPreview,
|
|
25
25
|
id: id,
|
|
26
26
|
error: error,
|
|
27
27
|
errorInfo: info
|
|
@@ -37,5 +37,8 @@ var HoverCardWithErrorBoundary = function HoverCardWithErrorBoundary(props) {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export var HoverCard = withAnalyticsContext({
|
|
40
|
-
source: 'smartLinkPreviewHoverCard'
|
|
40
|
+
source: 'smartLinkPreviewHoverCard',
|
|
41
|
+
attributes: {
|
|
42
|
+
display: CardDisplay.HoverCardPreview
|
|
43
|
+
}
|
|
41
44
|
})(withAnalyticsEvents()(HoverCardWithErrorBoundary));
|
|
@@ -5,7 +5,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
|
|
7
7
|
import { ElementName } from '../../constants';
|
|
8
|
-
export var SMART_CARD_ANALYTICS_DISPLAY = 'flexible';
|
|
9
8
|
export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
10
9
|
var extensionKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
11
10
|
var types = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -20,7 +20,7 @@ import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
|
20
20
|
import { AKIconWrapper } from '../Icon';
|
|
21
21
|
import { messages } from '../../../messages';
|
|
22
22
|
import { FormattedMessage } from 'react-intl-next';
|
|
23
|
-
import {
|
|
23
|
+
import { IconStyledButton, LowercaseAppearance } from '../styled';
|
|
24
24
|
export var InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
|
|
25
25
|
_inherits(InlineCardErroredView, _React$Component);
|
|
26
26
|
|
|
@@ -47,14 +47,11 @@ export var InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "renderRightSide", function () {
|
|
51
51
|
var _this$props = _this.props,
|
|
52
52
|
onRetry = _this$props.onRetry,
|
|
53
|
-
url = _this$props.url,
|
|
54
53
|
message = _this$props.message;
|
|
55
|
-
|
|
56
|
-
var errorMessage = /*#__PURE__*/React.createElement(NoLinkAppearance, null, message);
|
|
57
|
-
return !onRetry ? /*#__PURE__*/React.createElement(React.Fragment, null, link, " - ", errorMessage) : /*#__PURE__*/React.createElement(React.Fragment, null, link, " - ", errorMessage, ",\xA0", /*#__PURE__*/React.createElement(Button, {
|
|
54
|
+
return !onRetry ? message : /*#__PURE__*/React.createElement(React.Fragment, null, message, ', ', /*#__PURE__*/React.createElement(Button, {
|
|
58
55
|
spacing: "none",
|
|
59
56
|
appearance: "subtle-link",
|
|
60
57
|
component: IconStyledButton,
|
|
@@ -79,8 +76,6 @@ export var InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
|
|
|
79
76
|
icon = _this$props2.icon;
|
|
80
77
|
return /*#__PURE__*/React.createElement(Frame, {
|
|
81
78
|
testId: testId,
|
|
82
|
-
link: url,
|
|
83
|
-
onClick: onClick,
|
|
84
79
|
isSelected: isSelected
|
|
85
80
|
}, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
|
|
86
81
|
icon: icon || /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
@@ -88,7 +83,10 @@ export var InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
|
|
|
88
83
|
size: "small",
|
|
89
84
|
primaryColor: token('color.icon.danger', R300)
|
|
90
85
|
})),
|
|
91
|
-
|
|
86
|
+
link: url,
|
|
87
|
+
title: url,
|
|
88
|
+
onClick: onClick,
|
|
89
|
+
rightSide: this.renderRightSide()
|
|
92
90
|
}));
|
|
93
91
|
}
|
|
94
92
|
}]);
|
|
@@ -21,7 +21,7 @@ import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
|
21
21
|
import { AKIconWrapper } from '../Icon';
|
|
22
22
|
import { messages } from '../../../messages';
|
|
23
23
|
import { FormattedMessage } from 'react-intl-next';
|
|
24
|
-
import { IconStyledButton, LowercaseAppearance
|
|
24
|
+
import { IconStyledButton, LowercaseAppearance } from '../styled';
|
|
25
25
|
var FallbackForbiddenIcon = /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(LockIcon, {
|
|
26
26
|
label: "error",
|
|
27
27
|
size: "small",
|
|
@@ -76,21 +76,18 @@ export var InlineCardForbiddenView = /*#__PURE__*/function (_React$Component) {
|
|
|
76
76
|
}));
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
80
|
-
var _this$
|
|
79
|
+
_defineProperty(_assertThisInitialized(_this), "renderRightSide", function () {
|
|
80
|
+
var _this$props3, _this$props3$requestA;
|
|
81
81
|
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var link = /*#__PURE__*/React.createElement(LinkAppearance, null, url);
|
|
86
|
-
var hasRequestAccessContextMessage = (_this$props4 = _this.props) === null || _this$props4 === void 0 ? void 0 : (_this$props4$requestA = _this$props4.requestAccessContext) === null || _this$props4$requestA === void 0 ? void 0 : _this$props4$requestA.callToActionMessageKey;
|
|
87
|
-
return !onAuthorise && !hasRequestAccessContextMessage ? link : /*#__PURE__*/React.createElement(React.Fragment, null, link, ' - ', /*#__PURE__*/React.createElement(Button, {
|
|
82
|
+
var onAuthorise = _this.props.onAuthorise;
|
|
83
|
+
var hasRequestAccessContextMessage = (_this$props3 = _this.props) === null || _this$props3 === void 0 ? void 0 : (_this$props3$requestA = _this$props3.requestAccessContext) === null || _this$props3$requestA === void 0 ? void 0 : _this$props3$requestA.callToActionMessageKey;
|
|
84
|
+
return onAuthorise || hasRequestAccessContextMessage ? /*#__PURE__*/React.createElement(Button, {
|
|
88
85
|
spacing: "none",
|
|
89
86
|
appearance: "subtle-link",
|
|
90
87
|
onClick: _this.handleRetry,
|
|
91
88
|
component: IconStyledButton,
|
|
92
89
|
testId: "button-connect-other-account"
|
|
93
|
-
}, _this.renderForbiddenAccessMessage())
|
|
90
|
+
}, _this.renderForbiddenAccessMessage()) : null;
|
|
94
91
|
});
|
|
95
92
|
|
|
96
93
|
return _this;
|
|
@@ -99,21 +96,22 @@ export var InlineCardForbiddenView = /*#__PURE__*/function (_React$Component) {
|
|
|
99
96
|
_createClass(InlineCardForbiddenView, [{
|
|
100
97
|
key: "render",
|
|
101
98
|
value: function render() {
|
|
102
|
-
var _this$
|
|
103
|
-
url = _this$
|
|
104
|
-
icon = _this$
|
|
105
|
-
onClick = _this$
|
|
106
|
-
isSelected = _this$
|
|
107
|
-
_this$
|
|
108
|
-
testId = _this$
|
|
99
|
+
var _this$props4 = this.props,
|
|
100
|
+
url = _this$props4.url,
|
|
101
|
+
icon = _this$props4.icon,
|
|
102
|
+
onClick = _this$props4.onClick,
|
|
103
|
+
isSelected = _this$props4.isSelected,
|
|
104
|
+
_this$props4$testId = _this$props4.testId,
|
|
105
|
+
testId = _this$props4$testId === void 0 ? 'inline-card-forbidden-view' : _this$props4$testId;
|
|
109
106
|
return /*#__PURE__*/React.createElement(Frame, {
|
|
110
107
|
testId: testId,
|
|
111
|
-
link: url,
|
|
112
|
-
onClick: onClick,
|
|
113
108
|
isSelected: isSelected
|
|
114
109
|
}, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
|
|
115
110
|
icon: icon ? icon : FallbackForbiddenIcon,
|
|
116
|
-
|
|
111
|
+
link: url,
|
|
112
|
+
title: url,
|
|
113
|
+
onClick: onClick,
|
|
114
|
+
rightSide: this.renderRightSide(),
|
|
117
115
|
titleColor: token('color.text.subtle', N500)
|
|
118
116
|
}));
|
|
119
117
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
3
|
-
import {
|
|
3
|
+
import { WrapperAnchor, WrapperSpan } from './styled';
|
|
4
4
|
export var Frame = function Frame(props) {
|
|
5
5
|
var isSelected = props.isSelected,
|
|
6
6
|
children = props.children,
|
|
7
7
|
onClick = props.onClick,
|
|
8
8
|
link = props.link,
|
|
9
9
|
withoutBackground = props.withoutBackground,
|
|
10
|
-
withoutHover = props.withoutHover,
|
|
11
10
|
testId = props.testId,
|
|
12
11
|
className = props.className;
|
|
13
12
|
var handleClick = useCallback(function (event) {
|
|
@@ -28,14 +27,15 @@ export var Frame = function Frame(props) {
|
|
|
28
27
|
onClick(event);
|
|
29
28
|
}
|
|
30
29
|
}, [onClick]);
|
|
31
|
-
var isInteractive = Boolean(onClick); //
|
|
30
|
+
var isInteractive = Boolean(onClick); // Depending on whenever Frame was given onClick or link itself we display span or anchor elements
|
|
31
|
+
|
|
32
|
+
var Wrapper = link || onClick ? WrapperAnchor : WrapperSpan; // TODO Theming doesn't work right now in editor. Required React context does not trickle down atm.
|
|
32
33
|
// It will be worked as part of https://product-fabric.atlassian.net/jira/servicedesk/projects/DTR/queues/issue/DTR-154
|
|
33
34
|
|
|
34
35
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
35
36
|
theme: useGlobalTheme(),
|
|
36
37
|
href: link,
|
|
37
38
|
withoutBackground: withoutBackground,
|
|
38
|
-
withoutHover: withoutHover,
|
|
39
39
|
isSelected: isSelected,
|
|
40
40
|
isInteractive: isInteractive,
|
|
41
41
|
tabIndex: isInteractive ? 0 : undefined,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject;
|
|
3
|
+
var _templateObject, _templateObject2;
|
|
4
4
|
|
|
5
5
|
import styled from '@emotion/styled';
|
|
6
6
|
import { B100, B400, B50, DN40A, DN50A, N20, N40A, N50A } from '@atlaskit/theme/colors';
|
|
7
7
|
import { borderRadius as akBorderRadius } from '@atlaskit/theme/constants';
|
|
8
8
|
import { themed } from '@atlaskit/theme/components';
|
|
9
9
|
import { token } from '@atlaskit/tokens';
|
|
10
|
-
import { TitleWrapperClassName } from '../IconAndTitleLayout/styled';
|
|
11
10
|
var BACKGROUND_COLOR_DARK = '#262B31';
|
|
12
11
|
var selected = "\n cursor: pointer;\n box-shadow: 0 0 0 2px ".concat(token('color.border.selected', B100), ";\n outline: none;\n user-select: none;\n &, :hover, :focus, :active {\n text-decoration: none;\n }\n");
|
|
13
12
|
|
|
@@ -15,13 +14,13 @@ var isInteractive = function isInteractive(_ref) {
|
|
|
15
14
|
var isInteractive = _ref.isInteractive;
|
|
16
15
|
|
|
17
16
|
if (isInteractive) {
|
|
18
|
-
return "\n
|
|
17
|
+
return "\n :hover {\n background-color: ".concat(themed({
|
|
19
18
|
light: token('color.background.neutral.subtle.hovered', N20),
|
|
20
19
|
dark: token('color.background.neutral.subtle.hovered', BACKGROUND_COLOR_DARK)
|
|
21
|
-
}), ";\n
|
|
20
|
+
}), ";\n }\n :active {\n background-color: ").concat(themed({
|
|
22
21
|
light: token('color.background.selected', B50),
|
|
23
22
|
dark: token('color.background.selected', BACKGROUND_COLOR_DARK)
|
|
24
|
-
}), ";\n
|
|
23
|
+
}), ";\n }\n :focus {\n ").concat(selected, "\n }\n ");
|
|
25
24
|
} else {
|
|
26
25
|
return '';
|
|
27
26
|
}
|
|
@@ -36,11 +35,6 @@ var isSelected = function isSelected(_ref2) {
|
|
|
36
35
|
return 'user-select: text';
|
|
37
36
|
}
|
|
38
37
|
};
|
|
39
|
-
|
|
40
|
-
var withoutHover = function withoutHover(_ref3) {
|
|
41
|
-
var withoutHover = _ref3.withoutHover;
|
|
42
|
-
return withoutHover ? "\n &:hover {\n text-decoration: none;\n }\n " : '';
|
|
43
|
-
};
|
|
44
38
|
/*
|
|
45
39
|
Inline smart cards should have the following layout:
|
|
46
40
|
------------------------------------
|
|
@@ -55,28 +49,20 @@ var withoutHover = function withoutHover(_ref3) {
|
|
|
55
49
|
// NB: `box-decoration-break` required for retaining properties (border-radius) on wrap.
|
|
56
50
|
|
|
57
51
|
|
|
58
|
-
|
|
59
|
-
return props.withoutBackground ? "padding-left: 0; margin-left:-2px;" : ''
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}), function (props) {
|
|
64
|
-
return props.withoutBackground ? '' : themed({
|
|
52
|
+
var baseWrapperStyle = function baseWrapperStyle(props) {
|
|
53
|
+
return "\n line-height: 16px;\n padding: 1px 0.24em 2px 0.24em;\n ".concat(props.withoutBackground ? "padding-left: 0; margin-left:-2px;" : '', "\n display: inline;\n box-decoration-break: clone;\n border-radius: ").concat(akBorderRadius(), "px;\n color: ").concat(themed({
|
|
54
|
+
light: token('color.link', B400),
|
|
55
|
+
dark: token('color.link', '#4794FF')
|
|
56
|
+
})(props), ";\n background-color: ").concat(props.withoutBackground ? '' : themed({
|
|
65
57
|
light: token('elevation.surface.raised', 'white'),
|
|
66
58
|
dark: token('elevation.surface.raised', BACKGROUND_COLOR_DARK)
|
|
67
|
-
})
|
|
68
|
-
}, function (props) {
|
|
69
|
-
return props.withoutBackground ? '' : themed({
|
|
59
|
+
})(props), ";\n ").concat(props.withoutBackground ? '' : themed({
|
|
70
60
|
light: "box-shadow: ".concat(token('elevation.shadow.raised', "0 1px 1px ".concat(N50A, ", 0 0 1px 1px ").concat(N40A)), ";"),
|
|
71
61
|
dark: "box-shadow: ".concat(token('elevation.shadow.raised', "0 1px 1px ".concat(DN50A, ", 0 0 1px 1px ").concat(DN40A)), ";")
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}, TitleWrapperClassName, function (_ref4) {
|
|
80
|
-
var withoutHover = _ref4.withoutHover;
|
|
81
|
-
return withoutHover ? 'none' : 'underline';
|
|
82
|
-
});
|
|
62
|
+
})(props), "\n ").concat(isSelected(props), ";\n transition: 0.1s all ease-in-out;\n -moz-user-select: none;\n");
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export var WrapperAnchor = styled.a(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n ", "\n"])), baseWrapperStyle, isInteractive);
|
|
66
|
+
WrapperAnchor.displayName = 'WrapperAnchor';
|
|
67
|
+
export var WrapperSpan = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n"])), baseWrapperStyle);
|
|
68
|
+
WrapperSpan.displayName = 'WrapperSpan';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
3
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
8
|
|
|
7
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
10
|
|
|
@@ -13,15 +15,48 @@ import ImageLoader from 'react-render-image';
|
|
|
13
15
|
import { Icon, Shimmer } from '../Icon';
|
|
14
16
|
import { IconEmptyWrapper, IconPositionWrapper, IconTitleWrapper, IconWrapper, TitleWrapper, EmojiWrapper, TitleWrapperClassName } from './styled';
|
|
15
17
|
import LinkIcon from '@atlaskit/icon/glyph/link';
|
|
18
|
+
import { LinkAppearance, NoLinkAppearance } from '../styled';
|
|
16
19
|
export var IconAndTitleLayout = /*#__PURE__*/function (_React$Component) {
|
|
17
20
|
_inherits(IconAndTitleLayout, _React$Component);
|
|
18
21
|
|
|
19
22
|
var _super = _createSuper(IconAndTitleLayout);
|
|
20
23
|
|
|
21
24
|
function IconAndTitleLayout() {
|
|
25
|
+
var _this;
|
|
26
|
+
|
|
22
27
|
_classCallCheck(this, IconAndTitleLayout);
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
30
|
+
args[_key] = arguments[_key];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
34
|
+
|
|
35
|
+
_defineProperty(_assertThisInitialized(_this), "handleClick", function (event) {
|
|
36
|
+
var onClick = _this.props.onClick;
|
|
37
|
+
|
|
38
|
+
if (onClick) {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
event.stopPropagation();
|
|
41
|
+
onClick(event);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyPress", function (event) {
|
|
46
|
+
var onClick = _this.props.onClick;
|
|
47
|
+
|
|
48
|
+
if (event.key !== ' ' && event.key !== 'Enter') {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (onClick) {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
event.stopPropagation();
|
|
55
|
+
onClick(event);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return _this;
|
|
25
60
|
}
|
|
26
61
|
|
|
27
62
|
_createClass(IconAndTitleLayout, [{
|
|
@@ -103,18 +138,25 @@ export var IconAndTitleLayout = /*#__PURE__*/function (_React$Component) {
|
|
|
103
138
|
title = _this$props2.title,
|
|
104
139
|
titleColor = _this$props2.titleColor,
|
|
105
140
|
titleTextColor = _this$props2.titleTextColor,
|
|
141
|
+
link = _this$props2.link,
|
|
142
|
+
rightSide = _this$props2.rightSide,
|
|
106
143
|
_this$props2$testId = _this$props2.testId,
|
|
107
144
|
testId = _this$props2$testId === void 0 ? 'inline-card-icon-and-title' : _this$props2$testId;
|
|
108
|
-
|
|
109
|
-
style: {
|
|
110
|
-
color: titleColor
|
|
111
|
-
}
|
|
112
|
-
}, /*#__PURE__*/React.createElement(IconPositionWrapper, null, children || /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconEmptyWrapper, null), this.renderIcon(testId))), /*#__PURE__*/React.createElement(TitleWrapper, {
|
|
145
|
+
var titlePart = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconPositionWrapper, null, children || /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconEmptyWrapper, null), this.renderIcon(testId))), /*#__PURE__*/React.createElement(TitleWrapper, {
|
|
113
146
|
style: {
|
|
114
147
|
color: titleTextColor
|
|
115
148
|
},
|
|
116
149
|
className: TitleWrapperClassName
|
|
117
|
-
}, title))
|
|
150
|
+
}, title));
|
|
151
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconTitleWrapper, {
|
|
152
|
+
style: {
|
|
153
|
+
color: titleColor
|
|
154
|
+
}
|
|
155
|
+
}, link ? /*#__PURE__*/React.createElement(LinkAppearance, {
|
|
156
|
+
href: link,
|
|
157
|
+
onClick: this.handleClick,
|
|
158
|
+
onKeyPress: this.handleKeyPress
|
|
159
|
+
}, titlePart) : titlePart, rightSide ? /*#__PURE__*/React.createElement(NoLinkAppearance, null, ' - ', rightSide) : null));
|
|
118
160
|
}
|
|
119
161
|
}]);
|
|
120
162
|
|
|
@@ -35,13 +35,11 @@ export var InlineCardResolvingView = /*#__PURE__*/function (_React$Component) {
|
|
|
35
35
|
inlinePreloaderStyle = _this$props.inlinePreloaderStyle,
|
|
36
36
|
_this$props$testId = _this$props.testId,
|
|
37
37
|
testId = _this$props$testId === void 0 ? 'inline-card-resolving-view' : _this$props$testId,
|
|
38
|
-
titleTextColor = _this$props.titleTextColor
|
|
39
|
-
withoutHover = _this$props.withoutHover;
|
|
38
|
+
titleTextColor = _this$props.titleTextColor;
|
|
40
39
|
|
|
41
40
|
if (inlinePreloaderStyle === 'on-right-without-skeleton') {
|
|
42
41
|
return /*#__PURE__*/React.createElement(Frame, {
|
|
43
42
|
withoutBackground: true,
|
|
44
|
-
withoutHover: withoutHover,
|
|
45
43
|
testId: testId,
|
|
46
44
|
onClick: onClick,
|
|
47
45
|
isSelected: isSelected
|
|
@@ -54,9 +52,9 @@ export var InlineCardResolvingView = /*#__PURE__*/function (_React$Component) {
|
|
|
54
52
|
return /*#__PURE__*/React.createElement(Frame, {
|
|
55
53
|
testId: testId,
|
|
56
54
|
onClick: onClick,
|
|
57
|
-
isSelected: isSelected
|
|
58
|
-
withoutHover: withoutHover
|
|
55
|
+
isSelected: isSelected
|
|
59
56
|
}, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
|
|
57
|
+
link: url,
|
|
60
58
|
title: url,
|
|
61
59
|
titleTextColor: titleTextColor
|
|
62
60
|
}, /*#__PURE__*/React.createElement(SpinnerWrapper, {
|