@atlaskit/smart-card 23.13.2 → 23.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +3 -2
- package/dist/cjs/view/CardWithUrl/loader.js +2 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +88 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +90 -42
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +5 -69
- package/dist/cjs/view/FlexibleCard/index.js +3 -1
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +27 -25
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +3 -2
- package/dist/es2019/view/CardWithUrl/loader.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +64 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +75 -34
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +3 -56
- package/dist/es2019/view/FlexibleCard/index.js +2 -2
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +24 -22
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/CardWithUrl/component.js +3 -2
- package/dist/esm/view/CardWithUrl/loader.js +2 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +69 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +89 -42
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +4 -66
- package/dist/esm/view/FlexibleCard/index.js +4 -2
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +27 -25
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/Card/types.d.ts +1 -0
- package/dist/types/view/CardWithUrl/component.d.ts +1 -1
- package/dist/types/view/CardWithUrl/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-group/action-group-item/index.d.ts +12 -0
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +2 -3
- package/package.json +2 -2
- package/report.api.md +3 -0
- package/tmp/api-report-tmp.d.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 23.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`eb2e7a0e762`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eb2e7a0e762) - Add new "showAuthTooltip" prop to SmartCard which shows Auth Tooltip on unauthorised inline Smart Links. This allows us to remove product feature flags in the future
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 23.13.3
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`e5b8a41f4da`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e5b8a41f4da) - Hover Preview: Reduce hover content re-rendering
|
|
18
|
+
|
|
3
19
|
## 23.13.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cjs/version.json
CHANGED
|
@@ -58,6 +58,7 @@ function CardWithUrlContent(_ref) {
|
|
|
58
58
|
ui = _ref.ui,
|
|
59
59
|
children = _ref.children,
|
|
60
60
|
showHoverPreview = _ref.showHoverPreview,
|
|
61
|
+
showAuthTooltipProp = _ref.showAuthTooltip,
|
|
61
62
|
analyticsEvents = _ref.analyticsEvents;
|
|
62
63
|
|
|
63
64
|
// Get state, actions for this card.
|
|
@@ -79,8 +80,8 @@ function CardWithUrlContent(_ref) {
|
|
|
79
80
|
var isFlexibleUi = (0, _react.useMemo)(function () {
|
|
80
81
|
return (0, _flexible.isFlexibleUiCard)(children);
|
|
81
82
|
}, [children]);
|
|
82
|
-
var
|
|
83
|
-
var showAuthTooltip =
|
|
83
|
+
var showAuthTooltipFeatureFlagValue = (0, _linkProvider.useFeatureFlag)('showAuthTooltip');
|
|
84
|
+
var showAuthTooltip = showAuthTooltipFeatureFlagValue !== undefined ? showAuthTooltipFeatureFlagValue === 'experiment' : showAuthTooltipProp;
|
|
84
85
|
var enableFlexibleBlockCardFlag = Boolean((0, _linkProvider.useFeatureFlag)('enableFlexibleBlockCard')); // Setup UI handlers.
|
|
85
86
|
|
|
86
87
|
var handleClick = (0, _react.useCallback)(function (event) {
|
|
@@ -71,6 +71,7 @@ function CardWithURLRenderer(props) {
|
|
|
71
71
|
children = props.children,
|
|
72
72
|
ui = props.ui,
|
|
73
73
|
showHoverPreview = props.showHoverPreview,
|
|
74
|
+
showAuthTooltip = props.showAuthTooltip,
|
|
74
75
|
analyticsEvents = props.analyticsEvents,
|
|
75
76
|
placeholder = props.placeholder; // Wrapper around analytics.
|
|
76
77
|
|
|
@@ -139,6 +140,7 @@ function CardWithURLRenderer(props) {
|
|
|
139
140
|
inlinePreloaderStyle: inlinePreloaderStyle,
|
|
140
141
|
ui: ui,
|
|
141
142
|
showHoverPreview: showHoverPreview,
|
|
143
|
+
showAuthTooltip: showAuthTooltip,
|
|
142
144
|
analyticsEvents: analyticsEvents,
|
|
143
145
|
placeholder: placeholder
|
|
144
146
|
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
+
|
|
18
|
+
var _react = require("@emotion/react");
|
|
19
|
+
|
|
20
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
22
|
+
var Actions = _interopRequireWildcard(require("../../../actions"));
|
|
23
|
+
|
|
24
|
+
var _utils = require("../../utils");
|
|
25
|
+
|
|
26
|
+
var _excluded = ["name", "hideContent", "hideIcon", "onClick"];
|
|
27
|
+
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
32
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
+
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
|
+
|
|
36
|
+
var ActionGroupItem = function ActionGroupItem(_ref) {
|
|
37
|
+
var item = _ref.item,
|
|
38
|
+
size = _ref.size,
|
|
39
|
+
appearance = _ref.appearance,
|
|
40
|
+
asDropDownItems = _ref.asDropDownItems,
|
|
41
|
+
onActionItemClick = _ref.onActionItemClick;
|
|
42
|
+
var name = item.name,
|
|
43
|
+
hideContent = item.hideContent,
|
|
44
|
+
hideIcon = item.hideIcon,
|
|
45
|
+
onClick = item.onClick,
|
|
46
|
+
props = (0, _objectWithoutProperties2.default)(item, _excluded);
|
|
47
|
+
var handleOnClick = (0, _react2.useCallback)(function () {
|
|
48
|
+
if (onActionItemClick) {
|
|
49
|
+
onActionItemClick();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (onClick) {
|
|
53
|
+
onClick();
|
|
54
|
+
}
|
|
55
|
+
}, [onActionItemClick, onClick]);
|
|
56
|
+
var Action = Actions[name];
|
|
57
|
+
|
|
58
|
+
if (!Action) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var actionProps = _objectSpread({}, props);
|
|
63
|
+
|
|
64
|
+
if (hideContent && !asDropDownItems) {
|
|
65
|
+
actionProps.content = '';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (hideIcon) {
|
|
69
|
+
actionProps.icon = undefined;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
var action = (0, _react.jsx)(Action, (0, _extends2.default)({
|
|
73
|
+
url: "",
|
|
74
|
+
asDropDownItem: asDropDownItems,
|
|
75
|
+
size: size,
|
|
76
|
+
appearance: appearance,
|
|
77
|
+
onClick: handleOnClick
|
|
78
|
+
}, actionProps));
|
|
79
|
+
|
|
80
|
+
if (!(0, _utils.isJSXElementNull)(action)) {
|
|
81
|
+
return action;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return null;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
var _default = ActionGroupItem;
|
|
88
|
+
exports.default = _default;
|
|
@@ -25,8 +25,6 @@ var _buttonGroup = _interopRequireDefault(require("@atlaskit/button/button-group
|
|
|
25
25
|
|
|
26
26
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
27
27
|
|
|
28
|
-
var _utils = require("../utils");
|
|
29
|
-
|
|
30
28
|
var _dropdownMenu = _interopRequireDefault(require("@atlaskit/dropdown-menu"));
|
|
31
29
|
|
|
32
30
|
var _constants = require("../../../../../constants");
|
|
@@ -35,17 +33,61 @@ var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-
|
|
|
35
33
|
|
|
36
34
|
var _more = _interopRequireDefault(require("@atlaskit/icon/glyph/more"));
|
|
37
35
|
|
|
38
|
-
var
|
|
36
|
+
var _utils = require("../../utils");
|
|
39
37
|
|
|
40
38
|
var _token = require("../../../../../utils/token");
|
|
41
39
|
|
|
42
40
|
var _messages = require("../../../../../messages");
|
|
43
41
|
|
|
42
|
+
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
43
|
+
|
|
44
|
+
var _actionGroupItem = _interopRequireDefault(require("./action-group-item"));
|
|
45
|
+
|
|
44
46
|
var _excluded = ["triggerRef"];
|
|
45
47
|
|
|
46
48
|
var _templateObject;
|
|
47
49
|
|
|
48
50
|
var styles = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: inline-flex;\n line-height: 1rem;\n > div {\n align-items: center;\n button:focus {\n // AK button removes the default browser outline on focus and apply\n // box-shadow styling to create the outline appearance.\n // Due to our container elements (Container/Block/ElementGroup) has\n // overflow hidden to prevent the metadata element from leaking outside\n // of its container, the box-shadow doesn't show properly.\n // Invert the AK box-shadow styling.\n box-shadow: inset 0 0 0 2px ", ";\n }\n }\n"])), _token.tokens.focus);
|
|
51
|
+
|
|
52
|
+
var renderActionItems = function renderActionItems() {
|
|
53
|
+
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
54
|
+
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.SmartLinkSize.Medium;
|
|
55
|
+
var appearance = arguments.length > 2 ? arguments[2] : undefined;
|
|
56
|
+
var asDropDownItems = arguments.length > 3 ? arguments[3] : undefined;
|
|
57
|
+
var onActionItemClick = arguments.length > 4 ? arguments[4] : undefined;
|
|
58
|
+
return items.map(function (item, idx) {
|
|
59
|
+
return (0, _react2.jsx)(_actionGroupItem.default, {
|
|
60
|
+
item: item,
|
|
61
|
+
key: idx,
|
|
62
|
+
size: size,
|
|
63
|
+
appearance: appearance,
|
|
64
|
+
asDropDownItems: asDropDownItems,
|
|
65
|
+
onActionItemClick: onActionItemClick
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
var filterActionItems = function filterActionItems() {
|
|
71
|
+
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
72
|
+
var context = arguments.length > 1 ? arguments[1] : undefined;
|
|
73
|
+
return items.filter(function (item) {
|
|
74
|
+
switch (item.name) {
|
|
75
|
+
// Action that require data from the data context to render.
|
|
76
|
+
case _constants.ActionName.DownloadAction:
|
|
77
|
+
return Boolean(context === null || context === void 0 ? void 0 : context.downloadAction);
|
|
78
|
+
|
|
79
|
+
case _constants.ActionName.PreviewAction:
|
|
80
|
+
return Boolean(context === null || context === void 0 ? void 0 : context.previewAction);
|
|
81
|
+
|
|
82
|
+
case _constants.ActionName.ViewAction:
|
|
83
|
+
return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
|
|
84
|
+
|
|
85
|
+
default:
|
|
86
|
+
// Named and custom actions that user defines.
|
|
87
|
+
return Boolean(_constants.ActionName[item.name]);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
};
|
|
49
91
|
/**
|
|
50
92
|
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
51
93
|
* preferences.
|
|
@@ -54,6 +96,7 @@ var styles = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedT
|
|
|
54
96
|
* @see Action
|
|
55
97
|
*/
|
|
56
98
|
|
|
99
|
+
|
|
57
100
|
var ActionGroup = function ActionGroup(_ref) {
|
|
58
101
|
var _ref$items = _ref.items,
|
|
59
102
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
@@ -64,12 +107,17 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
64
107
|
visibleButtonsNum = _ref$visibleButtonsNu === void 0 ? 2 : _ref$visibleButtonsNu,
|
|
65
108
|
onDropdownOpenChange = _ref.onDropdownOpenChange,
|
|
66
109
|
testId = _ref.testId;
|
|
110
|
+
var context = (0, _flexibleUiContext.useFlexibleUiContext)();
|
|
67
111
|
|
|
68
112
|
var _useState = (0, _react.useState)(false),
|
|
69
113
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
70
114
|
isOpen = _useState2[0],
|
|
71
115
|
setIsOpen = _useState2[1];
|
|
72
116
|
|
|
117
|
+
var renderableActionItems = (0, _react.useMemo)(function () {
|
|
118
|
+
return filterActionItems(items, context);
|
|
119
|
+
}, [context, items]);
|
|
120
|
+
var isMoreThenTwoItems = renderableActionItems.length > visibleButtonsNum;
|
|
73
121
|
var onOpenChange = (0, _react.useCallback)(function (attrs) {
|
|
74
122
|
setIsOpen(attrs.isOpen);
|
|
75
123
|
|
|
@@ -77,54 +125,54 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
77
125
|
onDropdownOpenChange(attrs.isOpen);
|
|
78
126
|
}
|
|
79
127
|
}, [onDropdownOpenChange]);
|
|
80
|
-
var
|
|
128
|
+
var onActionItemClick = (0, _react.useCallback)(function () {
|
|
81
129
|
if (isOpen) {
|
|
82
130
|
onOpenChange({
|
|
83
131
|
isOpen: false
|
|
84
132
|
});
|
|
85
133
|
}
|
|
86
134
|
}, [isOpen, onOpenChange]);
|
|
87
|
-
var
|
|
88
|
-
|
|
89
|
-
|
|
135
|
+
var actionButtons = (0, _react.useMemo)(function () {
|
|
136
|
+
var actionItems = isMoreThenTwoItems ? renderableActionItems.slice(0, visibleButtonsNum - 1) : renderableActionItems;
|
|
137
|
+
return renderActionItems(actionItems, size, appearance, false, onActionItemClick);
|
|
138
|
+
}, [appearance, isMoreThenTwoItems, onActionItemClick, renderableActionItems, size, visibleButtonsNum]);
|
|
139
|
+
var moreActionDropdown = (0, _react.useMemo)(function () {
|
|
140
|
+
var actionItems = isMoreThenTwoItems ? renderableActionItems.slice(visibleButtonsNum - 1) : [];
|
|
141
|
+
|
|
142
|
+
if (actionItems.length > 0) {
|
|
143
|
+
var spacing = _utils.sizeToButtonSpacing[size];
|
|
144
|
+
var moreIcon = (0, _react2.jsx)(_more.default, {
|
|
145
|
+
label: "more"
|
|
146
|
+
});
|
|
147
|
+
var formatMessage = (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.messages.more_actions);
|
|
148
|
+
return (0, _react2.jsx)(_dropdownMenu.default, {
|
|
149
|
+
isOpen: isOpen,
|
|
150
|
+
onOpenChange: onOpenChange,
|
|
151
|
+
trigger: function trigger(_ref2) {
|
|
152
|
+
var triggerRef = _ref2.triggerRef,
|
|
153
|
+
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
154
|
+
return (0, _react2.jsx)(_tooltip.default, {
|
|
155
|
+
content: formatMessage,
|
|
156
|
+
hideTooltipOnClick: true,
|
|
157
|
+
testId: "action-group-more-button-tooltip",
|
|
158
|
+
tag: "span"
|
|
159
|
+
}, (0, _react2.jsx)(_standardButton.default, (0, _extends2.default)({}, props, {
|
|
160
|
+
spacing: spacing,
|
|
161
|
+
testId: "action-group-more-button",
|
|
162
|
+
iconBefore: moreIcon,
|
|
163
|
+
ref: triggerRef
|
|
164
|
+
})));
|
|
165
|
+
},
|
|
166
|
+
testId: "action-group-dropdown"
|
|
167
|
+
}, renderActionItems(actionItems, size, appearance, true, onActionItemClick));
|
|
168
|
+
}
|
|
90
169
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var dropdownItems = isMoreThenTwoItems ? renderableActions.slice(visibleButtonsNum - 1) : [];
|
|
95
|
-
return [buttons, dropdownItems];
|
|
96
|
-
}, [renderableActions, visibleButtonsNum]),
|
|
97
|
-
_useMemo2 = (0, _slicedToArray2.default)(_useMemo, 2),
|
|
98
|
-
buttonActions = _useMemo2[0],
|
|
99
|
-
dropdownItemActions = _useMemo2[1];
|
|
100
|
-
|
|
101
|
-
var dropdownMenuElement = (0, _utils.renderActionItems)(dropdownItemActions, size, appearance, true, onActionClick);
|
|
102
|
-
var buttonGroupElement = (0, _utils.renderActionItems)(buttonActions, size, appearance, false, onActionClick);
|
|
103
|
-
return (0, _react2.jsx)("div", {
|
|
170
|
+
return null;
|
|
171
|
+
}, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, visibleButtonsNum]);
|
|
172
|
+
return renderableActionItems.length > 0 ? (0, _react2.jsx)("div", {
|
|
104
173
|
css: styles,
|
|
105
174
|
className: "actions-button-group"
|
|
106
|
-
}, (0, _react2.jsx)(_buttonGroup.default, null,
|
|
107
|
-
isOpen: isOpen,
|
|
108
|
-
onOpenChange: onOpenChange,
|
|
109
|
-
trigger: function trigger(_ref2) {
|
|
110
|
-
var triggerRef = _ref2.triggerRef,
|
|
111
|
-
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
112
|
-
return (0, _react2.jsx)(_tooltip.default, {
|
|
113
|
-
content: (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.messages.more_actions),
|
|
114
|
-
hideTooltipOnClick: true,
|
|
115
|
-
testId: "action-group-more-button-tooltip",
|
|
116
|
-
tag: "span"
|
|
117
|
-
}, (0, _react2.jsx)(_standardButton.default, (0, _extends2.default)({}, props, {
|
|
118
|
-
spacing: _utils2.sizeToButtonSpacing[size],
|
|
119
|
-
testId: "action-group-more-button",
|
|
120
|
-
iconBefore: (0, _react2.jsx)(_more.default, {
|
|
121
|
-
label: "more"
|
|
122
|
-
}),
|
|
123
|
-
ref: triggerRef
|
|
124
|
-
})));
|
|
125
|
-
},
|
|
126
|
-
testId: "action-group-dropdown"
|
|
127
|
-
}, dropdownMenuElement) : null));
|
|
175
|
+
}, (0, _react2.jsx)(_buttonGroup.default, null, actionButtons, moreActionDropdown)) : null;
|
|
128
176
|
};
|
|
129
177
|
|
|
130
178
|
var _default = ActionGroup;
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.renderElementItems = exports.renderChildren = exports.
|
|
10
|
+
exports.renderElementItems = exports.renderChildren = exports.isJSXElementNull = exports.highlightRemoveStyles = exports.getGapSize = exports.getBaseStyles = exports.ElementDisplaySchema = void 0;
|
|
11
11
|
|
|
12
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
13
|
|
|
@@ -27,16 +27,13 @@ var _constants = require("../../../../constants");
|
|
|
27
27
|
|
|
28
28
|
var Elements = _interopRequireWildcard(require("../elements"));
|
|
29
29
|
|
|
30
|
-
var Actions = _interopRequireWildcard(require("../actions"));
|
|
31
|
-
|
|
32
30
|
var _flexible = require("../../../../utils/flexible");
|
|
33
31
|
|
|
34
32
|
var _actionGroup = _interopRequireDefault(require("./action-group"));
|
|
35
33
|
|
|
36
34
|
var _elementGroup = _interopRequireDefault(require("./element-group"));
|
|
37
35
|
|
|
38
|
-
var _excluded = ["name"]
|
|
39
|
-
_excluded2 = ["name", "hideContent", "hideIcon", "onClick"];
|
|
36
|
+
var _excluded = ["name"];
|
|
40
37
|
|
|
41
38
|
var _ElementDisplaySchema, _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
42
39
|
|
|
@@ -44,10 +41,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
44
41
|
|
|
45
42
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
46
43
|
|
|
47
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
48
|
-
|
|
49
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
50
|
-
|
|
51
44
|
var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AttachmentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ChecklistProgress, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CollaboratorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CommentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ViewCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ReactCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.VoteCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.DueOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LatestCommit, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LinkIcon, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Preview, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Priority, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ProgrammingLanguage, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Provider, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SourceBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.TargetBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), _ElementDisplaySchema);
|
|
52
45
|
exports.ElementDisplaySchema = ElementDisplaySchema;
|
|
53
46
|
|
|
@@ -103,6 +96,8 @@ var isJSXElementNull = function isJSXElementNull(children) {
|
|
|
103
96
|
return Boolean(children.type() === null);
|
|
104
97
|
};
|
|
105
98
|
|
|
99
|
+
exports.isJSXElementNull = isJSXElementNull;
|
|
100
|
+
|
|
106
101
|
var isElementOrElementGroup = function isElementOrElementGroup(node) {
|
|
107
102
|
return /*#__PURE__*/_react.default.isValidElement(node) && ((0, _flexible.isFlexibleUiElement)(node) || node.type === _elementGroup.default);
|
|
108
103
|
};
|
|
@@ -150,63 +145,4 @@ var renderElementItems = function renderElementItems() {
|
|
|
150
145
|
}
|
|
151
146
|
};
|
|
152
147
|
|
|
153
|
-
exports.renderElementItems = renderElementItems;
|
|
154
|
-
|
|
155
|
-
var renderActionItems = function renderActionItems() {
|
|
156
|
-
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
157
|
-
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.SmartLinkSize.Medium;
|
|
158
|
-
var appearance = arguments.length > 2 ? arguments[2] : undefined;
|
|
159
|
-
var asDropDownItems = arguments.length > 3 ? arguments[3] : undefined;
|
|
160
|
-
var onActionItemClick = arguments.length > 4 ? arguments[4] : undefined;
|
|
161
|
-
var actions = items.reduce(function (acc, curr, idx) {
|
|
162
|
-
var name = curr.name,
|
|
163
|
-
hideContent = curr.hideContent,
|
|
164
|
-
hideIcon = curr.hideIcon,
|
|
165
|
-
onClick = curr.onClick,
|
|
166
|
-
props = (0, _objectWithoutProperties2.default)(curr, _excluded2);
|
|
167
|
-
var Action = Actions[name];
|
|
168
|
-
|
|
169
|
-
var actionProps = _objectSpread({}, props);
|
|
170
|
-
|
|
171
|
-
if (hideContent && !asDropDownItems) {
|
|
172
|
-
actionProps.content = '';
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (hideIcon) {
|
|
176
|
-
actionProps.icon = undefined;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (Action) {
|
|
180
|
-
var handleOnClick = function handleOnClick() {
|
|
181
|
-
if (onActionItemClick) {
|
|
182
|
-
onActionItemClick();
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (onClick) {
|
|
186
|
-
onClick();
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
var action = /*#__PURE__*/_react.default.createElement(Action, (0, _extends2.default)({
|
|
191
|
-
url: '',
|
|
192
|
-
asDropDownItem: asDropDownItems,
|
|
193
|
-
size: size,
|
|
194
|
-
key: idx,
|
|
195
|
-
appearance: appearance,
|
|
196
|
-
onClick: handleOnClick
|
|
197
|
-
}, actionProps));
|
|
198
|
-
|
|
199
|
-
if (!isJSXElementNull(action)) {
|
|
200
|
-
return [].concat((0, _toConsumableArray2.default)(acc), [action]);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return acc;
|
|
205
|
-
}, []);
|
|
206
|
-
|
|
207
|
-
if (actions.length) {
|
|
208
|
-
return actions;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
exports.renderActionItems = renderActionItems;
|
|
148
|
+
exports.renderElementItems = renderElementItems;
|
|
@@ -47,7 +47,9 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
47
47
|
var cardType = cardState.status,
|
|
48
48
|
details = cardState.details;
|
|
49
49
|
var status = cardType;
|
|
50
|
-
var context = (0,
|
|
50
|
+
var context = (0, _react.useMemo)(function () {
|
|
51
|
+
return (0, _utils.getContextByStatus)(url, status, details, renderers);
|
|
52
|
+
}, [details, renderers, status, url]);
|
|
51
53
|
var retry = (0, _utils.getRetryOptions)(url, status, details, onAuthorize);
|
|
52
54
|
|
|
53
55
|
var _ref2 = context || {},
|
|
@@ -145,6 +145,31 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
145
145
|
hideCard();
|
|
146
146
|
}
|
|
147
147
|
}, [closeOnChildClick, hideCard]);
|
|
148
|
+
var content = (0, _react2.useCallback)(function (_ref2) {
|
|
149
|
+
var update = _ref2.update;
|
|
150
|
+
return (0, _react.jsx)(_HoverCardContent.default, {
|
|
151
|
+
onMouseEnter: initShowCard,
|
|
152
|
+
onMouseLeave: initHideCard,
|
|
153
|
+
analytics: analytics,
|
|
154
|
+
cardActions: linkActions,
|
|
155
|
+
cardState: linkState,
|
|
156
|
+
onActionClick: onActionClick,
|
|
157
|
+
onResolve: update,
|
|
158
|
+
renderers: renderers,
|
|
159
|
+
url: url
|
|
160
|
+
});
|
|
161
|
+
}, [analytics, initHideCard, initShowCard, linkActions, linkState, onActionClick, renderers, url]);
|
|
162
|
+
var trigger = (0, _react2.useCallback)(function (triggerProps) {
|
|
163
|
+
return (0, _react.jsx)("span", {
|
|
164
|
+
ref: parentSpan
|
|
165
|
+
}, (0, _react.jsx)("span", (0, _extends2.default)({}, triggerProps, {
|
|
166
|
+
onMouseEnter: initShowCard,
|
|
167
|
+
onMouseLeave: initHideCard,
|
|
168
|
+
onMouseMove: setMousePosition,
|
|
169
|
+
onClick: onChildClick,
|
|
170
|
+
"data-testid": "hover-card-trigger-wrapper"
|
|
171
|
+
}), children));
|
|
172
|
+
}, [children, initHideCard, initShowCard, onChildClick, setMousePosition]);
|
|
148
173
|
return (0, _react.jsx)(_popup.default, {
|
|
149
174
|
testId: "hover-card",
|
|
150
175
|
isOpen: isOpen && canOpen,
|
|
@@ -152,31 +177,8 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
152
177
|
placement: "bottom-start",
|
|
153
178
|
offset: popupOffset.current,
|
|
154
179
|
autoFocus: false,
|
|
155
|
-
content:
|
|
156
|
-
|
|
157
|
-
return (0, _react.jsx)(_HoverCardContent.default, {
|
|
158
|
-
onMouseEnter: initShowCard,
|
|
159
|
-
onMouseLeave: initHideCard,
|
|
160
|
-
analytics: analytics,
|
|
161
|
-
cardActions: linkActions,
|
|
162
|
-
cardState: linkState,
|
|
163
|
-
onActionClick: onActionClick,
|
|
164
|
-
onResolve: update,
|
|
165
|
-
renderers: renderers,
|
|
166
|
-
url: url
|
|
167
|
-
});
|
|
168
|
-
},
|
|
169
|
-
trigger: function trigger(triggerProps) {
|
|
170
|
-
return (0, _react.jsx)("span", {
|
|
171
|
-
ref: parentSpan
|
|
172
|
-
}, (0, _react.jsx)("span", (0, _extends2.default)({}, triggerProps, {
|
|
173
|
-
onMouseEnter: initShowCard,
|
|
174
|
-
onMouseLeave: initHideCard,
|
|
175
|
-
onMouseMove: setMousePosition,
|
|
176
|
-
onClick: onChildClick,
|
|
177
|
-
"data-testid": "hover-card-trigger-wrapper"
|
|
178
|
-
}), children));
|
|
179
|
-
},
|
|
180
|
+
content: content,
|
|
181
|
+
trigger: trigger,
|
|
180
182
|
zIndex: 511 // Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
|
|
181
183
|
|
|
182
184
|
});
|
package/dist/es2019/version.json
CHANGED
|
@@ -30,6 +30,7 @@ export function CardWithUrlContent({
|
|
|
30
30
|
ui,
|
|
31
31
|
children,
|
|
32
32
|
showHoverPreview,
|
|
33
|
+
showAuthTooltip: showAuthTooltipProp,
|
|
33
34
|
analyticsEvents
|
|
34
35
|
}) {
|
|
35
36
|
// Get state, actions for this card.
|
|
@@ -49,8 +50,8 @@ export function CardWithUrlContent({
|
|
|
49
50
|
const subproduct = getSubproduct(state.details);
|
|
50
51
|
const services = getServices(state.details);
|
|
51
52
|
let isFlexibleUi = useMemo(() => isFlexibleUiCard(children), [children]);
|
|
52
|
-
const
|
|
53
|
-
const showAuthTooltip =
|
|
53
|
+
const showAuthTooltipFeatureFlagValue = useFeatureFlag('showAuthTooltip');
|
|
54
|
+
const showAuthTooltip = showAuthTooltipFeatureFlagValue !== undefined ? showAuthTooltipFeatureFlagValue === 'experiment' : showAuthTooltipProp;
|
|
54
55
|
const enableFlexibleBlockCardFlag = Boolean(useFeatureFlag('enableFlexibleBlockCard')); // Setup UI handlers.
|
|
55
56
|
|
|
56
57
|
const handleClick = useCallback(event => {
|
|
@@ -37,6 +37,7 @@ export function CardWithURLRenderer(props) {
|
|
|
37
37
|
children,
|
|
38
38
|
ui,
|
|
39
39
|
showHoverPreview,
|
|
40
|
+
showAuthTooltip,
|
|
40
41
|
analyticsEvents,
|
|
41
42
|
placeholder
|
|
42
43
|
} = props; // Wrapper around analytics.
|
|
@@ -108,6 +109,7 @@ export function CardWithURLRenderer(props) {
|
|
|
108
109
|
inlinePreloaderStyle,
|
|
109
110
|
ui,
|
|
110
111
|
showHoverPreview,
|
|
112
|
+
showAuthTooltip,
|
|
111
113
|
analyticsEvents,
|
|
112
114
|
placeholder
|
|
113
115
|
};
|
package/dist/es2019/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
|
+
import * as Actions from '../../../actions';
|
|
7
|
+
import { isJSXElementNull } from '../../utils';
|
|
8
|
+
|
|
9
|
+
const ActionGroupItem = ({
|
|
10
|
+
item,
|
|
11
|
+
size,
|
|
12
|
+
appearance,
|
|
13
|
+
asDropDownItems,
|
|
14
|
+
onActionItemClick
|
|
15
|
+
}) => {
|
|
16
|
+
const {
|
|
17
|
+
name,
|
|
18
|
+
hideContent,
|
|
19
|
+
hideIcon,
|
|
20
|
+
onClick,
|
|
21
|
+
...props
|
|
22
|
+
} = item;
|
|
23
|
+
const handleOnClick = useCallback(() => {
|
|
24
|
+
if (onActionItemClick) {
|
|
25
|
+
onActionItemClick();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (onClick) {
|
|
29
|
+
onClick();
|
|
30
|
+
}
|
|
31
|
+
}, [onActionItemClick, onClick]);
|
|
32
|
+
const Action = Actions[name];
|
|
33
|
+
|
|
34
|
+
if (!Action) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const actionProps = { ...props
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
if (hideContent && !asDropDownItems) {
|
|
42
|
+
actionProps.content = '';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (hideIcon) {
|
|
46
|
+
actionProps.icon = undefined;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const action = jsx(Action, _extends({
|
|
50
|
+
url: "",
|
|
51
|
+
asDropDownItem: asDropDownItems,
|
|
52
|
+
size: size,
|
|
53
|
+
appearance: appearance,
|
|
54
|
+
onClick: handleOnClick
|
|
55
|
+
}, actionProps));
|
|
56
|
+
|
|
57
|
+
if (!isJSXElementNull(action)) {
|
|
58
|
+
return action;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return null;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default ActionGroupItem;
|