@atlaskit/smart-card 26.42.8 → 26.42.10
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 +14 -0
- package/dist/cjs/constants.js +2 -1
- package/dist/cjs/messages.js +7 -2
- package/dist/cjs/state/helpers.js +4 -1
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +1 -1
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +3 -1
- package/dist/cjs/view/BlockCard/views/flexible/styled.js +3 -7
- package/dist/cjs/view/{InlineCard/ResolvingView → BlockCard/views}/styled.js +3 -3
- package/dist/cjs/view/CardWithData/component.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +1 -3
- package/dist/cjs/view/EmbedCard/components/styled.js +12 -20
- package/dist/cjs/view/EmbedCard/index.js +4 -1
- package/dist/cjs/view/EmbedCard/views/UnauthorisedView.js +4 -2
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/index.js +4 -2
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +7 -16
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/index.js +33 -0
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +3 -5
- package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +3 -0
- package/dist/cjs/view/HoverCard/styled.js +2 -3
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/LinkView/index.js +1 -1
- package/dist/cjs/view/common/UnauthorisedViewContent.js +4 -2
- package/dist/es2019/constants.js +1 -0
- package/dist/es2019/messages.js +7 -2
- package/dist/es2019/state/helpers.js +2 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +1 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +4 -2
- package/dist/es2019/view/BlockCard/views/flexible/styled.js +6 -13
- package/dist/es2019/view/BlockCard/views/styled.js +7 -0
- package/dist/es2019/view/CardWithData/component.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +1 -3
- package/dist/es2019/view/EmbedCard/components/styled.js +9 -30
- package/dist/es2019/view/EmbedCard/index.js +5 -2
- package/dist/es2019/view/EmbedCard/views/UnauthorisedView.js +4 -2
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/index.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +7 -11
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/index.js +21 -0
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +3 -5
- package/dist/es2019/view/HoverCard/components/views/unauthorised/index.js +3 -0
- package/dist/es2019/view/HoverCard/styled.js +6 -9
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/LinkView/index.js +1 -1
- package/dist/es2019/view/common/UnauthorisedViewContent.js +5 -3
- package/dist/esm/constants.js +1 -0
- package/dist/esm/messages.js +7 -2
- package/dist/esm/state/helpers.js +3 -0
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/views/ResolvedView.js +1 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +4 -2
- package/dist/esm/view/BlockCard/views/flexible/styled.js +3 -7
- package/dist/esm/view/BlockCard/views/styled.js +5 -0
- package/dist/esm/view/CardWithData/component.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +1 -3
- package/dist/esm/view/EmbedCard/components/styled.js +12 -20
- package/dist/esm/view/EmbedCard/index.js +5 -2
- package/dist/esm/view/EmbedCard/views/UnauthorisedView.js +4 -2
- package/dist/esm/view/EmbedCard/views/unauthorized-view/index.js +4 -2
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +7 -13
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/index.js +25 -0
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +3 -5
- package/dist/esm/view/HoverCard/components/views/unauthorised/index.js +3 -0
- package/dist/esm/view/HoverCard/styled.js +2 -3
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/LinkView/index.js +1 -1
- package/dist/esm/view/common/UnauthorisedViewContent.js +5 -3
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/extractors/inline/index.d.ts +1 -1
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/helpers.d.ts +1 -0
- package/dist/types/view/BlockCard/views/styled.d.ts +5 -0
- package/dist/types/view/EmbedCard/views/UnauthorisedView.d.ts +1 -0
- package/dist/types/view/EmbedCard/views/unauthorized-view/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/types.d.ts +7 -0
- package/dist/types/view/LinkView/index.d.ts +1 -1
- package/dist/types/view/common/UnauthorisedViewContent.d.ts +6 -1
- package/dist/types-ts4.5/constants.d.ts +1 -0
- package/dist/types-ts4.5/extractors/inline/index.d.ts +1 -1
- package/dist/types-ts4.5/messages.d.ts +1 -1
- package/dist/types-ts4.5/state/helpers.d.ts +1 -0
- package/dist/types-ts4.5/view/BlockCard/views/styled.d.ts +5 -0
- package/dist/types-ts4.5/view/EmbedCard/views/UnauthorisedView.d.ts +1 -0
- package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/types.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/types.d.ts +7 -0
- package/dist/types-ts4.5/view/LinkView/index.d.ts +1 -1
- package/dist/types-ts4.5/view/common/UnauthorisedViewContent.d.ts +6 -1
- package/package.json +5 -8
- package/dist/cjs/view/InlineCard/ErroredView/index.js +0 -89
- package/dist/cjs/view/InlineCard/ForbiddenView/index.js +0 -128
- package/dist/cjs/view/InlineCard/Frame/index.js +0 -61
- package/dist/cjs/view/InlineCard/Frame/styled.js +0 -66
- package/dist/cjs/view/InlineCard/Icon.js +0 -40
- package/dist/cjs/view/InlineCard/IconAndTitleLayout/index.js +0 -150
- package/dist/cjs/view/InlineCard/IconAndTitleLayout/styled.js +0 -47
- package/dist/cjs/view/InlineCard/ResolvedView/index.js +0 -82
- package/dist/cjs/view/InlineCard/ResolvingView/index.js +0 -68
- package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +0 -110
- package/dist/cjs/view/InlineCard/index.js +0 -182
- package/dist/cjs/view/InlineCard/styled.js +0 -26
- package/dist/es2019/view/InlineCard/ErroredView/index.js +0 -65
- package/dist/es2019/view/InlineCard/ForbiddenView/index.js +0 -107
- package/dist/es2019/view/InlineCard/Frame/index.js +0 -54
- package/dist/es2019/view/InlineCard/Frame/styled.js +0 -93
- package/dist/es2019/view/InlineCard/Icon.js +0 -45
- package/dist/es2019/view/InlineCard/IconAndTitleLayout/index.js +0 -124
- package/dist/es2019/view/InlineCard/IconAndTitleLayout/styled.js +0 -101
- package/dist/es2019/view/InlineCard/ResolvedView/index.js +0 -55
- package/dist/es2019/view/InlineCard/ResolvingView/index.js +0 -44
- package/dist/es2019/view/InlineCard/ResolvingView/styled.js +0 -6
- package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +0 -84
- package/dist/es2019/view/InlineCard/index.js +0 -149
- package/dist/es2019/view/InlineCard/styled.js +0 -35
- package/dist/esm/view/InlineCard/ErroredView/index.js +0 -82
- package/dist/esm/view/InlineCard/ForbiddenView/index.js +0 -121
- package/dist/esm/view/InlineCard/Frame/index.js +0 -52
- package/dist/esm/view/InlineCard/Frame/styled.js +0 -59
- package/dist/esm/view/InlineCard/Icon.js +0 -34
- package/dist/esm/view/InlineCard/IconAndTitleLayout/index.js +0 -143
- package/dist/esm/view/InlineCard/IconAndTitleLayout/styled.js +0 -40
- package/dist/esm/view/InlineCard/ResolvedView/index.js +0 -75
- package/dist/esm/view/InlineCard/ResolvingView/index.js +0 -61
- package/dist/esm/view/InlineCard/ResolvingView/styled.js +0 -5
- package/dist/esm/view/InlineCard/UnauthorisedView/index.js +0 -103
- package/dist/esm/view/InlineCard/index.js +0 -146
- package/dist/esm/view/InlineCard/styled.js +0 -19
- package/dist/types/view/InlineCard/ErroredView/index.d.ts +0 -21
- package/dist/types/view/InlineCard/ForbiddenView/index.d.ts +0 -28
- package/dist/types/view/InlineCard/Frame/index.d.ts +0 -15
- package/dist/types/view/InlineCard/Frame/styled.d.ts +0 -15
- package/dist/types/view/InlineCard/Icon.d.ts +0 -12
- package/dist/types/view/InlineCard/IconAndTitleLayout/index.d.ts +0 -28
- package/dist/types/view/InlineCard/IconAndTitleLayout/styled.d.ts +0 -40
- package/dist/types/view/InlineCard/ResolvedView/index.d.ts +0 -32
- package/dist/types/view/InlineCard/ResolvingView/index.d.ts +0 -17
- package/dist/types/view/InlineCard/ResolvingView/styled.d.ts +0 -9
- package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +0 -31
- package/dist/types/view/InlineCard/index.d.ts +0 -9
- package/dist/types/view/InlineCard/styled.d.ts +0 -17
- package/dist/types/view/InlineCard/types.d.ts +0 -25
- package/dist/types-ts4.5/view/InlineCard/ErroredView/index.d.ts +0 -21
- package/dist/types-ts4.5/view/InlineCard/ForbiddenView/index.d.ts +0 -28
- package/dist/types-ts4.5/view/InlineCard/Frame/index.d.ts +0 -15
- package/dist/types-ts4.5/view/InlineCard/Frame/styled.d.ts +0 -15
- package/dist/types-ts4.5/view/InlineCard/Icon.d.ts +0 -12
- package/dist/types-ts4.5/view/InlineCard/IconAndTitleLayout/index.d.ts +0 -28
- package/dist/types-ts4.5/view/InlineCard/IconAndTitleLayout/styled.d.ts +0 -40
- package/dist/types-ts4.5/view/InlineCard/ResolvedView/index.d.ts +0 -32
- package/dist/types-ts4.5/view/InlineCard/ResolvingView/index.d.ts +0 -17
- package/dist/types-ts4.5/view/InlineCard/ResolvingView/styled.d.ts +0 -9
- package/dist/types-ts4.5/view/InlineCard/UnauthorisedView/index.d.ts +0 -31
- package/dist/types-ts4.5/view/InlineCard/index.d.ts +0 -9
- package/dist/types-ts4.5/view/InlineCard/styled.d.ts +0 -17
- package/dist/types-ts4.5/view/InlineCard/types.d.ts +0 -25
- package/tmp/api-report-tmp.d.ts +0 -1007
- /package/dist/cjs/view/{InlineCard → FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group}/types.js +0 -0
- /package/dist/es2019/view/{InlineCard → FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group}/types.js +0 -0
- /package/dist/esm/view/{InlineCard → FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group}/types.js +0 -0
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
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 React from 'react';
|
|
7
|
-
import { FormattedMessage } from 'react-intl-next';
|
|
8
|
-
import { messages } from '../../../messages';
|
|
9
|
-
import { Frame } from '../Frame';
|
|
10
|
-
import { AKIconWrapper } from '../Icon';
|
|
11
|
-
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
12
|
-
import { IconStyledButton } from '../styled';
|
|
13
|
-
import { HoverCard } from '../../HoverCard';
|
|
14
|
-
const FallbackUnauthorizedIcon = /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(LockIcon, {
|
|
15
|
-
label: "error",
|
|
16
|
-
size: "small",
|
|
17
|
-
primaryColor: `var(--ds-icon-danger, ${R400})`
|
|
18
|
-
}));
|
|
19
|
-
export class InlineCardUnauthorizedView extends React.Component {
|
|
20
|
-
constructor(...args) {
|
|
21
|
-
super(...args);
|
|
22
|
-
_defineProperty(this, "handleConnectAccount", event => {
|
|
23
|
-
const {
|
|
24
|
-
analytics,
|
|
25
|
-
extensionKey,
|
|
26
|
-
onAuthorise
|
|
27
|
-
} = this.props;
|
|
28
|
-
event.preventDefault();
|
|
29
|
-
event.stopPropagation();
|
|
30
|
-
if (onAuthorise) {
|
|
31
|
-
analytics === null || analytics === void 0 ? void 0 : analytics.track.appAccountAuthStarted({
|
|
32
|
-
extensionKey
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return onAuthorise();
|
|
36
|
-
});
|
|
37
|
-
_defineProperty(this, "renderRightSide", () => {
|
|
38
|
-
const {
|
|
39
|
-
onAuthorise,
|
|
40
|
-
context
|
|
41
|
-
} = this.props;
|
|
42
|
-
return onAuthorise ? /*#__PURE__*/React.createElement(Button, {
|
|
43
|
-
spacing: "none",
|
|
44
|
-
appearance: "subtle-link",
|
|
45
|
-
component: IconStyledButton,
|
|
46
|
-
onClick: this.handleConnectAccount,
|
|
47
|
-
testId: "button-connect-account"
|
|
48
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_link_account_card_name, {
|
|
49
|
-
values: {
|
|
50
|
-
context
|
|
51
|
-
}
|
|
52
|
-
}))) : undefined;
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
render() {
|
|
56
|
-
const {
|
|
57
|
-
url,
|
|
58
|
-
icon,
|
|
59
|
-
onAuthorise,
|
|
60
|
-
onClick,
|
|
61
|
-
isSelected,
|
|
62
|
-
testId = 'inline-card-unauthorized-view',
|
|
63
|
-
showAuthTooltip = false
|
|
64
|
-
} = this.props;
|
|
65
|
-
const inlineCardUnauthenticatedView = /*#__PURE__*/React.createElement(Frame, {
|
|
66
|
-
testId: testId,
|
|
67
|
-
isSelected: isSelected
|
|
68
|
-
}, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
|
|
69
|
-
icon: icon ? icon : FallbackUnauthorizedIcon,
|
|
70
|
-
title: url,
|
|
71
|
-
link: url,
|
|
72
|
-
rightSide: this.renderRightSide(),
|
|
73
|
-
onClick: onClick,
|
|
74
|
-
titleColor: `var(--ds-text-subtle, ${N500})`
|
|
75
|
-
}));
|
|
76
|
-
if (onAuthorise && showAuthTooltip) {
|
|
77
|
-
return /*#__PURE__*/React.createElement(HoverCard, {
|
|
78
|
-
url: url,
|
|
79
|
-
id: this.props.id
|
|
80
|
-
}, inlineCardUnauthenticatedView);
|
|
81
|
-
}
|
|
82
|
-
return inlineCardUnauthenticatedView;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
export const IconStyledButton = styled.span`
|
|
9
|
-
text-align: initial !important;
|
|
10
|
-
display: inline !important;
|
|
11
|
-
|
|
12
|
-
> span {
|
|
13
|
-
display: inline;
|
|
14
|
-
> span {
|
|
15
|
-
overflow: initial;
|
|
16
|
-
text-overflow: initial;
|
|
17
|
-
white-space: initial;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
export const NoLinkAppearance = styled.span`
|
|
22
|
-
color: ${themed({
|
|
23
|
-
light: `var(--ds-text-subtlest, ${N200})`,
|
|
24
|
-
dark: `var(--ds-text-subtlest, ${LINK_COLOR_DARK})`
|
|
25
|
-
})};
|
|
26
|
-
`;
|
|
27
|
-
export const LowercaseAppearance = styled.span`
|
|
28
|
-
text-transform: lowercase;
|
|
29
|
-
`;
|
|
30
|
-
export const LinkAppearance = styled.a`
|
|
31
|
-
color: ${themed({
|
|
32
|
-
light: `var(--ds-link, ${B400})`,
|
|
33
|
-
dark: `var(--ds-link, ${LINK_COLOR_DARK})`
|
|
34
|
-
})};
|
|
35
|
-
`;
|
|
@@ -1,82 +0,0 @@
|
|
|
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, LowercaseAppearance } from '../styled';
|
|
20
|
-
export var InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
|
|
21
|
-
_inherits(InlineCardErroredView, _React$Component);
|
|
22
|
-
var _super = _createSuper(InlineCardErroredView);
|
|
23
|
-
function InlineCardErroredView() {
|
|
24
|
-
var _this;
|
|
25
|
-
_classCallCheck(this, InlineCardErroredView);
|
|
26
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
|
-
args[_key] = arguments[_key];
|
|
28
|
-
}
|
|
29
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
30
|
-
_defineProperty(_assertThisInitialized(_this), "handleRetry", function (event) {
|
|
31
|
-
var onRetry = _this.props.onRetry;
|
|
32
|
-
if (onRetry) {
|
|
33
|
-
event.preventDefault();
|
|
34
|
-
event.stopPropagation();
|
|
35
|
-
onRetry();
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
_defineProperty(_assertThisInitialized(_this), "renderRightSide", function () {
|
|
39
|
-
var _this$props = _this.props,
|
|
40
|
-
onRetry = _this$props.onRetry,
|
|
41
|
-
message = _this$props.message;
|
|
42
|
-
return !onRetry ? message : /*#__PURE__*/React.createElement(React.Fragment, null, message, ', ', /*#__PURE__*/React.createElement(Button, {
|
|
43
|
-
spacing: "none",
|
|
44
|
-
appearance: "subtle-link",
|
|
45
|
-
component: IconStyledButton,
|
|
46
|
-
onClick: _this.handleRetry,
|
|
47
|
-
role: "button"
|
|
48
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.try_again, function (formattedMessage) {
|
|
49
|
-
return /*#__PURE__*/React.createElement(LowercaseAppearance, null, formattedMessage);
|
|
50
|
-
})));
|
|
51
|
-
});
|
|
52
|
-
return _this;
|
|
53
|
-
}
|
|
54
|
-
_createClass(InlineCardErroredView, [{
|
|
55
|
-
key: "render",
|
|
56
|
-
value: function render() {
|
|
57
|
-
var _this$props2 = this.props,
|
|
58
|
-
url = _this$props2.url,
|
|
59
|
-
onClick = _this$props2.onClick,
|
|
60
|
-
isSelected = _this$props2.isSelected,
|
|
61
|
-
_this$props2$testId = _this$props2.testId,
|
|
62
|
-
testId = _this$props2$testId === void 0 ? 'inline-card-errored-view' : _this$props2$testId,
|
|
63
|
-
icon = _this$props2.icon;
|
|
64
|
-
return /*#__PURE__*/React.createElement(Frame, {
|
|
65
|
-
testId: testId,
|
|
66
|
-
isSelected: isSelected
|
|
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: this.renderRightSide()
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
}]);
|
|
81
|
-
return InlineCardErroredView;
|
|
82
|
-
}(React.Component);
|
|
@@ -1,121 +0,0 @@
|
|
|
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, LozengeBlockWrapper } from '../IconAndTitleLayout/styled';
|
|
23
|
-
var FallbackForbiddenIcon = /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(LockIcon, {
|
|
24
|
-
label: "error",
|
|
25
|
-
size: "small",
|
|
26
|
-
primaryColor: "var(--ds-icon-danger, ".concat(R400, ")"),
|
|
27
|
-
testId: "forbidden-view-fallback-icon"
|
|
28
|
-
}));
|
|
29
|
-
export var InlineCardForbiddenView = /*#__PURE__*/function (_React$Component) {
|
|
30
|
-
_inherits(InlineCardForbiddenView, _React$Component);
|
|
31
|
-
var _super = _createSuper(InlineCardForbiddenView);
|
|
32
|
-
function InlineCardForbiddenView() {
|
|
33
|
-
var _this$props;
|
|
34
|
-
var _this;
|
|
35
|
-
_classCallCheck(this, InlineCardForbiddenView);
|
|
36
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
37
|
-
args[_key] = arguments[_key];
|
|
38
|
-
}
|
|
39
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
40
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
41
|
-
hasRequestAccessContextMessage: !!((_this$props = _this.props) !== null && _this$props !== void 0 && (_this$props = _this$props.requestAccessContext) !== null && _this$props !== void 0 && _this$props.callToActionMessageKey)
|
|
42
|
-
});
|
|
43
|
-
_defineProperty(_assertThisInitialized(_this), "handleRetry", function (event) {
|
|
44
|
-
var onAuthorise = _this.props.onAuthorise;
|
|
45
|
-
event.preventDefault();
|
|
46
|
-
event.stopPropagation();
|
|
47
|
-
if (onAuthorise) {
|
|
48
|
-
onAuthorise();
|
|
49
|
-
} else {
|
|
50
|
-
var _this$props2;
|
|
51
|
-
(_this$props2 = _this.props) === null || _this$props2 === void 0 || (_this$props2 = _this$props2.requestAccessContext) === null || _this$props2 === void 0 || (_this$props2 = _this$props2.action) === null || _this$props2 === void 0 || _this$props2.promise();
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
_defineProperty(_assertThisInitialized(_this), "renderForbiddenAccessMessage", function () {
|
|
55
|
-
var _this$props3;
|
|
56
|
-
if ((_this$props3 = _this.props) !== null && _this$props3 !== void 0 && (_this$props3 = _this$props3.requestAccessContext) !== null && _this$props3 !== void 0 && _this$props3.callToActionMessageKey) {
|
|
57
|
-
var callToActionMessageKey = _this.props.requestAccessContext.callToActionMessageKey;
|
|
58
|
-
return /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[callToActionMessageKey], {
|
|
59
|
-
values: {
|
|
60
|
-
context: _this.props.context
|
|
61
|
-
}
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, messages.invalid_permissions, function (formattedMessage) {
|
|
65
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, formattedMessage);
|
|
66
|
-
}));
|
|
67
|
-
});
|
|
68
|
-
_defineProperty(_assertThisInitialized(_this), "renderRightSide", function () {
|
|
69
|
-
var onAuthorise = _this.props.onAuthorise;
|
|
70
|
-
if (_this.state.hasRequestAccessContextMessage) {
|
|
71
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
72
|
-
spacing: "none",
|
|
73
|
-
appearance: "subtle-link",
|
|
74
|
-
onClick: _this.handleRetry,
|
|
75
|
-
component: IconStyledButton,
|
|
76
|
-
testId: "button-connect-other-account",
|
|
77
|
-
role: "button"
|
|
78
|
-
}, _this.renderForbiddenAccessMessage());
|
|
79
|
-
}
|
|
80
|
-
if (onAuthorise) {
|
|
81
|
-
return /*#__PURE__*/React.createElement(LozengeBlockWrapper, null, /*#__PURE__*/React.createElement(Button, {
|
|
82
|
-
spacing: "none",
|
|
83
|
-
appearance: "subtle-link",
|
|
84
|
-
onClick: _this.handleRetry,
|
|
85
|
-
component: IconStyledButton,
|
|
86
|
-
testId: "button-connect-other-account",
|
|
87
|
-
role: "button"
|
|
88
|
-
}, /*#__PURE__*/React.createElement(LozengeWrapper, null, /*#__PURE__*/React.createElement(Lozenge, {
|
|
89
|
-
appearance: 'moved'
|
|
90
|
-
}, _this.renderForbiddenAccessMessage()))));
|
|
91
|
-
}
|
|
92
|
-
return null;
|
|
93
|
-
});
|
|
94
|
-
return _this;
|
|
95
|
-
}
|
|
96
|
-
_createClass(InlineCardForbiddenView, [{
|
|
97
|
-
key: "render",
|
|
98
|
-
value: function render() {
|
|
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;
|
|
106
|
-
return /*#__PURE__*/React.createElement(Frame, {
|
|
107
|
-
testId: testId,
|
|
108
|
-
isSelected: isSelected
|
|
109
|
-
}, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
|
|
110
|
-
icon: icon ? icon : FallbackForbiddenIcon,
|
|
111
|
-
link: url,
|
|
112
|
-
title: url,
|
|
113
|
-
onClick: onClick,
|
|
114
|
-
titleColor: "var(--ds-text-subtle, ".concat(N500, ")"),
|
|
115
|
-
rightSide: this.renderRightSide(),
|
|
116
|
-
rightSideSpacer: this.state.hasRequestAccessContextMessage
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
}]);
|
|
120
|
-
return InlineCardForbiddenView;
|
|
121
|
-
}(React.Component);
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
3
|
-
import { WrapperAnchor, WrapperSpan } from './styled';
|
|
4
|
-
import { useMouseDownEvent } from '../../../state/analytics/useLinkClicked';
|
|
5
|
-
export var Frame = function Frame(props) {
|
|
6
|
-
var isSelected = props.isSelected,
|
|
7
|
-
children = props.children,
|
|
8
|
-
onClick = props.onClick,
|
|
9
|
-
link = props.link,
|
|
10
|
-
withoutBackground = props.withoutBackground,
|
|
11
|
-
testId = props.testId,
|
|
12
|
-
className = props.className;
|
|
13
|
-
var handleClick = useCallback(function (event) {
|
|
14
|
-
if (onClick) {
|
|
15
|
-
event.preventDefault();
|
|
16
|
-
event.stopPropagation();
|
|
17
|
-
onClick(event);
|
|
18
|
-
}
|
|
19
|
-
}, [onClick]);
|
|
20
|
-
var handleKeyPress = useCallback(function (event) {
|
|
21
|
-
if (event.key !== ' ' && event.key !== 'Enter') {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (onClick) {
|
|
25
|
-
event.preventDefault();
|
|
26
|
-
event.stopPropagation();
|
|
27
|
-
onClick(event);
|
|
28
|
-
}
|
|
29
|
-
}, [onClick]);
|
|
30
|
-
var handleMouseDown = useMouseDownEvent();
|
|
31
|
-
var isInteractive = Boolean(onClick);
|
|
32
|
-
|
|
33
|
-
// Depending on whenever Frame was given onClick or link itself we display span or anchor elements
|
|
34
|
-
var Wrapper = link || onClick ? WrapperAnchor : WrapperSpan;
|
|
35
|
-
|
|
36
|
-
// TODO Theming doesn't work right now in editor. Required React context does not trickle down atm.
|
|
37
|
-
// It will be worked as part of https://product-fabric.atlassian.net/jira/servicedesk/projects/DTR/queues/issue/DTR-154
|
|
38
|
-
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
39
|
-
theme: useGlobalTheme(),
|
|
40
|
-
href: link,
|
|
41
|
-
withoutBackground: withoutBackground,
|
|
42
|
-
isSelected: isSelected,
|
|
43
|
-
isInteractive: isInteractive,
|
|
44
|
-
tabIndex: isInteractive ? 0 : undefined,
|
|
45
|
-
role: isInteractive ? 'button' : undefined,
|
|
46
|
-
onClick: handleClick,
|
|
47
|
-
onMouseDown: handleMouseDown,
|
|
48
|
-
onKeyPress: handleKeyPress,
|
|
49
|
-
"data-testid": testId,
|
|
50
|
-
className: className
|
|
51
|
-
}, children);
|
|
52
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2;
|
|
3
|
-
import styled from '@emotion/styled';
|
|
4
|
-
import { B100, B400, B50, DN40A, DN50A, N20, N40A, N50A } from '@atlaskit/theme/colors';
|
|
5
|
-
import { borderRadius as akBorderRadius } from '@atlaskit/theme/constants';
|
|
6
|
-
import { themed } from '@atlaskit/theme/components';
|
|
7
|
-
var BACKGROUND_COLOR_DARK = '#262B31';
|
|
8
|
-
var selected = "\n cursor: pointer;\n box-shadow: 0 0 0 2px ".concat("var(--ds-border-selected, ".concat(B100, ")"), ";\n outline: none;\n user-select: none;\n &, :hover, :focus, :active {\n text-decoration: none;\n }\n");
|
|
9
|
-
var isInteractive = function isInteractive(_ref) {
|
|
10
|
-
var isInteractive = _ref.isInteractive;
|
|
11
|
-
if (isInteractive) {
|
|
12
|
-
return "\n :hover {\n background-color: ".concat(themed({
|
|
13
|
-
light: "var(--ds-background-neutral-subtle-hovered, ".concat(N20, ")"),
|
|
14
|
-
dark: "var(--ds-background-neutral-subtle-hovered, ".concat(BACKGROUND_COLOR_DARK, ")")
|
|
15
|
-
}), ";\n }\n :active {\n background-color: ").concat(themed({
|
|
16
|
-
light: "var(--ds-background-selected, ".concat(B50, ")"),
|
|
17
|
-
dark: "var(--ds-background-selected, ".concat(BACKGROUND_COLOR_DARK, ")")
|
|
18
|
-
}), ";\n }\n :focus {\n ").concat(selected, "\n }\n ");
|
|
19
|
-
} else {
|
|
20
|
-
return '';
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
var isSelected = function isSelected(_ref2) {
|
|
24
|
-
var isSelected = _ref2.isSelected;
|
|
25
|
-
if (isSelected) {
|
|
26
|
-
return selected;
|
|
27
|
-
} else {
|
|
28
|
-
return 'user-select: text';
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/*
|
|
33
|
-
Inline smart cards should have the following layout:
|
|
34
|
-
------------------------------------
|
|
35
|
-
| icon | title | action OR lozenge |
|
|
36
|
-
------------------------------------
|
|
37
|
-
The aim is to ensure (1) all children are
|
|
38
|
-
in line with each other, (2) are vertically
|
|
39
|
-
centered.
|
|
40
|
-
*/
|
|
41
|
-
// NB: `padding` consistent with @mentions.
|
|
42
|
-
// NB: `display: inline` required for `box-decoration-break` to work.
|
|
43
|
-
// NB: `box-decoration-break` required for retaining properties (border-radius) on wrap.
|
|
44
|
-
var baseWrapperStyle = function baseWrapperStyle(props) {
|
|
45
|
-
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({
|
|
46
|
-
light: "var(--ds-link, ".concat(B400, ")"),
|
|
47
|
-
dark: "var(--ds-link, #4794FF)"
|
|
48
|
-
})(props), ";\n background-color: ").concat(props.withoutBackground ? '' : themed({
|
|
49
|
-
light: "var(--ds-surface-raised, white)",
|
|
50
|
-
dark: "var(--ds-surface-raised, ".concat(BACKGROUND_COLOR_DARK, ")")
|
|
51
|
-
})(props), ";\n ").concat(props.withoutBackground ? '' : themed({
|
|
52
|
-
light: "box-shadow: ".concat("var(--ds-shadow-raised, ".concat("0 1px 1px ".concat(N50A, ", 0 0 1px 1px ").concat(N40A), ")"), ";"),
|
|
53
|
-
dark: "box-shadow: ".concat("var(--ds-shadow-raised, ".concat("0 1px 1px ".concat(DN50A, ", 0 0 1px 1px ").concat(DN40A), ")"), ";")
|
|
54
|
-
})(props), "\n ").concat(isSelected(props), ";\n transition: 0.1s all ease-in-out;\n -moz-user-select: none;\n");
|
|
55
|
-
};
|
|
56
|
-
export var WrapperAnchor = styled.a(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n ", "\n"])), baseWrapperStyle, isInteractive);
|
|
57
|
-
WrapperAnchor.displayName = 'WrapperAnchor';
|
|
58
|
-
export var WrapperSpan = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n"])), baseWrapperStyle);
|
|
59
|
-
WrapperSpan.displayName = 'WrapperSpan';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2;
|
|
3
|
-
import styled from '@emotion/styled';
|
|
4
|
-
import { Skeleton } from '@atlaskit/linking-common';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
// TODO: Figure out a more scalable/responsive solution
|
|
8
|
-
// for vertical alignment.
|
|
9
|
-
// Current rationale: vertically positioned at the top of
|
|
10
|
-
// the smart card container (when set to 0). Offset this
|
|
11
|
-
// to position it with appropriate whitespace from the top.
|
|
12
|
-
export var Icon = styled.img(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 14px;\n width: 14px;\n margin-right: ", ";\n border-radius: 2px;\n user-select: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n"])), "var(--ds-space-050, 4px)");
|
|
13
|
-
|
|
14
|
-
// Used for 'untrue' icons which claim to be 16x16 but
|
|
15
|
-
// are less than that in height/width.
|
|
16
|
-
// TODO: Replace this override with proper AtlasKit solution.
|
|
17
|
-
export var AKIconWrapper = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-right: ", ";\n"])), "var(--ds-space-negative-025, -2px)");
|
|
18
|
-
export var Shimmer = function Shimmer(_ref) {
|
|
19
|
-
var testId = _ref.testId;
|
|
20
|
-
var skeletonCustomStyles = {
|
|
21
|
-
position: 'absolute',
|
|
22
|
-
top: '50%',
|
|
23
|
-
left: '50%',
|
|
24
|
-
transform: 'translate(-50%, -50%)',
|
|
25
|
-
marginRight: "var(--ds-space-050, 4px)"
|
|
26
|
-
};
|
|
27
|
-
return /*#__PURE__*/React.createElement(Skeleton, {
|
|
28
|
-
width: 14,
|
|
29
|
-
height: 14,
|
|
30
|
-
borderRadius: 2,
|
|
31
|
-
testId: testId,
|
|
32
|
-
style: skeletonCustomStyles
|
|
33
|
-
});
|
|
34
|
-
};
|