@atlaskit/smart-card 20.1.2 → 20.1.3
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/components/HoverCardComponent.js +14 -9
- package/dist/cjs/view/HoverCard/styled.js +5 -2
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +15 -10
- package/dist/es2019/view/HoverCard/styled.js +3 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +15 -10
- package/dist/esm/view/HoverCard/styled.js +3 -1
- package/dist/types/view/HoverCard/styled.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/cjs/version.json
CHANGED
|
@@ -58,6 +58,8 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
58
58
|
x: 0,
|
|
59
59
|
y: 0
|
|
60
60
|
});
|
|
61
|
+
var popupOffset = (0, _react.useRef)();
|
|
62
|
+
var parentSpan = (0, _react.useRef)(null);
|
|
61
63
|
var renderers = (0, _renderers.useSmartLinkRenderers)();
|
|
62
64
|
var linkState = (0, _store.useSmartCardState)(url);
|
|
63
65
|
var hoverDisplay = 'card';
|
|
@@ -92,6 +94,14 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
92
94
|
analytics.ui.hoverCardViewedEvent(hoverDisplay, invokeMethod);
|
|
93
95
|
}
|
|
94
96
|
|
|
97
|
+
if (parentSpan.current) {
|
|
98
|
+
var _parentSpan$current$g = parentSpan.current.getBoundingClientRect(),
|
|
99
|
+
bottom = _parentSpan$current$g.bottom,
|
|
100
|
+
left = _parentSpan$current$g.left;
|
|
101
|
+
|
|
102
|
+
popupOffset.current = [mousePos.current.x - left, mousePos.current.y - bottom + _styled.CARD_GAP_PX];
|
|
103
|
+
}
|
|
104
|
+
|
|
95
105
|
setIsOpen(true);
|
|
96
106
|
}, delay);
|
|
97
107
|
}, [delay, isOpen, analytics.ui]);
|
|
@@ -124,6 +134,7 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
124
134
|
isOpen: isOpen,
|
|
125
135
|
onClose: hideCard,
|
|
126
136
|
placement: "bottom-start",
|
|
137
|
+
offset: popupOffset.current,
|
|
127
138
|
content: function content(_ref2) {
|
|
128
139
|
var update = _ref2.update;
|
|
129
140
|
return (0, _core.jsx)("div", {
|
|
@@ -145,18 +156,12 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
145
156
|
},
|
|
146
157
|
trigger: function trigger(triggerProps) {
|
|
147
158
|
return (0, _core.jsx)("span", {
|
|
159
|
+
ref: parentSpan
|
|
160
|
+
}, (0, _core.jsx)("span", (0, _extends2.default)({}, triggerProps, {
|
|
148
161
|
onMouseEnter: initShowCard,
|
|
149
162
|
onMouseLeave: initHideCard,
|
|
150
163
|
onMouseMove: setMousePosition
|
|
151
|
-
}
|
|
152
|
-
css: {
|
|
153
|
-
position: 'sticky'
|
|
154
|
-
},
|
|
155
|
-
style: {
|
|
156
|
-
left: mousePos.current.x,
|
|
157
|
-
top: mousePos.current.y
|
|
158
|
-
}
|
|
159
|
-
})), children);
|
|
164
|
+
}), children));
|
|
160
165
|
},
|
|
161
166
|
zIndex: 511 // Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
|
|
162
167
|
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.titleBlockCss = exports.skeletonContainer = exports.metadataBlockCss = exports.loadingViewContainer = exports.footerBlockCss = exports.flexibleUiOptions = exports.HoverCardContainer = exports.CARD_WIDTH_REM = void 0;
|
|
8
|
+
exports.titleBlockCss = exports.skeletonContainer = exports.metadataBlockCss = exports.loadingViewContainer = exports.footerBlockCss = exports.flexibleUiOptions = exports.HoverCardContainer = exports.CARD_WIDTH_REM = exports.CARD_GAP_PX = void 0;
|
|
9
9
|
|
|
10
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
11
|
|
|
@@ -25,8 +25,11 @@ var flexibleUiOptions = {
|
|
|
25
25
|
hidePadding: true
|
|
26
26
|
};
|
|
27
27
|
exports.flexibleUiOptions = flexibleUiOptions;
|
|
28
|
-
var CARD_WIDTH_REM = 24;
|
|
28
|
+
var CARD_WIDTH_REM = 24; // gap between mouse cursor and hover card
|
|
29
|
+
|
|
29
30
|
exports.CARD_WIDTH_REM = CARD_WIDTH_REM;
|
|
31
|
+
var CARD_GAP_PX = 10;
|
|
32
|
+
exports.CARD_GAP_PX = CARD_GAP_PX;
|
|
30
33
|
var blockGap = '0.5rem';
|
|
31
34
|
var elementGap = '0.5rem';
|
|
32
35
|
var separatorCss = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n [data-separator] + [data-separator]:before {\n margin-right: ", ";\n }\n"])), elementGap);
|
package/dist/es2019/version.json
CHANGED
|
@@ -8,7 +8,7 @@ import { useSmartLinkActions } from '../../../state/hooks-external/useSmartLinkA
|
|
|
8
8
|
import { useSmartLinkRenderers } from '../../../state/renderers';
|
|
9
9
|
import { useSmartCardState as useLinkState } from '../../../state/store';
|
|
10
10
|
import HoverCardContent from '../components/HoverCardContent';
|
|
11
|
-
import { HoverCardContainer } from '../styled';
|
|
11
|
+
import { HoverCardContainer, CARD_GAP_PX } from '../styled';
|
|
12
12
|
import { SMART_CARD_ANALYTICS_DISPLAY } from '../utils';
|
|
13
13
|
export const hoverCardClassName = 'smart-links-hover-preview';
|
|
14
14
|
export const HoverCardComponent = ({
|
|
@@ -26,6 +26,8 @@ export const HoverCardComponent = ({
|
|
|
26
26
|
x: 0,
|
|
27
27
|
y: 0
|
|
28
28
|
});
|
|
29
|
+
const popupOffset = useRef();
|
|
30
|
+
const parentSpan = useRef(null);
|
|
29
31
|
const renderers = useSmartLinkRenderers();
|
|
30
32
|
const linkState = useLinkState(url);
|
|
31
33
|
const hoverDisplay = 'card';
|
|
@@ -58,6 +60,14 @@ export const HoverCardComponent = ({
|
|
|
58
60
|
analytics.ui.hoverCardViewedEvent(hoverDisplay, invokeMethod);
|
|
59
61
|
}
|
|
60
62
|
|
|
63
|
+
if (parentSpan.current) {
|
|
64
|
+
const {
|
|
65
|
+
bottom,
|
|
66
|
+
left
|
|
67
|
+
} = parentSpan.current.getBoundingClientRect();
|
|
68
|
+
popupOffset.current = [mousePos.current.x - left, mousePos.current.y - bottom + CARD_GAP_PX];
|
|
69
|
+
}
|
|
70
|
+
|
|
61
71
|
setIsOpen(true);
|
|
62
72
|
}, delay);
|
|
63
73
|
}, [delay, isOpen, analytics.ui]);
|
|
@@ -88,6 +98,7 @@ export const HoverCardComponent = ({
|
|
|
88
98
|
isOpen: isOpen,
|
|
89
99
|
onClose: hideCard,
|
|
90
100
|
placement: "bottom-start",
|
|
101
|
+
offset: popupOffset.current,
|
|
91
102
|
content: ({
|
|
92
103
|
update
|
|
93
104
|
}) => jsx("div", {
|
|
@@ -107,18 +118,12 @@ export const HoverCardComponent = ({
|
|
|
107
118
|
url: url
|
|
108
119
|
})),
|
|
109
120
|
trigger: triggerProps => jsx("span", {
|
|
121
|
+
ref: parentSpan
|
|
122
|
+
}, jsx("span", _extends({}, triggerProps, {
|
|
110
123
|
onMouseEnter: initShowCard,
|
|
111
124
|
onMouseLeave: initHideCard,
|
|
112
125
|
onMouseMove: setMousePosition
|
|
113
|
-
},
|
|
114
|
-
css: {
|
|
115
|
-
position: 'sticky'
|
|
116
|
-
},
|
|
117
|
-
style: {
|
|
118
|
-
left: mousePos.current.x,
|
|
119
|
-
top: mousePos.current.y
|
|
120
|
-
}
|
|
121
|
-
})), children),
|
|
126
|
+
}), children)),
|
|
122
127
|
zIndex: 511 // Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
|
|
123
128
|
|
|
124
129
|
});
|
|
@@ -8,7 +8,9 @@ export const flexibleUiOptions = {
|
|
|
8
8
|
theme: SmartLinkTheme.Black,
|
|
9
9
|
hidePadding: true
|
|
10
10
|
};
|
|
11
|
-
export const CARD_WIDTH_REM = 24;
|
|
11
|
+
export const CARD_WIDTH_REM = 24; // gap between mouse cursor and hover card
|
|
12
|
+
|
|
13
|
+
export const CARD_GAP_PX = 10;
|
|
12
14
|
const blockGap = '0.5rem';
|
|
13
15
|
const elementGap = '0.5rem';
|
|
14
16
|
const separatorCss = css`
|
package/dist/esm/version.json
CHANGED
|
@@ -9,7 +9,7 @@ import { useSmartLinkActions } from '../../../state/hooks-external/useSmartLinkA
|
|
|
9
9
|
import { useSmartLinkRenderers } from '../../../state/renderers';
|
|
10
10
|
import { useSmartCardState as useLinkState } from '../../../state/store';
|
|
11
11
|
import HoverCardContent from '../components/HoverCardContent';
|
|
12
|
-
import { HoverCardContainer } from '../styled';
|
|
12
|
+
import { HoverCardContainer, CARD_GAP_PX } from '../styled';
|
|
13
13
|
import { SMART_CARD_ANALYTICS_DISPLAY } from '../utils';
|
|
14
14
|
export var hoverCardClassName = 'smart-links-hover-preview';
|
|
15
15
|
export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
@@ -31,6 +31,8 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
31
31
|
x: 0,
|
|
32
32
|
y: 0
|
|
33
33
|
});
|
|
34
|
+
var popupOffset = useRef();
|
|
35
|
+
var parentSpan = useRef(null);
|
|
34
36
|
var renderers = useSmartLinkRenderers();
|
|
35
37
|
var linkState = useLinkState(url);
|
|
36
38
|
var hoverDisplay = 'card';
|
|
@@ -65,6 +67,14 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
65
67
|
analytics.ui.hoverCardViewedEvent(hoverDisplay, invokeMethod);
|
|
66
68
|
}
|
|
67
69
|
|
|
70
|
+
if (parentSpan.current) {
|
|
71
|
+
var _parentSpan$current$g = parentSpan.current.getBoundingClientRect(),
|
|
72
|
+
bottom = _parentSpan$current$g.bottom,
|
|
73
|
+
left = _parentSpan$current$g.left;
|
|
74
|
+
|
|
75
|
+
popupOffset.current = [mousePos.current.x - left, mousePos.current.y - bottom + CARD_GAP_PX];
|
|
76
|
+
}
|
|
77
|
+
|
|
68
78
|
setIsOpen(true);
|
|
69
79
|
}, delay);
|
|
70
80
|
}, [delay, isOpen, analytics.ui]);
|
|
@@ -97,6 +107,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
97
107
|
isOpen: isOpen,
|
|
98
108
|
onClose: hideCard,
|
|
99
109
|
placement: "bottom-start",
|
|
110
|
+
offset: popupOffset.current,
|
|
100
111
|
content: function content(_ref2) {
|
|
101
112
|
var update = _ref2.update;
|
|
102
113
|
return jsx("div", {
|
|
@@ -118,18 +129,12 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
118
129
|
},
|
|
119
130
|
trigger: function trigger(triggerProps) {
|
|
120
131
|
return jsx("span", {
|
|
132
|
+
ref: parentSpan
|
|
133
|
+
}, jsx("span", _extends({}, triggerProps, {
|
|
121
134
|
onMouseEnter: initShowCard,
|
|
122
135
|
onMouseLeave: initHideCard,
|
|
123
136
|
onMouseMove: setMousePosition
|
|
124
|
-
},
|
|
125
|
-
css: {
|
|
126
|
-
position: 'sticky'
|
|
127
|
-
},
|
|
128
|
-
style: {
|
|
129
|
-
left: mousePos.current.x,
|
|
130
|
-
top: mousePos.current.y
|
|
131
|
-
}
|
|
132
|
-
})), children);
|
|
137
|
+
}), children));
|
|
133
138
|
},
|
|
134
139
|
zIndex: 511 // Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
|
|
135
140
|
|
|
@@ -12,7 +12,9 @@ export var flexibleUiOptions = {
|
|
|
12
12
|
theme: SmartLinkTheme.Black,
|
|
13
13
|
hidePadding: true
|
|
14
14
|
};
|
|
15
|
-
export var CARD_WIDTH_REM = 24;
|
|
15
|
+
export var CARD_WIDTH_REM = 24; // gap between mouse cursor and hover card
|
|
16
|
+
|
|
17
|
+
export var CARD_GAP_PX = 10;
|
|
16
18
|
var blockGap = '0.5rem';
|
|
17
19
|
var elementGap = '0.5rem';
|
|
18
20
|
var separatorCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n [data-separator] + [data-separator]:before {\n margin-right: ", ";\n }\n"])), elementGap);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FlexibleUiOptions } from '../FlexibleCard/types';
|
|
2
2
|
export declare const flexibleUiOptions: FlexibleUiOptions;
|
|
3
3
|
export declare const CARD_WIDTH_REM = 24;
|
|
4
|
+
export declare const CARD_GAP_PX = 10;
|
|
4
5
|
export declare const HoverCardContainer: import("@emotion/utils").SerializedStyles;
|
|
5
6
|
export declare const titleBlockCss: import("@emotion/utils").SerializedStyles;
|
|
6
7
|
export declare const metadataBlockCss: import("@emotion/utils").SerializedStyles;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "20.1.
|
|
3
|
+
"version": "20.1.3",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@atlaskit/docs": "*",
|
|
71
71
|
"@atlaskit/field-base": "^15.0.6",
|
|
72
72
|
"@atlaskit/form": "^8.5.0",
|
|
73
|
-
"@atlaskit/inline-message": "^11.
|
|
73
|
+
"@atlaskit/inline-message": "^11.3.0",
|
|
74
74
|
"@atlaskit/lozenge": "^11.1.0",
|
|
75
75
|
"@atlaskit/media-integration-test-helpers": "^2.6.0",
|
|
76
76
|
"@atlaskit/media-test-helpers": "^30.0.0",
|