@atlaskit/smart-card 26.9.16 → 26.9.18
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/version.json +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +5 -2
- package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +1 -2
- package/dist/cjs/view/InlineCard/Icon.js +0 -2
- package/dist/cjs/view/RedesignedInlineCard/ErroredView/index.js +90 -0
- package/dist/cjs/view/RedesignedInlineCard/ForbiddenView/index.js +129 -0
- package/dist/cjs/view/RedesignedInlineCard/Frame/index.js +63 -0
- package/dist/cjs/view/RedesignedInlineCard/Frame/styled.js +70 -0
- package/dist/cjs/view/RedesignedInlineCard/Icon.js +43 -0
- package/dist/cjs/view/RedesignedInlineCard/IconAndTitleLayout/index.js +151 -0
- package/dist/cjs/view/RedesignedInlineCard/IconAndTitleLayout/styled.js +56 -0
- package/dist/cjs/view/RedesignedInlineCard/ResolvedView/index.js +83 -0
- package/dist/cjs/view/RedesignedInlineCard/ResolvingView/index.js +69 -0
- package/dist/cjs/view/RedesignedInlineCard/ResolvingView/styled.js +13 -0
- package/dist/cjs/view/RedesignedInlineCard/UnauthorisedView/index.js +113 -0
- package/dist/cjs/view/RedesignedInlineCard/index.js +183 -0
- package/dist/cjs/view/RedesignedInlineCard/styled.js +31 -0
- package/dist/cjs/view/RedesignedInlineCard/types.js +5 -0
- package/dist/cjs/view/RedesignedInlineCard/utils/withFrameStyleControl.js +42 -0
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +5 -2
- package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +3 -2
- package/dist/es2019/view/InlineCard/Icon.js +0 -2
- package/dist/es2019/view/RedesignedInlineCard/ErroredView/index.js +66 -0
- package/dist/es2019/view/RedesignedInlineCard/ForbiddenView/index.js +107 -0
- package/dist/es2019/view/RedesignedInlineCard/Frame/index.js +55 -0
- package/dist/es2019/view/RedesignedInlineCard/Frame/styled.js +107 -0
- package/dist/es2019/view/RedesignedInlineCard/Icon.js +45 -0
- package/dist/es2019/view/RedesignedInlineCard/IconAndTitleLayout/index.js +124 -0
- package/dist/es2019/view/RedesignedInlineCard/IconAndTitleLayout/styled.js +97 -0
- package/dist/es2019/view/RedesignedInlineCard/ResolvedView/index.js +55 -0
- package/dist/es2019/view/RedesignedInlineCard/ResolvingView/index.js +44 -0
- package/dist/es2019/view/RedesignedInlineCard/ResolvingView/styled.js +6 -0
- package/dist/es2019/view/RedesignedInlineCard/UnauthorisedView/index.js +86 -0
- package/dist/es2019/view/RedesignedInlineCard/index.js +149 -0
- package/dist/es2019/view/RedesignedInlineCard/styled.js +52 -0
- package/dist/es2019/view/RedesignedInlineCard/types.js +1 -0
- package/dist/es2019/view/RedesignedInlineCard/utils/withFrameStyleControl.js +33 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/CardWithUrl/component.js +5 -2
- package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +1 -2
- package/dist/esm/view/InlineCard/Icon.js +0 -2
- package/dist/esm/view/RedesignedInlineCard/ErroredView/index.js +82 -0
- package/dist/esm/view/RedesignedInlineCard/ForbiddenView/index.js +121 -0
- package/dist/esm/view/RedesignedInlineCard/Frame/index.js +53 -0
- package/dist/esm/view/RedesignedInlineCard/Frame/styled.js +61 -0
- package/dist/esm/view/RedesignedInlineCard/Icon.js +34 -0
- package/dist/esm/view/RedesignedInlineCard/IconAndTitleLayout/index.js +143 -0
- package/dist/esm/view/RedesignedInlineCard/IconAndTitleLayout/styled.js +38 -0
- package/dist/esm/view/RedesignedInlineCard/ResolvedView/index.js +75 -0
- package/dist/esm/view/RedesignedInlineCard/ResolvingView/index.js +61 -0
- package/dist/esm/view/RedesignedInlineCard/ResolvingView/styled.js +5 -0
- package/dist/esm/view/RedesignedInlineCard/UnauthorisedView/index.js +105 -0
- package/dist/esm/view/RedesignedInlineCard/index.js +146 -0
- package/dist/esm/view/RedesignedInlineCard/styled.js +20 -0
- package/dist/esm/view/RedesignedInlineCard/types.js +1 -0
- package/dist/esm/view/RedesignedInlineCard/utils/withFrameStyleControl.js +35 -0
- package/dist/types/view/RedesignedInlineCard/ErroredView/index.d.ts +22 -0
- package/dist/types/view/RedesignedInlineCard/ForbiddenView/index.d.ts +29 -0
- package/dist/types/view/RedesignedInlineCard/Frame/index.d.ts +15 -0
- package/dist/types/view/RedesignedInlineCard/Frame/styled.d.ts +15 -0
- package/dist/types/view/RedesignedInlineCard/Icon.d.ts +12 -0
- package/dist/types/view/RedesignedInlineCard/IconAndTitleLayout/index.d.ts +28 -0
- package/dist/types/view/RedesignedInlineCard/IconAndTitleLayout/styled.d.ts +36 -0
- package/dist/types/view/RedesignedInlineCard/ResolvedView/index.d.ts +32 -0
- package/dist/types/view/RedesignedInlineCard/ResolvingView/index.d.ts +17 -0
- package/dist/types/view/RedesignedInlineCard/ResolvingView/styled.d.ts +9 -0
- package/dist/types/view/RedesignedInlineCard/UnauthorisedView/index.d.ts +32 -0
- package/dist/types/view/RedesignedInlineCard/index.d.ts +9 -0
- package/dist/types/view/RedesignedInlineCard/styled.d.ts +17 -0
- package/dist/types/view/RedesignedInlineCard/types.d.ts +25 -0
- package/dist/types/view/RedesignedInlineCard/utils/withFrameStyleControl.d.ts +9 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/ErroredView/index.d.ts +22 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/ForbiddenView/index.d.ts +29 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/Frame/index.d.ts +15 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/Frame/styled.d.ts +15 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/Icon.d.ts +12 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/IconAndTitleLayout/index.d.ts +28 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/IconAndTitleLayout/styled.d.ts +36 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/ResolvedView/index.d.ts +32 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/ResolvingView/index.d.ts +17 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/ResolvingView/styled.d.ts +9 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/UnauthorisedView/index.d.ts +32 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/index.d.ts +9 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/styled.d.ts +17 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/types.d.ts +25 -0
- package/dist/types-ts4.5/view/RedesignedInlineCard/utils/withFrameStyleControl.d.ts +9 -0
- package/package.json +6 -3
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Frame } from '../Frame';
|
|
3
|
+
import Spinner from '@atlaskit/spinner';
|
|
4
|
+
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
5
|
+
import { SpinnerWrapper } from './styled';
|
|
6
|
+
import { IconTitleWrapper, RightIconPositionWrapper } from '../IconAndTitleLayout/styled';
|
|
7
|
+
export class InlineCardResolvingView extends React.Component {
|
|
8
|
+
render() {
|
|
9
|
+
const {
|
|
10
|
+
url,
|
|
11
|
+
onClick,
|
|
12
|
+
isSelected,
|
|
13
|
+
inlinePreloaderStyle,
|
|
14
|
+
testId = 'inline-card-resolving-view',
|
|
15
|
+
titleTextColor
|
|
16
|
+
} = this.props;
|
|
17
|
+
if (inlinePreloaderStyle === 'on-right-without-skeleton') {
|
|
18
|
+
return /*#__PURE__*/React.createElement(Frame, {
|
|
19
|
+
withoutBackground: true,
|
|
20
|
+
testId: testId,
|
|
21
|
+
onClick: onClick,
|
|
22
|
+
isSelected: isSelected
|
|
23
|
+
}, /*#__PURE__*/React.createElement(IconTitleWrapper, null, url, /*#__PURE__*/React.createElement(RightIconPositionWrapper, null, /*#__PURE__*/React.createElement(SpinnerWrapper, {
|
|
24
|
+
className: "inline-resolving-spinner"
|
|
25
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
26
|
+
size: 14
|
|
27
|
+
})))));
|
|
28
|
+
} else {
|
|
29
|
+
return /*#__PURE__*/React.createElement(Frame, {
|
|
30
|
+
testId: testId,
|
|
31
|
+
onClick: onClick,
|
|
32
|
+
isSelected: isSelected
|
|
33
|
+
}, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
|
|
34
|
+
link: url,
|
|
35
|
+
title: url,
|
|
36
|
+
titleTextColor: titleTextColor
|
|
37
|
+
}, /*#__PURE__*/React.createElement(SpinnerWrapper, {
|
|
38
|
+
className: "inline-resolving-spinner"
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
40
|
+
size: 14
|
|
41
|
+
}))));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import Button from '@atlaskit/button/custom-theme-button';
|
|
4
|
+
import LockIcon from '@atlaskit/icon/glyph/lock-filled';
|
|
5
|
+
import { N500, R400 } from '@atlaskit/theme/colors';
|
|
6
|
+
import withFrameStyleControl from '../utils/withFrameStyleControl';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
9
|
+
import { messages } from '../../../messages';
|
|
10
|
+
import { Frame } from '../Frame';
|
|
11
|
+
import { AKIconWrapper } from '../Icon';
|
|
12
|
+
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
13
|
+
import { IconStyledButton } from '../styled';
|
|
14
|
+
import { HoverCard } from '../../HoverCard';
|
|
15
|
+
const FallbackUnauthorizedIcon = /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(LockIcon, {
|
|
16
|
+
label: "error",
|
|
17
|
+
size: "small",
|
|
18
|
+
primaryColor: `var(--ds-icon-danger, ${R400})`
|
|
19
|
+
}));
|
|
20
|
+
export class InlineCardUnauthorizedView extends React.Component {
|
|
21
|
+
constructor(...args) {
|
|
22
|
+
super(...args);
|
|
23
|
+
_defineProperty(this, "frameRef", /*#__PURE__*/React.createRef());
|
|
24
|
+
_defineProperty(this, "handleConnectAccount", event => {
|
|
25
|
+
const {
|
|
26
|
+
analytics,
|
|
27
|
+
extensionKey,
|
|
28
|
+
onAuthorise
|
|
29
|
+
} = this.props;
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
event.stopPropagation();
|
|
32
|
+
if (onAuthorise) {
|
|
33
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.appAccountAuthStarted({
|
|
34
|
+
extensionKey
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return onAuthorise();
|
|
38
|
+
});
|
|
39
|
+
_defineProperty(this, "renderActionButton", () => {
|
|
40
|
+
const {
|
|
41
|
+
onAuthorise,
|
|
42
|
+
context
|
|
43
|
+
} = this.props;
|
|
44
|
+
const ActionButton = withFrameStyleControl(Button, this.frameRef);
|
|
45
|
+
return onAuthorise ? /*#__PURE__*/React.createElement(ActionButton, {
|
|
46
|
+
spacing: "none",
|
|
47
|
+
component: IconStyledButton,
|
|
48
|
+
onClick: this.handleConnectAccount,
|
|
49
|
+
testId: "button-connect-account"
|
|
50
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_link_account_card_name, {
|
|
51
|
+
values: {
|
|
52
|
+
context
|
|
53
|
+
}
|
|
54
|
+
}))) : undefined;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
render() {
|
|
58
|
+
const {
|
|
59
|
+
url,
|
|
60
|
+
icon,
|
|
61
|
+
onClick,
|
|
62
|
+
isSelected,
|
|
63
|
+
testId = 'inline-card-unauthorized-view',
|
|
64
|
+
showAuthTooltip = false
|
|
65
|
+
} = this.props;
|
|
66
|
+
const inlineCardUnauthenticatedView = /*#__PURE__*/React.createElement(Frame, {
|
|
67
|
+
testId: testId,
|
|
68
|
+
isSelected: isSelected,
|
|
69
|
+
ref: this.frameRef
|
|
70
|
+
}, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
|
|
71
|
+
icon: icon ? icon : FallbackUnauthorizedIcon,
|
|
72
|
+
title: url,
|
|
73
|
+
link: url,
|
|
74
|
+
onClick: onClick,
|
|
75
|
+
titleColor: `var(--ds-text-subtle, ${N500})`
|
|
76
|
+
}), this.renderActionButton());
|
|
77
|
+
if (showAuthTooltip) {
|
|
78
|
+
return /*#__PURE__*/React.createElement(HoverCard, {
|
|
79
|
+
url: url,
|
|
80
|
+
onAuthorize: this.props.onAuthorise,
|
|
81
|
+
id: this.props.id
|
|
82
|
+
}, inlineCardUnauthenticatedView);
|
|
83
|
+
}
|
|
84
|
+
return inlineCardUnauthenticatedView;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { getEmptyJsonLd, getForbiddenJsonLd } from '../../utils/jsonld';
|
|
4
|
+
import { extractInlineProps } from '../../extractors/inline';
|
|
5
|
+
import { extractRequestAccessContext } from '../../extractors/common/context';
|
|
6
|
+
import { CardLinkView } from '../LinkView';
|
|
7
|
+
import { InlineCardErroredView } from './ErroredView';
|
|
8
|
+
import { InlineCardForbiddenView } from './ForbiddenView';
|
|
9
|
+
import { InlineCardResolvedView } from './ResolvedView';
|
|
10
|
+
import { InlineCardResolvingView } from './ResolvingView';
|
|
11
|
+
import { InlineCardUnauthorizedView } from './UnauthorisedView';
|
|
12
|
+
import { extractProvider } from '@atlaskit/link-extractors';
|
|
13
|
+
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
14
|
+
import { getExtensionKey } from '../../state/helpers';
|
|
15
|
+
export { InlineCardResolvedView, InlineCardResolvingView, InlineCardErroredView, InlineCardForbiddenView, InlineCardUnauthorizedView };
|
|
16
|
+
export const InlineCard = ({
|
|
17
|
+
analytics,
|
|
18
|
+
id,
|
|
19
|
+
url,
|
|
20
|
+
cardState,
|
|
21
|
+
handleAuthorize,
|
|
22
|
+
handleFrameClick,
|
|
23
|
+
isSelected,
|
|
24
|
+
renderers,
|
|
25
|
+
onResolve,
|
|
26
|
+
onError,
|
|
27
|
+
testId,
|
|
28
|
+
inlinePreloaderStyle,
|
|
29
|
+
showHoverPreview,
|
|
30
|
+
showAuthTooltip,
|
|
31
|
+
showServerActions
|
|
32
|
+
}) => {
|
|
33
|
+
var _details$meta;
|
|
34
|
+
const {
|
|
35
|
+
status,
|
|
36
|
+
details
|
|
37
|
+
} = cardState;
|
|
38
|
+
const cardDetails = details && details.data || getEmptyJsonLd();
|
|
39
|
+
const extensionKey = getExtensionKey(details);
|
|
40
|
+
const testIdWithStatus = testId ? `${testId}-${status}-view` : undefined;
|
|
41
|
+
const showHoverPreviewFlag = useFeatureFlag('showHoverPreview');
|
|
42
|
+
if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
|
|
43
|
+
showHoverPreview = Boolean(showHoverPreviewFlag);
|
|
44
|
+
}
|
|
45
|
+
switch (status) {
|
|
46
|
+
case 'pending':
|
|
47
|
+
case 'resolving':
|
|
48
|
+
return /*#__PURE__*/React.createElement(InlineCardResolvingView, {
|
|
49
|
+
url: url,
|
|
50
|
+
isSelected: isSelected,
|
|
51
|
+
onClick: handleFrameClick,
|
|
52
|
+
testId: testIdWithStatus,
|
|
53
|
+
inlinePreloaderStyle: inlinePreloaderStyle
|
|
54
|
+
});
|
|
55
|
+
case 'resolved':
|
|
56
|
+
const resolvedProps = extractInlineProps(cardDetails, renderers);
|
|
57
|
+
if (onResolve) {
|
|
58
|
+
onResolve({
|
|
59
|
+
url,
|
|
60
|
+
title: resolvedProps.title
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return /*#__PURE__*/React.createElement(InlineCardResolvedView, _extends({}, resolvedProps, {
|
|
64
|
+
id: id,
|
|
65
|
+
showHoverPreview: showHoverPreview,
|
|
66
|
+
showServerActions: showServerActions,
|
|
67
|
+
link: url,
|
|
68
|
+
isSelected: isSelected,
|
|
69
|
+
onClick: handleFrameClick,
|
|
70
|
+
testId: testIdWithStatus
|
|
71
|
+
}));
|
|
72
|
+
case 'unauthorized':
|
|
73
|
+
if (onError) {
|
|
74
|
+
onError({
|
|
75
|
+
url,
|
|
76
|
+
status
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const provider = extractProvider(cardDetails);
|
|
80
|
+
return /*#__PURE__*/React.createElement(InlineCardUnauthorizedView, {
|
|
81
|
+
icon: provider && provider.icon,
|
|
82
|
+
context: provider && provider.text,
|
|
83
|
+
url: url,
|
|
84
|
+
isSelected: isSelected,
|
|
85
|
+
onClick: handleFrameClick,
|
|
86
|
+
onAuthorise: handleAuthorize,
|
|
87
|
+
testId: testIdWithStatus,
|
|
88
|
+
showAuthTooltip: showAuthTooltip,
|
|
89
|
+
id: id,
|
|
90
|
+
analytics: analytics,
|
|
91
|
+
extensionKey: extensionKey
|
|
92
|
+
});
|
|
93
|
+
case 'forbidden':
|
|
94
|
+
if (onError) {
|
|
95
|
+
onError({
|
|
96
|
+
url,
|
|
97
|
+
status
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
const providerForbidden = extractProvider(cardDetails);
|
|
101
|
+
const cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : getForbiddenJsonLd().meta;
|
|
102
|
+
const requestAccessContext = extractRequestAccessContext({
|
|
103
|
+
jsonLd: cardMetadata,
|
|
104
|
+
url,
|
|
105
|
+
context: providerForbidden === null || providerForbidden === void 0 ? void 0 : providerForbidden.text
|
|
106
|
+
});
|
|
107
|
+
return /*#__PURE__*/React.createElement(InlineCardForbiddenView, {
|
|
108
|
+
url: url,
|
|
109
|
+
icon: providerForbidden && providerForbidden.icon,
|
|
110
|
+
context: providerForbidden === null || providerForbidden === void 0 ? void 0 : providerForbidden.text,
|
|
111
|
+
isSelected: isSelected,
|
|
112
|
+
onClick: handleFrameClick,
|
|
113
|
+
onAuthorise: handleAuthorize,
|
|
114
|
+
testId: testIdWithStatus,
|
|
115
|
+
requestAccessContext: requestAccessContext
|
|
116
|
+
});
|
|
117
|
+
case 'not_found':
|
|
118
|
+
if (onError) {
|
|
119
|
+
onError({
|
|
120
|
+
url,
|
|
121
|
+
status
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const providerNotFound = extractProvider(cardDetails);
|
|
125
|
+
return /*#__PURE__*/React.createElement(InlineCardErroredView, {
|
|
126
|
+
url: url,
|
|
127
|
+
icon: providerNotFound && providerNotFound.icon,
|
|
128
|
+
isSelected: isSelected,
|
|
129
|
+
message: "Can't find link",
|
|
130
|
+
onClick: handleFrameClick,
|
|
131
|
+
testId: testIdWithStatus || 'inline-card-not-found-view'
|
|
132
|
+
});
|
|
133
|
+
case 'fallback':
|
|
134
|
+
case 'errored':
|
|
135
|
+
default:
|
|
136
|
+
if (onError) {
|
|
137
|
+
onError({
|
|
138
|
+
url,
|
|
139
|
+
status
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return /*#__PURE__*/React.createElement(CardLinkView, {
|
|
143
|
+
link: url,
|
|
144
|
+
isSelected: isSelected,
|
|
145
|
+
onClick: handleFrameClick,
|
|
146
|
+
testId: testIdWithStatus || 'inline-card-errored-view'
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import { B400, N200 } from '@atlaskit/theme/colors';
|
|
3
|
+
import { themed } from '@atlaskit/theme/components';
|
|
4
|
+
const LINK_COLOR_DARK = '#4794FF';
|
|
5
|
+
|
|
6
|
+
// By default buttons will hide overflow and ellipsis content instead of wrapping.
|
|
7
|
+
// This basically turns the button back into inline content
|
|
8
|
+
// There is a workaround for negative token spacing suggested by the design system team. calc(${token} * -1)
|
|
9
|
+
export const IconStyledButton = styled.span`
|
|
10
|
+
&&& {
|
|
11
|
+
text-align: initial;
|
|
12
|
+
display: inline;
|
|
13
|
+
vertical-align: baseline;
|
|
14
|
+
border-radius: ${"var(--ds-border-radius-100, 2px)"};
|
|
15
|
+
border-top-left-radius: 0px;
|
|
16
|
+
border-bottom-left-radius: 0px;
|
|
17
|
+
padding: ${"var(--ds-space-025, 2px)"} ${"var(--ds-space-075, 6px)"};
|
|
18
|
+
background-clip: padding-box;
|
|
19
|
+
box-decoration-break: clone;
|
|
20
|
+
}
|
|
21
|
+
> span {
|
|
22
|
+
display: inline;
|
|
23
|
+
overflow: initial;
|
|
24
|
+
text-overflow: initial;
|
|
25
|
+
white-space: initial;
|
|
26
|
+
> span {
|
|
27
|
+
overflow: initial;
|
|
28
|
+
text-overflow: initial;
|
|
29
|
+
white-space: initial;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
export const NoLinkAppearance = styled.span`
|
|
34
|
+
color: ${themed({
|
|
35
|
+
light: `var(--ds-text-subtlest, ${N200})`,
|
|
36
|
+
dark: `var(--ds-text-subtlest, ${LINK_COLOR_DARK})`
|
|
37
|
+
})};
|
|
38
|
+
margin-left: ${"var(--ds-space-050, 4px)"};
|
|
39
|
+
`;
|
|
40
|
+
export const LowercaseAppearance = styled.span`
|
|
41
|
+
text-transform: lowercase;
|
|
42
|
+
`;
|
|
43
|
+
export const LinkAppearance = styled.a`
|
|
44
|
+
color: ${themed({
|
|
45
|
+
light: `var(--ds-link, ${B400})`,
|
|
46
|
+
dark: `var(--ds-link, ${LINK_COLOR_DARK})`
|
|
47
|
+
})};
|
|
48
|
+
|
|
49
|
+
&:hover {
|
|
50
|
+
text-decoration: none;
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { themed } from '@atlaskit/theme/components';
|
|
4
|
+
import { N500, N40 } from '@atlaskit/theme/colors';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This HOC serves as a temporary workaround for controlling the style of a parent component.
|
|
8
|
+
* We do not want the Frame to have a hover state when hovering over the action button.
|
|
9
|
+
* TODO: When Firefox begins supporting the :has()pseudo-selector (e.g "frame:has(button:hover){...}"),
|
|
10
|
+
* it should be used instead and the code should be cleaned up.
|
|
11
|
+
*/
|
|
12
|
+
export default ((Button, frameRef) => props => {
|
|
13
|
+
const setBorderStyle = () => {
|
|
14
|
+
const borderColor = themed({
|
|
15
|
+
light: `${`var(--ds-border-input, ${N40})`}`,
|
|
16
|
+
dark: `${`var(--ds-border-input, ${N500})`}`
|
|
17
|
+
})();
|
|
18
|
+
const frameNode = frameRef.current;
|
|
19
|
+
if (frameNode) {
|
|
20
|
+
frameNode.style.borderColor = borderColor;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const removeBorderStyle = () => {
|
|
24
|
+
const frameNode = frameRef.current;
|
|
25
|
+
if (frameNode) {
|
|
26
|
+
frameNode.removeAttribute('style');
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return /*#__PURE__*/React.createElement(Button, _extends({}, props, {
|
|
30
|
+
onMouseEnter: setBorderStyle,
|
|
31
|
+
onMouseLeave: removeBorderStyle
|
|
32
|
+
}));
|
|
33
|
+
});
|
package/dist/esm/version.json
CHANGED
|
@@ -7,6 +7,8 @@ import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceTyp
|
|
|
7
7
|
import { useSmartLink } from '../../state';
|
|
8
8
|
import { BlockCard } from '../BlockCard';
|
|
9
9
|
import { InlineCard } from '../InlineCard';
|
|
10
|
+
import { InlineCard as RedesignedInlineCard } from '../RedesignedInlineCard';
|
|
11
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
12
|
import { EmbedCard } from '../EmbedCard';
|
|
11
13
|
import { isFlexibleUiCard } from '../../utils/flexible';
|
|
12
14
|
import FlexibleCard from '../FlexibleCard';
|
|
@@ -195,7 +197,7 @@ function Component(_ref) {
|
|
|
195
197
|
}
|
|
196
198
|
switch (appearance) {
|
|
197
199
|
case 'inline':
|
|
198
|
-
|
|
200
|
+
var inlineProps = {
|
|
199
201
|
analytics: analytics,
|
|
200
202
|
id: id,
|
|
201
203
|
url: url,
|
|
@@ -211,7 +213,8 @@ function Component(_ref) {
|
|
|
211
213
|
showHoverPreview: showHoverPreview,
|
|
212
214
|
showAuthTooltip: showAuthTooltip,
|
|
213
215
|
showServerActions: showServerActions
|
|
214
|
-
}
|
|
216
|
+
};
|
|
217
|
+
return getBooleanFF('platform.linking-platform.smart-card.show-inline-card-refreshed-design') ? /*#__PURE__*/React.createElement(RedesignedInlineCard, inlineProps) : /*#__PURE__*/React.createElement(InlineCard, inlineProps);
|
|
215
218
|
case 'block':
|
|
216
219
|
return /*#__PURE__*/React.createElement(BlockCard, {
|
|
217
220
|
id: id,
|
|
@@ -7,8 +7,7 @@ import AtlaskitAvatarGroup from '@atlaskit/avatar-group';
|
|
|
7
7
|
import { SmartLinkSize } from '../../../../../constants';
|
|
8
8
|
var MAX_COUNT = 4;
|
|
9
9
|
var getStyles = function getStyles(size) {
|
|
10
|
-
|
|
11
|
-
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n ul {\n margin-right: 8px;\n }\n "])));
|
|
10
|
+
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n ul,\n ul {\n margin-right: 0.5rem;\n margin-top: 0;\n }\n "])));
|
|
12
11
|
switch (size) {
|
|
13
12
|
case SmartLinkSize.XLarge:
|
|
14
13
|
case SmartLinkSize.Large:
|
|
@@ -19,9 +19,7 @@ export var Shimmer = function Shimmer(_ref) {
|
|
|
19
19
|
var testId = _ref.testId;
|
|
20
20
|
var skeletonCustomStyles = {
|
|
21
21
|
position: 'absolute',
|
|
22
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
23
22
|
top: '50%',
|
|
24
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
25
23
|
left: '50%',
|
|
26
24
|
transform: 'translate(-50%, -50%)',
|
|
27
25
|
marginRight: "var(--ds-space-050, 4px)"
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
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); }; }
|
|
9
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { R300 } from '@atlaskit/theme/colors';
|
|
12
|
+
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
13
|
+
import Button from '@atlaskit/button/custom-theme-button';
|
|
14
|
+
import { Frame } from '../Frame';
|
|
15
|
+
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
16
|
+
import { AKIconWrapper } from '../Icon';
|
|
17
|
+
import { messages } from '../../../messages';
|
|
18
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
19
|
+
import { IconStyledButton } from '../styled';
|
|
20
|
+
import withFrameStyleControl from '../utils/withFrameStyleControl';
|
|
21
|
+
export var InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
|
|
22
|
+
_inherits(InlineCardErroredView, _React$Component);
|
|
23
|
+
var _super = _createSuper(InlineCardErroredView);
|
|
24
|
+
function InlineCardErroredView() {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, InlineCardErroredView);
|
|
27
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
|
+
args[_key] = arguments[_key];
|
|
29
|
+
}
|
|
30
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "frameRef", /*#__PURE__*/React.createRef());
|
|
32
|
+
_defineProperty(_assertThisInitialized(_this), "handleRetry", function (event) {
|
|
33
|
+
var onRetry = _this.props.onRetry;
|
|
34
|
+
if (onRetry) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
event.stopPropagation();
|
|
37
|
+
onRetry();
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
_defineProperty(_assertThisInitialized(_this), "renderActionButton", function () {
|
|
41
|
+
var onRetry = _this.props.onRetry;
|
|
42
|
+
var ActionButton = withFrameStyleControl(Button, _this.frameRef);
|
|
43
|
+
return onRetry && /*#__PURE__*/React.createElement(ActionButton, {
|
|
44
|
+
spacing: "none",
|
|
45
|
+
component: IconStyledButton,
|
|
46
|
+
onClick: _this.handleRetry,
|
|
47
|
+
role: "button"
|
|
48
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.try_again));
|
|
49
|
+
});
|
|
50
|
+
return _this;
|
|
51
|
+
}
|
|
52
|
+
_createClass(InlineCardErroredView, [{
|
|
53
|
+
key: "render",
|
|
54
|
+
value: function render() {
|
|
55
|
+
var _this$props = this.props,
|
|
56
|
+
url = _this$props.url,
|
|
57
|
+
onClick = _this$props.onClick,
|
|
58
|
+
isSelected = _this$props.isSelected,
|
|
59
|
+
_this$props$testId = _this$props.testId,
|
|
60
|
+
testId = _this$props$testId === void 0 ? 'inline-card-errored-view' : _this$props$testId,
|
|
61
|
+
icon = _this$props.icon,
|
|
62
|
+
message = _this$props.message;
|
|
63
|
+
return /*#__PURE__*/React.createElement(Frame, {
|
|
64
|
+
testId: testId,
|
|
65
|
+
isSelected: isSelected,
|
|
66
|
+
ref: this.frameRef
|
|
67
|
+
}, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
|
|
68
|
+
icon: icon || /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
69
|
+
label: "error",
|
|
70
|
+
size: "small",
|
|
71
|
+
primaryColor: "var(--ds-icon-danger, ".concat(R300, ")"),
|
|
72
|
+
testId: "errored-view-default-icon"
|
|
73
|
+
})),
|
|
74
|
+
link: url,
|
|
75
|
+
title: url,
|
|
76
|
+
onClick: onClick,
|
|
77
|
+
rightSide: message
|
|
78
|
+
}), this.renderActionButton());
|
|
79
|
+
}
|
|
80
|
+
}]);
|
|
81
|
+
return InlineCardErroredView;
|
|
82
|
+
}(React.Component);
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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); }; }
|
|
10
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { R400, N500 } from '@atlaskit/theme/colors';
|
|
13
|
+
import LockIcon from '@atlaskit/icon/glyph/lock-filled';
|
|
14
|
+
import Button from '@atlaskit/button/custom-theme-button';
|
|
15
|
+
import { Frame } from '../Frame';
|
|
16
|
+
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
17
|
+
import { AKIconWrapper } from '../Icon';
|
|
18
|
+
import { messages } from '../../../messages';
|
|
19
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
20
|
+
import { IconStyledButton } from '../styled';
|
|
21
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
22
|
+
import { LozengeWrapper } from '../IconAndTitleLayout/styled';
|
|
23
|
+
import withFrameStyleControl from '../utils/withFrameStyleControl';
|
|
24
|
+
var FallbackForbiddenIcon = /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(LockIcon, {
|
|
25
|
+
label: "error",
|
|
26
|
+
size: "small",
|
|
27
|
+
primaryColor: "var(--ds-icon-danger, ".concat(R400, ")"),
|
|
28
|
+
testId: "forbidden-view-fallback-icon"
|
|
29
|
+
}));
|
|
30
|
+
export var InlineCardForbiddenView = /*#__PURE__*/function (_React$Component) {
|
|
31
|
+
_inherits(InlineCardForbiddenView, _React$Component);
|
|
32
|
+
var _super = _createSuper(InlineCardForbiddenView);
|
|
33
|
+
function InlineCardForbiddenView() {
|
|
34
|
+
var _this$props, _this$props$requestAc;
|
|
35
|
+
var _this;
|
|
36
|
+
_classCallCheck(this, InlineCardForbiddenView);
|
|
37
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
38
|
+
args[_key] = arguments[_key];
|
|
39
|
+
}
|
|
40
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
41
|
+
_defineProperty(_assertThisInitialized(_this), "frameRef", /*#__PURE__*/React.createRef());
|
|
42
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
43
|
+
hasRequestAccessContextMessage: !!((_this$props = _this.props) !== null && _this$props !== void 0 && (_this$props$requestAc = _this$props.requestAccessContext) !== null && _this$props$requestAc !== void 0 && _this$props$requestAc.callToActionMessageKey)
|
|
44
|
+
});
|
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "handleRetry", function (event) {
|
|
46
|
+
var onAuthorise = _this.props.onAuthorise;
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
event.stopPropagation();
|
|
49
|
+
if (onAuthorise) {
|
|
50
|
+
onAuthorise();
|
|
51
|
+
} else {
|
|
52
|
+
var _this$props2, _this$props2$requestA, _this$props2$requestA2;
|
|
53
|
+
(_this$props2 = _this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$requestA = _this$props2.requestAccessContext) === null || _this$props2$requestA === void 0 ? void 0 : (_this$props2$requestA2 = _this$props2$requestA.action) === null || _this$props2$requestA2 === void 0 ? void 0 : _this$props2$requestA2.promise();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "renderForbiddenAccessMessage", function () {
|
|
57
|
+
var _this$props3, _this$props3$requestA;
|
|
58
|
+
if ((_this$props3 = _this.props) !== null && _this$props3 !== void 0 && (_this$props3$requestA = _this$props3.requestAccessContext) !== null && _this$props3$requestA !== void 0 && _this$props3$requestA.callToActionMessageKey) {
|
|
59
|
+
var callToActionMessageKey = _this.props.requestAccessContext.callToActionMessageKey;
|
|
60
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[callToActionMessageKey], {
|
|
61
|
+
values: {
|
|
62
|
+
context: _this.props.context
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, messages.invalid_permissions, function (formattedMessage) {
|
|
67
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, formattedMessage);
|
|
68
|
+
}));
|
|
69
|
+
});
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "renderActionButton", function () {
|
|
71
|
+
var onAuthorise = _this.props.onAuthorise;
|
|
72
|
+
var ActionButton = withFrameStyleControl(Button, _this.frameRef);
|
|
73
|
+
if (_this.state.hasRequestAccessContextMessage) {
|
|
74
|
+
return /*#__PURE__*/React.createElement(ActionButton, {
|
|
75
|
+
spacing: "none",
|
|
76
|
+
onClick: _this.handleRetry,
|
|
77
|
+
component: IconStyledButton,
|
|
78
|
+
testId: "button-connect-other-account",
|
|
79
|
+
role: "button"
|
|
80
|
+
}, _this.renderForbiddenAccessMessage());
|
|
81
|
+
}
|
|
82
|
+
if (onAuthorise) {
|
|
83
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
84
|
+
spacing: "none",
|
|
85
|
+
onClick: _this.handleRetry,
|
|
86
|
+
appearance: "subtle-link",
|
|
87
|
+
testId: "button-connect-other-account",
|
|
88
|
+
role: "button"
|
|
89
|
+
}, /*#__PURE__*/React.createElement(LozengeWrapper, null, /*#__PURE__*/React.createElement(Lozenge, {
|
|
90
|
+
appearance: 'moved'
|
|
91
|
+
}, _this.renderForbiddenAccessMessage())));
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
});
|
|
95
|
+
return _this;
|
|
96
|
+
}
|
|
97
|
+
_createClass(InlineCardForbiddenView, [{
|
|
98
|
+
key: "render",
|
|
99
|
+
value: function render() {
|
|
100
|
+
var _this$props4 = this.props,
|
|
101
|
+
url = _this$props4.url,
|
|
102
|
+
icon = _this$props4.icon,
|
|
103
|
+
onClick = _this$props4.onClick,
|
|
104
|
+
isSelected = _this$props4.isSelected,
|
|
105
|
+
_this$props4$testId = _this$props4.testId,
|
|
106
|
+
testId = _this$props4$testId === void 0 ? 'inline-card-forbidden-view' : _this$props4$testId;
|
|
107
|
+
return /*#__PURE__*/React.createElement(Frame, {
|
|
108
|
+
testId: testId,
|
|
109
|
+
isSelected: isSelected,
|
|
110
|
+
ref: this.frameRef
|
|
111
|
+
}, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
|
|
112
|
+
icon: icon ? icon : FallbackForbiddenIcon,
|
|
113
|
+
link: url,
|
|
114
|
+
title: url,
|
|
115
|
+
onClick: onClick,
|
|
116
|
+
titleColor: "var(--ds-text-subtle, ".concat(N500, ")")
|
|
117
|
+
}), this.renderActionButton());
|
|
118
|
+
}
|
|
119
|
+
}]);
|
|
120
|
+
return InlineCardForbiddenView;
|
|
121
|
+
}(React.Component);
|