@atlaskit/smart-card 17.7.3 → 17.7.4
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 +6 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/HoverCard/index.js +37 -0
- package/dist/cjs/view/HoverCard/styled.js +19 -0
- package/dist/cjs/view/HoverCard/types.js +5 -0
- package/dist/cjs/view/InlineCard/ResolvedView/index.js +15 -2
- package/dist/cjs/view/InlineCard/index.js +3 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/HoverCard/index.js +20 -0
- package/dist/es2019/view/HoverCard/styled.js +9 -0
- package/dist/es2019/view/HoverCard/types.js +1 -0
- package/dist/es2019/view/InlineCard/ResolvedView/index.js +12 -2
- package/dist/es2019/view/InlineCard/index.js +3 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/HoverCard/index.js +19 -0
- package/dist/esm/view/HoverCard/styled.js +7 -0
- package/dist/esm/view/HoverCard/types.js +1 -0
- package/dist/esm/view/InlineCard/ResolvedView/index.js +13 -2
- package/dist/esm/view/InlineCard/index.js +3 -1
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/HoverCard/index.d.ts +3 -0
- package/dist/types/view/HoverCard/styled.d.ts +2 -0
- package/dist/types/view/HoverCard/types.d.ts +3 -0
- package/dist/types/view/InlineCard/ResolvedView/index.d.ts +2 -0
- package/dist/types/view/InlineCard/types.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cjs/version.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.HoverCard = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
13
|
+
|
|
14
|
+
var _blocks = require("../FlexibleCard/components/blocks");
|
|
15
|
+
|
|
16
|
+
var _Card = require("../Card");
|
|
17
|
+
|
|
18
|
+
var _styled = require("./styled");
|
|
19
|
+
|
|
20
|
+
var HoverCard = function HoverCard(_ref) {
|
|
21
|
+
var children = _ref.children,
|
|
22
|
+
url = _ref.url;
|
|
23
|
+
|
|
24
|
+
var cardComponent = /*#__PURE__*/_react.default.createElement(_Card.Card, {
|
|
25
|
+
appearance: "block",
|
|
26
|
+
url: url
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement(_blocks.TitleBlock, null), /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, null), /*#__PURE__*/_react.default.createElement(_blocks.FooterBlock, null));
|
|
28
|
+
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
30
|
+
content: cardComponent,
|
|
31
|
+
component: _styled.HoverCardContainer,
|
|
32
|
+
testId: "hover-card",
|
|
33
|
+
tag: "span"
|
|
34
|
+
}, children);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.HoverCard = HoverCard;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.HoverCardContainer = void 0;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
13
|
+
|
|
14
|
+
var _tooltip = require("@atlaskit/tooltip");
|
|
15
|
+
|
|
16
|
+
var _templateObject;
|
|
17
|
+
|
|
18
|
+
var HoverCardContainer = (0, _styled.default)(_tooltip.TooltipPrimitive)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: none;\n border-width: 0;\n box-sizing: content-box; /* do not set this to border-box or it will break the overflow handling */\n max-width: 500px;\n padding: 0;\n"])));
|
|
19
|
+
exports.HoverCardContainer = HoverCardContainer;
|
|
@@ -27,6 +27,8 @@ var _IconAndTitleLayout = require("../IconAndTitleLayout");
|
|
|
27
27
|
|
|
28
28
|
var _styled = require("../IconAndTitleLayout/styled");
|
|
29
29
|
|
|
30
|
+
var _index = require("../../../view/HoverCard/index");
|
|
31
|
+
|
|
30
32
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
31
33
|
|
|
32
34
|
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; } }
|
|
@@ -68,8 +70,11 @@ var InlineCardResolvedView = /*#__PURE__*/function (_React$Component) {
|
|
|
68
70
|
_this$props$testId = _this$props.testId,
|
|
69
71
|
testId = _this$props$testId === void 0 ? 'inline-card-resolved-view' : _this$props$testId,
|
|
70
72
|
titleTextColor = _this$props.titleTextColor,
|
|
71
|
-
titlePrefix = _this$props.titlePrefix
|
|
72
|
-
|
|
73
|
+
titlePrefix = _this$props.titlePrefix,
|
|
74
|
+
_this$props$showHover = _this$props.showHoverPreview,
|
|
75
|
+
showHoverPreview = _this$props$showHover === void 0 ? false : _this$props$showHover;
|
|
76
|
+
|
|
77
|
+
var inlineCardResolvedView = /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
|
|
73
78
|
testId: testId,
|
|
74
79
|
link: link,
|
|
75
80
|
isSelected: isSelected,
|
|
@@ -80,6 +85,14 @@ var InlineCardResolvedView = /*#__PURE__*/function (_React$Component) {
|
|
|
80
85
|
title: title,
|
|
81
86
|
titleTextColor: titleTextColor
|
|
82
87
|
}), this.renderLozenge());
|
|
88
|
+
|
|
89
|
+
if (showHoverPreview && link) {
|
|
90
|
+
return /*#__PURE__*/_react.default.createElement(_index.HoverCard, {
|
|
91
|
+
url: link
|
|
92
|
+
}, inlineCardResolvedView);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return inlineCardResolvedView;
|
|
83
96
|
}
|
|
84
97
|
}]);
|
|
85
98
|
return InlineCardResolvedView;
|
|
@@ -70,7 +70,8 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
70
70
|
renderers = _ref.renderers,
|
|
71
71
|
onResolve = _ref.onResolve,
|
|
72
72
|
testId = _ref.testId,
|
|
73
|
-
inlinePreloaderStyle = _ref.inlinePreloaderStyle
|
|
73
|
+
inlinePreloaderStyle = _ref.inlinePreloaderStyle,
|
|
74
|
+
showHoverPreview = _ref.showHoverPreview;
|
|
74
75
|
var status = cardState.status,
|
|
75
76
|
details = cardState.details;
|
|
76
77
|
var cardDetails = details && details.data || (0, _jsonld.getEmptyJsonLd)();
|
|
@@ -98,6 +99,7 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
return /*#__PURE__*/_react.default.createElement(_ResolvedView.InlineCardResolvedView, (0, _extends2.default)({}, resolvedProps, {
|
|
102
|
+
showHoverPreview: showHoverPreview,
|
|
101
103
|
link: url,
|
|
102
104
|
isSelected: isSelected,
|
|
103
105
|
onClick: handleFrameClick,
|
package/dist/es2019/version.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
3
|
+
import { TitleBlock, SnippetBlock, FooterBlock } from '../FlexibleCard/components/blocks';
|
|
4
|
+
import { Card } from '../Card';
|
|
5
|
+
import { HoverCardContainer } from './styled';
|
|
6
|
+
export const HoverCard = ({
|
|
7
|
+
children,
|
|
8
|
+
url
|
|
9
|
+
}) => {
|
|
10
|
+
const cardComponent = /*#__PURE__*/React.createElement(Card, {
|
|
11
|
+
appearance: "block",
|
|
12
|
+
url: url
|
|
13
|
+
}, /*#__PURE__*/React.createElement(TitleBlock, null), /*#__PURE__*/React.createElement(SnippetBlock, null), /*#__PURE__*/React.createElement(FooterBlock, null));
|
|
14
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
15
|
+
content: cardComponent,
|
|
16
|
+
component: HoverCardContainer,
|
|
17
|
+
testId: "hover-card",
|
|
18
|
+
tag: "span"
|
|
19
|
+
}, children);
|
|
20
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import { TooltipPrimitive } from '@atlaskit/tooltip';
|
|
3
|
+
export const HoverCardContainer = styled(TooltipPrimitive)`
|
|
4
|
+
background: none;
|
|
5
|
+
border-width: 0;
|
|
6
|
+
box-sizing: content-box; /* do not set this to border-box or it will break the overflow handling */
|
|
7
|
+
max-width: 500px;
|
|
8
|
+
padding: 0;
|
|
9
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,6 +3,7 @@ import { Frame } from '../Frame';
|
|
|
3
3
|
import Lozenge from '@atlaskit/lozenge';
|
|
4
4
|
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
5
5
|
import { LozengeWrapper } from '../IconAndTitleLayout/styled';
|
|
6
|
+
import { HoverCard } from '../../../view/HoverCard/index';
|
|
6
7
|
export class InlineCardResolvedView extends React.Component {
|
|
7
8
|
renderLozenge() {
|
|
8
9
|
const {
|
|
@@ -28,9 +29,10 @@ export class InlineCardResolvedView extends React.Component {
|
|
|
28
29
|
link,
|
|
29
30
|
testId = 'inline-card-resolved-view',
|
|
30
31
|
titleTextColor,
|
|
31
|
-
titlePrefix
|
|
32
|
+
titlePrefix,
|
|
33
|
+
showHoverPreview = false
|
|
32
34
|
} = this.props;
|
|
33
|
-
|
|
35
|
+
const inlineCardResolvedView = /*#__PURE__*/React.createElement(Frame, {
|
|
34
36
|
testId: testId,
|
|
35
37
|
link: link,
|
|
36
38
|
isSelected: isSelected,
|
|
@@ -41,6 +43,14 @@ export class InlineCardResolvedView extends React.Component {
|
|
|
41
43
|
title: title,
|
|
42
44
|
titleTextColor: titleTextColor
|
|
43
45
|
}), this.renderLozenge());
|
|
46
|
+
|
|
47
|
+
if (showHoverPreview && link) {
|
|
48
|
+
return /*#__PURE__*/React.createElement(HoverCard, {
|
|
49
|
+
url: link
|
|
50
|
+
}, inlineCardResolvedView);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return inlineCardResolvedView;
|
|
44
54
|
}
|
|
45
55
|
|
|
46
56
|
}
|
|
@@ -19,7 +19,8 @@ export const InlineCard = ({
|
|
|
19
19
|
renderers,
|
|
20
20
|
onResolve,
|
|
21
21
|
testId,
|
|
22
|
-
inlinePreloaderStyle
|
|
22
|
+
inlinePreloaderStyle,
|
|
23
|
+
showHoverPreview
|
|
23
24
|
}) => {
|
|
24
25
|
var _details$meta;
|
|
25
26
|
|
|
@@ -52,6 +53,7 @@ export const InlineCard = ({
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
return /*#__PURE__*/React.createElement(InlineCardResolvedView, _extends({}, resolvedProps, {
|
|
56
|
+
showHoverPreview: showHoverPreview,
|
|
55
57
|
link: url,
|
|
56
58
|
isSelected: isSelected,
|
|
57
59
|
onClick: handleFrameClick,
|
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
3
|
+
import { TitleBlock, SnippetBlock, FooterBlock } from '../FlexibleCard/components/blocks';
|
|
4
|
+
import { Card } from '../Card';
|
|
5
|
+
import { HoverCardContainer } from './styled';
|
|
6
|
+
export var HoverCard = function HoverCard(_ref) {
|
|
7
|
+
var children = _ref.children,
|
|
8
|
+
url = _ref.url;
|
|
9
|
+
var cardComponent = /*#__PURE__*/React.createElement(Card, {
|
|
10
|
+
appearance: "block",
|
|
11
|
+
url: url
|
|
12
|
+
}, /*#__PURE__*/React.createElement(TitleBlock, null), /*#__PURE__*/React.createElement(SnippetBlock, null), /*#__PURE__*/React.createElement(FooterBlock, null));
|
|
13
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
14
|
+
content: cardComponent,
|
|
15
|
+
component: HoverCardContainer,
|
|
16
|
+
testId: "hover-card",
|
|
17
|
+
tag: "span"
|
|
18
|
+
}, children);
|
|
19
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
import styled from '@emotion/styled';
|
|
6
|
+
import { TooltipPrimitive } from '@atlaskit/tooltip';
|
|
7
|
+
export var HoverCardContainer = styled(TooltipPrimitive)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: none;\n border-width: 0;\n box-sizing: content-box; /* do not set this to border-box or it will break the overflow handling */\n max-width: 500px;\n padding: 0;\n"])));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -13,6 +13,7 @@ import { Frame } from '../Frame';
|
|
|
13
13
|
import Lozenge from '@atlaskit/lozenge';
|
|
14
14
|
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
15
15
|
import { LozengeWrapper } from '../IconAndTitleLayout/styled';
|
|
16
|
+
import { HoverCard } from '../../../view/HoverCard/index';
|
|
16
17
|
export var InlineCardResolvedView = /*#__PURE__*/function (_React$Component) {
|
|
17
18
|
_inherits(InlineCardResolvedView, _React$Component);
|
|
18
19
|
|
|
@@ -51,8 +52,10 @@ export var InlineCardResolvedView = /*#__PURE__*/function (_React$Component) {
|
|
|
51
52
|
_this$props$testId = _this$props.testId,
|
|
52
53
|
testId = _this$props$testId === void 0 ? 'inline-card-resolved-view' : _this$props$testId,
|
|
53
54
|
titleTextColor = _this$props.titleTextColor,
|
|
54
|
-
titlePrefix = _this$props.titlePrefix
|
|
55
|
-
|
|
55
|
+
titlePrefix = _this$props.titlePrefix,
|
|
56
|
+
_this$props$showHover = _this$props.showHoverPreview,
|
|
57
|
+
showHoverPreview = _this$props$showHover === void 0 ? false : _this$props$showHover;
|
|
58
|
+
var inlineCardResolvedView = /*#__PURE__*/React.createElement(Frame, {
|
|
56
59
|
testId: testId,
|
|
57
60
|
link: link,
|
|
58
61
|
isSelected: isSelected,
|
|
@@ -63,6 +66,14 @@ export var InlineCardResolvedView = /*#__PURE__*/function (_React$Component) {
|
|
|
63
66
|
title: title,
|
|
64
67
|
titleTextColor: titleTextColor
|
|
65
68
|
}), this.renderLozenge());
|
|
69
|
+
|
|
70
|
+
if (showHoverPreview && link) {
|
|
71
|
+
return /*#__PURE__*/React.createElement(HoverCard, {
|
|
72
|
+
url: link
|
|
73
|
+
}, inlineCardResolvedView);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return inlineCardResolvedView;
|
|
66
77
|
}
|
|
67
78
|
}]);
|
|
68
79
|
|
|
@@ -21,7 +21,8 @@ export var InlineCard = function InlineCard(_ref) {
|
|
|
21
21
|
renderers = _ref.renderers,
|
|
22
22
|
onResolve = _ref.onResolve,
|
|
23
23
|
testId = _ref.testId,
|
|
24
|
-
inlinePreloaderStyle = _ref.inlinePreloaderStyle
|
|
24
|
+
inlinePreloaderStyle = _ref.inlinePreloaderStyle,
|
|
25
|
+
showHoverPreview = _ref.showHoverPreview;
|
|
25
26
|
var status = cardState.status,
|
|
26
27
|
details = cardState.details;
|
|
27
28
|
var cardDetails = details && details.data || getEmptyJsonLd();
|
|
@@ -49,6 +50,7 @@ export var InlineCard = function InlineCard(_ref) {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
return /*#__PURE__*/React.createElement(InlineCardResolvedView, _extends({}, resolvedProps, {
|
|
53
|
+
showHoverPreview: showHoverPreview,
|
|
52
54
|
link: url,
|
|
53
55
|
isSelected: isSelected,
|
|
54
56
|
onClick: handleFrameClick,
|
|
@@ -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<Pick<React.PropsWithChildren<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps<"intl">>>, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "onClick" | "url" | "
|
|
4
|
+
export declare const Card: React.ForwardRefExoticComponent<Pick<Pick<React.PropsWithChildren<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps<"intl">>>, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "onClick" | "url" | "forwardedRef" | "platform" | "isFrameVisible" | "importer" | "container" | "showActions" | "onResolve" | "embedIframeRef" | "inlinePreloaderStyle" | "ui"> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "onClick" | "analyticsContext" | "key" | "url" | "forwardedRef" | "platform" | "isFrameVisible" | "importer" | "container" | "showActions" | "onResolve" | "embedIframeRef" | "inlinePreloaderStyle" | "ui"> & React.RefAttributes<any>>;
|
|
5
5
|
export type { CardAppearance, CardProps, CardPlatform };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const HoverCardContainer: import("@emotion/styled-base").StyledComponent<Pick<import("@atlaskit/tooltip").TooltipPrimitiveProps, "children" | "style" | "testId" | "className" | "id" | "onMouseOut" | "onMouseOver" | "placement" | "truncate"> & import("react").RefAttributes<HTMLDivElement> & import("react").Attributes, Pick<Pick<import("@atlaskit/tooltip").TooltipPrimitiveProps, "children" | "style" | "testId" | "className" | "id" | "onMouseOut" | "onMouseOver" | "placement" | "truncate"> & import("react").RefAttributes<HTMLDivElement> & import("react").Attributes, "children" | "style" | "testId" | "className" | "id" | "onMouseOut" | "onMouseOver" | "placement" | "truncate">, any>;
|
|
@@ -19,6 +19,8 @@ export interface InlineCardResolvedViewProps {
|
|
|
19
19
|
titleTextColor?: string;
|
|
20
20
|
/** The Emoji icon prefix that was added to the title text via Add emoji button */
|
|
21
21
|
titlePrefix?: React.ReactNode;
|
|
22
|
+
/** Enables showing a custom preview on hover of link */
|
|
23
|
+
showHoverPreview?: boolean;
|
|
22
24
|
}
|
|
23
25
|
export declare class InlineCardResolvedView extends React.Component<InlineCardResolvedViewProps> {
|
|
24
26
|
renderLozenge(): JSX.Element | null;
|