@atlaskit/smart-card 26.52.2 → 26.52.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/extractors/flexible/actions/index.js +1 -1
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +72 -102
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-icon/index.js +23 -6
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/index.js +94 -0
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +36 -20
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +6 -2
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/preview-icon/index.js +19 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +72 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/index.js +8 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +6 -0
- package/dist/cjs/view/FlexibleCard/components/container/index.js +26 -5
- package/dist/cjs/view/FlexibleCard/components/utils.js +76 -8
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +2 -0
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/actions/index.js +2 -2
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +4 -4
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-icon/index.js +21 -6
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/index.js +83 -0
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +34 -17
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +6 -2
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/preview-icon/index.js +10 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +61 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/index.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +6 -0
- package/dist/es2019/view/FlexibleCard/components/container/index.js +23 -24
- package/dist/es2019/view/FlexibleCard/components/utils.js +73 -38
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +3 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/actions/index.js +1 -1
- package/dist/esm/messages.js +5 -0
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +72 -102
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/action-icon/index.js +22 -6
- package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/index.js +84 -0
- package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +35 -18
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +6 -2
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/preview-icon/index.js +12 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +63 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +6 -0
- package/dist/esm/view/FlexibleCard/components/container/index.js +26 -5
- package/dist/esm/view/FlexibleCard/components/utils.js +75 -7
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +3 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +2 -2
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +4 -4
- package/dist/types/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +4 -3
- package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +10 -0
- package/dist/types/view/FlexibleCard/components/actions/action/index.d.ts +3 -6
- package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +24 -16
- package/dist/types/view/FlexibleCard/components/actions/preview-action/preview-icon/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-block/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-block/types.d.ts +17 -0
- package/dist/types/view/FlexibleCard/components/blocks/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/utils.d.ts +11 -0
- package/dist/types-ts4.5/messages.d.ts +1 -1
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +2 -2
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +4 -4
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +4 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +10 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/index.d.ts +3 -6
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/types.d.ts +24 -16
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/preview-action/preview-icon/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-block/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-block/types.d.ts +17 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/index.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/utils.d.ts +5 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +11 -0
- package/package.json +4 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _primitives = require("@atlaskit/primitives");
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _constants = require("../../../../../constants");
|
|
11
|
+
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
12
|
+
var Actions = _interopRequireWildcard(require("../../actions"));
|
|
13
|
+
var _utils = require("../../utils");
|
|
14
|
+
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); }
|
|
15
|
+
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 && Object.prototype.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; }
|
|
16
|
+
// We have to find a better way to ignore container padding
|
|
17
|
+
// This has become more and more of a common use case.
|
|
18
|
+
var ignoreContainerPaddingStyles = (0, _primitives.xcss)({
|
|
19
|
+
marginLeft: 'calc(var(--container-gap-left) * -1)',
|
|
20
|
+
marginRight: 'calc(var(--container-gap-right) * -1)'
|
|
21
|
+
});
|
|
22
|
+
var ActionBlock = function ActionBlock(_ref) {
|
|
23
|
+
var blockRef = _ref.blockRef,
|
|
24
|
+
onClickCallback = _ref.onClick,
|
|
25
|
+
size = _ref.size,
|
|
26
|
+
sort = _ref.sort,
|
|
27
|
+
spaceInline = _ref.spaceInline,
|
|
28
|
+
_ref$testId = _ref.testId,
|
|
29
|
+
testId = _ref$testId === void 0 ? 'smart-block-action' : _ref$testId;
|
|
30
|
+
var context = (0, _flexibleUiContext.useFlexibleUiContext)();
|
|
31
|
+
var ui = (0, _flexibleUiContext.useFlexibleUiOptionContext)();
|
|
32
|
+
var padding = !(ui !== null && ui !== void 0 && ui.hidePadding) ? (0, _utils.getPrimitivesPaddingSpaceBySize)((ui === null || ui === void 0 ? void 0 : ui.size) || _constants.SmartLinkSize.Medium) : undefined;
|
|
33
|
+
var actions = (0, _react.useMemo)(function () {
|
|
34
|
+
if (!(context !== null && context !== void 0 && context.actions)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
var arr = Object.keys(context.actions);
|
|
38
|
+
if (sort) {
|
|
39
|
+
arr.sort(sort);
|
|
40
|
+
}
|
|
41
|
+
return arr.map(function (name) {
|
|
42
|
+
var Action = Actions[name];
|
|
43
|
+
return Action ? /*#__PURE__*/_react.default.createElement(Action, {
|
|
44
|
+
as: "stack-item",
|
|
45
|
+
spaceInline: spaceInline,
|
|
46
|
+
key: name,
|
|
47
|
+
onClick: function onClick() {
|
|
48
|
+
return onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback(name);
|
|
49
|
+
},
|
|
50
|
+
size: size
|
|
51
|
+
// Remove url once ViewAction is retired.
|
|
52
|
+
// This seems to be a typescript workaround
|
|
53
|
+
// because ViewAction marks it as required,
|
|
54
|
+
// which does not reflect actual implementation as the url
|
|
55
|
+
// came from data context and not all actions require url.
|
|
56
|
+
// https://product-fabric.atlassian.net/browse/EDM-9547
|
|
57
|
+
,
|
|
58
|
+
url: "",
|
|
59
|
+
xcss: (0, _primitives.xcss)({
|
|
60
|
+
paddingInline: padding
|
|
61
|
+
})
|
|
62
|
+
}) : null;
|
|
63
|
+
});
|
|
64
|
+
}, [context === null || context === void 0 ? void 0 : context.actions, onClickCallback, padding, size, sort, spaceInline]);
|
|
65
|
+
return actions ? /*#__PURE__*/_react.default.createElement(_primitives.Stack, {
|
|
66
|
+
grow: "fill",
|
|
67
|
+
xcss: ignoreContainerPaddingStyles,
|
|
68
|
+
ref: blockRef,
|
|
69
|
+
testId: testId
|
|
70
|
+
}, actions) : null;
|
|
71
|
+
};
|
|
72
|
+
var _default = exports.default = ActionBlock;
|
|
@@ -10,6 +10,12 @@ Object.defineProperty(exports, "AISummaryBlock", {
|
|
|
10
10
|
return _aiSummaryBlock.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
+
Object.defineProperty(exports, "ActionBlock", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _actionBlock.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
13
19
|
Object.defineProperty(exports, "CustomBlock", {
|
|
14
20
|
enumerable: true,
|
|
15
21
|
get: function get() {
|
|
@@ -66,4 +72,5 @@ var _titleBlock = _interopRequireDefault(require("./title-block"));
|
|
|
66
72
|
var _block = _interopRequireDefault(require("./block"));
|
|
67
73
|
var _resolved = _interopRequireDefault(require("./footer-block/resolved"));
|
|
68
74
|
var _relatedUrlsBlock = _interopRequireDefault(require("./related-urls-block"));
|
|
69
|
-
var _aiSummaryBlock = _interopRequireDefault(require("./ai-summary-block"));
|
|
75
|
+
var _aiSummaryBlock = _interopRequireDefault(require("./ai-summary-block"));
|
|
76
|
+
var _actionBlock = _interopRequireDefault(require("./action-block"));
|
|
@@ -40,6 +40,12 @@ var getDirectionStyles = function getDirectionStyles(direction) {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get gap size between elements inside a block
|
|
46
|
+
* Equivalent version for DS primitives space token is getPrimitivesInlineSpaceBySize()
|
|
47
|
+
* at view/FlexibleCard/components/utils.tsx
|
|
48
|
+
*/
|
|
43
49
|
var getGapSize = exports.getGapSize = function getGapSize(size) {
|
|
44
50
|
switch (size) {
|
|
45
51
|
case _constants.SmartLinkSize.XLarge:
|
|
@@ -17,11 +17,15 @@ var _hoverCardControl = _interopRequireDefault(require("./hover-card-control"));
|
|
|
17
17
|
var _utils = require("../../../../state/flexible-ui-context/utils");
|
|
18
18
|
var _colors = require("@atlaskit/theme/colors");
|
|
19
19
|
var _reactMagneticDi = require("react-magnetic-di");
|
|
20
|
-
var _templateObject
|
|
20
|
+
var _templateObject;
|
|
21
21
|
/** @jsx jsx */
|
|
22
22
|
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); }
|
|
23
23
|
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 && Object.prototype.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; }
|
|
24
|
-
var elevationStyles = (0, _react2.css)(
|
|
24
|
+
var elevationStyles = (0, _react2.css)({
|
|
25
|
+
border: "1px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
|
|
26
|
+
borderRadius: "var(--ds-border-radius-200, 8px)",
|
|
27
|
+
margin: "var(--ds-space-025, 2px)"
|
|
28
|
+
});
|
|
25
29
|
var getGap = function getGap(size) {
|
|
26
30
|
switch (size) {
|
|
27
31
|
case _constants.SmartLinkSize.XLarge:
|
|
@@ -35,6 +39,12 @@ var getGap = function getGap(size) {
|
|
|
35
39
|
return '.25rem';
|
|
36
40
|
}
|
|
37
41
|
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get container padding based on smart link size
|
|
45
|
+
* Equivalent version for DS primitives space token is getPrimitivesPaddingSpaceBySize()
|
|
46
|
+
* at view/FlexibleCard/components/utils.tsx
|
|
47
|
+
*/
|
|
38
48
|
var getPadding = function getPadding(size) {
|
|
39
49
|
switch (size) {
|
|
40
50
|
case _constants.SmartLinkSize.XLarge:
|
|
@@ -48,13 +58,24 @@ var getPadding = function getPadding(size) {
|
|
|
48
58
|
return '.5rem';
|
|
49
59
|
}
|
|
50
60
|
};
|
|
51
|
-
var clickableContainerStyles = (0, _react2.css)(
|
|
61
|
+
var clickableContainerStyles = (0, _react2.css)({
|
|
62
|
+
'a, button, .has-action': {
|
|
63
|
+
position: 'relative',
|
|
64
|
+
zIndex: 1
|
|
65
|
+
}
|
|
66
|
+
});
|
|
52
67
|
var getContainerPaddingStyles = function getContainerPaddingStyles(size, hidePadding, childrenOptions) {
|
|
53
68
|
var padding = hidePadding ? '0rem' : getPadding(size);
|
|
54
69
|
var gap = getGap(size);
|
|
55
70
|
var previewOnLeft = childrenOptions.previewOnLeft,
|
|
56
71
|
previewOnRight = childrenOptions.previewOnRight;
|
|
57
|
-
return (0, _react2.css)(
|
|
72
|
+
return (0, _react2.css)({
|
|
73
|
+
'--container-padding': padding,
|
|
74
|
+
'--container-gap-left': previewOnLeft ? gap : padding,
|
|
75
|
+
'--container-gap-right': previewOnRight ? gap : padding,
|
|
76
|
+
'--preview-block-width': '30%',
|
|
77
|
+
padding: padding
|
|
78
|
+
}, previewOnLeft ? "padding-left: calc(var(--preview-block-width) + ".concat(gap, ");") : '', previewOnRight ? "padding-right: calc(var(--preview-block-width) + ".concat(gap, ");") : '');
|
|
58
79
|
};
|
|
59
80
|
var getChildrenOptions = function getChildrenOptions(children, context) {
|
|
60
81
|
var options = {};
|
|
@@ -77,7 +98,7 @@ var getChildrenOptions = function getChildrenOptions(children, context) {
|
|
|
77
98
|
};
|
|
78
99
|
var getContainerStyles = exports.getContainerStyles = function getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer, childrenOptions) {
|
|
79
100
|
var paddingCss = getContainerPaddingStyles(size, hidePadding, childrenOptions);
|
|
80
|
-
return (0, _react2.css)(
|
|
101
|
+
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n gap: ", " 0;\n flex-direction: column;\n min-width: 0;\n overflow-x: hidden;\n position: relative;\n ", "\n ", "\n ", "\n ", "\n &:hover ~ .actions-button-group {\n opacity: 1;\n }\n a:focus,\n .has-action:focus {\n outline-offset: -2px;\n }\n "])), getGap(size), hideBackground ? '' : "background-color: ".concat("var(--ds-surface-raised, #FFFFFF)", ";"), paddingCss, hideElevation ? '' : elevationStyles, clickableContainer ? clickableContainerStyles : '');
|
|
81
102
|
};
|
|
82
103
|
var renderChildren = function renderChildren(children, containerSize, containerTheme, status, retry, onClick) {
|
|
83
104
|
return _react.default.Children.map(children, function (child) {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.sizeToButtonSpacing = exports.openEmbedModalWithFlexibleUiIcon = exports.hasWhiteSpace = exports.getTruncateStyles = exports.getMaxLines = exports.getMaxLineHeight = exports.getLinkSizeStyles = exports.getLinkLineHeight = exports.getIconWidth = exports.getIconSizeStyles = exports.getFormattedMessageAsString = exports.getFormattedMessage = void 0;
|
|
7
|
+
exports.sizeToButtonSpacing = exports.openEmbedModalWithFlexibleUiIcon = exports.hasWhiteSpace = exports.getTruncateStyles = exports.getPrimitivesPaddingSpaceBySize = exports.getPrimitivesInlineSpaceBySize = exports.getMaxLines = exports.getMaxLineHeight = exports.getLinkSizeStyles = exports.getLinkLineHeight = exports.getIconWidth = exports.getIconSizeStyles = exports.getFormattedMessageAsString = exports.getFormattedMessage = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
@@ -16,7 +16,7 @@ var _constants = require("../../../constants");
|
|
|
16
16
|
var _icon = _interopRequireDefault(require("./elements/icon"));
|
|
17
17
|
var _utils = require("../../EmbedModal/utils");
|
|
18
18
|
var _excluded = ["linkIcon"];
|
|
19
|
-
var _sizeToButtonSpacing, _templateObject
|
|
19
|
+
var _sizeToButtonSpacing, _templateObject;
|
|
20
20
|
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; }
|
|
21
21
|
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; }
|
|
22
22
|
var sizeToButtonSpacing = exports.sizeToButtonSpacing = (_sizeToButtonSpacing = {}, (0, _defineProperty2.default)(_sizeToButtonSpacing, _constants.SmartLinkSize.Small, 'none'), (0, _defineProperty2.default)(_sizeToButtonSpacing, _constants.SmartLinkSize.Medium, 'compact'), (0, _defineProperty2.default)(_sizeToButtonSpacing, _constants.SmartLinkSize.Large, 'compact'), (0, _defineProperty2.default)(_sizeToButtonSpacing, _constants.SmartLinkSize.XLarge, 'default'), _sizeToButtonSpacing);
|
|
@@ -36,11 +36,18 @@ var getFormattedMessageAsString = exports.getFormattedMessageAsString = function
|
|
|
36
36
|
}) : '';
|
|
37
37
|
};
|
|
38
38
|
var getIconDimensionStyles = function getIconDimensionStyles(value) {
|
|
39
|
-
return (0, _react2.css)(
|
|
39
|
+
return (0, _react2.css)({
|
|
40
|
+
height: value,
|
|
41
|
+
minHeight: value,
|
|
42
|
+
maxHeight: value,
|
|
43
|
+
width: value,
|
|
44
|
+
minWidth: value,
|
|
45
|
+
maxWidth: value
|
|
46
|
+
});
|
|
40
47
|
};
|
|
41
48
|
var getIconSizeStyles = exports.getIconSizeStyles = function getIconSizeStyles(width) {
|
|
42
49
|
var sizeStyles = getIconDimensionStyles(width);
|
|
43
|
-
return (0, _react2.css)(
|
|
50
|
+
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n flex: 0 0 auto;\n ", "\n span,\n svg,\n img {\n ", "\n }\n svg {\n padding: 0;\n }\n "])), sizeStyles, sizeStyles);
|
|
44
51
|
};
|
|
45
52
|
var getIconWidth = exports.getIconWidth = function getIconWidth(size) {
|
|
46
53
|
switch (size) {
|
|
@@ -69,13 +76,28 @@ var getLinkLineHeight = exports.getLinkLineHeight = function getLinkLineHeight(s
|
|
|
69
76
|
var getLinkSizeStyles = exports.getLinkSizeStyles = function getLinkSizeStyles(size) {
|
|
70
77
|
switch (size) {
|
|
71
78
|
case _constants.SmartLinkSize.XLarge:
|
|
72
|
-
return (0, _react2.css)(
|
|
79
|
+
return (0, _react2.css)({
|
|
80
|
+
fontSize: '1.25rem',
|
|
81
|
+
fontWeight: 400,
|
|
82
|
+
letterSpacing: '-0.008em',
|
|
83
|
+
lineHeight: getLinkLineHeight(size)
|
|
84
|
+
});
|
|
73
85
|
case _constants.SmartLinkSize.Large:
|
|
74
86
|
case _constants.SmartLinkSize.Medium:
|
|
75
|
-
return (0, _react2.css)(
|
|
87
|
+
return (0, _react2.css)({
|
|
88
|
+
fontSize: '0.875rem',
|
|
89
|
+
fontWeight: 400,
|
|
90
|
+
letterSpacing: '-0.003em',
|
|
91
|
+
lineHeight: getLinkLineHeight(size)
|
|
92
|
+
});
|
|
76
93
|
case _constants.SmartLinkSize.Small:
|
|
77
94
|
default:
|
|
78
|
-
return (0, _react2.css)(
|
|
95
|
+
return (0, _react2.css)({
|
|
96
|
+
fontSize: '0.75rem',
|
|
97
|
+
fontWeight: 400,
|
|
98
|
+
letterSpacing: '0em',
|
|
99
|
+
lineHeight: getLinkLineHeight(size)
|
|
100
|
+
});
|
|
79
101
|
}
|
|
80
102
|
};
|
|
81
103
|
var getMaxLineHeight = exports.getMaxLineHeight = function getMaxLineHeight(size) {
|
|
@@ -100,10 +122,56 @@ var getMaxLines = exports.getMaxLines = function getMaxLines(value, defaultValue
|
|
|
100
122
|
}
|
|
101
123
|
return value;
|
|
102
124
|
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* A space between element based on smart link size
|
|
128
|
+
* To replace blocks/utils.tsz getGapSize() with space token for primitives
|
|
129
|
+
*/
|
|
130
|
+
var getPrimitivesInlineSpaceBySize = exports.getPrimitivesInlineSpaceBySize = function getPrimitivesInlineSpaceBySize(size) {
|
|
131
|
+
switch (size) {
|
|
132
|
+
case _constants.SmartLinkSize.XLarge:
|
|
133
|
+
return 'space.250';
|
|
134
|
+
case _constants.SmartLinkSize.Large:
|
|
135
|
+
return 'space.200';
|
|
136
|
+
case _constants.SmartLinkSize.Medium:
|
|
137
|
+
return 'space.100';
|
|
138
|
+
case _constants.SmartLinkSize.Small:
|
|
139
|
+
default:
|
|
140
|
+
return 'space.050';
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Get container padding based on smart link size
|
|
146
|
+
* To replace container/index.tsx getPadding() with space token for primitives
|
|
147
|
+
*/
|
|
148
|
+
var getPrimitivesPaddingSpaceBySize = exports.getPrimitivesPaddingSpaceBySize = function getPrimitivesPaddingSpaceBySize(size) {
|
|
149
|
+
switch (size) {
|
|
150
|
+
case _constants.SmartLinkSize.XLarge:
|
|
151
|
+
return 'space.300';
|
|
152
|
+
case _constants.SmartLinkSize.Large:
|
|
153
|
+
return 'space.250';
|
|
154
|
+
case _constants.SmartLinkSize.Medium:
|
|
155
|
+
return 'space.200';
|
|
156
|
+
case _constants.SmartLinkSize.Small:
|
|
157
|
+
default:
|
|
158
|
+
return 'space.100';
|
|
159
|
+
}
|
|
160
|
+
};
|
|
103
161
|
var getTruncateStyles = exports.getTruncateStyles = function getTruncateStyles(maxLines) {
|
|
104
162
|
var lineHeight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1rem';
|
|
105
163
|
var wordBreak = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'break-word';
|
|
106
|
-
return (0, _react2.css)(
|
|
164
|
+
return (0, _react2.css)({
|
|
165
|
+
display: '-webkit-box',
|
|
166
|
+
overflow: 'hidden',
|
|
167
|
+
textOverflow: 'ellipsis',
|
|
168
|
+
wordBreak: wordBreak,
|
|
169
|
+
WebkitLineClamp: maxLines,
|
|
170
|
+
WebkitBoxOrient: 'vertical',
|
|
171
|
+
'@supports not (-webkit-line-clamp: 1)': {
|
|
172
|
+
maxHeight: "calc(".concat(maxLines, " * ").concat(lineHeight, ")")
|
|
173
|
+
}
|
|
174
|
+
});
|
|
107
175
|
};
|
|
108
176
|
var hasWhiteSpace = exports.hasWhiteSpace = function hasWhiteSpace(str) {
|
|
109
177
|
return str.search(/\s/) >= 0;
|
|
@@ -192,6 +192,8 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
192
192
|
actions: footerActions,
|
|
193
193
|
size: _constants.SmartLinkSize.Large,
|
|
194
194
|
overrideCss: _styled.footerBlockCss
|
|
195
|
+
}), (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.hover-card-action-redesign') && /*#__PURE__*/_react.default.createElement(_blocks.ActionBlock, {
|
|
196
|
+
spaceInline: "space.150"
|
|
195
197
|
}));
|
|
196
198
|
};
|
|
197
199
|
var _default = exports.default = HoverCardResolvedView;
|
|
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
17
17
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
18
18
|
var PACKAGE_DATA = {
|
|
19
19
|
packageName: "@atlaskit/smart-card",
|
|
20
|
-
packageVersion: "26.52.
|
|
20
|
+
packageVersion: "26.52.3",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -4,9 +4,9 @@ import { extractPreviewAction } from './extract-preview-action';
|
|
|
4
4
|
import extractFollowAction from './extract-follow-action';
|
|
5
5
|
const extractActions = (response, data, actionOptions, id) => {
|
|
6
6
|
const action = {
|
|
7
|
-
[ActionName.PreviewAction]: extractPreviewAction(response, actionOptions),
|
|
8
7
|
[ActionName.DownloadAction]: extractDownloadAction(data, actionOptions),
|
|
9
|
-
[ActionName.FollowAction]: extractFollowAction(response, actionOptions, id)
|
|
8
|
+
[ActionName.FollowAction]: extractFollowAction(response, actionOptions, id),
|
|
9
|
+
[ActionName.PreviewAction]: extractPreviewAction(response, actionOptions)
|
|
10
10
|
};
|
|
11
11
|
return Object.values(action).some(value => Boolean(value)) ? action : undefined;
|
|
12
12
|
};
|
package/dist/es2019/messages.js
CHANGED
|
@@ -255,6 +255,11 @@ export const messages = defineMessages({
|
|
|
255
255
|
defaultMessage: 'Owned by {context}',
|
|
256
256
|
description: 'Indicates the person or entity that owns or maintains the resource.'
|
|
257
257
|
},
|
|
258
|
+
preview_description: {
|
|
259
|
+
id: 'fabric.linking.preview_description.nonfinal',
|
|
260
|
+
defaultMessage: 'Open a full screen preview of this link',
|
|
261
|
+
description: 'Description on what Preview does'
|
|
262
|
+
},
|
|
258
263
|
preview_improved: {
|
|
259
264
|
id: 'fabric.linking.preview_improved',
|
|
260
265
|
defaultMessage: 'Open preview',
|
|
@@ -9,13 +9,13 @@ export class AISummaryService {
|
|
|
9
9
|
status: 'ready'
|
|
10
10
|
});
|
|
11
11
|
_defineProperty(this, "subscribedStateSetters", new Set());
|
|
12
|
-
_defineProperty(this, "fetchStream", async
|
|
12
|
+
_defineProperty(this, "fetchStream", async () => {
|
|
13
13
|
const payload = {
|
|
14
14
|
recipient_agent_named_id: 'summary_agent',
|
|
15
15
|
agent_input_context: {
|
|
16
16
|
content_url: this.url,
|
|
17
17
|
content_ari: this.ari,
|
|
18
|
-
|
|
18
|
+
prompt_id: 'smart_links',
|
|
19
19
|
summary_output_mimetype: 'text/markdown'
|
|
20
20
|
}
|
|
21
21
|
};
|
|
@@ -54,7 +54,7 @@ export class AISummaryService {
|
|
|
54
54
|
this.onSuccess = props.onSuccess;
|
|
55
55
|
this.onError = props.onError;
|
|
56
56
|
}
|
|
57
|
-
async summariseUrl(
|
|
57
|
+
async summariseUrl() {
|
|
58
58
|
this.state = {
|
|
59
59
|
status: 'loading',
|
|
60
60
|
content: ''
|
|
@@ -66,7 +66,7 @@ export class AISummaryService {
|
|
|
66
66
|
try {
|
|
67
67
|
var _this$onStart, _this$onSuccess;
|
|
68
68
|
(_this$onStart = this.onStart) === null || _this$onStart === void 0 ? void 0 : _this$onStart.call(this, id);
|
|
69
|
-
const stream = await this.fetchStream(
|
|
69
|
+
const stream = await this.fetchStream();
|
|
70
70
|
let bufferContent = '';
|
|
71
71
|
for await (const chunk of stream) {
|
|
72
72
|
if (chunk.type === 'ANSWER_PART') {
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "26.52.
|
|
7
|
+
packageVersion: "26.52.3"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -14,17 +14,32 @@ const getIconWidth = size => {
|
|
|
14
14
|
return '1rem';
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
const getIconStyles =
|
|
18
|
-
color:
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const getIconStyles = isDisabled => css({
|
|
18
|
+
color: isDisabled ? "var(--ds-text-disabled, #6B778C)" : "var(--ds-icon, #44546F)"
|
|
19
|
+
});
|
|
20
|
+
const backgroundStyles = css({
|
|
21
|
+
backgroundColor: "var(--ds-background-brand-subtlest, #E9F2FF)",
|
|
22
|
+
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
23
|
+
color: "var(--ds-icon-brand, #0C66E4)",
|
|
24
|
+
display: 'inline-block',
|
|
25
|
+
lineHeight: 0,
|
|
26
|
+
padding: "var(--ds-space-025, 2px)",
|
|
27
|
+
'span,svg,img': {
|
|
28
|
+
lineHeight: 0
|
|
29
|
+
},
|
|
30
|
+
// Use !important to win over `style` prop specificity in DS Spinner. :(
|
|
31
|
+
circle: {
|
|
32
|
+
stroke: `${"var(--ds-icon-brand, #0C66E4)"} !important`
|
|
33
|
+
}
|
|
34
|
+
});
|
|
21
35
|
const ActionIcon = ({
|
|
22
36
|
size,
|
|
23
37
|
testId,
|
|
24
38
|
icon,
|
|
25
|
-
isDisabled
|
|
39
|
+
isDisabled,
|
|
40
|
+
showBackground
|
|
26
41
|
}) => jsx("span", {
|
|
27
|
-
css: getIconStyles(
|
|
42
|
+
css: [getIconStyles(isDisabled), getIconSizeStyles(getIconWidth(size)), showBackground && backgroundStyles],
|
|
28
43
|
"data-testid": `${testId}-icon`
|
|
29
44
|
}, icon);
|
|
30
45
|
export default ActionIcon;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import { Box, Inline, xcss } from '@atlaskit/primitives';
|
|
3
|
+
import Spinner from '@atlaskit/spinner';
|
|
4
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
|
+
import { getPrimitivesInlineSpaceBySize } from '../../../utils';
|
|
7
|
+
import ActionIcon from '../action-icon';
|
|
8
|
+
const buttonStyles = xcss({
|
|
9
|
+
all: 'unset',
|
|
10
|
+
padding: 'space.050',
|
|
11
|
+
width: '100%',
|
|
12
|
+
':focus:not(:focus-visible)': {
|
|
13
|
+
outline: 'none'
|
|
14
|
+
},
|
|
15
|
+
':focus': {
|
|
16
|
+
outlineColor: 'color.border.focused',
|
|
17
|
+
// xcss outlineOffset does not support space.negative.025
|
|
18
|
+
// @ts-ignore-next-line TS2322: Type "var(--ds-space-negative-025)" is not assignable to type
|
|
19
|
+
outlineOffset: "var(--ds-space-negative-025, -2px)",
|
|
20
|
+
outlineStyle: 'solid',
|
|
21
|
+
outlineWidth: 'border.width.outline'
|
|
22
|
+
},
|
|
23
|
+
':hover': {
|
|
24
|
+
backgroundColor: 'color.background.neutral.subtle.hovered'
|
|
25
|
+
},
|
|
26
|
+
':active': {
|
|
27
|
+
backgroundColor: 'color.background.neutral.subtle.pressed'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
const contentStyles = xcss({
|
|
31
|
+
color: 'color.text',
|
|
32
|
+
// Replace with font token once it becomes stable (currently alpha)
|
|
33
|
+
// font: 'font.body.small',
|
|
34
|
+
fontSize: '12px',
|
|
35
|
+
fontStyle: 'normal',
|
|
36
|
+
fontWeight: '400',
|
|
37
|
+
lineHeight: '20px'
|
|
38
|
+
});
|
|
39
|
+
const ActionStackItem = ({
|
|
40
|
+
content,
|
|
41
|
+
icon: iconOption,
|
|
42
|
+
isDisabled,
|
|
43
|
+
isLoading,
|
|
44
|
+
onClick: onClickCallback,
|
|
45
|
+
size,
|
|
46
|
+
space: spaceOption,
|
|
47
|
+
testId,
|
|
48
|
+
tooltipMessage,
|
|
49
|
+
xcss
|
|
50
|
+
}) => {
|
|
51
|
+
const space = spaceOption !== null && spaceOption !== void 0 ? spaceOption : getPrimitivesInlineSpaceBySize(size);
|
|
52
|
+
const onClick = useCallback(() => {
|
|
53
|
+
if (!isDisabled && !isLoading && onClickCallback) {
|
|
54
|
+
onClickCallback();
|
|
55
|
+
}
|
|
56
|
+
}, [isDisabled, isLoading, onClickCallback]);
|
|
57
|
+
const icon = iconOption && isLoading ? /*#__PURE__*/React.createElement(ActionIcon, {
|
|
58
|
+
icon: /*#__PURE__*/React.createElement(Spinner, {
|
|
59
|
+
testId: `${testId}-loading`
|
|
60
|
+
}),
|
|
61
|
+
showBackground: true,
|
|
62
|
+
size: size
|
|
63
|
+
}) : iconOption;
|
|
64
|
+
|
|
65
|
+
// Replace Box with Pressable once it becomes stable (currently beta)
|
|
66
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
67
|
+
content: tooltipMessage || content,
|
|
68
|
+
hideTooltipOnMouseDown: true
|
|
69
|
+
}, tooltipProps => /*#__PURE__*/React.createElement(Box, _extends({
|
|
70
|
+
as: "button",
|
|
71
|
+
xcss: [buttonStyles, xcss]
|
|
72
|
+
}, tooltipProps, {
|
|
73
|
+
onClick: onClick
|
|
74
|
+
}), /*#__PURE__*/React.createElement(Inline, {
|
|
75
|
+
alignBlock: "center",
|
|
76
|
+
grow: "fill",
|
|
77
|
+
space: space,
|
|
78
|
+
testId: testId
|
|
79
|
+
}, icon, /*#__PURE__*/React.createElement(Box, {
|
|
80
|
+
xcss: contentStyles
|
|
81
|
+
}, content))));
|
|
82
|
+
};
|
|
83
|
+
export default ActionStackItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import { SmartLinkSize } from '../../../../../constants';
|
|
5
|
+
import ActionStackItem from './action-stack-item';
|
|
5
6
|
import ActionButton from './action-button';
|
|
6
7
|
import ActionDropdownItem from './action-dropdown-item';
|
|
7
8
|
import ActionIcon from './action-icon';
|
|
@@ -10,11 +11,9 @@ import ActionIcon from './action-icon';
|
|
|
10
11
|
* A base action that can be triggered with an on click.
|
|
11
12
|
* @internal
|
|
12
13
|
* @param {ActionProps} ActionProps - The props necessary for the Action.
|
|
13
|
-
* @see DeleteAction
|
|
14
|
-
* @see EditAction
|
|
15
|
-
* @see CustomAction
|
|
16
14
|
*/
|
|
17
15
|
const Action = ({
|
|
16
|
+
as,
|
|
18
17
|
appearance = 'subtle',
|
|
19
18
|
content,
|
|
20
19
|
isLoading = false,
|
|
@@ -23,7 +22,9 @@ const Action = ({
|
|
|
23
22
|
testId = 'smart-action',
|
|
24
23
|
icon,
|
|
25
24
|
iconPosition = 'before',
|
|
25
|
+
spaceInline,
|
|
26
26
|
tooltipMessage,
|
|
27
|
+
xcss,
|
|
27
28
|
asDropDownItem,
|
|
28
29
|
overrideCss,
|
|
29
30
|
isDisabled
|
|
@@ -31,37 +32,53 @@ const Action = ({
|
|
|
31
32
|
if (!onClick) {
|
|
32
33
|
return null;
|
|
33
34
|
}
|
|
35
|
+
const isStackItem = as === 'stack-item';
|
|
36
|
+
const isDropdownItem = as === 'dropdown-item' || asDropDownItem;
|
|
34
37
|
const actionIcon = icon && jsx(ActionIcon, {
|
|
35
38
|
isDisabled: isDisabled,
|
|
36
39
|
icon: icon,
|
|
37
40
|
size: size,
|
|
41
|
+
showBackground: isStackItem,
|
|
38
42
|
testId: testId
|
|
39
43
|
});
|
|
40
44
|
const iconBefore = icon && iconPosition === 'before' ? actionIcon : undefined;
|
|
41
45
|
const iconAfter = icon && iconPosition === 'after' ? actionIcon : undefined;
|
|
42
|
-
if (
|
|
43
|
-
return jsx(
|
|
46
|
+
if (isStackItem) {
|
|
47
|
+
return jsx(ActionStackItem, {
|
|
44
48
|
content: content,
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
icon: actionIcon,
|
|
50
|
+
space: spaceInline,
|
|
51
|
+
isDisabled: isDisabled,
|
|
47
52
|
isLoading: isLoading,
|
|
48
53
|
onClick: onClick,
|
|
49
|
-
|
|
54
|
+
size: size,
|
|
55
|
+
testId: testId,
|
|
56
|
+
tooltipMessage: tooltipMessage || content,
|
|
57
|
+
xcss: xcss
|
|
50
58
|
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
}
|
|
60
|
+
if (isDropdownItem) {
|
|
61
|
+
return jsx(ActionDropdownItem, {
|
|
54
62
|
content: content,
|
|
55
63
|
iconAfter: iconAfter,
|
|
56
64
|
iconBefore: iconBefore,
|
|
57
65
|
isLoading: isLoading,
|
|
58
66
|
onClick: onClick,
|
|
59
|
-
|
|
60
|
-
size: size,
|
|
61
|
-
testId: testId,
|
|
62
|
-
tooltipMessage: tooltipMessage || content,
|
|
63
|
-
isDisabled: isDisabled
|
|
67
|
+
testId: testId
|
|
64
68
|
});
|
|
65
69
|
}
|
|
70
|
+
return jsx(ActionButton, {
|
|
71
|
+
appearance: appearance,
|
|
72
|
+
content: content,
|
|
73
|
+
iconAfter: iconAfter,
|
|
74
|
+
iconBefore: iconBefore,
|
|
75
|
+
isLoading: isLoading,
|
|
76
|
+
onClick: onClick,
|
|
77
|
+
overrideCss: overrideCss,
|
|
78
|
+
size: size,
|
|
79
|
+
testId: testId,
|
|
80
|
+
tooltipMessage: tooltipMessage || content,
|
|
81
|
+
isDisabled: isDisabled
|
|
82
|
+
});
|
|
66
83
|
};
|
|
67
84
|
export default Action;
|