@atlaskit/smart-card 34.6.2 → 34.6.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 +8 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/views/ResolvedView.compiled.css +1 -0
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/ActionBlockOld.js +116 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.compiled.css +7 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +21 -26
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/ActionGroupOld.js +147 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +2 -8
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.compiled.css +4 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +28 -32
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/FeatureDiscoveryOld.js +71 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/index.compiled.css +4 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/index.js +30 -18
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/styled.js +3 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/AISummaryBlockResolvedViewOld.js +65 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.compiled.css +2 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +22 -15
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.compiled.css +4 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +7 -6
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +2 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.compiled.css +2 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.js +7 -4
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/RelatedLinksModal/components/related-link-item/index.compiled.css +4 -0
- package/dist/cjs/view/RelatedLinksModal/components/related-link-item/index.js +20 -12
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/views/ResolvedView.compiled.css +1 -0
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/ActionBlockOld.js +96 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.compiled.css +7 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +20 -24
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/ActionGroupOld.js +121 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +2 -9
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.compiled.css +4 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +24 -32
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/FeatureDiscoveryOld.js +63 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/index.compiled.css +5 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/index.js +21 -16
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/styled.js +3 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/AISummaryBlockResolvedViewOld.js +58 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.compiled.css +2 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +18 -11
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.compiled.css +4 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +7 -6
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.compiled.css +2 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.js +8 -4
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/RelatedLinksModal/components/related-link-item/index.compiled.css +4 -0
- package/dist/es2019/view/RelatedLinksModal/components/related-link-item/index.js +12 -7
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/views/ResolvedView.compiled.css +1 -0
- package/dist/esm/view/BlockCard/views/ResolvedView.js +2 -2
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/ActionBlockOld.js +105 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.compiled.css +7 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +20 -24
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/ActionGroupOld.js +141 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +2 -9
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.compiled.css +4 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +24 -32
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/FeatureDiscoveryOld.js +64 -0
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/index.compiled.css +4 -0
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/index.js +25 -16
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/styled.js +3 -0
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/AISummaryBlockResolvedViewOld.js +55 -0
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.compiled.css +2 -0
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +18 -11
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.compiled.css +4 -1
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +7 -6
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.compiled.css +2 -1
- package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.js +8 -4
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/RelatedLinksModal/components/related-link-item/index.compiled.css +4 -0
- package/dist/esm/view/RelatedLinksModal/components/related-link-item/index.js +12 -7
- package/dist/types/view/FlexibleCard/components/blocks/action-block/ActionBlockOld.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-block/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/blocks/action-group/ActionGroupOld.d.ts +11 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-group/action-group-item/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/blocks/action-group/index.d.ts +2 -9
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/FeatureDiscoveryOld.d.ts +12 -0
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/index.d.ts +1 -6
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/styled.d.ts +3 -0
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/resolved/AISummaryBlockResolvedViewOld.d.ts +10 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-block/ActionBlockOld.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-block/index.d.ts +2 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-group/ActionGroupOld.d.ts +11 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-group/action-group-item/index.d.ts +2 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-group/index.d.ts +2 -9
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/FeatureDiscoveryOld.d.ts +12 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/index.d.ts +1 -6
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/styled.d.ts +3 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/resolved/AISummaryBlockResolvedViewOld.d.ts +10 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 34.6.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#106497](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/106497)
|
|
8
|
+
[`d56401d90b5e5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d56401d90b5e5) -
|
|
9
|
+
[ux] Migrate flexible card components to compiled and fix blockcard
|
|
10
|
+
|
|
3
11
|
## 34.6.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -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: "34.6.
|
|
14
|
+
packageVersion: "34.6.3"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -3,4 +3,5 @@
|
|
|
3
3
|
._1sxbcxkx span[data-smart-element-avatar-group]>ul{margin-right:var(--ds-space-100,.5rem)}
|
|
4
4
|
._4t3i1k8s{height:1.5rem}
|
|
5
5
|
._g0eioxwj .actions-button-group button, ._1qryoxwj .actions-button-group button:active, ._sxbroxwj .actions-button-group button:focus, ._1gyioxwj .actions-button-group button:hover{font-size:.875rem}
|
|
6
|
+
._i8d01j6v [data-smart-element-group]{line-height:1rem}
|
|
6
7
|
._wwyvidpf span[data-smart-element-avatar-group]>ul{padding-left:0}
|
|
@@ -86,12 +86,12 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
86
86
|
primary: topMetadata,
|
|
87
87
|
maxLines: 1,
|
|
88
88
|
status: _constants.SmartLinkStatus.Resolved,
|
|
89
|
-
className: (0, _runtime.ax)(["_wwyvidpf _1sxbcxkx"])
|
|
89
|
+
className: (0, _runtime.ax)(["_wwyvidpf _1sxbcxkx _i8d01j6v"])
|
|
90
90
|
}), /*#__PURE__*/React.createElement(_blocks.SnippetBlock, null), /*#__PURE__*/React.createElement(_blocks.MetadataBlock, {
|
|
91
91
|
primary: bottomMetadata,
|
|
92
92
|
maxLines: 1,
|
|
93
93
|
status: _constants.SmartLinkStatus.Resolved,
|
|
94
|
-
className: (0, _runtime.ax)(["_wwyvidpf _1sxbcxkx"])
|
|
94
|
+
className: (0, _runtime.ax)(["_wwyvidpf _1sxbcxkx _i8d01j6v"])
|
|
95
95
|
}), !isPreviewBlockErrored ? /*#__PURE__*/React.createElement(_blocks.PreviewBlock, (0, _extends2.default)({}, _utils.PreviewBlockOptions, {
|
|
96
96
|
onError: function onError() {
|
|
97
97
|
setIsPreviewBlockErrored(true);
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _react2 = require("@emotion/react");
|
|
12
|
+
var _reactMagneticDi = require("react-magnetic-di");
|
|
13
|
+
var _primitives = require("@atlaskit/primitives");
|
|
14
|
+
var _constants = require("../../../../../constants");
|
|
15
|
+
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
16
|
+
var Actions = _interopRequireWildcard(require("../../actions"));
|
|
17
|
+
var _utils = require("../../utils");
|
|
18
|
+
var _actionFooter = require("./action-footer");
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
21
|
+
/**
|
|
22
|
+
* @jsxRuntime classic
|
|
23
|
+
* @jsx jsx
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
27
|
+
|
|
28
|
+
var ignoreContainerPaddingStyles = (0, _react2.css)({
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexDirection: 'column',
|
|
31
|
+
boxSizing: 'border-box',
|
|
32
|
+
flexGrow: 1,
|
|
33
|
+
width: '100%',
|
|
34
|
+
// We have to find a better way to ignore container padding
|
|
35
|
+
// This has become more and more of a common use case.
|
|
36
|
+
marginLeft: 'calc(var(--container-gap-left) * -1)',
|
|
37
|
+
marginRight: 'calc(var(--container-gap-right) * -1)'
|
|
38
|
+
});
|
|
39
|
+
var DEFAULT_SORT_ORDER = ['PreviewAction', 'CopyLinkAction', 'AISummaryAction'];
|
|
40
|
+
var sort = function sort(a, b) {
|
|
41
|
+
var idxA = DEFAULT_SORT_ORDER.indexOf(a);
|
|
42
|
+
var idxB = DEFAULT_SORT_ORDER.indexOf(b);
|
|
43
|
+
if (idxA === -1) {
|
|
44
|
+
idxA = DEFAULT_SORT_ORDER.length;
|
|
45
|
+
}
|
|
46
|
+
if (idxB === -1) {
|
|
47
|
+
idxB = DEFAULT_SORT_ORDER.length;
|
|
48
|
+
}
|
|
49
|
+
return idxA - idxB;
|
|
50
|
+
};
|
|
51
|
+
var ActionBlockOld = function ActionBlockOld(_ref) {
|
|
52
|
+
var blockRef = _ref.blockRef,
|
|
53
|
+
onClickCallback = _ref.onClick,
|
|
54
|
+
size = _ref.size,
|
|
55
|
+
spaceInline = _ref.spaceInline,
|
|
56
|
+
_ref$testId = _ref.testId,
|
|
57
|
+
testId = _ref$testId === void 0 ? 'smart-block-action' : _ref$testId;
|
|
58
|
+
var context = (0, _flexibleUiContext.useFlexibleUiContext)();
|
|
59
|
+
var ui = (0, _flexibleUiContext.useFlexibleUiOptionContext)();
|
|
60
|
+
var _useState = (0, _react.useState)(),
|
|
61
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
62
|
+
message = _useState2[0],
|
|
63
|
+
setMessage = _useState2[1];
|
|
64
|
+
var _useState3 = (0, _react.useState)(false),
|
|
65
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
66
|
+
isLoading = _useState4[0],
|
|
67
|
+
setIsLoading = _useState4[1];
|
|
68
|
+
var onLoadingChange = (0, _react.useCallback)(function (isLoading) {
|
|
69
|
+
setIsLoading(isLoading);
|
|
70
|
+
}, [setIsLoading]);
|
|
71
|
+
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;
|
|
72
|
+
var _onClick = (0, _react.useCallback)(function (name) {
|
|
73
|
+
setMessage(undefined);
|
|
74
|
+
onClickCallback === null || onClickCallback === void 0 || onClickCallback(name);
|
|
75
|
+
}, [onClickCallback]);
|
|
76
|
+
var onError = (0, _react.useCallback)(function (error) {
|
|
77
|
+
setMessage(error);
|
|
78
|
+
}, []);
|
|
79
|
+
var actions = (0, _react.useMemo)(function () {
|
|
80
|
+
if (!(context !== null && context !== void 0 && context.actions)) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
var arr = Object.keys(context.actions);
|
|
84
|
+
arr.sort(sort);
|
|
85
|
+
return arr.map(function (name) {
|
|
86
|
+
var Action = name in Actions ? Actions[name] : undefined;
|
|
87
|
+
return Action ? (0, _react2.jsx)(Action, {
|
|
88
|
+
as: "stack-item",
|
|
89
|
+
spaceInline: spaceInline,
|
|
90
|
+
key: name,
|
|
91
|
+
onClick: function onClick() {
|
|
92
|
+
return _onClick(name);
|
|
93
|
+
},
|
|
94
|
+
onError: onError,
|
|
95
|
+
onLoadingChange: onLoadingChange,
|
|
96
|
+
size: size
|
|
97
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
98
|
+
,
|
|
99
|
+
xcss: (0, _primitives.xcss)({
|
|
100
|
+
paddingInline: padding
|
|
101
|
+
}),
|
|
102
|
+
hideTooltip: isLoading
|
|
103
|
+
}) : null;
|
|
104
|
+
});
|
|
105
|
+
}, [context === null || context === void 0 ? void 0 : context.actions, _onClick, onError, padding, size, spaceInline, isLoading, onLoadingChange]);
|
|
106
|
+
return actions ? (0, _react2.jsx)("div", {
|
|
107
|
+
css: ignoreContainerPaddingStyles,
|
|
108
|
+
ref: blockRef,
|
|
109
|
+
"data-testid": testId
|
|
110
|
+
}, actions, (0, _react2.jsx)(_actionFooter.ActionFooter, {
|
|
111
|
+
message: message,
|
|
112
|
+
paddingInline: padding,
|
|
113
|
+
testId: testId
|
|
114
|
+
})) : null;
|
|
115
|
+
};
|
|
116
|
+
var _default = exports.default = ActionBlockOld;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
._16jlkb7n{flex-grow:1}
|
|
2
|
+
._18u01ivi{margin-left:calc(var(--container-gap-left)*-1)}
|
|
3
|
+
._1bsb1osq{width:100%}
|
|
4
|
+
._1e0c1txw{display:flex}
|
|
5
|
+
._2hwxc10g{margin-right:calc(var(--container-gap-right)*-1)}
|
|
6
|
+
._2lx21bp4{flex-direction:column}
|
|
7
|
+
._vchhusvi{box-sizing:border-box}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.35.0 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -6,36 +7,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
7
|
value: true
|
|
7
8
|
});
|
|
8
9
|
exports.default = void 0;
|
|
10
|
+
require("./index.compiled.css");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
13
|
+
var _runtime = require("@compiled/react/runtime");
|
|
9
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
var _react2 = require("@emotion/react");
|
|
12
15
|
var _reactMagneticDi = require("react-magnetic-di");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
17
|
var _primitives = require("@atlaskit/primitives");
|
|
14
18
|
var _constants = require("../../../../../constants");
|
|
15
19
|
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
16
20
|
var Actions = _interopRequireWildcard(require("../../actions"));
|
|
17
21
|
var _utils = require("../../utils");
|
|
18
22
|
var _actionFooter = require("./action-footer");
|
|
23
|
+
var _ActionBlockOld = _interopRequireDefault(require("./ActionBlockOld"));
|
|
19
24
|
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); }
|
|
20
25
|
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; }
|
|
21
|
-
|
|
22
|
-
* @jsxRuntime classic
|
|
23
|
-
* @jsx jsx
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
27
|
-
|
|
28
|
-
var ignoreContainerPaddingStyles = (0, _react2.css)({
|
|
29
|
-
display: 'flex',
|
|
30
|
-
flexDirection: 'column',
|
|
31
|
-
boxSizing: 'border-box',
|
|
32
|
-
flexGrow: 1,
|
|
33
|
-
width: '100%',
|
|
34
|
-
// We have to find a better way to ignore container padding
|
|
35
|
-
// This has become more and more of a common use case.
|
|
36
|
-
marginLeft: 'calc(var(--container-gap-left) * -1)',
|
|
37
|
-
marginRight: 'calc(var(--container-gap-right) * -1)'
|
|
38
|
-
});
|
|
26
|
+
var ignoreContainerPaddingStyles = null;
|
|
39
27
|
var DEFAULT_SORT_ORDER = ['PreviewAction', 'CopyLinkAction', 'AISummaryAction'];
|
|
40
28
|
var sort = function sort(a, b) {
|
|
41
29
|
var idxA = DEFAULT_SORT_ORDER.indexOf(a);
|
|
@@ -48,7 +36,7 @@ var sort = function sort(a, b) {
|
|
|
48
36
|
}
|
|
49
37
|
return idxA - idxB;
|
|
50
38
|
};
|
|
51
|
-
var
|
|
39
|
+
var ActionBlockNew = function ActionBlockNew(_ref) {
|
|
52
40
|
var blockRef = _ref.blockRef,
|
|
53
41
|
onClickCallback = _ref.onClick,
|
|
54
42
|
size = _ref.size,
|
|
@@ -84,7 +72,7 @@ var ActionBlock = function ActionBlock(_ref) {
|
|
|
84
72
|
arr.sort(sort);
|
|
85
73
|
return arr.map(function (name) {
|
|
86
74
|
var Action = name in Actions ? Actions[name] : undefined;
|
|
87
|
-
return Action ?
|
|
75
|
+
return Action ? /*#__PURE__*/React.createElement(Action, {
|
|
88
76
|
as: "stack-item",
|
|
89
77
|
spaceInline: spaceInline,
|
|
90
78
|
key: name,
|
|
@@ -103,14 +91,21 @@ var ActionBlock = function ActionBlock(_ref) {
|
|
|
103
91
|
}) : null;
|
|
104
92
|
});
|
|
105
93
|
}, [context === null || context === void 0 ? void 0 : context.actions, _onClick, onError, padding, size, spaceInline, isLoading, onLoadingChange]);
|
|
106
|
-
return actions ?
|
|
107
|
-
css: ignoreContainerPaddingStyles,
|
|
94
|
+
return actions ? /*#__PURE__*/React.createElement("div", {
|
|
108
95
|
ref: blockRef,
|
|
109
|
-
"data-testid": testId
|
|
110
|
-
|
|
96
|
+
"data-testid": testId,
|
|
97
|
+
className: (0, _runtime.ax)(["_1e0c1txw _2lx21bp4 _vchhusvi _16jlkb7n _1bsb1osq _18u01ivi _2hwxc10g"])
|
|
98
|
+
}, actions, /*#__PURE__*/React.createElement(_actionFooter.ActionFooter, {
|
|
111
99
|
message: message,
|
|
112
100
|
paddingInline: padding,
|
|
113
101
|
testId: testId
|
|
114
102
|
})) : null;
|
|
115
103
|
};
|
|
104
|
+
var ActionBlock = function ActionBlock(props) {
|
|
105
|
+
if ((0, _platformFeatureFlags.fg)('bandicoots-compiled-migration-smartcard')) {
|
|
106
|
+
return /*#__PURE__*/React.createElement(ActionBlockNew, props);
|
|
107
|
+
} else {
|
|
108
|
+
return /*#__PURE__*/React.createElement(_ActionBlockOld.default, props);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
116
111
|
var _default = exports.default = ActionBlock;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
|
+
var _reactIntlNext = require("react-intl-next");
|
|
14
|
+
var _reactMagneticDi = require("react-magnetic-di");
|
|
15
|
+
var _buttonGroup = _interopRequireDefault(require("@atlaskit/button/button-group"));
|
|
16
|
+
var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
|
|
17
|
+
var _dropdownMenu = _interopRequireDefault(require("@atlaskit/dropdown-menu"));
|
|
18
|
+
var _showMoreHorizontalMore = _interopRequireDefault(require("@atlaskit/icon/core/migration/show-more-horizontal--more"));
|
|
19
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
20
|
+
var _constants = require("../../../../../constants");
|
|
21
|
+
var _messages = require("../../../../../messages");
|
|
22
|
+
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
23
|
+
var _utils = require("../../utils");
|
|
24
|
+
var _utils2 = require("../utils");
|
|
25
|
+
var _actionGroupItem = _interopRequireDefault(require("./action-group-item"));
|
|
26
|
+
var _excluded = ["triggerRef"];
|
|
27
|
+
/**
|
|
28
|
+
* @jsxRuntime classic
|
|
29
|
+
* @jsx jsx
|
|
30
|
+
*/
|
|
31
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
32
|
+
var styles = (0, _react2.css)({
|
|
33
|
+
display: 'inline-flex',
|
|
34
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
35
|
+
lineHeight: '1rem',
|
|
36
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
37
|
+
'> div': {
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
40
|
+
'button:focus-visible': {
|
|
41
|
+
outlineOffset: "var(--ds-space-negative-025, -2px)"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
var renderActionItems = function renderActionItems() {
|
|
46
|
+
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
47
|
+
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.SmartLinkSize.Medium;
|
|
48
|
+
var appearance = arguments.length > 2 ? arguments[2] : undefined;
|
|
49
|
+
var asDropDownItems = arguments.length > 3 ? arguments[3] : undefined;
|
|
50
|
+
var onActionItemClick = arguments.length > 4 ? arguments[4] : undefined;
|
|
51
|
+
return items.map(function (item, idx) {
|
|
52
|
+
return (0, _react2.jsx)(_actionGroupItem.default, {
|
|
53
|
+
item: item,
|
|
54
|
+
key: idx,
|
|
55
|
+
size: size,
|
|
56
|
+
appearance: appearance,
|
|
57
|
+
asDropDownItems: asDropDownItems,
|
|
58
|
+
onActionItemClick: onActionItemClick
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
65
|
+
* preferences.
|
|
66
|
+
* @internal
|
|
67
|
+
* @param {ActionGroupProps} ActionGroupProps
|
|
68
|
+
* @see Action
|
|
69
|
+
*/
|
|
70
|
+
var ActionGroupOld = function ActionGroupOld(_ref) {
|
|
71
|
+
var _ref$items = _ref.items,
|
|
72
|
+
items = _ref$items === void 0 ? [] : _ref$items,
|
|
73
|
+
_ref$size = _ref.size,
|
|
74
|
+
size = _ref$size === void 0 ? _constants.SmartLinkSize.Medium : _ref$size,
|
|
75
|
+
appearance = _ref.appearance,
|
|
76
|
+
_ref$visibleButtonsNu = _ref.visibleButtonsNum,
|
|
77
|
+
visibleButtonsNum = _ref$visibleButtonsNu === void 0 ? 2 : _ref$visibleButtonsNu,
|
|
78
|
+
onDropdownOpenChange = _ref.onDropdownOpenChange;
|
|
79
|
+
var context = (0, _flexibleUiContext.useFlexibleUiContext)();
|
|
80
|
+
var ui = (0, _flexibleUiContext.useFlexibleUiOptionContext)();
|
|
81
|
+
var _useState = (0, _react.useState)(false),
|
|
82
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
83
|
+
isOpen = _useState2[0],
|
|
84
|
+
setIsOpen = _useState2[1];
|
|
85
|
+
var renderableActionItems = (0, _react.useMemo)(function () {
|
|
86
|
+
return (0, _utils2.filterActionItems)(items, context);
|
|
87
|
+
}, [context, items]);
|
|
88
|
+
var isMoreThenTwoItems = renderableActionItems.length > visibleButtonsNum;
|
|
89
|
+
var onOpenChange = (0, _react.useCallback)(function (attrs) {
|
|
90
|
+
setIsOpen(attrs.isOpen);
|
|
91
|
+
if (onDropdownOpenChange) {
|
|
92
|
+
onDropdownOpenChange(attrs.isOpen);
|
|
93
|
+
}
|
|
94
|
+
}, [onDropdownOpenChange]);
|
|
95
|
+
var onActionItemClick = (0, _react.useCallback)(function () {
|
|
96
|
+
if (isOpen) {
|
|
97
|
+
onOpenChange({
|
|
98
|
+
isOpen: false
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}, [isOpen, onOpenChange]);
|
|
102
|
+
var actionButtons = (0, _react.useMemo)(function () {
|
|
103
|
+
var actionItems = isMoreThenTwoItems ? renderableActionItems.slice(0, visibleButtonsNum - 1) : renderableActionItems;
|
|
104
|
+
return renderActionItems(actionItems, size, appearance, false, onActionItemClick);
|
|
105
|
+
}, [appearance, isMoreThenTwoItems, onActionItemClick, renderableActionItems, size, visibleButtonsNum]);
|
|
106
|
+
var moreActionDropdown = (0, _react.useMemo)(function () {
|
|
107
|
+
var actionItems = isMoreThenTwoItems ? renderableActionItems.slice(visibleButtonsNum - 1) : [];
|
|
108
|
+
if (actionItems.length > 0) {
|
|
109
|
+
var spacing = _utils.sizeToButtonSpacing[size];
|
|
110
|
+
var moreIcon = (0, _react2.jsx)(_showMoreHorizontalMore.default, {
|
|
111
|
+
label: "more",
|
|
112
|
+
color: "currentColor"
|
|
113
|
+
});
|
|
114
|
+
var formatMessage = (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.messages.more_actions);
|
|
115
|
+
return (0, _react2.jsx)(_dropdownMenu.default, {
|
|
116
|
+
isOpen: isOpen,
|
|
117
|
+
onOpenChange: onOpenChange,
|
|
118
|
+
trigger: function trigger(_ref2) {
|
|
119
|
+
var triggerRef = _ref2.triggerRef,
|
|
120
|
+
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
121
|
+
return (0, _react2.jsx)(_tooltip.default, {
|
|
122
|
+
content: formatMessage,
|
|
123
|
+
hideTooltipOnClick: true,
|
|
124
|
+
testId: "action-group-more-button-tooltip",
|
|
125
|
+
tag: "span"
|
|
126
|
+
}, (0, _react2.jsx)(_standardButton.default, (0, _extends2.default)({}, props, {
|
|
127
|
+
spacing: spacing,
|
|
128
|
+
testId: "action-group-more-button",
|
|
129
|
+
iconBefore: moreIcon,
|
|
130
|
+
ref: triggerRef
|
|
131
|
+
})));
|
|
132
|
+
},
|
|
133
|
+
testId: "action-group-dropdown",
|
|
134
|
+
zIndex: ui === null || ui === void 0 ? void 0 : ui.zIndex
|
|
135
|
+
}, renderActionItems(actionItems, size, appearance, true, onActionItemClick));
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
138
|
+
}, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum]);
|
|
139
|
+
return renderableActionItems.length > 0 ? (0, _react2.jsx)("div", {
|
|
140
|
+
css: styles
|
|
141
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
142
|
+
,
|
|
143
|
+
className: "actions-button-group",
|
|
144
|
+
"data-action-open": isOpen
|
|
145
|
+
}, (0, _react2.jsx)(_buttonGroup.default, null, actionButtons, moreActionDropdown)) : null;
|
|
146
|
+
};
|
|
147
|
+
var _default = exports.default = ActionGroupOld;
|
package/dist/cjs/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js
CHANGED
|
@@ -9,15 +9,9 @@ exports.default = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
-
var _react = require("react");
|
|
13
|
-
var _react2 = require("@emotion/react");
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
13
|
var Actions = _interopRequireWildcard(require("../../../actions"));
|
|
15
14
|
var _excluded = ["name", "hideContent", "hideIcon", "onClick", "isDisabled"];
|
|
16
|
-
/**
|
|
17
|
-
* @jsxRuntime classic
|
|
18
|
-
* @jsx jsx
|
|
19
|
-
*/
|
|
20
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
21
15
|
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); }
|
|
22
16
|
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; }
|
|
23
17
|
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; }
|
|
@@ -56,7 +50,7 @@ var ActionGroupItem = function ActionGroupItem(_ref) {
|
|
|
56
50
|
if (item !== null && item !== void 0 && item.entryPointWrapper) {
|
|
57
51
|
actionProps.wrapper = item.entryPointWrapper;
|
|
58
52
|
}
|
|
59
|
-
return
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(Action, (0, _extends2.default)({
|
|
60
54
|
asDropDownItem: asDropDownItems,
|
|
61
55
|
size: size,
|
|
62
56
|
appearance: appearance,
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.35.0 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
6
|
Object.defineProperty(exports, "__esModule", {
|
|
5
7
|
value: true
|
|
6
8
|
});
|
|
7
9
|
exports.default = void 0;
|
|
10
|
+
require("./index.compiled.css");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
13
|
+
var _runtime = require("@compiled/react/runtime");
|
|
8
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
15
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
var _react = require("react");
|
|
12
|
-
var _react2 = require("@emotion/react");
|
|
13
17
|
var _reactIntlNext = require("react-intl-next");
|
|
14
18
|
var _reactMagneticDi = require("react-magnetic-di");
|
|
15
19
|
var _buttonGroup = _interopRequireDefault(require("@atlaskit/button/button-group"));
|
|
16
20
|
var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
|
|
17
21
|
var _dropdownMenu = _interopRequireDefault(require("@atlaskit/dropdown-menu"));
|
|
18
22
|
var _showMoreHorizontalMore = _interopRequireDefault(require("@atlaskit/icon/core/migration/show-more-horizontal--more"));
|
|
23
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
24
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
20
25
|
var _constants = require("../../../../../constants");
|
|
21
26
|
var _messages = require("../../../../../messages");
|
|
@@ -23,25 +28,11 @@ var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
|
23
28
|
var _utils = require("../../utils");
|
|
24
29
|
var _utils2 = require("../utils");
|
|
25
30
|
var _actionGroupItem = _interopRequireDefault(require("./action-group-item"));
|
|
31
|
+
var _ActionGroupOld = _interopRequireDefault(require("./ActionGroupOld"));
|
|
26
32
|
var _excluded = ["triggerRef"];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*/
|
|
31
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
32
|
-
var styles = (0, _react2.css)({
|
|
33
|
-
display: 'inline-flex',
|
|
34
|
-
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
35
|
-
lineHeight: '1rem',
|
|
36
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
37
|
-
'> div': {
|
|
38
|
-
alignItems: 'center',
|
|
39
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
40
|
-
'button:focus-visible': {
|
|
41
|
-
outlineOffset: "var(--ds-space-negative-025, -2px)"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
});
|
|
33
|
+
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); }
|
|
34
|
+
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; }
|
|
35
|
+
var styles = null;
|
|
45
36
|
var renderActionItems = function renderActionItems() {
|
|
46
37
|
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
47
38
|
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.SmartLinkSize.Medium;
|
|
@@ -49,7 +40,7 @@ var renderActionItems = function renderActionItems() {
|
|
|
49
40
|
var asDropDownItems = arguments.length > 3 ? arguments[3] : undefined;
|
|
50
41
|
var onActionItemClick = arguments.length > 4 ? arguments[4] : undefined;
|
|
51
42
|
return items.map(function (item, idx) {
|
|
52
|
-
return
|
|
43
|
+
return /*#__PURE__*/React.createElement(_actionGroupItem.default, {
|
|
53
44
|
item: item,
|
|
54
45
|
key: idx,
|
|
55
46
|
size: size,
|
|
@@ -67,7 +58,7 @@ var renderActionItems = function renderActionItems() {
|
|
|
67
58
|
* @param {ActionGroupProps} ActionGroupProps
|
|
68
59
|
* @see Action
|
|
69
60
|
*/
|
|
70
|
-
var
|
|
61
|
+
var ActionGroupNew = function ActionGroupNew(_ref) {
|
|
71
62
|
var _ref$items = _ref.items,
|
|
72
63
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
73
64
|
_ref$size = _ref.size,
|
|
@@ -107,23 +98,23 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
107
98
|
var actionItems = isMoreThenTwoItems ? renderableActionItems.slice(visibleButtonsNum - 1) : [];
|
|
108
99
|
if (actionItems.length > 0) {
|
|
109
100
|
var spacing = _utils.sizeToButtonSpacing[size];
|
|
110
|
-
var moreIcon =
|
|
101
|
+
var moreIcon = /*#__PURE__*/React.createElement(_showMoreHorizontalMore.default, {
|
|
111
102
|
label: "more",
|
|
112
103
|
color: "currentColor"
|
|
113
104
|
});
|
|
114
|
-
var formatMessage =
|
|
115
|
-
return
|
|
105
|
+
var formatMessage = /*#__PURE__*/React.createElement(_reactIntlNext.FormattedMessage, _messages.messages.more_actions);
|
|
106
|
+
return /*#__PURE__*/React.createElement(_dropdownMenu.default, {
|
|
116
107
|
isOpen: isOpen,
|
|
117
108
|
onOpenChange: onOpenChange,
|
|
118
109
|
trigger: function trigger(_ref2) {
|
|
119
110
|
var triggerRef = _ref2.triggerRef,
|
|
120
111
|
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
121
|
-
return
|
|
112
|
+
return /*#__PURE__*/React.createElement(_tooltip.default, {
|
|
122
113
|
content: formatMessage,
|
|
123
114
|
hideTooltipOnClick: true,
|
|
124
115
|
testId: "action-group-more-button-tooltip",
|
|
125
116
|
tag: "span"
|
|
126
|
-
},
|
|
117
|
+
}, /*#__PURE__*/React.createElement(_standardButton.default, (0, _extends2.default)({}, props, {
|
|
127
118
|
spacing: spacing,
|
|
128
119
|
testId: "action-group-more-button",
|
|
129
120
|
iconBefore: moreIcon,
|
|
@@ -136,12 +127,17 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
136
127
|
}
|
|
137
128
|
return null;
|
|
138
129
|
}, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum]);
|
|
139
|
-
return renderableActionItems.length > 0 ?
|
|
140
|
-
css: styles
|
|
130
|
+
return renderableActionItems.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
141
131
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
142
|
-
,
|
|
143
|
-
className: "actions-button-group",
|
|
132
|
+
className: (0, _runtime.ax)(["_1e0c116y _vwz41j6v _dzc21h6o _1ilq1i6y", "actions-button-group"]),
|
|
144
133
|
"data-action-open": isOpen
|
|
145
|
-
},
|
|
134
|
+
}, /*#__PURE__*/React.createElement(_buttonGroup.default, null, actionButtons, moreActionDropdown)) : null;
|
|
135
|
+
};
|
|
136
|
+
var ActionGroup = function ActionGroup(props) {
|
|
137
|
+
if ((0, _platformFeatureFlags.fg)('bandicoots-compiled-migration-smartcard')) {
|
|
138
|
+
return /*#__PURE__*/React.createElement(ActionGroupNew, props);
|
|
139
|
+
} else {
|
|
140
|
+
return /*#__PURE__*/React.createElement(_ActionGroupOld.default, props);
|
|
141
|
+
}
|
|
146
142
|
};
|
|
147
143
|
var _default = exports.default = ActionGroup;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _react2 = require("@emotion/react");
|
|
9
|
+
var _storageClient = require("@atlaskit/frontend-utilities/storage-client");
|
|
10
|
+
var _styled = require("./styled");
|
|
11
|
+
/**
|
|
12
|
+
* @jsxRuntime classic
|
|
13
|
+
* @jsx jsx
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
17
|
+
|
|
18
|
+
var LOCAL_STORAGE_CLIENT_KEY = '@atlaskit/smart-card';
|
|
19
|
+
var LOCAL_STORAGE_DISCOVERY_KEY = 'action-discovery-ai-summarise';
|
|
20
|
+
var LOCAL_STORAGE_DISCOVERY_VALUE = 'discovered';
|
|
21
|
+
var LOCAL_STORAGE_DISCOVERY_EXPIRY_IN_MS = 15552000000; // 180 days
|
|
22
|
+
var LOCAL_STORAGE_DISCOVERY_REQUIRED_TIME = 2000;
|
|
23
|
+
/**
|
|
24
|
+
* This is a hacky solution to help with the feature discovery.
|
|
25
|
+
* This implementation must be removed once the experiment is completed.
|
|
26
|
+
* Cleanup on https://product-fabric.atlassian.net/browse/EDM-9649
|
|
27
|
+
*/
|
|
28
|
+
var FeatureDiscoveryOld = function FeatureDiscoveryOld(_ref) {
|
|
29
|
+
var children = _ref.children,
|
|
30
|
+
testId = _ref.testId;
|
|
31
|
+
var renderedTime = (0, _react.useRef)();
|
|
32
|
+
var storageClient = (0, _react.useMemo)(function () {
|
|
33
|
+
return new _storageClient.StorageClient(LOCAL_STORAGE_CLIENT_KEY);
|
|
34
|
+
}, []);
|
|
35
|
+
var discovered = (0, _react.useMemo)(function () {
|
|
36
|
+
try {
|
|
37
|
+
return storageClient.getItem(LOCAL_STORAGE_DISCOVERY_KEY) === LOCAL_STORAGE_DISCOVERY_VALUE;
|
|
38
|
+
} catch (_unused) {
|
|
39
|
+
// If localStorage is not available, don't show feature discovery component. Treat it as 'discovered'.
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
}, [storageClient]);
|
|
43
|
+
(0, _react.useEffect)(function () {
|
|
44
|
+
renderedTime.current = Date.now();
|
|
45
|
+
return function () {
|
|
46
|
+
if (!discovered && renderedTime.current) {
|
|
47
|
+
var duration = Date.now() - renderedTime.current;
|
|
48
|
+
if (duration > LOCAL_STORAGE_DISCOVERY_REQUIRED_TIME) {
|
|
49
|
+
try {
|
|
50
|
+
storageClient.setItemWithExpiry(LOCAL_STORAGE_DISCOVERY_KEY, LOCAL_STORAGE_DISCOVERY_VALUE, LOCAL_STORAGE_DISCOVERY_EXPIRY_IN_MS);
|
|
51
|
+
} catch (_unused2) {
|
|
52
|
+
// silent error
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}, [storageClient, discovered]);
|
|
58
|
+
var component = (0, _react.useMemo)(function () {
|
|
59
|
+
if (!discovered) {
|
|
60
|
+
return (
|
|
61
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
62
|
+
(0, _react2.jsx)("span", {
|
|
63
|
+
css: (0, _styled.getPulseStyles)(),
|
|
64
|
+
"data-testid": "".concat(testId, "-discovery")
|
|
65
|
+
}, children)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}, [children, discovered, testId]);
|
|
69
|
+
return component !== null && component !== void 0 ? component : children;
|
|
70
|
+
};
|
|
71
|
+
var _default = exports.default = FeatureDiscoveryOld;
|