@atlaskit/smart-card 18.0.1 → 18.0.2
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 +36 -7
- package/dist/cjs/view/HoverCard/styled.js +2 -4
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/HoverCard/index.js +30 -9
- package/dist/es2019/view/HoverCard/styled.js +2 -4
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/HoverCard/index.js +36 -9
- package/dist/esm/view/HoverCard/styled.js +2 -3
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/HoverCard/styled.d.ts +1 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 18.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`cff21812950`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cff21812950) - add smart link actions to footer of hover card, plus small styling changes
|
|
8
|
+
|
|
3
9
|
## 18.0.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/version.json
CHANGED
|
@@ -13,6 +13,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
13
13
|
|
|
14
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
15
|
|
|
16
|
+
var _core = require("@emotion/core");
|
|
17
|
+
|
|
16
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
19
|
|
|
18
20
|
var _blocks = require("../FlexibleCard/components/blocks");
|
|
@@ -23,10 +25,15 @@ var _popup = _interopRequireDefault(require("@atlaskit/popup"));
|
|
|
23
25
|
|
|
24
26
|
var _constants = require("../../constants");
|
|
25
27
|
|
|
28
|
+
var _useSmartLinkActions = require("../../state/hooks-external/useSmartLinkActions");
|
|
29
|
+
|
|
30
|
+
var _styled = require("./styled");
|
|
31
|
+
|
|
26
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
33
|
|
|
28
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
35
|
|
|
36
|
+
/** @jsx jsx */
|
|
30
37
|
var HoverCard = function HoverCard(_ref) {
|
|
31
38
|
var children = _ref.children,
|
|
32
39
|
url = _ref.url;
|
|
@@ -56,33 +63,55 @@ var HoverCard = function HoverCard(_ref) {
|
|
|
56
63
|
fadeInTimeoutId.current = setTimeout(function () {
|
|
57
64
|
setIsOpen(true);
|
|
58
65
|
}, delay);
|
|
59
|
-
}, [delay]);
|
|
66
|
+
}, [delay]); //TODO: EDM-2905: Add analytics events
|
|
67
|
+
|
|
68
|
+
var analyticsHandler = (0, _react.useCallback)(function () {}, []);
|
|
69
|
+
var linkActions = (0, _useSmartLinkActions.useSmartLinkActions)({
|
|
70
|
+
url: url,
|
|
71
|
+
appearance: 'block',
|
|
72
|
+
analyticsHandler: analyticsHandler
|
|
73
|
+
});
|
|
74
|
+
var actions = (0, _react.useMemo)(function () {
|
|
75
|
+
return linkActions.map(function (action) {
|
|
76
|
+
return {
|
|
77
|
+
content: action.text,
|
|
78
|
+
name: _constants.ActionName.CustomAction,
|
|
79
|
+
onClick: function onClick() {
|
|
80
|
+
return action.invoke();
|
|
81
|
+
},
|
|
82
|
+
testId: action.id
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
}, [linkActions]);
|
|
60
86
|
|
|
61
87
|
var cardComponent = function cardComponent() {
|
|
62
|
-
return
|
|
88
|
+
return (0, _core.jsx)("div", {
|
|
63
89
|
onMouseEnter: initShowCard,
|
|
64
|
-
onMouseLeave: initHideCard
|
|
65
|
-
|
|
90
|
+
onMouseLeave: initHideCard,
|
|
91
|
+
css: _styled.HoverCardContainer
|
|
92
|
+
}, (0, _core.jsx)(_Card.Card, {
|
|
66
93
|
appearance: "block",
|
|
67
94
|
url: url,
|
|
68
95
|
ui: {
|
|
69
96
|
hideElevation: true,
|
|
70
97
|
size: _constants.SmartLinkSize.Large
|
|
71
98
|
}
|
|
72
|
-
},
|
|
99
|
+
}, (0, _core.jsx)(_blocks.TitleBlock, null), (0, _core.jsx)(_blocks.SnippetBlock, null), (0, _core.jsx)(_blocks.FooterBlock, {
|
|
100
|
+
actions: actions
|
|
101
|
+
})));
|
|
73
102
|
};
|
|
74
103
|
|
|
75
104
|
var onClose = (0, _react.useCallback)(function () {
|
|
76
105
|
return setIsOpen(false);
|
|
77
106
|
}, []);
|
|
78
|
-
return
|
|
107
|
+
return (0, _core.jsx)(_popup.default, {
|
|
79
108
|
testId: "hover-card",
|
|
80
109
|
isOpen: isOpen,
|
|
81
110
|
onClose: onClose,
|
|
82
111
|
placement: "bottom",
|
|
83
112
|
content: cardComponent,
|
|
84
113
|
trigger: function trigger(triggerProps) {
|
|
85
|
-
return
|
|
114
|
+
return (0, _core.jsx)("span", (0, _extends2.default)({}, triggerProps, {
|
|
86
115
|
onMouseEnter: initShowCard,
|
|
87
116
|
onMouseLeave: initHideCard
|
|
88
117
|
}), children);
|
|
@@ -9,11 +9,9 @@ exports.HoverCardContainer = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _tooltip = require("@atlaskit/tooltip");
|
|
12
|
+
var _core = require("@emotion/core");
|
|
15
13
|
|
|
16
14
|
var _templateObject;
|
|
17
15
|
|
|
18
|
-
var HoverCardContainer = (0,
|
|
16
|
+
var HoverCardContainer = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: none;\n border-width: 0;\n max-width: 500px;\n padding: 0;\n"])));
|
|
19
17
|
exports.HoverCardContainer = HoverCardContainer;
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { jsx } from '@emotion/core';
|
|
5
|
+
import React, { useCallback, useRef, useMemo } from 'react';
|
|
3
6
|
import { TitleBlock, SnippetBlock, FooterBlock } from '../FlexibleCard/components/blocks';
|
|
4
7
|
import { Card } from '../Card';
|
|
5
8
|
import Popup from '@atlaskit/popup';
|
|
6
|
-
import { SmartLinkSize } from '../../constants';
|
|
9
|
+
import { SmartLinkSize, ActionName } from '../../constants';
|
|
10
|
+
import { useSmartLinkActions } from '../../state/hooks-external/useSmartLinkActions';
|
|
11
|
+
import { HoverCardContainer } from './styled';
|
|
7
12
|
export const HoverCard = ({
|
|
8
13
|
children,
|
|
9
14
|
url
|
|
@@ -29,28 +34,44 @@ export const HoverCard = ({
|
|
|
29
34
|
fadeInTimeoutId.current = setTimeout(() => {
|
|
30
35
|
setIsOpen(true);
|
|
31
36
|
}, delay);
|
|
32
|
-
}, [delay]);
|
|
37
|
+
}, [delay]); //TODO: EDM-2905: Add analytics events
|
|
38
|
+
|
|
39
|
+
const analyticsHandler = useCallback(() => {}, []);
|
|
40
|
+
const linkActions = useSmartLinkActions({
|
|
41
|
+
url,
|
|
42
|
+
appearance: 'block',
|
|
43
|
+
analyticsHandler
|
|
44
|
+
});
|
|
45
|
+
const actions = useMemo(() => linkActions.map(action => ({
|
|
46
|
+
content: action.text,
|
|
47
|
+
name: ActionName.CustomAction,
|
|
48
|
+
onClick: () => action.invoke(),
|
|
49
|
+
testId: action.id
|
|
50
|
+
})), [linkActions]);
|
|
33
51
|
|
|
34
|
-
const cardComponent = () =>
|
|
52
|
+
const cardComponent = () => jsx("div", {
|
|
35
53
|
onMouseEnter: initShowCard,
|
|
36
|
-
onMouseLeave: initHideCard
|
|
37
|
-
|
|
54
|
+
onMouseLeave: initHideCard,
|
|
55
|
+
css: HoverCardContainer
|
|
56
|
+
}, jsx(Card, {
|
|
38
57
|
appearance: "block",
|
|
39
58
|
url: url,
|
|
40
59
|
ui: {
|
|
41
60
|
hideElevation: true,
|
|
42
61
|
size: SmartLinkSize.Large
|
|
43
62
|
}
|
|
44
|
-
},
|
|
63
|
+
}, jsx(TitleBlock, null), jsx(SnippetBlock, null), jsx(FooterBlock, {
|
|
64
|
+
actions: actions
|
|
65
|
+
})));
|
|
45
66
|
|
|
46
67
|
const onClose = useCallback(() => setIsOpen(false), []);
|
|
47
|
-
return
|
|
68
|
+
return jsx(Popup, {
|
|
48
69
|
testId: "hover-card",
|
|
49
70
|
isOpen: isOpen,
|
|
50
71
|
onClose: onClose,
|
|
51
72
|
placement: "bottom",
|
|
52
73
|
content: cardComponent,
|
|
53
|
-
trigger: triggerProps =>
|
|
74
|
+
trigger: triggerProps => jsx("span", _extends({}, triggerProps, {
|
|
54
75
|
onMouseEnter: initShowCard,
|
|
55
76
|
onMouseLeave: initHideCard
|
|
56
77
|
}), children)
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export const HoverCardContainer = styled(TooltipPrimitive)`
|
|
1
|
+
import { css } from '@emotion/core';
|
|
2
|
+
export const HoverCardContainer = css`
|
|
4
3
|
background: none;
|
|
5
4
|
border-width: 0;
|
|
6
|
-
box-sizing: content-box; /* do not set this to border-box or it will break the overflow handling */
|
|
7
5
|
max-width: 500px;
|
|
8
6
|
padding: 0;
|
|
9
7
|
`;
|
package/dist/esm/version.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
/** @jsx jsx */
|
|
5
|
+
import { jsx } from '@emotion/core';
|
|
6
|
+
import React, { useCallback, useRef, useMemo } from 'react';
|
|
4
7
|
import { TitleBlock, SnippetBlock, FooterBlock } from '../FlexibleCard/components/blocks';
|
|
5
8
|
import { Card } from '../Card';
|
|
6
9
|
import Popup from '@atlaskit/popup';
|
|
7
|
-
import { SmartLinkSize } from '../../constants';
|
|
10
|
+
import { SmartLinkSize, ActionName } from '../../constants';
|
|
11
|
+
import { useSmartLinkActions } from '../../state/hooks-external/useSmartLinkActions';
|
|
12
|
+
import { HoverCardContainer } from './styled';
|
|
8
13
|
export var HoverCard = function HoverCard(_ref) {
|
|
9
14
|
var children = _ref.children,
|
|
10
15
|
url = _ref.url;
|
|
@@ -34,33 +39,55 @@ export var HoverCard = function HoverCard(_ref) {
|
|
|
34
39
|
fadeInTimeoutId.current = setTimeout(function () {
|
|
35
40
|
setIsOpen(true);
|
|
36
41
|
}, delay);
|
|
37
|
-
}, [delay]);
|
|
42
|
+
}, [delay]); //TODO: EDM-2905: Add analytics events
|
|
43
|
+
|
|
44
|
+
var analyticsHandler = useCallback(function () {}, []);
|
|
45
|
+
var linkActions = useSmartLinkActions({
|
|
46
|
+
url: url,
|
|
47
|
+
appearance: 'block',
|
|
48
|
+
analyticsHandler: analyticsHandler
|
|
49
|
+
});
|
|
50
|
+
var actions = useMemo(function () {
|
|
51
|
+
return linkActions.map(function (action) {
|
|
52
|
+
return {
|
|
53
|
+
content: action.text,
|
|
54
|
+
name: ActionName.CustomAction,
|
|
55
|
+
onClick: function onClick() {
|
|
56
|
+
return action.invoke();
|
|
57
|
+
},
|
|
58
|
+
testId: action.id
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
}, [linkActions]);
|
|
38
62
|
|
|
39
63
|
var cardComponent = function cardComponent() {
|
|
40
|
-
return
|
|
64
|
+
return jsx("div", {
|
|
41
65
|
onMouseEnter: initShowCard,
|
|
42
|
-
onMouseLeave: initHideCard
|
|
43
|
-
|
|
66
|
+
onMouseLeave: initHideCard,
|
|
67
|
+
css: HoverCardContainer
|
|
68
|
+
}, jsx(Card, {
|
|
44
69
|
appearance: "block",
|
|
45
70
|
url: url,
|
|
46
71
|
ui: {
|
|
47
72
|
hideElevation: true,
|
|
48
73
|
size: SmartLinkSize.Large
|
|
49
74
|
}
|
|
50
|
-
},
|
|
75
|
+
}, jsx(TitleBlock, null), jsx(SnippetBlock, null), jsx(FooterBlock, {
|
|
76
|
+
actions: actions
|
|
77
|
+
})));
|
|
51
78
|
};
|
|
52
79
|
|
|
53
80
|
var onClose = useCallback(function () {
|
|
54
81
|
return setIsOpen(false);
|
|
55
82
|
}, []);
|
|
56
|
-
return
|
|
83
|
+
return jsx(Popup, {
|
|
57
84
|
testId: "hover-card",
|
|
58
85
|
isOpen: isOpen,
|
|
59
86
|
onClose: onClose,
|
|
60
87
|
placement: "bottom",
|
|
61
88
|
content: cardComponent,
|
|
62
89
|
trigger: function trigger(triggerProps) {
|
|
63
|
-
return
|
|
90
|
+
return jsx("span", _extends({}, triggerProps, {
|
|
64
91
|
onMouseEnter: initShowCard,
|
|
65
92
|
onMouseLeave: initHideCard
|
|
66
93
|
}), children);
|
|
@@ -2,6 +2,5 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
|
|
3
3
|
var _templateObject;
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
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"])));
|
|
5
|
+
import { css } from '@emotion/core';
|
|
6
|
+
export var HoverCardContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: none;\n border-width: 0;\n max-width: 500px;\n padding: 0;\n"])));
|
|
@@ -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" | "ui" | "showActions" | "onResolve" | "platform" | "forwardedRef" | "isFrameVisible" | "importer" | "container" | "embedIframeRef" | "inlinePreloaderStyle"> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "onClick" | "analyticsContext" | "key" | "url" | "ui" | "showActions" | "onResolve" | "platform" | "forwardedRef" | "isFrameVisible" | "importer" | "container" | "embedIframeRef" | "inlinePreloaderStyle"> & React.RefAttributes<any>>;
|
|
5
5
|
export type { CardAppearance, CardProps, CardPlatform };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
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>;
|
|
1
|
+
export declare const HoverCardContainer: import("@emotion/utils").SerializedStyles;
|