@atlaskit/smart-card 43.8.0 → 43.9.0
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 +19 -0
- package/dist/cjs/extractors/flexible/icon/extract-file-formatIcon.js +22 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/HoverCard/components/CustomPopupContainer.js +25 -2
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +16 -5
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/icon/extract-file-formatIcon.js +22 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/HoverCard/components/CustomPopupContainer.js +19 -0
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +16 -6
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/icon/extract-file-formatIcon.js +22 -0
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/HoverCard/components/CustomPopupContainer.js +24 -1
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +17 -6
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/view/HoverCard/components/CustomPopupContainer.d.ts +4 -0
- package/dist/types/view/HoverCard/components/HoverCardComponent.d.ts +1 -1
- package/dist/types/view/HoverCard/types.d.ts +6 -1
- package/dist/types-ts4.5/view/HoverCard/components/CustomPopupContainer.d.ts +4 -0
- package/dist/types-ts4.5/view/HoverCard/components/HoverCardComponent.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/types.d.ts +6 -1
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 43.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`f2ab75f2947ab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2ab75f2947ab) -
|
|
8
|
+
[ux] Add shouldRenderToParent prop to HoverCard which is propagated to the internal Popup
|
|
9
|
+
component
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`06d5717d57f36`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/06d5717d57f36) -
|
|
14
|
+
Suppress i18n errors
|
|
15
|
+
|
|
16
|
+
## 43.8.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 43.8.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
|
@@ -11,6 +11,7 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
11
11
|
switch (fileFormat) {
|
|
12
12
|
// Generic documents
|
|
13
13
|
case 'folder':
|
|
14
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
14
15
|
return {
|
|
15
16
|
icon: _constants.IconType.Folder,
|
|
16
17
|
label: 'Folder'
|
|
@@ -18,44 +19,52 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
18
19
|
case 'text/plain':
|
|
19
20
|
case 'application/vnd.oasis.opendocument.text':
|
|
20
21
|
case 'application/vnd.apple.pages':
|
|
22
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
21
23
|
return {
|
|
22
24
|
icon: _constants.IconType.Document,
|
|
23
25
|
label: 'Document'
|
|
24
26
|
};
|
|
25
27
|
case 'application/pdf':
|
|
28
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
26
29
|
return {
|
|
27
30
|
icon: _constants.IconType.PDF,
|
|
28
31
|
label: 'PDF document'
|
|
29
32
|
};
|
|
30
33
|
case 'application/vnd.oasis.opendocument.presentation':
|
|
31
34
|
case 'application/vnd.apple.keynote':
|
|
35
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
32
36
|
return {
|
|
33
37
|
icon: _constants.IconType.Presentation,
|
|
34
38
|
label: 'Presentation'
|
|
35
39
|
};
|
|
36
40
|
case 'application/vnd.oasis.opendocument.spreadsheet':
|
|
37
41
|
case 'application/vnd.apple.numbers':
|
|
42
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
38
43
|
return {
|
|
39
44
|
icon: _constants.IconType.Spreadsheet,
|
|
40
45
|
label: 'Spreadsheet'
|
|
41
46
|
};
|
|
42
47
|
// Google Drive
|
|
43
48
|
case 'application/vnd.google-apps.document':
|
|
49
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
44
50
|
return {
|
|
45
51
|
icon: _constants.IconType.GoogleDocs,
|
|
46
52
|
label: 'Google Docs'
|
|
47
53
|
};
|
|
48
54
|
case 'application/vnd.google-apps.form':
|
|
55
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
49
56
|
return {
|
|
50
57
|
icon: _constants.IconType.GoogleForms,
|
|
51
58
|
label: 'Google Form'
|
|
52
59
|
};
|
|
53
60
|
case 'application/vnd.google-apps.spreadsheet':
|
|
61
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
54
62
|
return {
|
|
55
63
|
icon: _constants.IconType.GoogleSheets,
|
|
56
64
|
label: 'Google Sheets'
|
|
57
65
|
};
|
|
58
66
|
case 'application/vnd.google-apps.presentation':
|
|
67
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
59
68
|
return {
|
|
60
69
|
icon: _constants.IconType.GoogleSlides,
|
|
61
70
|
label: 'Google Slides'
|
|
@@ -63,18 +72,21 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
63
72
|
// Microsoft
|
|
64
73
|
case 'application/vnd.ms-excel':
|
|
65
74
|
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
|
75
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
66
76
|
return {
|
|
67
77
|
icon: _constants.IconType.MSExcel,
|
|
68
78
|
label: 'Excel spreadsheet'
|
|
69
79
|
};
|
|
70
80
|
case 'application/vnd.ms-powerpoint':
|
|
71
81
|
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
|
|
82
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
72
83
|
return {
|
|
73
84
|
icon: _constants.IconType.MSPowerpoint,
|
|
74
85
|
label: 'PowerPoint presentation'
|
|
75
86
|
};
|
|
76
87
|
case 'application/msword':
|
|
77
88
|
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
|
89
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
78
90
|
return {
|
|
79
91
|
icon: _constants.IconType.MSWord,
|
|
80
92
|
label: 'Word document'
|
|
@@ -84,11 +96,13 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
84
96
|
case 'image/bmp':
|
|
85
97
|
case 'image/webp':
|
|
86
98
|
case 'image/svg+xml':
|
|
99
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
87
100
|
return {
|
|
88
101
|
icon: _constants.IconType.Image,
|
|
89
102
|
label: 'Image'
|
|
90
103
|
};
|
|
91
104
|
case 'image/gif':
|
|
105
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
92
106
|
return {
|
|
93
107
|
icon: _constants.IconType.GIF,
|
|
94
108
|
label: 'GIF'
|
|
@@ -98,6 +112,7 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
98
112
|
case 'audio/webm':
|
|
99
113
|
case 'audio/ogg':
|
|
100
114
|
case 'audio/wav':
|
|
115
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
101
116
|
return {
|
|
102
117
|
icon: _constants.IconType.Audio,
|
|
103
118
|
label: 'Audio'
|
|
@@ -109,6 +124,7 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
109
124
|
case 'video/ogg':
|
|
110
125
|
case 'video/x-ms-wmv':
|
|
111
126
|
case 'video/x-msvideo':
|
|
127
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
112
128
|
return {
|
|
113
129
|
icon: _constants.IconType.Video,
|
|
114
130
|
label: 'Video'
|
|
@@ -117,6 +133,7 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
117
133
|
case 'text/css':
|
|
118
134
|
case 'text/html':
|
|
119
135
|
case 'application/javascript':
|
|
136
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
120
137
|
return {
|
|
121
138
|
icon: _constants.IconType.Code,
|
|
122
139
|
label: 'Source Code'
|
|
@@ -127,26 +144,31 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
127
144
|
case 'application/x-7z-compressed':
|
|
128
145
|
case 'application/x-apple-diskimage':
|
|
129
146
|
case 'application/vnd.rar':
|
|
147
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
130
148
|
return {
|
|
131
149
|
icon: _constants.IconType.Archive,
|
|
132
150
|
label: 'Archive'
|
|
133
151
|
};
|
|
134
152
|
case 'application/dmg':
|
|
153
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
135
154
|
return {
|
|
136
155
|
icon: _constants.IconType.Executable,
|
|
137
156
|
label: 'Executable'
|
|
138
157
|
};
|
|
139
158
|
case 'application/sketch':
|
|
159
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
140
160
|
return {
|
|
141
161
|
icon: _constants.IconType.Sketch,
|
|
142
162
|
label: 'Sketch'
|
|
143
163
|
};
|
|
144
164
|
case 'application/octet-stream':
|
|
165
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
145
166
|
return {
|
|
146
167
|
icon: _constants.IconType.Generic,
|
|
147
168
|
label: 'Binary file'
|
|
148
169
|
};
|
|
149
170
|
case 'application/invision.prototype':
|
|
171
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
150
172
|
return {
|
|
151
173
|
icon: _constants.IconType.Generic,
|
|
152
174
|
label: 'Prototype'
|
|
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
11
11
|
var context = exports.context = {
|
|
12
12
|
componentName: 'smart-cards',
|
|
13
13
|
packageName: "@atlaskit/smart-card",
|
|
14
|
-
packageVersion: "43.
|
|
14
|
+
packageVersion: "43.8.1"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -4,11 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default = void 0;
|
|
7
|
+
exports.default = exports.createCustomPopupContainer = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var _excluded = ["children", "shouldFitContainer", "shouldRenderToParent"]
|
|
12
|
+
var _excluded = ["children", "shouldFitContainer", "shouldRenderToParent"],
|
|
13
|
+
_excluded2 = ["children", "shouldFitContainer", "shouldRenderToParent"];
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
16
|
/**
|
|
13
17
|
* The purpose of this component is to hide the default Popup border.
|
|
14
18
|
* HoverCard border implementation is in ContentContainer where it can
|
|
@@ -23,4 +27,23 @@ var CustomPopupContainer = /*#__PURE__*/_react.default.forwardRef(function (_ref
|
|
|
23
27
|
ref: ref
|
|
24
28
|
}), children);
|
|
25
29
|
});
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Factory function to create a CustomPopupContainer with a specific z-index
|
|
33
|
+
*/
|
|
34
|
+
var createCustomPopupContainer = exports.createCustomPopupContainer = function createCustomPopupContainer(zIndex) {
|
|
35
|
+
return /*#__PURE__*/_react.default.forwardRef(function (_ref2, ref) {
|
|
36
|
+
var children = _ref2.children,
|
|
37
|
+
_ = _ref2.shouldFitContainer,
|
|
38
|
+
__ = _ref2.shouldRenderToParent,
|
|
39
|
+
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, props, {
|
|
41
|
+
ref: ref
|
|
42
|
+
}, zIndex !== undefined && {
|
|
43
|
+
style: _objectSpread(_objectSpread({}, props.style), {}, {
|
|
44
|
+
zIndex: zIndex
|
|
45
|
+
})
|
|
46
|
+
}), children);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
26
49
|
var _default = exports.default = CustomPopupContainer;
|
|
@@ -18,7 +18,7 @@ var _actions = require("../../../state/actions");
|
|
|
18
18
|
var _renderers = require("../../../state/renderers");
|
|
19
19
|
var _store = require("../../../state/store");
|
|
20
20
|
var _SmartLinkAnalyticsContext = require("../../../utils/analytics/SmartLinkAnalyticsContext");
|
|
21
|
-
var _CustomPopupContainer =
|
|
21
|
+
var _CustomPopupContainer = _interopRequireWildcard(require("../components/CustomPopupContainer"));
|
|
22
22
|
var _HoverCardContent = _interopRequireDefault(require("../components/HoverCardContent"));
|
|
23
23
|
var _styled = require("../styled");
|
|
24
24
|
var _excluded = ["aria-haspopup", "aria-expanded"];
|
|
@@ -47,6 +47,8 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
|
|
|
47
47
|
noFadeDelay = _ref$noFadeDelay === void 0 ? false : _ref$noFadeDelay,
|
|
48
48
|
hoverPreviewOptions = _ref.hoverPreviewOptions,
|
|
49
49
|
role = _ref.role,
|
|
50
|
+
_ref$shouldRenderToPa = _ref.shouldRenderToParent,
|
|
51
|
+
shouldRenderToParent = _ref$shouldRenderToPa === void 0 ? false : _ref$shouldRenderToPa,
|
|
50
52
|
label = _ref.label,
|
|
51
53
|
titleId = _ref.titleId,
|
|
52
54
|
onVisibilityChange = _ref.onVisibilityChange;
|
|
@@ -244,7 +246,14 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
|
|
|
244
246
|
className: HOVER_CARD_TRIGGER_WRAPPER
|
|
245
247
|
} : {}), children));
|
|
246
248
|
}, [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition]);
|
|
247
|
-
|
|
249
|
+
var popupComponent = (0, _platformFeatureFlags.fg)('hover-card-prop-should-render-to-parent') ?
|
|
250
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
251
|
+
(0, _react.useMemo)(function () {
|
|
252
|
+
// Within the Popup component, if shouldRenderToParent, the zIndex prop is ignored
|
|
253
|
+
// as it is assumed that the custom popup container has the desired styles
|
|
254
|
+
return (0, _CustomPopupContainer.createCustomPopupContainer)(shouldRenderToParent ? zIndex : undefined);
|
|
255
|
+
}, [zIndex, shouldRenderToParent]) : _CustomPopupContainer.default;
|
|
256
|
+
return /*#__PURE__*/_react.default.createElement(_popup.default, (0, _extends2.default)({
|
|
248
257
|
testId: "hover-card",
|
|
249
258
|
isOpen: isOpen && canOpen,
|
|
250
259
|
onClose: hideCard,
|
|
@@ -257,8 +266,10 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
|
|
|
257
266
|
role: role,
|
|
258
267
|
titleId: titleId,
|
|
259
268
|
label: label
|
|
269
|
+
}, (0, _platformFeatureFlags.fg)('hover-card-prop-should-render-to-parent') ? {
|
|
270
|
+
shouldRenderToParent: shouldRenderToParent
|
|
271
|
+
} : {}, {
|
|
260
272
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
});
|
|
273
|
+
popupComponent: popupComponent
|
|
274
|
+
}));
|
|
264
275
|
};
|
|
@@ -22,7 +22,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
22
22
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
23
23
|
var PACKAGE_DATA = {
|
|
24
24
|
packageName: "@atlaskit/smart-card",
|
|
25
|
-
packageVersion: "43.
|
|
25
|
+
packageVersion: "43.8.1",
|
|
26
26
|
componentName: 'linkUrl'
|
|
27
27
|
};
|
|
28
28
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -4,6 +4,7 @@ const extractFileFormatIcon = fileFormat => {
|
|
|
4
4
|
switch (fileFormat) {
|
|
5
5
|
// Generic documents
|
|
6
6
|
case 'folder':
|
|
7
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
7
8
|
return {
|
|
8
9
|
icon: IconType.Folder,
|
|
9
10
|
label: 'Folder'
|
|
@@ -11,44 +12,52 @@ const extractFileFormatIcon = fileFormat => {
|
|
|
11
12
|
case 'text/plain':
|
|
12
13
|
case 'application/vnd.oasis.opendocument.text':
|
|
13
14
|
case 'application/vnd.apple.pages':
|
|
15
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
14
16
|
return {
|
|
15
17
|
icon: IconType.Document,
|
|
16
18
|
label: 'Document'
|
|
17
19
|
};
|
|
18
20
|
case 'application/pdf':
|
|
21
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
19
22
|
return {
|
|
20
23
|
icon: IconType.PDF,
|
|
21
24
|
label: 'PDF document'
|
|
22
25
|
};
|
|
23
26
|
case 'application/vnd.oasis.opendocument.presentation':
|
|
24
27
|
case 'application/vnd.apple.keynote':
|
|
28
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
25
29
|
return {
|
|
26
30
|
icon: IconType.Presentation,
|
|
27
31
|
label: 'Presentation'
|
|
28
32
|
};
|
|
29
33
|
case 'application/vnd.oasis.opendocument.spreadsheet':
|
|
30
34
|
case 'application/vnd.apple.numbers':
|
|
35
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
31
36
|
return {
|
|
32
37
|
icon: IconType.Spreadsheet,
|
|
33
38
|
label: 'Spreadsheet'
|
|
34
39
|
};
|
|
35
40
|
// Google Drive
|
|
36
41
|
case 'application/vnd.google-apps.document':
|
|
42
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
37
43
|
return {
|
|
38
44
|
icon: IconType.GoogleDocs,
|
|
39
45
|
label: 'Google Docs'
|
|
40
46
|
};
|
|
41
47
|
case 'application/vnd.google-apps.form':
|
|
48
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
42
49
|
return {
|
|
43
50
|
icon: IconType.GoogleForms,
|
|
44
51
|
label: 'Google Form'
|
|
45
52
|
};
|
|
46
53
|
case 'application/vnd.google-apps.spreadsheet':
|
|
54
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
47
55
|
return {
|
|
48
56
|
icon: IconType.GoogleSheets,
|
|
49
57
|
label: 'Google Sheets'
|
|
50
58
|
};
|
|
51
59
|
case 'application/vnd.google-apps.presentation':
|
|
60
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
52
61
|
return {
|
|
53
62
|
icon: IconType.GoogleSlides,
|
|
54
63
|
label: 'Google Slides'
|
|
@@ -56,18 +65,21 @@ const extractFileFormatIcon = fileFormat => {
|
|
|
56
65
|
// Microsoft
|
|
57
66
|
case 'application/vnd.ms-excel':
|
|
58
67
|
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
|
68
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
59
69
|
return {
|
|
60
70
|
icon: IconType.MSExcel,
|
|
61
71
|
label: 'Excel spreadsheet'
|
|
62
72
|
};
|
|
63
73
|
case 'application/vnd.ms-powerpoint':
|
|
64
74
|
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
|
|
75
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
65
76
|
return {
|
|
66
77
|
icon: IconType.MSPowerpoint,
|
|
67
78
|
label: 'PowerPoint presentation'
|
|
68
79
|
};
|
|
69
80
|
case 'application/msword':
|
|
70
81
|
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
|
82
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
71
83
|
return {
|
|
72
84
|
icon: IconType.MSWord,
|
|
73
85
|
label: 'Word document'
|
|
@@ -77,11 +89,13 @@ const extractFileFormatIcon = fileFormat => {
|
|
|
77
89
|
case 'image/bmp':
|
|
78
90
|
case 'image/webp':
|
|
79
91
|
case 'image/svg+xml':
|
|
92
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
80
93
|
return {
|
|
81
94
|
icon: IconType.Image,
|
|
82
95
|
label: 'Image'
|
|
83
96
|
};
|
|
84
97
|
case 'image/gif':
|
|
98
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
85
99
|
return {
|
|
86
100
|
icon: IconType.GIF,
|
|
87
101
|
label: 'GIF'
|
|
@@ -91,6 +105,7 @@ const extractFileFormatIcon = fileFormat => {
|
|
|
91
105
|
case 'audio/webm':
|
|
92
106
|
case 'audio/ogg':
|
|
93
107
|
case 'audio/wav':
|
|
108
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
94
109
|
return {
|
|
95
110
|
icon: IconType.Audio,
|
|
96
111
|
label: 'Audio'
|
|
@@ -102,6 +117,7 @@ const extractFileFormatIcon = fileFormat => {
|
|
|
102
117
|
case 'video/ogg':
|
|
103
118
|
case 'video/x-ms-wmv':
|
|
104
119
|
case 'video/x-msvideo':
|
|
120
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
105
121
|
return {
|
|
106
122
|
icon: IconType.Video,
|
|
107
123
|
label: 'Video'
|
|
@@ -110,6 +126,7 @@ const extractFileFormatIcon = fileFormat => {
|
|
|
110
126
|
case 'text/css':
|
|
111
127
|
case 'text/html':
|
|
112
128
|
case 'application/javascript':
|
|
129
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
113
130
|
return {
|
|
114
131
|
icon: IconType.Code,
|
|
115
132
|
label: 'Source Code'
|
|
@@ -120,26 +137,31 @@ const extractFileFormatIcon = fileFormat => {
|
|
|
120
137
|
case 'application/x-7z-compressed':
|
|
121
138
|
case 'application/x-apple-diskimage':
|
|
122
139
|
case 'application/vnd.rar':
|
|
140
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
123
141
|
return {
|
|
124
142
|
icon: IconType.Archive,
|
|
125
143
|
label: 'Archive'
|
|
126
144
|
};
|
|
127
145
|
case 'application/dmg':
|
|
146
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
128
147
|
return {
|
|
129
148
|
icon: IconType.Executable,
|
|
130
149
|
label: 'Executable'
|
|
131
150
|
};
|
|
132
151
|
case 'application/sketch':
|
|
152
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
133
153
|
return {
|
|
134
154
|
icon: IconType.Sketch,
|
|
135
155
|
label: 'Sketch'
|
|
136
156
|
};
|
|
137
157
|
case 'application/octet-stream':
|
|
158
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
138
159
|
return {
|
|
139
160
|
icon: IconType.Generic,
|
|
140
161
|
label: 'Binary file'
|
|
141
162
|
};
|
|
142
163
|
case 'application/invision.prototype':
|
|
164
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
143
165
|
return {
|
|
144
166
|
icon: IconType.Generic,
|
|
145
167
|
label: 'Prototype'
|
|
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
2
2
|
export const context = {
|
|
3
3
|
componentName: 'smart-cards',
|
|
4
4
|
packageName: "@atlaskit/smart-card",
|
|
5
|
-
packageVersion: "43.
|
|
5
|
+
packageVersion: "43.8.1"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -13,4 +13,23 @@ const CustomPopupContainer = /*#__PURE__*/React.forwardRef(({
|
|
|
13
13
|
}, ref) => /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
14
14
|
ref: ref
|
|
15
15
|
}), children));
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Factory function to create a CustomPopupContainer with a specific z-index
|
|
19
|
+
*/
|
|
20
|
+
export const createCustomPopupContainer = zIndex => {
|
|
21
|
+
return /*#__PURE__*/React.forwardRef(({
|
|
22
|
+
children,
|
|
23
|
+
shouldFitContainer: _,
|
|
24
|
+
shouldRenderToParent: __,
|
|
25
|
+
...props
|
|
26
|
+
}, ref) => /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
27
|
+
ref: ref
|
|
28
|
+
}, zIndex !== undefined && {
|
|
29
|
+
style: {
|
|
30
|
+
...props.style,
|
|
31
|
+
zIndex
|
|
32
|
+
}
|
|
33
|
+
}), children));
|
|
34
|
+
};
|
|
16
35
|
export default CustomPopupContainer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import Popup from '@atlaskit/popup';
|
|
5
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -8,7 +8,7 @@ import { useSmartCardActions } from '../../../state/actions';
|
|
|
8
8
|
import { useSmartLinkRenderers } from '../../../state/renderers';
|
|
9
9
|
import { useSmartCardState as useLinkState } from '../../../state/store';
|
|
10
10
|
import { SmartLinkAnalyticsContext } from '../../../utils/analytics/SmartLinkAnalyticsContext';
|
|
11
|
-
import CustomPopupContainer from '../components/CustomPopupContainer';
|
|
11
|
+
import CustomPopupContainer, { createCustomPopupContainer } from '../components/CustomPopupContainer';
|
|
12
12
|
import HoverCardContent from '../components/HoverCardContent';
|
|
13
13
|
import { CARD_GAP_PX, HOVER_CARD_Z_INDEX } from '../styled';
|
|
14
14
|
export const HOVER_CARD_SOURCE = 'smartLinkPreviewHoverCard';
|
|
@@ -28,6 +28,7 @@ export const HoverCardComponent = ({
|
|
|
28
28
|
noFadeDelay = false,
|
|
29
29
|
hoverPreviewOptions,
|
|
30
30
|
role,
|
|
31
|
+
shouldRenderToParent = false,
|
|
31
32
|
label,
|
|
32
33
|
titleId,
|
|
33
34
|
onVisibilityChange
|
|
@@ -220,7 +221,14 @@ export const HoverCardComponent = ({
|
|
|
220
221
|
}, editorExperiment('platform_editor_preview_panel_linking_exp', true) ? {
|
|
221
222
|
className: HOVER_CARD_TRIGGER_WRAPPER
|
|
222
223
|
} : {}), children)), [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition]);
|
|
223
|
-
|
|
224
|
+
const popupComponent = fg('hover-card-prop-should-render-to-parent') ?
|
|
225
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
226
|
+
useMemo(() => {
|
|
227
|
+
// Within the Popup component, if shouldRenderToParent, the zIndex prop is ignored
|
|
228
|
+
// as it is assumed that the custom popup container has the desired styles
|
|
229
|
+
return createCustomPopupContainer(shouldRenderToParent ? zIndex : undefined);
|
|
230
|
+
}, [zIndex, shouldRenderToParent]) : CustomPopupContainer;
|
|
231
|
+
return /*#__PURE__*/React.createElement(Popup, _extends({
|
|
224
232
|
testId: "hover-card",
|
|
225
233
|
isOpen: isOpen && canOpen,
|
|
226
234
|
onClose: hideCard,
|
|
@@ -233,8 +241,10 @@ export const HoverCardComponent = ({
|
|
|
233
241
|
role: role,
|
|
234
242
|
titleId: titleId,
|
|
235
243
|
label: label
|
|
244
|
+
}, fg('hover-card-prop-should-render-to-parent') ? {
|
|
245
|
+
shouldRenderToParent
|
|
246
|
+
} : {}, {
|
|
236
247
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
});
|
|
248
|
+
popupComponent: popupComponent
|
|
249
|
+
}));
|
|
240
250
|
};
|
|
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
12
12
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
13
13
|
const PACKAGE_DATA = {
|
|
14
14
|
packageName: "@atlaskit/smart-card",
|
|
15
|
-
packageVersion: "43.
|
|
15
|
+
packageVersion: "43.8.1",
|
|
16
16
|
componentName: 'linkUrl'
|
|
17
17
|
};
|
|
18
18
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -4,6 +4,7 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
4
4
|
switch (fileFormat) {
|
|
5
5
|
// Generic documents
|
|
6
6
|
case 'folder':
|
|
7
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
7
8
|
return {
|
|
8
9
|
icon: IconType.Folder,
|
|
9
10
|
label: 'Folder'
|
|
@@ -11,44 +12,52 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
11
12
|
case 'text/plain':
|
|
12
13
|
case 'application/vnd.oasis.opendocument.text':
|
|
13
14
|
case 'application/vnd.apple.pages':
|
|
15
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
14
16
|
return {
|
|
15
17
|
icon: IconType.Document,
|
|
16
18
|
label: 'Document'
|
|
17
19
|
};
|
|
18
20
|
case 'application/pdf':
|
|
21
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
19
22
|
return {
|
|
20
23
|
icon: IconType.PDF,
|
|
21
24
|
label: 'PDF document'
|
|
22
25
|
};
|
|
23
26
|
case 'application/vnd.oasis.opendocument.presentation':
|
|
24
27
|
case 'application/vnd.apple.keynote':
|
|
28
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
25
29
|
return {
|
|
26
30
|
icon: IconType.Presentation,
|
|
27
31
|
label: 'Presentation'
|
|
28
32
|
};
|
|
29
33
|
case 'application/vnd.oasis.opendocument.spreadsheet':
|
|
30
34
|
case 'application/vnd.apple.numbers':
|
|
35
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
31
36
|
return {
|
|
32
37
|
icon: IconType.Spreadsheet,
|
|
33
38
|
label: 'Spreadsheet'
|
|
34
39
|
};
|
|
35
40
|
// Google Drive
|
|
36
41
|
case 'application/vnd.google-apps.document':
|
|
42
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
37
43
|
return {
|
|
38
44
|
icon: IconType.GoogleDocs,
|
|
39
45
|
label: 'Google Docs'
|
|
40
46
|
};
|
|
41
47
|
case 'application/vnd.google-apps.form':
|
|
48
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
42
49
|
return {
|
|
43
50
|
icon: IconType.GoogleForms,
|
|
44
51
|
label: 'Google Form'
|
|
45
52
|
};
|
|
46
53
|
case 'application/vnd.google-apps.spreadsheet':
|
|
54
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
47
55
|
return {
|
|
48
56
|
icon: IconType.GoogleSheets,
|
|
49
57
|
label: 'Google Sheets'
|
|
50
58
|
};
|
|
51
59
|
case 'application/vnd.google-apps.presentation':
|
|
60
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
52
61
|
return {
|
|
53
62
|
icon: IconType.GoogleSlides,
|
|
54
63
|
label: 'Google Slides'
|
|
@@ -56,18 +65,21 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
56
65
|
// Microsoft
|
|
57
66
|
case 'application/vnd.ms-excel':
|
|
58
67
|
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
|
68
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
59
69
|
return {
|
|
60
70
|
icon: IconType.MSExcel,
|
|
61
71
|
label: 'Excel spreadsheet'
|
|
62
72
|
};
|
|
63
73
|
case 'application/vnd.ms-powerpoint':
|
|
64
74
|
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
|
|
75
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
65
76
|
return {
|
|
66
77
|
icon: IconType.MSPowerpoint,
|
|
67
78
|
label: 'PowerPoint presentation'
|
|
68
79
|
};
|
|
69
80
|
case 'application/msword':
|
|
70
81
|
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
|
82
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
71
83
|
return {
|
|
72
84
|
icon: IconType.MSWord,
|
|
73
85
|
label: 'Word document'
|
|
@@ -77,11 +89,13 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
77
89
|
case 'image/bmp':
|
|
78
90
|
case 'image/webp':
|
|
79
91
|
case 'image/svg+xml':
|
|
92
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
80
93
|
return {
|
|
81
94
|
icon: IconType.Image,
|
|
82
95
|
label: 'Image'
|
|
83
96
|
};
|
|
84
97
|
case 'image/gif':
|
|
98
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
85
99
|
return {
|
|
86
100
|
icon: IconType.GIF,
|
|
87
101
|
label: 'GIF'
|
|
@@ -91,6 +105,7 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
91
105
|
case 'audio/webm':
|
|
92
106
|
case 'audio/ogg':
|
|
93
107
|
case 'audio/wav':
|
|
108
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
94
109
|
return {
|
|
95
110
|
icon: IconType.Audio,
|
|
96
111
|
label: 'Audio'
|
|
@@ -102,6 +117,7 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
102
117
|
case 'video/ogg':
|
|
103
118
|
case 'video/x-ms-wmv':
|
|
104
119
|
case 'video/x-msvideo':
|
|
120
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
105
121
|
return {
|
|
106
122
|
icon: IconType.Video,
|
|
107
123
|
label: 'Video'
|
|
@@ -110,6 +126,7 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
110
126
|
case 'text/css':
|
|
111
127
|
case 'text/html':
|
|
112
128
|
case 'application/javascript':
|
|
129
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
113
130
|
return {
|
|
114
131
|
icon: IconType.Code,
|
|
115
132
|
label: 'Source Code'
|
|
@@ -120,26 +137,31 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
120
137
|
case 'application/x-7z-compressed':
|
|
121
138
|
case 'application/x-apple-diskimage':
|
|
122
139
|
case 'application/vnd.rar':
|
|
140
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
123
141
|
return {
|
|
124
142
|
icon: IconType.Archive,
|
|
125
143
|
label: 'Archive'
|
|
126
144
|
};
|
|
127
145
|
case 'application/dmg':
|
|
146
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
128
147
|
return {
|
|
129
148
|
icon: IconType.Executable,
|
|
130
149
|
label: 'Executable'
|
|
131
150
|
};
|
|
132
151
|
case 'application/sketch':
|
|
152
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
133
153
|
return {
|
|
134
154
|
icon: IconType.Sketch,
|
|
135
155
|
label: 'Sketch'
|
|
136
156
|
};
|
|
137
157
|
case 'application/octet-stream':
|
|
158
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
138
159
|
return {
|
|
139
160
|
icon: IconType.Generic,
|
|
140
161
|
label: 'Binary file'
|
|
141
162
|
};
|
|
142
163
|
case 'application/invision.prototype':
|
|
164
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
143
165
|
return {
|
|
144
166
|
icon: IconType.Generic,
|
|
145
167
|
label: 'Prototype'
|
|
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export var context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "43.
|
|
7
|
+
packageVersion: "43.8.1"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "shouldFitContainer", "shouldRenderToParent"]
|
|
4
|
+
var _excluded = ["children", "shouldFitContainer", "shouldRenderToParent"],
|
|
5
|
+
_excluded2 = ["children", "shouldFitContainer", "shouldRenderToParent"];
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
8
|
import React from 'react';
|
|
5
9
|
/**
|
|
6
10
|
* The purpose of this component is to hide the default Popup border.
|
|
@@ -16,4 +20,23 @@ var CustomPopupContainer = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
16
20
|
ref: ref
|
|
17
21
|
}), children);
|
|
18
22
|
});
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Factory function to create a CustomPopupContainer with a specific z-index
|
|
26
|
+
*/
|
|
27
|
+
export var createCustomPopupContainer = function createCustomPopupContainer(zIndex) {
|
|
28
|
+
return /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
29
|
+
var children = _ref2.children,
|
|
30
|
+
_ = _ref2.shouldFitContainer,
|
|
31
|
+
__ = _ref2.shouldRenderToParent,
|
|
32
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
33
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
34
|
+
ref: ref
|
|
35
|
+
}, zIndex !== undefined && {
|
|
36
|
+
style: _objectSpread(_objectSpread({}, props.style), {}, {
|
|
37
|
+
zIndex: zIndex
|
|
38
|
+
})
|
|
39
|
+
}), children);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
19
42
|
export default CustomPopupContainer;
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
var _excluded = ["aria-haspopup", "aria-expanded"];
|
|
5
|
-
import React, { useCallback, useEffect, useRef } from 'react';
|
|
5
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import Popup from '@atlaskit/popup';
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -11,7 +11,7 @@ import { useSmartCardActions } from '../../../state/actions';
|
|
|
11
11
|
import { useSmartLinkRenderers } from '../../../state/renderers';
|
|
12
12
|
import { useSmartCardState as useLinkState } from '../../../state/store';
|
|
13
13
|
import { SmartLinkAnalyticsContext } from '../../../utils/analytics/SmartLinkAnalyticsContext';
|
|
14
|
-
import CustomPopupContainer from '../components/CustomPopupContainer';
|
|
14
|
+
import CustomPopupContainer, { createCustomPopupContainer } from '../components/CustomPopupContainer';
|
|
15
15
|
import HoverCardContent from '../components/HoverCardContent';
|
|
16
16
|
import { CARD_GAP_PX, HOVER_CARD_Z_INDEX } from '../styled';
|
|
17
17
|
export var HOVER_CARD_SOURCE = 'smartLinkPreviewHoverCard';
|
|
@@ -38,6 +38,8 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
38
38
|
noFadeDelay = _ref$noFadeDelay === void 0 ? false : _ref$noFadeDelay,
|
|
39
39
|
hoverPreviewOptions = _ref.hoverPreviewOptions,
|
|
40
40
|
role = _ref.role,
|
|
41
|
+
_ref$shouldRenderToPa = _ref.shouldRenderToParent,
|
|
42
|
+
shouldRenderToParent = _ref$shouldRenderToPa === void 0 ? false : _ref$shouldRenderToPa,
|
|
41
43
|
label = _ref.label,
|
|
42
44
|
titleId = _ref.titleId,
|
|
43
45
|
onVisibilityChange = _ref.onVisibilityChange;
|
|
@@ -235,7 +237,14 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
235
237
|
className: HOVER_CARD_TRIGGER_WRAPPER
|
|
236
238
|
} : {}), children));
|
|
237
239
|
}, [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition]);
|
|
238
|
-
|
|
240
|
+
var popupComponent = fg('hover-card-prop-should-render-to-parent') ?
|
|
241
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
242
|
+
useMemo(function () {
|
|
243
|
+
// Within the Popup component, if shouldRenderToParent, the zIndex prop is ignored
|
|
244
|
+
// as it is assumed that the custom popup container has the desired styles
|
|
245
|
+
return createCustomPopupContainer(shouldRenderToParent ? zIndex : undefined);
|
|
246
|
+
}, [zIndex, shouldRenderToParent]) : CustomPopupContainer;
|
|
247
|
+
return /*#__PURE__*/React.createElement(Popup, _extends({
|
|
239
248
|
testId: "hover-card",
|
|
240
249
|
isOpen: isOpen && canOpen,
|
|
241
250
|
onClose: hideCard,
|
|
@@ -248,8 +257,10 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
248
257
|
role: role,
|
|
249
258
|
titleId: titleId,
|
|
250
259
|
label: label
|
|
260
|
+
}, fg('hover-card-prop-should-render-to-parent') ? {
|
|
261
|
+
shouldRenderToParent: shouldRenderToParent
|
|
262
|
+
} : {}, {
|
|
251
263
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
});
|
|
264
|
+
popupComponent: popupComponent
|
|
265
|
+
}));
|
|
255
266
|
};
|
|
@@ -15,7 +15,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
15
15
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
16
16
|
var PACKAGE_DATA = {
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "43.
|
|
18
|
+
packageVersion: "43.8.1",
|
|
19
19
|
componentName: 'linkUrl'
|
|
20
20
|
};
|
|
21
21
|
var Anchor = withLinkClickedEvent('a');
|
|
@@ -6,4 +6,8 @@ import { type PopupComponentProps } from '@atlaskit/popup';
|
|
|
6
6
|
* change between the default border and prism border during runtime.
|
|
7
7
|
*/
|
|
8
8
|
declare const CustomPopupContainer: React.ForwardRefExoticComponent<Omit<PopupComponentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
/**
|
|
10
|
+
* Factory function to create a CustomPopupContainer with a specific z-index
|
|
11
|
+
*/
|
|
12
|
+
export declare const createCustomPopupContainer: (zIndex?: number) => React.ForwardRefExoticComponent<Omit<PopupComponentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
13
|
export default CustomPopupContainer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type HoverCardComponentProps } from '../types';
|
|
3
3
|
export declare const HOVER_CARD_SOURCE = "smartLinkPreviewHoverCard";
|
|
4
|
-
export declare const HoverCardComponent: ({ children, url, id, canOpen, closeOnChildClick, actionOptions, allowEventPropagation, zIndex, noFadeDelay, hoverPreviewOptions, role, label, titleId, onVisibilityChange, }: HoverCardComponentProps) => React.JSX.Element;
|
|
4
|
+
export declare const HoverCardComponent: ({ children, url, id, canOpen, closeOnChildClick, actionOptions, allowEventPropagation, zIndex, noFadeDelay, hoverPreviewOptions, role, shouldRenderToParent, label, titleId, onVisibilityChange, }: HoverCardComponentProps) => React.JSX.Element;
|
|
@@ -51,6 +51,11 @@ export interface HoverCardProps extends WithAnalyticsEventsProps {
|
|
|
51
51
|
* Should be used along with `label` or `titleId` for supported roles.
|
|
52
52
|
*/
|
|
53
53
|
role?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the hover card should render to the parent element, to the
|
|
56
|
+
* atlaskit-portal-container at the root of the document. Defaults to false.
|
|
57
|
+
*/
|
|
58
|
+
shouldRenderToParent?: boolean;
|
|
54
59
|
/**
|
|
55
60
|
* Id referenced by the hover card `aria-labelledby` attribute.
|
|
56
61
|
* Usage of either this, or the `label` attribute is strongly recommended.
|
|
@@ -86,6 +91,7 @@ export interface HoverCardComponentProps extends HoverCardProps, HoverCardIntern
|
|
|
86
91
|
export type HoverCardContentProps = {
|
|
87
92
|
actionOptions?: CardActionOptions;
|
|
88
93
|
cardState: CardState;
|
|
94
|
+
hoverPreviewOptions?: HoverPreviewOptions;
|
|
89
95
|
id?: string;
|
|
90
96
|
onActionClick: (actionId: string | ActionName) => void;
|
|
91
97
|
onMouseEnter?: MouseEventHandler;
|
|
@@ -93,7 +99,6 @@ export type HoverCardContentProps = {
|
|
|
93
99
|
onResolve: () => void;
|
|
94
100
|
renderers?: CardProviderRenderers;
|
|
95
101
|
url: string;
|
|
96
|
-
hoverPreviewOptions?: HoverPreviewOptions;
|
|
97
102
|
};
|
|
98
103
|
export type ContentContainerProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
99
104
|
isAIEnabled?: boolean;
|
|
@@ -6,4 +6,8 @@ import { type PopupComponentProps } from '@atlaskit/popup';
|
|
|
6
6
|
* change between the default border and prism border during runtime.
|
|
7
7
|
*/
|
|
8
8
|
declare const CustomPopupContainer: React.ForwardRefExoticComponent<Omit<PopupComponentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
/**
|
|
10
|
+
* Factory function to create a CustomPopupContainer with a specific z-index
|
|
11
|
+
*/
|
|
12
|
+
export declare const createCustomPopupContainer: (zIndex?: number) => React.ForwardRefExoticComponent<Omit<PopupComponentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
13
|
export default CustomPopupContainer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type HoverCardComponentProps } from '../types';
|
|
3
3
|
export declare const HOVER_CARD_SOURCE = "smartLinkPreviewHoverCard";
|
|
4
|
-
export declare const HoverCardComponent: ({ children, url, id, canOpen, closeOnChildClick, actionOptions, allowEventPropagation, zIndex, noFadeDelay, hoverPreviewOptions, role, label, titleId, onVisibilityChange, }: HoverCardComponentProps) => React.JSX.Element;
|
|
4
|
+
export declare const HoverCardComponent: ({ children, url, id, canOpen, closeOnChildClick, actionOptions, allowEventPropagation, zIndex, noFadeDelay, hoverPreviewOptions, role, shouldRenderToParent, label, titleId, onVisibilityChange, }: HoverCardComponentProps) => React.JSX.Element;
|
|
@@ -51,6 +51,11 @@ export interface HoverCardProps extends WithAnalyticsEventsProps {
|
|
|
51
51
|
* Should be used along with `label` or `titleId` for supported roles.
|
|
52
52
|
*/
|
|
53
53
|
role?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the hover card should render to the parent element, to the
|
|
56
|
+
* atlaskit-portal-container at the root of the document. Defaults to false.
|
|
57
|
+
*/
|
|
58
|
+
shouldRenderToParent?: boolean;
|
|
54
59
|
/**
|
|
55
60
|
* Id referenced by the hover card `aria-labelledby` attribute.
|
|
56
61
|
* Usage of either this, or the `label` attribute is strongly recommended.
|
|
@@ -86,6 +91,7 @@ export interface HoverCardComponentProps extends HoverCardProps, HoverCardIntern
|
|
|
86
91
|
export type HoverCardContentProps = {
|
|
87
92
|
actionOptions?: CardActionOptions;
|
|
88
93
|
cardState: CardState;
|
|
94
|
+
hoverPreviewOptions?: HoverPreviewOptions;
|
|
89
95
|
id?: string;
|
|
90
96
|
onActionClick: (actionId: string | ActionName) => void;
|
|
91
97
|
onMouseEnter?: MouseEventHandler;
|
|
@@ -93,7 +99,6 @@ export type HoverCardContentProps = {
|
|
|
93
99
|
onResolve: () => void;
|
|
94
100
|
renderers?: CardProviderRenderers;
|
|
95
101
|
url: string;
|
|
96
|
-
hoverPreviewOptions?: HoverPreviewOptions;
|
|
97
102
|
};
|
|
98
103
|
export type ContentContainerProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
99
104
|
isAIEnabled?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "43.
|
|
3
|
+
"version": "43.9.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@atlaskit/badge": "^18.2.0",
|
|
35
35
|
"@atlaskit/button": "^23.6.0",
|
|
36
36
|
"@atlaskit/checkbox": "^17.1.0",
|
|
37
|
-
"@atlaskit/css": "^0.
|
|
37
|
+
"@atlaskit/css": "^0.16.0",
|
|
38
38
|
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
39
39
|
"@atlaskit/embedded-confluence": "^4.3.0",
|
|
40
40
|
"@atlaskit/feature-gate-js-client": "^5.5.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@atlaskit/outbound-auth-flow-client": "^3.4.0",
|
|
64
64
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
65
65
|
"@atlaskit/popup": "^4.6.0",
|
|
66
|
-
"@atlaskit/primitives": "^16.
|
|
66
|
+
"@atlaskit/primitives": "^16.2.0",
|
|
67
67
|
"@atlaskit/section-message": "^8.9.0",
|
|
68
68
|
"@atlaskit/select": "^21.4.0",
|
|
69
69
|
"@atlaskit/spinner": "^19.0.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@atlaskit/textfield": "^8.1.0",
|
|
72
72
|
"@atlaskit/theme": "^21.0.0",
|
|
73
73
|
"@atlaskit/tmp-editor-statsig": "^13.39.0",
|
|
74
|
-
"@atlaskit/tokens": "^8.
|
|
74
|
+
"@atlaskit/tokens": "^8.1.0",
|
|
75
75
|
"@atlaskit/tooltip": "^20.10.0",
|
|
76
76
|
"@atlaskit/ufo": "^0.4.0",
|
|
77
77
|
"@babel/runtime": "^7.0.0",
|
|
@@ -235,6 +235,9 @@
|
|
|
235
235
|
"navx-2479-sl-fix-inilne-card-show-connect-button": {
|
|
236
236
|
"type": "boolean"
|
|
237
237
|
},
|
|
238
|
+
"hover-card-prop-should-render-to-parent": {
|
|
239
|
+
"type": "boolean"
|
|
240
|
+
},
|
|
238
241
|
"platform-linking-smart-card-layered-link-a11y": {
|
|
239
242
|
"type": "boolean"
|
|
240
243
|
},
|