@atlaskit/smart-card 38.4.0 → 38.4.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 +16 -0
- package/dist/cjs/state/flexible-ui-context/index.js +23 -3
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +4 -2
- package/dist/cjs/view/FlexibleCard/components/container/index.js +5 -1
- package/dist/cjs/view/FlexibleCard/components/elements/applied-to-components-count-element/index.js +6 -1
- package/dist/cjs/view/FlexibleCard/components/elements/common/base-link-element/index.js +4 -1
- package/dist/cjs/view/FlexibleCard/components/elements/preview-element/index.js +6 -1
- package/dist/cjs/view/FlexibleCard/components/elements/snippet-element/index.js +5 -1
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +5 -1
- package/dist/cjs/view/FlexibleCard/index.js +23 -0
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/state/flexible-ui-context/index.js +24 -2
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/container/index.js +6 -2
- package/dist/es2019/view/FlexibleCard/components/elements/applied-to-components-count-element/index.js +7 -2
- package/dist/es2019/view/FlexibleCard/components/elements/common/base-link-element/index.js +4 -1
- package/dist/es2019/view/FlexibleCard/components/elements/preview-element/index.js +7 -2
- package/dist/es2019/view/FlexibleCard/components/elements/snippet-element/index.js +6 -2
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +6 -2
- package/dist/es2019/view/FlexibleCard/index.js +22 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/state/flexible-ui-context/index.js +22 -2
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +4 -2
- package/dist/esm/view/FlexibleCard/components/container/index.js +6 -2
- package/dist/esm/view/FlexibleCard/components/elements/applied-to-components-count-element/index.js +7 -2
- package/dist/esm/view/FlexibleCard/components/elements/common/base-link-element/index.js +4 -1
- package/dist/esm/view/FlexibleCard/components/elements/preview-element/index.js +7 -2
- package/dist/esm/view/FlexibleCard/components/elements/snippet-element/index.js +6 -2
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +6 -2
- package/dist/esm/view/FlexibleCard/index.js +24 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/state/flexible-ui-context/index.d.ts +14 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/elements/common/base-link-element/index.d.ts +5 -1
- package/dist/types-ts4.5/state/flexible-ui-context/index.d.ts +14 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/types.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/common/base-link-element/index.d.ts +5 -1
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 38.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#159004](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/159004)
|
|
8
|
+
[`350a4ab0a5375`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/350a4ab0a5375) -
|
|
9
|
+
Refactor FlexibleCard context, merge into one context
|
|
10
|
+
|
|
11
|
+
## 38.4.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#159077](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/159077)
|
|
16
|
+
[`6b2c9fe5e676b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6b2c9fe5e676b) -
|
|
17
|
+
Add anchor ref to smartlink link component
|
|
18
|
+
|
|
3
19
|
## 38.4.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -3,22 +3,42 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useFlexibleUiOptionContext = exports.useFlexibleUiContext = exports.FlexibleUiOptionContext = exports.FlexibleUiContext = void 0;
|
|
6
|
+
exports.useFlexibleUiOptionContext = exports.useFlexibleUiContext = exports.useFlexibleCardContext = exports.FlexibleUiOptionContext = exports.FlexibleUiContext = exports.FlexibleCardContext = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
9
|
/**
|
|
9
10
|
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
10
11
|
* underlying elements.
|
|
11
12
|
*/
|
|
13
|
+
var FlexibleCardContext = exports.FlexibleCardContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
14
|
+
var useFlexibleCardContext = exports.useFlexibleCardContext = function useFlexibleCardContext() {
|
|
15
|
+
return (0, _react.useContext)(FlexibleCardContext);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
20
|
+
* underlying elements.
|
|
21
|
+
* @deprecated Remove on cleanup of platform-linking-flexible-card-context
|
|
22
|
+
*/
|
|
12
23
|
var FlexibleUiContext = exports.FlexibleUiContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
13
24
|
var useFlexibleUiContext = exports.useFlexibleUiContext = function useFlexibleUiContext() {
|
|
14
|
-
|
|
25
|
+
var _useFlexibleCardConte;
|
|
26
|
+
return (0, _platformFeatureFlags.fg)('platform-linking-flexible-card-context') ? // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
27
|
+
(_useFlexibleCardConte = useFlexibleCardContext()) === null || _useFlexibleCardConte === void 0 ? void 0 : _useFlexibleCardConte.data :
|
|
28
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
29
|
+
(0, _react.useContext)(FlexibleUiContext);
|
|
15
30
|
};
|
|
16
31
|
|
|
17
32
|
/**
|
|
18
33
|
* This provides the ui options that will be used by Smart Links Flexible UI
|
|
19
34
|
* to render its underlying elements.
|
|
35
|
+
* @deprecated Remove on cleanup of platform-linking-flexible-card-context
|
|
20
36
|
*/
|
|
21
37
|
var FlexibleUiOptionContext = exports.FlexibleUiOptionContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
22
38
|
var useFlexibleUiOptionContext = exports.useFlexibleUiOptionContext = function useFlexibleUiOptionContext() {
|
|
23
|
-
|
|
39
|
+
var _useFlexibleCardConte2;
|
|
40
|
+
return (0, _platformFeatureFlags.fg)('platform-linking-flexible-card-context') ? // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
41
|
+
(_useFlexibleCardConte2 = useFlexibleCardContext()) === null || _useFlexibleCardConte2 === void 0 ? void 0 : _useFlexibleCardConte2.ui :
|
|
42
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
43
|
+
(0, _react.useContext)(FlexibleUiOptionContext);
|
|
24
44
|
};
|
|
@@ -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: "38.4.
|
|
14
|
+
packageVersion: "38.4.2"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -22,7 +22,7 @@ var _actionGroup = _interopRequireDefault(require("../action-group"));
|
|
|
22
22
|
var _errored = _interopRequireDefault(require("./errored"));
|
|
23
23
|
var _resolved = _interopRequireDefault(require("./resolved"));
|
|
24
24
|
var _resolving = _interopRequireDefault(require("./resolving"));
|
|
25
|
-
var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onActionMenuOpenChange", "onClick", "status", "showActionOnHover", "testId", "text", "icon", "theme", "hideRetry", "metadataPosition", "hideIcon", "className"];
|
|
25
|
+
var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onActionMenuOpenChange", "onClick", "status", "showActionOnHover", "testId", "text", "icon", "theme", "hideRetry", "metadataPosition", "hideIcon", "className", "anchorRef"];
|
|
26
26
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
27
27
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
28
|
var actionStyles = null;
|
|
@@ -76,6 +76,7 @@ var TitleBlock = function TitleBlock(_ref) {
|
|
|
76
76
|
_ref$hideIcon = _ref.hideIcon,
|
|
77
77
|
hideIcon = _ref$hideIcon === void 0 ? false : _ref$hideIcon,
|
|
78
78
|
className = _ref.className,
|
|
79
|
+
anchorRef = _ref.anchorRef,
|
|
79
80
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
80
81
|
if (!(0, _platformFeatureFlags.fg)('platform-linking-flexible-card-unresolved-action')) {
|
|
81
82
|
if (hideRetry && props.retry) {
|
|
@@ -109,7 +110,8 @@ var TitleBlock = function TitleBlock(_ref) {
|
|
|
109
110
|
onClick: onClick,
|
|
110
111
|
onMouseDown: onMouseDown,
|
|
111
112
|
target: anchorTarget,
|
|
112
|
-
theme: theme
|
|
113
|
+
theme: theme,
|
|
114
|
+
anchorRef: anchorRef
|
|
113
115
|
}, overrideText));
|
|
114
116
|
var Component = getTitleBlockViewComponent(status);
|
|
115
117
|
return /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({}, props, {
|
|
@@ -324,7 +324,11 @@ var Container = function Container(_ref5) {
|
|
|
324
324
|
theme = _ref5$theme === void 0 ? _constants.SmartLinkTheme.Link : _ref5$theme;
|
|
325
325
|
var padding = hidePadding ? (0, _platformFeatureFlags.fg)('platform-linking-visual-refresh-v1') ? '0px' : '0rem' : getPadding(size);
|
|
326
326
|
var gap = getGap(size);
|
|
327
|
-
var context = (0,
|
|
327
|
+
var context = (0, _platformFeatureFlags.fg)('platform-linking-flexible-card-context') ?
|
|
328
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
329
|
+
(0, _flexibleUiContext.useFlexibleUiContext)() :
|
|
330
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
331
|
+
(0, _react.useContext)(_flexibleUiContext.FlexibleUiContext);
|
|
328
332
|
var _getChildrenOptions = getChildrenOptions(children, context),
|
|
329
333
|
previewOnLeft = _getChildrenOptions.previewOnLeft,
|
|
330
334
|
previewOnRight = _getChildrenOptions.previewOnRight;
|
package/dist/cjs/view/FlexibleCard/components/elements/applied-to-components-count-element/index.js
CHANGED
|
@@ -9,6 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _reactIntlNext = require("react-intl-next");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
13
|
var _constants = require("../../../../../constants");
|
|
13
14
|
var _messages = require("../../../../../messages");
|
|
14
15
|
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
@@ -18,7 +19,11 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
18
19
|
var AppliedToComponentsCountElement = function AppliedToComponentsCountElement(props) {
|
|
19
20
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
20
21
|
formatMessage = _useIntl.formatMessage;
|
|
21
|
-
var context = (0,
|
|
22
|
+
var context = (0, _platformFeatureFlags.fg)('platform-linking-flexible-card-context') ?
|
|
23
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
24
|
+
(0, _flexibleUiContext.useFlexibleUiContext)() :
|
|
25
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
26
|
+
(0, _react.useContext)(_flexibleUiContext.FlexibleUiContext);
|
|
22
27
|
if (
|
|
23
28
|
// Check for null and undefined, render if it's 0.
|
|
24
29
|
(context === null || context === void 0 ? void 0 : context.appliedToComponentsCount) === null || (context === null || context === void 0 ? void 0 : context.appliedToComponentsCount) === undefined) {
|
|
@@ -94,7 +94,8 @@ var BaseLinkElement = function BaseLinkElement(_ref) {
|
|
|
94
94
|
url = _ref.url,
|
|
95
95
|
onClick = _ref.onClick,
|
|
96
96
|
_ref$target = _ref.target,
|
|
97
|
-
target = _ref$target === void 0 ? '_blank' : _ref$target
|
|
97
|
+
target = _ref$target === void 0 ? '_blank' : _ref$target,
|
|
98
|
+
anchorRef = _ref.anchorRef;
|
|
98
99
|
var onMouseDown = (0, _useLinkClicked.useMouseDownEvent)();
|
|
99
100
|
var hasSpace = (0, _react.useMemo)(function () {
|
|
100
101
|
return text ? (0, _utils.hasWhiteSpace)(text) : false;
|
|
@@ -113,6 +114,8 @@ var BaseLinkElement = function BaseLinkElement(_ref) {
|
|
|
113
114
|
// click issues in Confluence and Trello which rely on it not being set unless necessary.
|
|
114
115
|
}, target !== '_self' && {
|
|
115
116
|
target: target
|
|
117
|
+
}, {
|
|
118
|
+
ref: anchorRef
|
|
116
119
|
}), text);
|
|
117
120
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
118
121
|
className: (0, _runtime.ax)(["_16jlkb7n _1o9zkb7n _i0dl1wug"])
|
|
@@ -9,6 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
13
|
var _constants = require("../../../../../constants");
|
|
13
14
|
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
14
15
|
var _mediaElement = _interopRequireDefault(require("../media-element"));
|
|
@@ -19,7 +20,11 @@ var PreviewElement = function PreviewElement(props) {
|
|
|
19
20
|
var _ref = props !== null && props !== void 0 ? props : {},
|
|
20
21
|
overrideUrl = _ref.overrideUrl,
|
|
21
22
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
22
|
-
var context = (0,
|
|
23
|
+
var context = (0, _platformFeatureFlags.fg)('platform-linking-flexible-card-context') ?
|
|
24
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
25
|
+
(0, _flexibleUiContext.useFlexibleUiContext)() :
|
|
26
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
27
|
+
(0, _react.useContext)(_flexibleUiContext.FlexibleUiContext);
|
|
23
28
|
var data = overrideUrl ? {
|
|
24
29
|
url: overrideUrl,
|
|
25
30
|
type: _constants.MediaType.Image
|
|
@@ -31,7 +31,11 @@ var SnippetElement = function SnippetElement(props) {
|
|
|
31
31
|
maxLines = _ref$maxLines === void 0 ? SNIPPET_DEFAULT_MAX_LINES : _ref$maxLines,
|
|
32
32
|
className = _ref.className,
|
|
33
33
|
restOfProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
34
|
-
var context = (0,
|
|
34
|
+
var context = (0, _platformFeatureFlags.fg)('platform-linking-flexible-card-context') ?
|
|
35
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
36
|
+
(0, _flexibleUiContext.useFlexibleUiContext)() :
|
|
37
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
38
|
+
(0, _react.useContext)(_flexibleUiContext.FlexibleUiContext);
|
|
35
39
|
return /*#__PURE__*/React.createElement(_common.BaseTextElement, (0, _extends2.default)({
|
|
36
40
|
content: overrideContent !== null && overrideContent !== void 0 ? overrideContent : context === null || context === void 0 ? void 0 : context.snippet,
|
|
37
41
|
maxLines: maxLines,
|
|
@@ -297,7 +297,11 @@ var createElement = exports.createElement = function createElement(name) {
|
|
|
297
297
|
throw Error("Element ".concat(name, " does not exist."));
|
|
298
298
|
}
|
|
299
299
|
return function (overrides) {
|
|
300
|
-
var context = (0,
|
|
300
|
+
var context = (0, _platformFeatureFlags.fg)('platform-linking-flexible-card-context') ?
|
|
301
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
302
|
+
(0, _flexibleUiContext.useFlexibleUiContext)() :
|
|
303
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
304
|
+
(0, _react.useContext)(_flexibleUiContext.FlexibleUiContext);
|
|
301
305
|
var data = getData(name, contextKey, context);
|
|
302
306
|
return data ? /*#__PURE__*/_react.default.createElement(BaseElement, (0, _extends2.default)({}, props, data, overrides, {
|
|
303
307
|
name: name
|
|
@@ -65,6 +65,15 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
65
65
|
url: url
|
|
66
66
|
});
|
|
67
67
|
}, [aiSummaryConfig, appearance, details, fireEvent, id, onAuthorize, origin, renderers, actionOptions, resolve, status, url]);
|
|
68
|
+
var flexibleCardContext = (0, _platformFeatureFlags.fg)('platform-linking-flexible-card-context') ?
|
|
69
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
70
|
+
(0, _react.useMemo)(function () {
|
|
71
|
+
return {
|
|
72
|
+
data: context,
|
|
73
|
+
status: status,
|
|
74
|
+
ui: ui
|
|
75
|
+
};
|
|
76
|
+
}, [context, status, ui]) : undefined;
|
|
68
77
|
var retry = (0, _platformFeatureFlags.fg)('platform-linking-flexible-card-unresolved-action') ? undefined : (0, _utils.getRetryOptions)(url, status, details, onAuthorize);
|
|
69
78
|
var _ref2 = context || {},
|
|
70
79
|
title = _ref2.title;
|
|
@@ -92,6 +101,20 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
92
101
|
break;
|
|
93
102
|
}
|
|
94
103
|
}, [onError, onResolve, status, title, url]);
|
|
104
|
+
if ((0, _platformFeatureFlags.fg)('platform-linking-flexible-card-context')) {
|
|
105
|
+
return /*#__PURE__*/_react.default.createElement(_flexibleUiContext.FlexibleCardContext.Provider, {
|
|
106
|
+
value: flexibleCardContext
|
|
107
|
+
}, /*#__PURE__*/_react.default.createElement(_container.default, (0, _extends2.default)({
|
|
108
|
+
testId: testId
|
|
109
|
+
}, ui, {
|
|
110
|
+
onClick: onClick,
|
|
111
|
+
retry: retry,
|
|
112
|
+
showHoverPreview: showHoverPreview,
|
|
113
|
+
hoverPreviewOptions: hoverPreviewOptions,
|
|
114
|
+
actionOptions: actionOptions,
|
|
115
|
+
status: status
|
|
116
|
+
}), children));
|
|
117
|
+
}
|
|
95
118
|
return /*#__PURE__*/_react.default.createElement(_flexibleUiContext.FlexibleUiOptionContext.Provider, {
|
|
96
119
|
value: ui
|
|
97
120
|
}, /*#__PURE__*/_react.default.createElement(_flexibleUiContext.FlexibleUiContext.Provider, {
|
|
@@ -20,7 +20,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
20
20
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
21
21
|
var PACKAGE_DATA = {
|
|
22
22
|
packageName: "@atlaskit/smart-card",
|
|
23
|
-
packageVersion: "38.4.
|
|
23
|
+
packageVersion: "38.4.2",
|
|
24
24
|
componentName: 'linkUrl'
|
|
25
25
|
};
|
|
26
26
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
import { createContext, useContext } from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
/**
|
|
3
4
|
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
4
5
|
* underlying elements.
|
|
5
6
|
*/
|
|
7
|
+
export const FlexibleCardContext = /*#__PURE__*/createContext(undefined);
|
|
8
|
+
export const useFlexibleCardContext = () => useContext(FlexibleCardContext);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
12
|
+
* underlying elements.
|
|
13
|
+
* @deprecated Remove on cleanup of platform-linking-flexible-card-context
|
|
14
|
+
*/
|
|
6
15
|
export const FlexibleUiContext = /*#__PURE__*/createContext(undefined);
|
|
7
|
-
export const useFlexibleUiContext = () =>
|
|
16
|
+
export const useFlexibleUiContext = () => {
|
|
17
|
+
var _useFlexibleCardConte;
|
|
18
|
+
return fg('platform-linking-flexible-card-context') ? // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
19
|
+
(_useFlexibleCardConte = useFlexibleCardContext()) === null || _useFlexibleCardConte === void 0 ? void 0 : _useFlexibleCardConte.data :
|
|
20
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
21
|
+
useContext(FlexibleUiContext);
|
|
22
|
+
};
|
|
8
23
|
|
|
9
24
|
/**
|
|
10
25
|
* This provides the ui options that will be used by Smart Links Flexible UI
|
|
11
26
|
* to render its underlying elements.
|
|
27
|
+
* @deprecated Remove on cleanup of platform-linking-flexible-card-context
|
|
12
28
|
*/
|
|
13
29
|
export const FlexibleUiOptionContext = /*#__PURE__*/createContext(undefined);
|
|
14
|
-
export const useFlexibleUiOptionContext = () =>
|
|
30
|
+
export const useFlexibleUiOptionContext = () => {
|
|
31
|
+
var _useFlexibleCardConte2;
|
|
32
|
+
return fg('platform-linking-flexible-card-context') ? // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
33
|
+
(_useFlexibleCardConte2 = useFlexibleCardContext()) === null || _useFlexibleCardConte2 === void 0 ? void 0 : _useFlexibleCardConte2.ui :
|
|
34
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
35
|
+
useContext(FlexibleUiOptionContext);
|
|
36
|
+
};
|
|
@@ -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: "38.4.
|
|
5
|
+
packageVersion: "38.4.2"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -59,6 +59,7 @@ const TitleBlock = ({
|
|
|
59
59
|
metadataPosition,
|
|
60
60
|
hideIcon = false,
|
|
61
61
|
className,
|
|
62
|
+
anchorRef,
|
|
62
63
|
...props
|
|
63
64
|
}) => {
|
|
64
65
|
if (!fg('platform-linking-flexible-card-unresolved-action')) {
|
|
@@ -90,7 +91,8 @@ const TitleBlock = ({
|
|
|
90
91
|
onClick: onClick,
|
|
91
92
|
onMouseDown: onMouseDown,
|
|
92
93
|
target: anchorTarget,
|
|
93
|
-
theme: theme
|
|
94
|
+
theme: theme,
|
|
95
|
+
anchorRef: anchorRef
|
|
94
96
|
}, overrideText));
|
|
95
97
|
const Component = getTitleBlockViewComponent(status);
|
|
96
98
|
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
@@ -8,7 +8,7 @@ import { di } from 'react-magnetic-di';
|
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { N40 } from '@atlaskit/theme/colors';
|
|
10
10
|
import { MediaPlacement, SmartLinkSize, SmartLinkTheme } from '../../../../constants';
|
|
11
|
-
import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
11
|
+
import { FlexibleUiContext, useFlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
12
12
|
import { isFlexUiPreviewPresent } from '../../../../state/flexible-ui-context/utils';
|
|
13
13
|
import { isFlexibleUiBlock, isFlexibleUiPreviewBlock, isFlexibleUiTitleBlock, isStyleCacheProvider } from '../../../../utils/flexible';
|
|
14
14
|
import { TitleBlock } from '../blocks';
|
|
@@ -310,7 +310,11 @@ const Container = ({
|
|
|
310
310
|
}) => {
|
|
311
311
|
const padding = hidePadding ? fg('platform-linking-visual-refresh-v1') ? '0px' : '0rem' : getPadding(size);
|
|
312
312
|
const gap = getGap(size);
|
|
313
|
-
const context =
|
|
313
|
+
const context = fg('platform-linking-flexible-card-context') ?
|
|
314
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
315
|
+
useFlexibleUiContext() :
|
|
316
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
317
|
+
useContext(FlexibleUiContext);
|
|
314
318
|
const {
|
|
315
319
|
previewOnLeft,
|
|
316
320
|
previewOnRight
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import { useIntl } from 'react-intl-next';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { IconType } from '../../../../../constants';
|
|
5
6
|
import { messages } from '../../../../../messages';
|
|
6
|
-
import { FlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
7
|
+
import { FlexibleUiContext, useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
7
8
|
import { BaseBadgeElement } from '../common';
|
|
8
9
|
const AppliedToComponentsCountElement = props => {
|
|
9
10
|
const {
|
|
10
11
|
formatMessage
|
|
11
12
|
} = useIntl();
|
|
12
|
-
const context =
|
|
13
|
+
const context = fg('platform-linking-flexible-card-context') ?
|
|
14
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
15
|
+
useFlexibleUiContext() :
|
|
16
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
17
|
+
useContext(FlexibleUiContext);
|
|
13
18
|
if (
|
|
14
19
|
// Check for null and undefined, render if it's 0.
|
|
15
20
|
(context === null || context === void 0 ? void 0 : context.appliedToComponentsCount) === null || (context === null || context === void 0 ? void 0 : context.appliedToComponentsCount) === undefined) {
|
|
@@ -78,7 +78,8 @@ const BaseLinkElement = ({
|
|
|
78
78
|
theme = SmartLinkTheme.Link,
|
|
79
79
|
url,
|
|
80
80
|
onClick,
|
|
81
|
-
target = '_blank'
|
|
81
|
+
target = '_blank',
|
|
82
|
+
anchorRef
|
|
82
83
|
}) => {
|
|
83
84
|
const onMouseDown = useMouseDownEvent();
|
|
84
85
|
const hasSpace = useMemo(() => text ? hasWhiteSpace(text) : false, [text]);
|
|
@@ -96,6 +97,8 @@ const BaseLinkElement = ({
|
|
|
96
97
|
// click issues in Confluence and Trello which rely on it not being set unless necessary.
|
|
97
98
|
}, target !== '_self' && {
|
|
98
99
|
target
|
|
100
|
+
}, {
|
|
101
|
+
ref: anchorRef
|
|
99
102
|
}), text);
|
|
100
103
|
return /*#__PURE__*/React.createElement("span", {
|
|
101
104
|
className: ax(["_16jlkb7n _1o9zkb7n _i0dl1wug"])
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { MediaType } from '../../../../../constants';
|
|
4
|
-
import { FlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
5
|
+
import { FlexibleUiContext, useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
5
6
|
import MediaElement from '../media-element';
|
|
6
7
|
const PreviewElement = props => {
|
|
7
8
|
const {
|
|
8
9
|
overrideUrl,
|
|
9
10
|
...rest
|
|
10
11
|
} = props !== null && props !== void 0 ? props : {};
|
|
11
|
-
const context =
|
|
12
|
+
const context = fg('platform-linking-flexible-card-context') ?
|
|
13
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
14
|
+
useFlexibleUiContext() :
|
|
15
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
16
|
+
useContext(FlexibleUiContext);
|
|
12
17
|
const data = overrideUrl ? {
|
|
13
18
|
url: overrideUrl,
|
|
14
19
|
type: MediaType.Image
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { useContext } from 'react';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
-
import { FlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
8
|
+
import { FlexibleUiContext, useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
9
9
|
import { BaseTextElement } from '../common';
|
|
10
10
|
const SNIPPET_DEFAULT_MAX_LINES = 3;
|
|
11
11
|
|
|
@@ -19,7 +19,11 @@ const SnippetElement = props => {
|
|
|
19
19
|
className,
|
|
20
20
|
...restOfProps
|
|
21
21
|
} = props !== null && props !== void 0 ? props : {};
|
|
22
|
-
const context =
|
|
22
|
+
const context = fg('platform-linking-flexible-card-context') ?
|
|
23
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
24
|
+
useFlexibleUiContext() :
|
|
25
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
26
|
+
useContext(FlexibleUiContext);
|
|
23
27
|
return /*#__PURE__*/React.createElement(BaseTextElement, _extends({
|
|
24
28
|
content: overrideContent !== null && overrideContent !== void 0 ? overrideContent : context === null || context === void 0 ? void 0 : context.snippet,
|
|
25
29
|
maxLines: maxLines,
|
|
@@ -4,7 +4,7 @@ import { FormattedDate } from 'react-intl-next';
|
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { ElementName, IconType, SmartLinkInternalTheme } from '../../../../constants';
|
|
6
6
|
import { messages } from '../../../../messages';
|
|
7
|
-
import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
7
|
+
import { FlexibleUiContext, useFlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
8
8
|
import { isProfileType } from '../../../../utils';
|
|
9
9
|
import AppliedToComponentsCount from './applied-to-components-count-element';
|
|
10
10
|
import AtlaskitElementBadge from './atlaskit-badge-element';
|
|
@@ -319,7 +319,11 @@ export const createElement = name => {
|
|
|
319
319
|
throw Error(`Element ${name} does not exist.`);
|
|
320
320
|
}
|
|
321
321
|
return overrides => {
|
|
322
|
-
const context =
|
|
322
|
+
const context = fg('platform-linking-flexible-card-context') ?
|
|
323
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
324
|
+
useFlexibleUiContext() :
|
|
325
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
326
|
+
useContext(FlexibleUiContext);
|
|
323
327
|
const data = getData(name, contextKey, context);
|
|
324
328
|
return data ? /*#__PURE__*/React.createElement(BaseElement, _extends({}, props, data, overrides, {
|
|
325
329
|
name: name
|
|
@@ -3,7 +3,7 @@ import React, { useEffect, useMemo } from 'react';
|
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
5
5
|
import { SmartLinkStatus } from '../../constants';
|
|
6
|
-
import { FlexibleUiContext, FlexibleUiOptionContext } from '../../state/flexible-ui-context';
|
|
6
|
+
import { FlexibleCardContext, FlexibleUiContext, FlexibleUiOptionContext } from '../../state/flexible-ui-context';
|
|
7
7
|
import { useAISummaryConfig } from '../../state/hooks/use-ai-summary-config';
|
|
8
8
|
import useResolve from '../../state/hooks/use-resolve';
|
|
9
9
|
import Container from './components/container';
|
|
@@ -57,6 +57,13 @@ const FlexibleCard = ({
|
|
|
57
57
|
status,
|
|
58
58
|
url
|
|
59
59
|
}), [aiSummaryConfig, appearance, details, fireEvent, id, onAuthorize, origin, renderers, actionOptions, resolve, status, url]);
|
|
60
|
+
const flexibleCardContext = fg('platform-linking-flexible-card-context') ?
|
|
61
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
62
|
+
useMemo(() => ({
|
|
63
|
+
data: context,
|
|
64
|
+
status,
|
|
65
|
+
ui
|
|
66
|
+
}), [context, status, ui]) : undefined;
|
|
60
67
|
const retry = fg('platform-linking-flexible-card-unresolved-action') ? undefined : getRetryOptions(url, status, details, onAuthorize);
|
|
61
68
|
const {
|
|
62
69
|
title
|
|
@@ -85,6 +92,20 @@ const FlexibleCard = ({
|
|
|
85
92
|
break;
|
|
86
93
|
}
|
|
87
94
|
}, [onError, onResolve, status, title, url]);
|
|
95
|
+
if (fg('platform-linking-flexible-card-context')) {
|
|
96
|
+
return /*#__PURE__*/React.createElement(FlexibleCardContext.Provider, {
|
|
97
|
+
value: flexibleCardContext
|
|
98
|
+
}, /*#__PURE__*/React.createElement(Container, _extends({
|
|
99
|
+
testId: testId
|
|
100
|
+
}, ui, {
|
|
101
|
+
onClick: onClick,
|
|
102
|
+
retry: retry,
|
|
103
|
+
showHoverPreview: showHoverPreview,
|
|
104
|
+
hoverPreviewOptions: hoverPreviewOptions,
|
|
105
|
+
actionOptions: actionOptions,
|
|
106
|
+
status: status
|
|
107
|
+
}), children));
|
|
108
|
+
}
|
|
88
109
|
return /*#__PURE__*/React.createElement(FlexibleUiOptionContext.Provider, {
|
|
89
110
|
value: ui
|
|
90
111
|
}, /*#__PURE__*/React.createElement(FlexibleUiContext.Provider, {
|
|
@@ -10,7 +10,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
10
10
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
11
11
|
const PACKAGE_DATA = {
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "38.4.
|
|
13
|
+
packageVersion: "38.4.2",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
import { createContext, useContext } from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
/**
|
|
3
4
|
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
4
5
|
* underlying elements.
|
|
5
6
|
*/
|
|
7
|
+
export var FlexibleCardContext = /*#__PURE__*/createContext(undefined);
|
|
8
|
+
export var useFlexibleCardContext = function useFlexibleCardContext() {
|
|
9
|
+
return useContext(FlexibleCardContext);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
14
|
+
* underlying elements.
|
|
15
|
+
* @deprecated Remove on cleanup of platform-linking-flexible-card-context
|
|
16
|
+
*/
|
|
6
17
|
export var FlexibleUiContext = /*#__PURE__*/createContext(undefined);
|
|
7
18
|
export var useFlexibleUiContext = function useFlexibleUiContext() {
|
|
8
|
-
|
|
19
|
+
var _useFlexibleCardConte;
|
|
20
|
+
return fg('platform-linking-flexible-card-context') ? // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
21
|
+
(_useFlexibleCardConte = useFlexibleCardContext()) === null || _useFlexibleCardConte === void 0 ? void 0 : _useFlexibleCardConte.data :
|
|
22
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
23
|
+
useContext(FlexibleUiContext);
|
|
9
24
|
};
|
|
10
25
|
|
|
11
26
|
/**
|
|
12
27
|
* This provides the ui options that will be used by Smart Links Flexible UI
|
|
13
28
|
* to render its underlying elements.
|
|
29
|
+
* @deprecated Remove on cleanup of platform-linking-flexible-card-context
|
|
14
30
|
*/
|
|
15
31
|
export var FlexibleUiOptionContext = /*#__PURE__*/createContext(undefined);
|
|
16
32
|
export var useFlexibleUiOptionContext = function useFlexibleUiOptionContext() {
|
|
17
|
-
|
|
33
|
+
var _useFlexibleCardConte2;
|
|
34
|
+
return fg('platform-linking-flexible-card-context') ? // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
35
|
+
(_useFlexibleCardConte2 = useFlexibleCardContext()) === null || _useFlexibleCardConte2 === void 0 ? void 0 : _useFlexibleCardConte2.ui :
|
|
36
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
37
|
+
useContext(FlexibleUiOptionContext);
|
|
18
38
|
};
|
|
@@ -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: "38.4.
|
|
7
|
+
packageVersion: "38.4.2"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onActionMenuOpenChange", "onClick", "status", "showActionOnHover", "testId", "text", "icon", "theme", "hideRetry", "metadataPosition", "hideIcon", "className"];
|
|
5
|
+
var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onActionMenuOpenChange", "onClick", "status", "showActionOnHover", "testId", "text", "icon", "theme", "hideRetry", "metadataPosition", "hideIcon", "className", "anchorRef"];
|
|
6
6
|
import "./index.compiled.css";
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { ax, ix } from "@compiled/react/runtime";
|
|
@@ -66,6 +66,7 @@ var TitleBlock = function TitleBlock(_ref) {
|
|
|
66
66
|
_ref$hideIcon = _ref.hideIcon,
|
|
67
67
|
hideIcon = _ref$hideIcon === void 0 ? false : _ref$hideIcon,
|
|
68
68
|
className = _ref.className,
|
|
69
|
+
anchorRef = _ref.anchorRef,
|
|
69
70
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
70
71
|
if (!fg('platform-linking-flexible-card-unresolved-action')) {
|
|
71
72
|
if (hideRetry && props.retry) {
|
|
@@ -99,7 +100,8 @@ var TitleBlock = function TitleBlock(_ref) {
|
|
|
99
100
|
onClick: onClick,
|
|
100
101
|
onMouseDown: onMouseDown,
|
|
101
102
|
target: anchorTarget,
|
|
102
|
-
theme: theme
|
|
103
|
+
theme: theme,
|
|
104
|
+
anchorRef: anchorRef
|
|
103
105
|
}, overrideText));
|
|
104
106
|
var Component = getTitleBlockViewComponent(status);
|
|
105
107
|
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
@@ -14,7 +14,7 @@ import { di } from 'react-magnetic-di';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { N40 } from '@atlaskit/theme/colors';
|
|
16
16
|
import { MediaPlacement, SmartLinkSize, SmartLinkTheme } from '../../../../constants';
|
|
17
|
-
import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
17
|
+
import { FlexibleUiContext, useFlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
18
18
|
import { isFlexUiPreviewPresent } from '../../../../state/flexible-ui-context/utils';
|
|
19
19
|
import { isFlexibleUiBlock, isFlexibleUiPreviewBlock, isFlexibleUiTitleBlock, isStyleCacheProvider } from '../../../../utils/flexible';
|
|
20
20
|
import { TitleBlock } from '../blocks';
|
|
@@ -318,7 +318,11 @@ var Container = function Container(_ref5) {
|
|
|
318
318
|
theme = _ref5$theme === void 0 ? SmartLinkTheme.Link : _ref5$theme;
|
|
319
319
|
var padding = hidePadding ? fg('platform-linking-visual-refresh-v1') ? '0px' : '0rem' : getPadding(size);
|
|
320
320
|
var gap = getGap(size);
|
|
321
|
-
var context =
|
|
321
|
+
var context = fg('platform-linking-flexible-card-context') ?
|
|
322
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
323
|
+
useFlexibleUiContext() :
|
|
324
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
325
|
+
useContext(FlexibleUiContext);
|
|
322
326
|
var _getChildrenOptions = getChildrenOptions(children, context),
|
|
323
327
|
previewOnLeft = _getChildrenOptions.previewOnLeft,
|
|
324
328
|
previewOnRight = _getChildrenOptions.previewOnRight;
|
package/dist/esm/view/FlexibleCard/components/elements/applied-to-components-count-element/index.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import { useIntl } from 'react-intl-next';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { IconType } from '../../../../../constants';
|
|
5
6
|
import { messages } from '../../../../../messages';
|
|
6
|
-
import { FlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
7
|
+
import { FlexibleUiContext, useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
7
8
|
import { BaseBadgeElement } from '../common';
|
|
8
9
|
var AppliedToComponentsCountElement = function AppliedToComponentsCountElement(props) {
|
|
9
10
|
var _useIntl = useIntl(),
|
|
10
11
|
formatMessage = _useIntl.formatMessage;
|
|
11
|
-
var context =
|
|
12
|
+
var context = fg('platform-linking-flexible-card-context') ?
|
|
13
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
14
|
+
useFlexibleUiContext() :
|
|
15
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
16
|
+
useContext(FlexibleUiContext);
|
|
12
17
|
if (
|
|
13
18
|
// Check for null and undefined, render if it's 0.
|
|
14
19
|
(context === null || context === void 0 ? void 0 : context.appliedToComponentsCount) === null || (context === null || context === void 0 ? void 0 : context.appliedToComponentsCount) === undefined) {
|
|
@@ -85,7 +85,8 @@ var BaseLinkElement = function BaseLinkElement(_ref) {
|
|
|
85
85
|
url = _ref.url,
|
|
86
86
|
onClick = _ref.onClick,
|
|
87
87
|
_ref$target = _ref.target,
|
|
88
|
-
target = _ref$target === void 0 ? '_blank' : _ref$target
|
|
88
|
+
target = _ref$target === void 0 ? '_blank' : _ref$target,
|
|
89
|
+
anchorRef = _ref.anchorRef;
|
|
89
90
|
var onMouseDown = useMouseDownEvent();
|
|
90
91
|
var hasSpace = useMemo(function () {
|
|
91
92
|
return text ? hasWhiteSpace(text) : false;
|
|
@@ -104,6 +105,8 @@ var BaseLinkElement = function BaseLinkElement(_ref) {
|
|
|
104
105
|
// click issues in Confluence and Trello which rely on it not being set unless necessary.
|
|
105
106
|
}, target !== '_self' && {
|
|
106
107
|
target: target
|
|
108
|
+
}, {
|
|
109
|
+
ref: anchorRef
|
|
107
110
|
}), text);
|
|
108
111
|
return /*#__PURE__*/React.createElement("span", {
|
|
109
112
|
className: ax(["_16jlkb7n _1o9zkb7n _i0dl1wug"])
|
|
@@ -2,14 +2,19 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["overrideUrl"];
|
|
4
4
|
import React, { useContext } from 'react';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { MediaType } from '../../../../../constants';
|
|
6
|
-
import { FlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
7
|
+
import { FlexibleUiContext, useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
7
8
|
import MediaElement from '../media-element';
|
|
8
9
|
var PreviewElement = function PreviewElement(props) {
|
|
9
10
|
var _ref = props !== null && props !== void 0 ? props : {},
|
|
10
11
|
overrideUrl = _ref.overrideUrl,
|
|
11
12
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
-
var context =
|
|
13
|
+
var context = fg('platform-linking-flexible-card-context') ?
|
|
14
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
15
|
+
useFlexibleUiContext() :
|
|
16
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
17
|
+
useContext(FlexibleUiContext);
|
|
13
18
|
var data = overrideUrl ? {
|
|
14
19
|
url: overrideUrl,
|
|
15
20
|
type: MediaType.Image
|
|
@@ -7,7 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import { ax, ix } from "@compiled/react/runtime";
|
|
8
8
|
import { useContext } from 'react';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import { FlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
10
|
+
import { FlexibleUiContext, useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
11
11
|
import { BaseTextElement } from '../common';
|
|
12
12
|
var SNIPPET_DEFAULT_MAX_LINES = 3;
|
|
13
13
|
|
|
@@ -21,7 +21,11 @@ var SnippetElement = function SnippetElement(props) {
|
|
|
21
21
|
maxLines = _ref$maxLines === void 0 ? SNIPPET_DEFAULT_MAX_LINES : _ref$maxLines,
|
|
22
22
|
className = _ref.className,
|
|
23
23
|
restOfProps = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
-
var context =
|
|
24
|
+
var context = fg('platform-linking-flexible-card-context') ?
|
|
25
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
26
|
+
useFlexibleUiContext() :
|
|
27
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
28
|
+
useContext(FlexibleUiContext);
|
|
25
29
|
return /*#__PURE__*/React.createElement(BaseTextElement, _extends({
|
|
26
30
|
content: overrideContent !== null && overrideContent !== void 0 ? overrideContent : context === null || context === void 0 ? void 0 : context.snippet,
|
|
27
31
|
maxLines: maxLines,
|
|
@@ -9,7 +9,7 @@ import { FormattedDate } from 'react-intl-next';
|
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { ElementName, IconType, SmartLinkInternalTheme } from '../../../../constants';
|
|
11
11
|
import { messages } from '../../../../messages';
|
|
12
|
-
import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
12
|
+
import { FlexibleUiContext, useFlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
13
13
|
import { isProfileType } from '../../../../utils';
|
|
14
14
|
import AppliedToComponentsCount from './applied-to-components-count-element';
|
|
15
15
|
import AtlaskitElementBadge from './atlaskit-badge-element';
|
|
@@ -287,7 +287,11 @@ export var createElement = function createElement(name) {
|
|
|
287
287
|
throw Error("Element ".concat(name, " does not exist."));
|
|
288
288
|
}
|
|
289
289
|
return function (overrides) {
|
|
290
|
-
var context =
|
|
290
|
+
var context = fg('platform-linking-flexible-card-context') ?
|
|
291
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
292
|
+
useFlexibleUiContext() :
|
|
293
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
294
|
+
useContext(FlexibleUiContext);
|
|
291
295
|
var data = getData(name, contextKey, context);
|
|
292
296
|
return data ? /*#__PURE__*/React.createElement(BaseElement, _extends({}, props, data, overrides, {
|
|
293
297
|
name: name
|
|
@@ -3,7 +3,7 @@ import React, { useEffect, useMemo } from 'react';
|
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
5
5
|
import { SmartLinkStatus } from '../../constants';
|
|
6
|
-
import { FlexibleUiContext, FlexibleUiOptionContext } from '../../state/flexible-ui-context';
|
|
6
|
+
import { FlexibleCardContext, FlexibleUiContext, FlexibleUiOptionContext } from '../../state/flexible-ui-context';
|
|
7
7
|
import { useAISummaryConfig } from '../../state/hooks/use-ai-summary-config';
|
|
8
8
|
import useResolve from '../../state/hooks/use-resolve';
|
|
9
9
|
import Container from './components/container';
|
|
@@ -56,6 +56,15 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
56
56
|
url: url
|
|
57
57
|
});
|
|
58
58
|
}, [aiSummaryConfig, appearance, details, fireEvent, id, onAuthorize, origin, renderers, actionOptions, resolve, status, url]);
|
|
59
|
+
var flexibleCardContext = fg('platform-linking-flexible-card-context') ?
|
|
60
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
61
|
+
useMemo(function () {
|
|
62
|
+
return {
|
|
63
|
+
data: context,
|
|
64
|
+
status: status,
|
|
65
|
+
ui: ui
|
|
66
|
+
};
|
|
67
|
+
}, [context, status, ui]) : undefined;
|
|
59
68
|
var retry = fg('platform-linking-flexible-card-unresolved-action') ? undefined : getRetryOptions(url, status, details, onAuthorize);
|
|
60
69
|
var _ref2 = context || {},
|
|
61
70
|
title = _ref2.title;
|
|
@@ -83,6 +92,20 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
83
92
|
break;
|
|
84
93
|
}
|
|
85
94
|
}, [onError, onResolve, status, title, url]);
|
|
95
|
+
if (fg('platform-linking-flexible-card-context')) {
|
|
96
|
+
return /*#__PURE__*/React.createElement(FlexibleCardContext.Provider, {
|
|
97
|
+
value: flexibleCardContext
|
|
98
|
+
}, /*#__PURE__*/React.createElement(Container, _extends({
|
|
99
|
+
testId: testId
|
|
100
|
+
}, ui, {
|
|
101
|
+
onClick: onClick,
|
|
102
|
+
retry: retry,
|
|
103
|
+
showHoverPreview: showHoverPreview,
|
|
104
|
+
hoverPreviewOptions: hoverPreviewOptions,
|
|
105
|
+
actionOptions: actionOptions,
|
|
106
|
+
status: status
|
|
107
|
+
}), children));
|
|
108
|
+
}
|
|
86
109
|
return /*#__PURE__*/React.createElement(FlexibleUiOptionContext.Provider, {
|
|
87
110
|
value: ui
|
|
88
111
|
}, /*#__PURE__*/React.createElement(FlexibleUiContext.Provider, {
|
|
@@ -13,7 +13,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
13
13
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
14
14
|
var PACKAGE_DATA = {
|
|
15
15
|
packageName: "@atlaskit/smart-card",
|
|
16
|
-
packageVersion: "38.4.
|
|
16
|
+
packageVersion: "38.4.2",
|
|
17
17
|
componentName: 'linkUrl'
|
|
18
18
|
};
|
|
19
19
|
var Anchor = withLinkClickedEvent('a');
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { SmartLinkStatus } from '../../constants';
|
|
2
3
|
import { type InternalFlexibleUiOptions } from '../../view/FlexibleCard/types';
|
|
3
4
|
import { type FlexibleUiDataContext } from './types';
|
|
5
|
+
export type FlexibleCardContextType = {
|
|
6
|
+
data?: FlexibleUiDataContext;
|
|
7
|
+
status?: SmartLinkStatus;
|
|
8
|
+
ui?: InternalFlexibleUiOptions;
|
|
9
|
+
};
|
|
4
10
|
/**
|
|
5
11
|
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
6
12
|
* underlying elements.
|
|
7
13
|
*/
|
|
14
|
+
export declare const FlexibleCardContext: import("react").Context<FlexibleCardContextType | undefined>;
|
|
15
|
+
export declare const useFlexibleCardContext: () => FlexibleCardContextType | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
18
|
+
* underlying elements.
|
|
19
|
+
* @deprecated Remove on cleanup of platform-linking-flexible-card-context
|
|
20
|
+
*/
|
|
8
21
|
export declare const FlexibleUiContext: import("react").Context<FlexibleUiDataContext | undefined>;
|
|
9
22
|
export declare const useFlexibleUiContext: () => FlexibleUiDataContext | undefined;
|
|
10
23
|
/**
|
|
11
24
|
* This provides the ui options that will be used by Smart Links Flexible UI
|
|
12
25
|
* to render its underlying elements.
|
|
26
|
+
* @deprecated Remove on cleanup of platform-linking-flexible-card-context
|
|
13
27
|
*/
|
|
14
28
|
export declare const FlexibleUiOptionContext: import("react").Context<InternalFlexibleUiOptions | undefined>;
|
|
15
29
|
export declare const useFlexibleUiOptionContext: () => InternalFlexibleUiOptions | undefined;
|
|
@@ -12,5 +12,5 @@ import { type TitleBlockProps } from './types';
|
|
|
12
12
|
* @see TitleBlockResolvedViewNew
|
|
13
13
|
* @see TitleBlockErroredViewNew
|
|
14
14
|
*/
|
|
15
|
-
declare const TitleBlock: ({ actions, anchorTarget, hideTitleTooltip, maxLines, onActionMenuOpenChange, onClick, status, showActionOnHover, testId, text, icon, theme, hideRetry, metadataPosition, hideIcon, className, ...props }: TitleBlockProps) => JSX.Element;
|
|
15
|
+
declare const TitleBlock: ({ actions, anchorTarget, hideTitleTooltip, maxLines, onActionMenuOpenChange, onClick, status, showActionOnHover, testId, text, icon, theme, hideRetry, metadataPosition, hideIcon, className, anchorRef, ...props }: TitleBlockProps) => JSX.Element;
|
|
16
16
|
export default TitleBlock;
|
|
@@ -99,6 +99,10 @@ export type TitleBlockProps = {
|
|
|
99
99
|
* Determines whether TitleBlock will hide the Link Icon.
|
|
100
100
|
*/
|
|
101
101
|
hideIcon?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Ref passed into the link <a> element
|
|
104
|
+
*/
|
|
105
|
+
anchorRef?: React.Ref<HTMLAnchorElement>;
|
|
102
106
|
} & BlockProps;
|
|
103
107
|
export type TitleBlockViewProps = TitleBlockProps & {
|
|
104
108
|
actionGroup?: React.ReactNode;
|
package/dist/types/view/FlexibleCard/components/elements/common/base-link-element/index.d.ts
CHANGED
|
@@ -40,6 +40,10 @@ export type BaseLinkElementProps = ElementProps & {
|
|
|
40
40
|
* The href target behaviour of the link.
|
|
41
41
|
*/
|
|
42
42
|
target?: AnchorTarget;
|
|
43
|
+
/**
|
|
44
|
+
* Ref passed into the link <a> element
|
|
45
|
+
*/
|
|
46
|
+
anchorRef?: React.Ref<HTMLAnchorElement>;
|
|
43
47
|
};
|
|
44
48
|
/**
|
|
45
49
|
* A base element that represent an anchor.
|
|
@@ -47,5 +51,5 @@ export type BaseLinkElementProps = ElementProps & {
|
|
|
47
51
|
* @param {BaseLinkElementProps} BaseLinkElementProps - The props necessary for the Link element.
|
|
48
52
|
* @see LinkIcon
|
|
49
53
|
*/
|
|
50
|
-
declare const BaseLinkElement: ({ hideTooltip, maxLines, name, className, size, testId, text, theme, url, onClick, target, }: BaseLinkElementProps) => JSX.Element;
|
|
54
|
+
declare const BaseLinkElement: ({ hideTooltip, maxLines, name, className, size, testId, text, theme, url, onClick, target, anchorRef, }: BaseLinkElementProps) => JSX.Element;
|
|
51
55
|
export default BaseLinkElement;
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { SmartLinkStatus } from '../../constants';
|
|
2
3
|
import { type InternalFlexibleUiOptions } from '../../view/FlexibleCard/types';
|
|
3
4
|
import { type FlexibleUiDataContext } from './types';
|
|
5
|
+
export type FlexibleCardContextType = {
|
|
6
|
+
data?: FlexibleUiDataContext;
|
|
7
|
+
status?: SmartLinkStatus;
|
|
8
|
+
ui?: InternalFlexibleUiOptions;
|
|
9
|
+
};
|
|
4
10
|
/**
|
|
5
11
|
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
6
12
|
* underlying elements.
|
|
7
13
|
*/
|
|
14
|
+
export declare const FlexibleCardContext: import("react").Context<FlexibleCardContextType | undefined>;
|
|
15
|
+
export declare const useFlexibleCardContext: () => FlexibleCardContextType | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
18
|
+
* underlying elements.
|
|
19
|
+
* @deprecated Remove on cleanup of platform-linking-flexible-card-context
|
|
20
|
+
*/
|
|
8
21
|
export declare const FlexibleUiContext: import("react").Context<FlexibleUiDataContext | undefined>;
|
|
9
22
|
export declare const useFlexibleUiContext: () => FlexibleUiDataContext | undefined;
|
|
10
23
|
/**
|
|
11
24
|
* This provides the ui options that will be used by Smart Links Flexible UI
|
|
12
25
|
* to render its underlying elements.
|
|
26
|
+
* @deprecated Remove on cleanup of platform-linking-flexible-card-context
|
|
13
27
|
*/
|
|
14
28
|
export declare const FlexibleUiOptionContext: import("react").Context<InternalFlexibleUiOptions | undefined>;
|
|
15
29
|
export declare const useFlexibleUiOptionContext: () => InternalFlexibleUiOptions | undefined;
|
|
@@ -12,5 +12,5 @@ import { type TitleBlockProps } from './types';
|
|
|
12
12
|
* @see TitleBlockResolvedViewNew
|
|
13
13
|
* @see TitleBlockErroredViewNew
|
|
14
14
|
*/
|
|
15
|
-
declare const TitleBlock: ({ actions, anchorTarget, hideTitleTooltip, maxLines, onActionMenuOpenChange, onClick, status, showActionOnHover, testId, text, icon, theme, hideRetry, metadataPosition, hideIcon, className, ...props }: TitleBlockProps) => JSX.Element;
|
|
15
|
+
declare const TitleBlock: ({ actions, anchorTarget, hideTitleTooltip, maxLines, onActionMenuOpenChange, onClick, status, showActionOnHover, testId, text, icon, theme, hideRetry, metadataPosition, hideIcon, className, anchorRef, ...props }: TitleBlockProps) => JSX.Element;
|
|
16
16
|
export default TitleBlock;
|
|
@@ -99,6 +99,10 @@ export type TitleBlockProps = {
|
|
|
99
99
|
* Determines whether TitleBlock will hide the Link Icon.
|
|
100
100
|
*/
|
|
101
101
|
hideIcon?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Ref passed into the link <a> element
|
|
104
|
+
*/
|
|
105
|
+
anchorRef?: React.Ref<HTMLAnchorElement>;
|
|
102
106
|
} & BlockProps;
|
|
103
107
|
export type TitleBlockViewProps = TitleBlockProps & {
|
|
104
108
|
actionGroup?: React.ReactNode;
|
package/dist/types-ts4.5/view/FlexibleCard/components/elements/common/base-link-element/index.d.ts
CHANGED
|
@@ -40,6 +40,10 @@ export type BaseLinkElementProps = ElementProps & {
|
|
|
40
40
|
* The href target behaviour of the link.
|
|
41
41
|
*/
|
|
42
42
|
target?: AnchorTarget;
|
|
43
|
+
/**
|
|
44
|
+
* Ref passed into the link <a> element
|
|
45
|
+
*/
|
|
46
|
+
anchorRef?: React.Ref<HTMLAnchorElement>;
|
|
43
47
|
};
|
|
44
48
|
/**
|
|
45
49
|
* A base element that represent an anchor.
|
|
@@ -47,5 +51,5 @@ export type BaseLinkElementProps = ElementProps & {
|
|
|
47
51
|
* @param {BaseLinkElementProps} BaseLinkElementProps - The props necessary for the Link element.
|
|
48
52
|
* @see LinkIcon
|
|
49
53
|
*/
|
|
50
|
-
declare const BaseLinkElement: ({ hideTooltip, maxLines, name, className, size, testId, text, theme, url, onClick, target, }: BaseLinkElementProps) => JSX.Element;
|
|
54
|
+
declare const BaseLinkElement: ({ hideTooltip, maxLines, name, className, size, testId, text, theme, url, onClick, target, anchorRef, }: BaseLinkElementProps) => JSX.Element;
|
|
51
55
|
export default BaseLinkElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "38.4.
|
|
3
|
+
"version": "38.4.2",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -243,6 +243,9 @@
|
|
|
243
243
|
"platform-linking-fix-a11y-in-smart-card": {
|
|
244
244
|
"type": "boolean"
|
|
245
245
|
},
|
|
246
|
+
"platform-linking-flexible-card-context": {
|
|
247
|
+
"type": "boolean"
|
|
248
|
+
},
|
|
246
249
|
"dst-a11y__replace-anchor-with-link__linking-platfo": {
|
|
247
250
|
"type": "boolean"
|
|
248
251
|
}
|