@atlaskit/smart-card 18.0.6 → 18.0.7
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 +21 -3
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/HoverCard/index.js +18 -3
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/HoverCard/index.js +20 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cjs/version.json
CHANGED
|
@@ -29,6 +29,8 @@ var _useSmartLinkActions = require("../../state/hooks-external/useSmartLinkActio
|
|
|
29
29
|
|
|
30
30
|
var _styled = require("./styled");
|
|
31
31
|
|
|
32
|
+
var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
|
|
33
|
+
|
|
32
34
|
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); }
|
|
33
35
|
|
|
34
36
|
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; }
|
|
@@ -71,7 +73,7 @@ var HoverCard = function HoverCard(_ref) {
|
|
|
71
73
|
appearance: 'block',
|
|
72
74
|
analyticsHandler: analyticsHandler
|
|
73
75
|
});
|
|
74
|
-
var
|
|
76
|
+
var smartlinkActions = (0, _react.useMemo)(function () {
|
|
75
77
|
return linkActions.map(function (action) {
|
|
76
78
|
return {
|
|
77
79
|
content: action.text,
|
|
@@ -83,6 +85,20 @@ var HoverCard = function HoverCard(_ref) {
|
|
|
83
85
|
};
|
|
84
86
|
});
|
|
85
87
|
}, [linkActions]);
|
|
88
|
+
var openAction = (0, _react.useMemo)(function () {
|
|
89
|
+
return {
|
|
90
|
+
name: _constants.ActionName.CustomAction,
|
|
91
|
+
icon: (0, _core.jsx)(_shortcut.default, {
|
|
92
|
+
label: "open in new tab",
|
|
93
|
+
size: "medium"
|
|
94
|
+
}),
|
|
95
|
+
iconPosition: 'before',
|
|
96
|
+
onClick: function onClick() {
|
|
97
|
+
return window.open(url, '_blank');
|
|
98
|
+
},
|
|
99
|
+
testId: 'hover-card-open-button'
|
|
100
|
+
};
|
|
101
|
+
}, [url]);
|
|
86
102
|
|
|
87
103
|
var cardComponent = function cardComponent() {
|
|
88
104
|
return (0, _core.jsx)("div", {
|
|
@@ -96,8 +112,10 @@ var HoverCard = function HoverCard(_ref) {
|
|
|
96
112
|
hideElevation: true,
|
|
97
113
|
size: _constants.SmartLinkSize.Large
|
|
98
114
|
}
|
|
99
|
-
}, (0, _core.jsx)(_blocks.TitleBlock,
|
|
100
|
-
actions:
|
|
115
|
+
}, (0, _core.jsx)(_blocks.TitleBlock, {
|
|
116
|
+
actions: [openAction]
|
|
117
|
+
}), (0, _core.jsx)(_blocks.SnippetBlock, null), (0, _core.jsx)(_blocks.FooterBlock, {
|
|
118
|
+
actions: smartlinkActions
|
|
101
119
|
})));
|
|
102
120
|
};
|
|
103
121
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -9,6 +9,7 @@ import Popup from '@atlaskit/popup';
|
|
|
9
9
|
import { SmartLinkSize, ActionName } from '../../constants';
|
|
10
10
|
import { useSmartLinkActions } from '../../state/hooks-external/useSmartLinkActions';
|
|
11
11
|
import { HoverCardContainer } from './styled';
|
|
12
|
+
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
12
13
|
export const HoverCard = ({
|
|
13
14
|
children,
|
|
14
15
|
url
|
|
@@ -42,12 +43,24 @@ export const HoverCard = ({
|
|
|
42
43
|
appearance: 'block',
|
|
43
44
|
analyticsHandler
|
|
44
45
|
});
|
|
45
|
-
const
|
|
46
|
+
const smartlinkActions = useMemo(() => linkActions.map(action => ({
|
|
46
47
|
content: action.text,
|
|
47
48
|
name: ActionName.CustomAction,
|
|
48
49
|
onClick: () => action.invoke(),
|
|
49
50
|
testId: action.id
|
|
50
51
|
})), [linkActions]);
|
|
52
|
+
const openAction = useMemo(() => {
|
|
53
|
+
return {
|
|
54
|
+
name: ActionName.CustomAction,
|
|
55
|
+
icon: jsx(ShortcutIcon, {
|
|
56
|
+
label: "open in new tab",
|
|
57
|
+
size: "medium"
|
|
58
|
+
}),
|
|
59
|
+
iconPosition: 'before',
|
|
60
|
+
onClick: () => window.open(url, '_blank'),
|
|
61
|
+
testId: 'hover-card-open-button'
|
|
62
|
+
};
|
|
63
|
+
}, [url]);
|
|
51
64
|
|
|
52
65
|
const cardComponent = () => jsx("div", {
|
|
53
66
|
onMouseEnter: initShowCard,
|
|
@@ -60,8 +73,10 @@ export const HoverCard = ({
|
|
|
60
73
|
hideElevation: true,
|
|
61
74
|
size: SmartLinkSize.Large
|
|
62
75
|
}
|
|
63
|
-
}, jsx(TitleBlock,
|
|
64
|
-
actions:
|
|
76
|
+
}, jsx(TitleBlock, {
|
|
77
|
+
actions: [openAction]
|
|
78
|
+
}), jsx(SnippetBlock, null), jsx(FooterBlock, {
|
|
79
|
+
actions: smartlinkActions
|
|
65
80
|
})));
|
|
66
81
|
|
|
67
82
|
const onClose = useCallback(() => setIsOpen(false), []);
|
package/dist/esm/version.json
CHANGED
|
@@ -10,6 +10,7 @@ import Popup from '@atlaskit/popup';
|
|
|
10
10
|
import { SmartLinkSize, ActionName } from '../../constants';
|
|
11
11
|
import { useSmartLinkActions } from '../../state/hooks-external/useSmartLinkActions';
|
|
12
12
|
import { HoverCardContainer } from './styled';
|
|
13
|
+
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
13
14
|
export var HoverCard = function HoverCard(_ref) {
|
|
14
15
|
var children = _ref.children,
|
|
15
16
|
url = _ref.url;
|
|
@@ -47,7 +48,7 @@ export var HoverCard = function HoverCard(_ref) {
|
|
|
47
48
|
appearance: 'block',
|
|
48
49
|
analyticsHandler: analyticsHandler
|
|
49
50
|
});
|
|
50
|
-
var
|
|
51
|
+
var smartlinkActions = useMemo(function () {
|
|
51
52
|
return linkActions.map(function (action) {
|
|
52
53
|
return {
|
|
53
54
|
content: action.text,
|
|
@@ -59,6 +60,20 @@ export var HoverCard = function HoverCard(_ref) {
|
|
|
59
60
|
};
|
|
60
61
|
});
|
|
61
62
|
}, [linkActions]);
|
|
63
|
+
var openAction = useMemo(function () {
|
|
64
|
+
return {
|
|
65
|
+
name: ActionName.CustomAction,
|
|
66
|
+
icon: jsx(ShortcutIcon, {
|
|
67
|
+
label: "open in new tab",
|
|
68
|
+
size: "medium"
|
|
69
|
+
}),
|
|
70
|
+
iconPosition: 'before',
|
|
71
|
+
onClick: function onClick() {
|
|
72
|
+
return window.open(url, '_blank');
|
|
73
|
+
},
|
|
74
|
+
testId: 'hover-card-open-button'
|
|
75
|
+
};
|
|
76
|
+
}, [url]);
|
|
62
77
|
|
|
63
78
|
var cardComponent = function cardComponent() {
|
|
64
79
|
return jsx("div", {
|
|
@@ -72,8 +87,10 @@ export var HoverCard = function HoverCard(_ref) {
|
|
|
72
87
|
hideElevation: true,
|
|
73
88
|
size: SmartLinkSize.Large
|
|
74
89
|
}
|
|
75
|
-
}, jsx(TitleBlock,
|
|
76
|
-
actions:
|
|
90
|
+
}, jsx(TitleBlock, {
|
|
91
|
+
actions: [openAction]
|
|
92
|
+
}), jsx(SnippetBlock, null), jsx(FooterBlock, {
|
|
93
|
+
actions: smartlinkActions
|
|
77
94
|
})));
|
|
78
95
|
};
|
|
79
96
|
|