@atlaskit/smart-card 26.42.7 → 26.42.9
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 +13 -0
- 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/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 +1 -1
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +3 -5
- 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/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +1 -1
- 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 +1 -1
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +3 -5
- 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/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/views/ResolvedView.js +1 -1
- 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 +1 -1
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +3 -5
- 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/types/extractors/inline/index.d.ts +1 -1
- package/dist/types/view/BlockCard/views/styled.d.ts +5 -0
- package/dist/types/view/LinkView/index.d.ts +1 -1
- package/dist/types-ts4.5/extractors/inline/index.d.ts +1 -1
- package/dist/types-ts4.5/view/BlockCard/views/styled.d.ts +5 -0
- package/dist/types-ts4.5/view/LinkView/index.d.ts +1 -1
- package/package.json +6 -9
- 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/cjs/view/InlineCard/types.js +0 -5
- 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/es2019/view/InlineCard/types.js +0 -1
- 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/esm/view/InlineCard/types.js +0 -1
- 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
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import ImageLoader from 'react-render-image';
|
|
4
|
-
import { Icon, Shimmer } from '../Icon';
|
|
5
|
-
import { IconEmptyWrapper, IconPositionWrapper, IconTitleWrapper, IconWrapper, TitleWrapper, EmojiWrapper, TitleWrapperClassName } from './styled';
|
|
6
|
-
import LinkIcon from '@atlaskit/icon/glyph/link';
|
|
7
|
-
import { LinkAppearance, NoLinkAppearance } from '../styled';
|
|
8
|
-
export class IconAndTitleLayout extends React.Component {
|
|
9
|
-
constructor(...args) {
|
|
10
|
-
super(...args);
|
|
11
|
-
_defineProperty(this, "handleClick", event => {
|
|
12
|
-
const {
|
|
13
|
-
onClick
|
|
14
|
-
} = this.props;
|
|
15
|
-
if (onClick) {
|
|
16
|
-
event.preventDefault();
|
|
17
|
-
event.stopPropagation();
|
|
18
|
-
onClick(event);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
_defineProperty(this, "handleKeyPress", event => {
|
|
22
|
-
const {
|
|
23
|
-
onClick
|
|
24
|
-
} = this.props;
|
|
25
|
-
if (event.key !== ' ' && event.key !== 'Enter') {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (onClick) {
|
|
29
|
-
event.preventDefault();
|
|
30
|
-
event.stopPropagation();
|
|
31
|
-
onClick(event);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
renderAtlaskitIcon() {
|
|
36
|
-
const {
|
|
37
|
-
icon,
|
|
38
|
-
emoji
|
|
39
|
-
} = this.props;
|
|
40
|
-
if (emoji) {
|
|
41
|
-
return /*#__PURE__*/React.createElement(EmojiWrapper, null, emoji);
|
|
42
|
-
}
|
|
43
|
-
if (!icon || typeof icon === 'string') {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
return /*#__PURE__*/React.createElement(IconWrapper, null, icon);
|
|
47
|
-
}
|
|
48
|
-
renderImageIcon(errored, testId) {
|
|
49
|
-
const {
|
|
50
|
-
icon: url
|
|
51
|
-
} = this.props;
|
|
52
|
-
if (!url || typeof url !== 'string') {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
return /*#__PURE__*/React.createElement(ImageLoader, {
|
|
56
|
-
src: url,
|
|
57
|
-
loaded: /*#__PURE__*/React.createElement(Icon, {
|
|
58
|
-
className: "smart-link-icon",
|
|
59
|
-
src: url,
|
|
60
|
-
"data-testid": `${testId}-image`
|
|
61
|
-
}),
|
|
62
|
-
errored: errored,
|
|
63
|
-
loading: /*#__PURE__*/React.createElement(Shimmer, {
|
|
64
|
-
testId: `${testId}-loading`
|
|
65
|
-
})
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
renderIconPlaceholder(testId) {
|
|
69
|
-
const {
|
|
70
|
-
defaultIcon
|
|
71
|
-
} = this.props;
|
|
72
|
-
if (defaultIcon) {
|
|
73
|
-
return /*#__PURE__*/React.createElement(IconWrapper, null, defaultIcon);
|
|
74
|
-
}
|
|
75
|
-
return /*#__PURE__*/React.createElement(IconWrapper, null, /*#__PURE__*/React.createElement(LinkIcon, {
|
|
76
|
-
label: "link",
|
|
77
|
-
size: "small",
|
|
78
|
-
testId: `${testId}-default`
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
renderIcon(testId) {
|
|
82
|
-
// We render two kinds of icons here:
|
|
83
|
-
// - Image: acquired from either DAC or Teamwork Platform Apps;
|
|
84
|
-
// - Atlaskit Icon: an Atlaskit SVG;
|
|
85
|
-
// Each of these are scaled down to 12x12.
|
|
86
|
-
const icon = this.renderAtlaskitIcon();
|
|
87
|
-
if (icon) {
|
|
88
|
-
return icon;
|
|
89
|
-
}
|
|
90
|
-
const placeholder = this.renderIconPlaceholder(testId);
|
|
91
|
-
const image = this.renderImageIcon(placeholder, testId);
|
|
92
|
-
return image || placeholder;
|
|
93
|
-
}
|
|
94
|
-
render() {
|
|
95
|
-
const {
|
|
96
|
-
children,
|
|
97
|
-
title,
|
|
98
|
-
titleColor,
|
|
99
|
-
titleTextColor,
|
|
100
|
-
link,
|
|
101
|
-
rightSide,
|
|
102
|
-
testId = 'inline-card-icon-and-title'
|
|
103
|
-
} = this.props;
|
|
104
|
-
const 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, {
|
|
105
|
-
style: {
|
|
106
|
-
color: titleTextColor
|
|
107
|
-
},
|
|
108
|
-
className: TitleWrapperClassName
|
|
109
|
-
}, title));
|
|
110
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconTitleWrapper, {
|
|
111
|
-
style: {
|
|
112
|
-
color: titleColor
|
|
113
|
-
},
|
|
114
|
-
"data-testid": testId
|
|
115
|
-
}, link ? /*#__PURE__*/React.createElement(LinkAppearance, {
|
|
116
|
-
href: link,
|
|
117
|
-
onClick: this.handleClick,
|
|
118
|
-
onKeyPress: this.handleKeyPress
|
|
119
|
-
}, titlePart) : titlePart, rightSide ? /*#__PURE__*/React.createElement(NoLinkAppearance, null, this.props.rightSideSpacer && ' - ', rightSide) : null));
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
_defineProperty(IconAndTitleLayout, "defaultProps", {
|
|
123
|
-
rightSideSpacer: true
|
|
124
|
-
});
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import styled from '@emotion/styled';
|
|
2
|
-
// TODO: remove this override behaviour for @atlaskit/icon-object
|
|
3
|
-
export const IconObjectOverrides = `
|
|
4
|
-
& > span {
|
|
5
|
-
height: 16px;
|
|
6
|
-
width: 14px;
|
|
7
|
-
position: absolute;
|
|
8
|
-
top: 0;
|
|
9
|
-
left: 0;
|
|
10
|
-
line-height: 14px;
|
|
11
|
-
& > svg {
|
|
12
|
-
position: absolute;
|
|
13
|
-
top: 50%;
|
|
14
|
-
left: 50%;
|
|
15
|
-
transform: translate(-50%, -50%);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
`;
|
|
19
|
-
// TODO: remove this override behaviour for @atlaskit/icon
|
|
20
|
-
export const IconOverrides = `
|
|
21
|
-
& > * > span {
|
|
22
|
-
height: 16px;
|
|
23
|
-
width: 14px;
|
|
24
|
-
position: absolute;
|
|
25
|
-
top: 0;
|
|
26
|
-
left: 0;
|
|
27
|
-
& > svg {
|
|
28
|
-
position: absolute;
|
|
29
|
-
top: 50%;
|
|
30
|
-
left: 50%;
|
|
31
|
-
transform: translate(-50%, -50%);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
// Wraps all icons represented in Inline Links. Icons have three sources/types:
|
|
37
|
-
// - JSON-LD: from the generator.icon property coming back from ORS.
|
|
38
|
-
// - @atlaskit/icon: for lock icons, unauthorized, etc.
|
|
39
|
-
// - @atlaskit/icon-object: for object icons, e.g. repository, branch, etc.
|
|
40
|
-
// NB: the first set of overrides style icons imported from @atlaskit/icon-object correctly.
|
|
41
|
-
// NB: the second set of overrides style icons imported from @atlaskit/icon correctly.
|
|
42
|
-
export const IconWrapper = styled.span`
|
|
43
|
-
user-select: none;
|
|
44
|
-
${IconOverrides}
|
|
45
|
-
${IconObjectOverrides}
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
|
-
// Wraps all emoji in Inline Links similar to icon
|
|
49
|
-
export const EmojiWrapper = styled.span`
|
|
50
|
-
display: inline-block;
|
|
51
|
-
margin-right: ${"var(--ds-space-025, 2px)"};
|
|
52
|
-
user-select: none;
|
|
53
|
-
${IconOverrides}
|
|
54
|
-
${IconObjectOverrides}
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
// The main 'wrapping' element, title of the content.
|
|
58
|
-
// NB: `white-space` adds little whitespace before wrapping.
|
|
59
|
-
// NB: `word-break` line breaks as soon as an overflow takes place.
|
|
60
|
-
export const IconTitleWrapper = styled.span`
|
|
61
|
-
white-space: pre-wrap;
|
|
62
|
-
word-break: break-all;
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
|
-
// TODO: Replace overrides with proper AtlasKit solution.
|
|
66
|
-
export const LozengeWrapper = styled.span`
|
|
67
|
-
display: inline-block;
|
|
68
|
-
vertical-align: 1px;
|
|
69
|
-
`;
|
|
70
|
-
// TODO: Replace overrides with proper AtlasKit solution.
|
|
71
|
-
export const LozengeBlockWrapper = styled.span`
|
|
72
|
-
& > span {
|
|
73
|
-
margin-left: ${"var(--ds-space-050, 4px)"};
|
|
74
|
-
}
|
|
75
|
-
`;
|
|
76
|
-
export const RightIconPositionWrapper = styled.span`
|
|
77
|
-
margin-left: ${"var(--ds-space-025, 2px)"};
|
|
78
|
-
margin-right: ${"var(--ds-space-050, 4px)"};
|
|
79
|
-
position: relative;
|
|
80
|
-
display: inline-block;
|
|
81
|
-
`;
|
|
82
|
-
|
|
83
|
-
// The following components are used to absolutely position icons in the vertical center.
|
|
84
|
-
// - IconPositionWrapper: the `relative` parent which has no height in itself.
|
|
85
|
-
// - IconEmptyWrapper: the child which forces `IconPositionWrapper` to have a height.
|
|
86
|
-
export const IconPositionWrapper = styled.span`
|
|
87
|
-
margin-right: ${"var(--ds-space-050, 4px)"};
|
|
88
|
-
position: relative;
|
|
89
|
-
display: inline-block;
|
|
90
|
-
`;
|
|
91
|
-
export const IconEmptyWrapper = styled.span`
|
|
92
|
-
width: 14px;
|
|
93
|
-
height: 100%;
|
|
94
|
-
display: inline-block;
|
|
95
|
-
opacity: 0;
|
|
96
|
-
`;
|
|
97
|
-
|
|
98
|
-
// With emotion it's not possible to use reference to `TitleWrapper` as part of a selector,
|
|
99
|
-
// To achieve same result we use classname instead.
|
|
100
|
-
export const TitleWrapperClassName = 'smart-link-title-wrapper';
|
|
101
|
-
export const TitleWrapper = styled.span``;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Frame } from '../Frame';
|
|
3
|
-
import Lozenge from '@atlaskit/lozenge';
|
|
4
|
-
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
5
|
-
import { LozengeWrapper, LozengeBlockWrapper } from '../IconAndTitleLayout/styled';
|
|
6
|
-
import { HoverCard } from '../../../view/HoverCard/index';
|
|
7
|
-
export class InlineCardResolvedView extends React.Component {
|
|
8
|
-
renderLozenge() {
|
|
9
|
-
const {
|
|
10
|
-
lozenge
|
|
11
|
-
} = this.props;
|
|
12
|
-
if (!lozenge) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return /*#__PURE__*/React.createElement(LozengeBlockWrapper, null, /*#__PURE__*/React.createElement(LozengeWrapper, null, /*#__PURE__*/React.createElement(Lozenge, {
|
|
16
|
-
testId: "inline-card-resolved-view-lozenge",
|
|
17
|
-
appearance: lozenge.appearance || 'default',
|
|
18
|
-
isBold: lozenge.isBold
|
|
19
|
-
}, lozenge.text)));
|
|
20
|
-
}
|
|
21
|
-
render() {
|
|
22
|
-
const {
|
|
23
|
-
id,
|
|
24
|
-
title = '',
|
|
25
|
-
isSelected,
|
|
26
|
-
onClick,
|
|
27
|
-
icon,
|
|
28
|
-
link,
|
|
29
|
-
testId = 'inline-card-resolved-view',
|
|
30
|
-
titleTextColor,
|
|
31
|
-
titlePrefix,
|
|
32
|
-
showHoverPreview = false,
|
|
33
|
-
showServerActions = false
|
|
34
|
-
} = this.props;
|
|
35
|
-
const inlineCardResolvedView = /*#__PURE__*/React.createElement(Frame, {
|
|
36
|
-
testId: testId,
|
|
37
|
-
link: link,
|
|
38
|
-
isSelected: isSelected,
|
|
39
|
-
onClick: onClick
|
|
40
|
-
}, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
|
|
41
|
-
emoji: titlePrefix,
|
|
42
|
-
icon: icon,
|
|
43
|
-
title: title,
|
|
44
|
-
titleTextColor: titleTextColor
|
|
45
|
-
}), this.renderLozenge());
|
|
46
|
-
if (showHoverPreview && link) {
|
|
47
|
-
return /*#__PURE__*/React.createElement(HoverCard, {
|
|
48
|
-
id: id,
|
|
49
|
-
showServerActions: showServerActions,
|
|
50
|
-
url: link
|
|
51
|
-
}, inlineCardResolvedView);
|
|
52
|
-
}
|
|
53
|
-
return inlineCardResolvedView;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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);
|