@atlaskit/smart-card 19.1.17 → 19.1.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 +13 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/CardWithUrl/component-lazy/LazyFallback.js +4 -2
- package/dist/cjs/view/CardWithUrl/loader.js +4 -2
- package/dist/cjs/view/LinkView/index.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/CardWithUrl/component-lazy/LazyFallback.js +13 -9
- package/dist/es2019/view/CardWithUrl/loader.js +4 -2
- package/dist/es2019/view/LinkView/index.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/CardWithUrl/component-lazy/LazyFallback.js +4 -2
- package/dist/esm/view/CardWithUrl/loader.js +4 -2
- package/dist/esm/view/LinkView/index.js +1 -1
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/Card/types.d.ts +1 -0
- package/dist/types/view/CardWithUrl/types.d.ts +1 -0
- package/dist/types/view/LinkView/index.d.ts +4 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 19.1.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b26dd70a1e6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b26dd70a1e6) - This PR adds the ability for an integrator to provide a string via `placeholder` which will be displayed instead of the url while the CardWithURLContent component is not mounted (i.e. not currently being observed). This should help with performance use cases where some text is required to be displayed before the full Smart Link component is rendered.
|
|
8
|
+
|
|
9
|
+
Usage:
|
|
10
|
+
|
|
11
|
+
```Typescript
|
|
12
|
+
// This will render the string "spaghetti" before the Smart Link is loaded.
|
|
13
|
+
<Card url={url} appearance='inline' placeholder='spaghetti'/>
|
|
14
|
+
```
|
|
15
|
+
|
|
3
16
|
## 19.1.17
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/cjs/version.json
CHANGED
|
@@ -16,14 +16,16 @@ exports.loadingPlaceholderClassName = loadingPlaceholderClassName;
|
|
|
16
16
|
|
|
17
17
|
var LoadingCardLink = function LoadingCardLink(_ref) {
|
|
18
18
|
var isSelected = _ref.isSelected,
|
|
19
|
-
url = _ref.url
|
|
19
|
+
url = _ref.url,
|
|
20
|
+
placeholder = _ref.placeholder;
|
|
20
21
|
return /*#__PURE__*/_react.default.createElement(_LinkView.CardLinkView, {
|
|
21
22
|
key: 'lazy-render-key',
|
|
22
23
|
testId: 'lazy-render-placeholder',
|
|
23
24
|
"data-trello-do-not-use-override": "lazy-render-placeholder-trello",
|
|
24
25
|
isSelected: isSelected,
|
|
25
26
|
link: url,
|
|
26
|
-
className: loadingPlaceholderClassName
|
|
27
|
+
className: loadingPlaceholderClassName,
|
|
28
|
+
placeholder: placeholder
|
|
27
29
|
});
|
|
28
30
|
};
|
|
29
31
|
|
|
@@ -66,7 +66,8 @@ function CardWithURLRenderer(props) {
|
|
|
66
66
|
children = props.children,
|
|
67
67
|
ui = props.ui,
|
|
68
68
|
showHoverPreview = props.showHoverPreview,
|
|
69
|
-
analyticsEvents = props.analyticsEvents
|
|
69
|
+
analyticsEvents = props.analyticsEvents,
|
|
70
|
+
placeholder = props.placeholder; // Wrapper around analytics.
|
|
70
71
|
|
|
71
72
|
var dispatchAnalytics = (0, _react.useCallback)(function (analyticsPayload) {
|
|
72
73
|
if (analyticsPayload && analyticsPayload.attributes) {
|
|
@@ -124,7 +125,8 @@ function CardWithURLRenderer(props) {
|
|
|
124
125
|
inlinePreloaderStyle: inlinePreloaderStyle,
|
|
125
126
|
ui: ui,
|
|
126
127
|
showHoverPreview: showHoverPreview,
|
|
127
|
-
analyticsEvents: analyticsEvents
|
|
128
|
+
analyticsEvents: analyticsEvents,
|
|
129
|
+
placeholder: placeholder
|
|
128
130
|
};
|
|
129
131
|
return /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
|
|
130
132
|
FallbackComponent: ErrorFallback,
|
|
@@ -42,7 +42,7 @@ var CardLinkView = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
42
42
|
value: function render() {
|
|
43
43
|
return /*#__PURE__*/_react.default.createElement(_Frame.Frame, (0, _extends2.default)({
|
|
44
44
|
withoutBackground: true
|
|
45
|
-
}, this.props), this.props.link);
|
|
45
|
+
}, this.props), this.props.placeholder || this.props.link);
|
|
46
46
|
}
|
|
47
47
|
}]);
|
|
48
48
|
return CardLinkView;
|
package/dist/es2019/version.json
CHANGED
|
@@ -3,12 +3,16 @@ import { CardLinkView } from '../../../view/LinkView';
|
|
|
3
3
|
export const loadingPlaceholderClassName = 'smart-link-loading-placeholder';
|
|
4
4
|
export const LoadingCardLink = ({
|
|
5
5
|
isSelected,
|
|
6
|
-
url
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
url,
|
|
7
|
+
placeholder
|
|
8
|
+
}) => {
|
|
9
|
+
return /*#__PURE__*/React.createElement(CardLinkView, {
|
|
10
|
+
key: 'lazy-render-key',
|
|
11
|
+
testId: 'lazy-render-placeholder',
|
|
12
|
+
"data-trello-do-not-use-override": "lazy-render-placeholder-trello",
|
|
13
|
+
isSelected: isSelected,
|
|
14
|
+
link: url,
|
|
15
|
+
className: loadingPlaceholderClassName,
|
|
16
|
+
placeholder: placeholder
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -35,7 +35,8 @@ export function CardWithURLRenderer(props) {
|
|
|
35
35
|
children,
|
|
36
36
|
ui,
|
|
37
37
|
showHoverPreview,
|
|
38
|
-
analyticsEvents
|
|
38
|
+
analyticsEvents,
|
|
39
|
+
placeholder
|
|
39
40
|
} = props; // Wrapper around analytics.
|
|
40
41
|
|
|
41
42
|
const dispatchAnalytics = useCallback(analyticsPayload => {
|
|
@@ -96,7 +97,8 @@ export function CardWithURLRenderer(props) {
|
|
|
96
97
|
inlinePreloaderStyle,
|
|
97
98
|
ui,
|
|
98
99
|
showHoverPreview,
|
|
99
|
-
analyticsEvents
|
|
100
|
+
analyticsEvents,
|
|
101
|
+
placeholder
|
|
100
102
|
};
|
|
101
103
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
102
104
|
FallbackComponent: ErrorFallback,
|
package/dist/esm/version.json
CHANGED
|
@@ -3,13 +3,15 @@ import { CardLinkView } from '../../../view/LinkView';
|
|
|
3
3
|
export var loadingPlaceholderClassName = 'smart-link-loading-placeholder';
|
|
4
4
|
export var LoadingCardLink = function LoadingCardLink(_ref) {
|
|
5
5
|
var isSelected = _ref.isSelected,
|
|
6
|
-
url = _ref.url
|
|
6
|
+
url = _ref.url,
|
|
7
|
+
placeholder = _ref.placeholder;
|
|
7
8
|
return /*#__PURE__*/React.createElement(CardLinkView, {
|
|
8
9
|
key: 'lazy-render-key',
|
|
9
10
|
testId: 'lazy-render-placeholder',
|
|
10
11
|
"data-trello-do-not-use-override": "lazy-render-placeholder-trello",
|
|
11
12
|
isSelected: isSelected,
|
|
12
13
|
link: url,
|
|
13
|
-
className: loadingPlaceholderClassName
|
|
14
|
+
className: loadingPlaceholderClassName,
|
|
15
|
+
placeholder: placeholder
|
|
14
16
|
});
|
|
15
17
|
};
|
|
@@ -42,7 +42,8 @@ export function CardWithURLRenderer(props) {
|
|
|
42
42
|
children = props.children,
|
|
43
43
|
ui = props.ui,
|
|
44
44
|
showHoverPreview = props.showHoverPreview,
|
|
45
|
-
analyticsEvents = props.analyticsEvents
|
|
45
|
+
analyticsEvents = props.analyticsEvents,
|
|
46
|
+
placeholder = props.placeholder; // Wrapper around analytics.
|
|
46
47
|
|
|
47
48
|
var dispatchAnalytics = useCallback(function (analyticsPayload) {
|
|
48
49
|
if (analyticsPayload && analyticsPayload.attributes) {
|
|
@@ -100,7 +101,8 @@ export function CardWithURLRenderer(props) {
|
|
|
100
101
|
inlinePreloaderStyle: inlinePreloaderStyle,
|
|
101
102
|
ui: ui,
|
|
102
103
|
showHoverPreview: showHoverPreview,
|
|
103
|
-
analyticsEvents: analyticsEvents
|
|
104
|
+
analyticsEvents: analyticsEvents,
|
|
105
|
+
placeholder: placeholder
|
|
104
106
|
};
|
|
105
107
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
106
108
|
FallbackComponent: ErrorFallback,
|
|
@@ -27,7 +27,7 @@ export var CardLinkView = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
27
27
|
value: function render() {
|
|
28
28
|
return /*#__PURE__*/React.createElement(Frame, _extends({
|
|
29
29
|
withoutBackground: true
|
|
30
|
-
}, this.props), this.props.link);
|
|
30
|
+
}, this.props), this.props.placeholder || this.props.link);
|
|
31
31
|
}
|
|
32
32
|
}]);
|
|
33
33
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CardAppearance, CardPlatform, CardProps } from './types';
|
|
3
3
|
import { WrappedComponentProps } from 'react-intl-next';
|
|
4
|
-
export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<React.PropsWithChildren<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps<"intl">>>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "id" | "onClick" | "analyticsContext" | "key" | "url" | "ui" | "showActions" | "onResolve" | "platform" | "isFrameVisible" | "embedIframeRef" | "showHoverPreview" | "inlinePreloaderStyle" | "importer" | "container" | "analyticsEvents" | "forwardedRef"> & React.RefAttributes<any>>;
|
|
4
|
+
export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<React.PropsWithChildren<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps<"intl">>>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "id" | "placeholder" | "onClick" | "analyticsContext" | "key" | "url" | "ui" | "showActions" | "onResolve" | "platform" | "isFrameVisible" | "embedIframeRef" | "showHoverPreview" | "inlinePreloaderStyle" | "importer" | "container" | "analyticsEvents" | "forwardedRef"> & React.RefAttributes<any>>;
|
|
5
5
|
export type { CardAppearance, CardProps, CardPlatform };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FrameViewProps } from '../InlineCard/Frame';
|
|
3
|
-
export
|
|
3
|
+
export interface CardLinkViewProps extends FrameViewProps {
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class CardLinkView extends React.PureComponent<CardLinkViewProps> {
|
|
4
7
|
render(): JSX.Element;
|
|
5
8
|
}
|