@atlaskit/smart-card 17.7.0 → 17.7.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 +18 -0
- package/dist/cjs/constants.js +1 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/index.js +4 -2
- package/dist/cjs/view/FlexibleCard/components/actions/utils.js +7 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +15 -7
- package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/index.js +7 -3
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +44 -11
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.js +7 -3
- package/dist/es2019/constants.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/index.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/actions/utils.js +4 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +10 -4
- package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/index.js +6 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +34 -10
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.js +6 -2
- package/dist/esm/constants.js +1 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/actions/utils.js +7 -3
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +15 -7
- package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +3 -2
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/index.js +7 -3
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +35 -11
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.js +7 -3
- package/dist/types/constants.d.ts +2 -1
- package/dist/types/view/FlexibleCard/components/actions/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-group/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +18 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 17.7.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`474d69913ef`](https://bitbucket.org/atlassian/atlassian-frontend/commits/474d69913ef) - Title block can have an action visible only on hover
|
|
8
|
+
|
|
9
|
+
## 17.7.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`9066a1e8154`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9066a1e8154) - EDM-2926: Add title override for title block
|
|
14
|
+
|
|
15
|
+
## 17.7.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`123201c5105`](https://bitbucket.org/atlassian/atlassian-frontend/commits/123201c5105) - Add ability to add custom action item
|
|
20
|
+
|
|
3
21
|
## 17.7.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/dist/cjs/constants.js
CHANGED
package/dist/cjs/version.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.DeleteAction = void 0;
|
|
6
|
+
exports.DeleteAction = exports.CustomAction = void 0;
|
|
7
7
|
|
|
8
8
|
var _constants = require("../../../../constants");
|
|
9
9
|
|
|
@@ -15,4 +15,6 @@ var _utils = require("./utils");
|
|
|
15
15
|
// UIActions infer that you do not need to get any data from the context.
|
|
16
16
|
// DataActions infer that the action depends on the data from the context.
|
|
17
17
|
var DeleteAction = (0, _utils.createUIAction)(_constants.ActionName.DeleteAction);
|
|
18
|
-
exports.DeleteAction = DeleteAction;
|
|
18
|
+
exports.DeleteAction = DeleteAction;
|
|
19
|
+
var CustomAction = (0, _utils.createUIAction)(_constants.ActionName.CustomAction);
|
|
20
|
+
exports.CustomAction = CustomAction;
|
|
@@ -27,6 +27,8 @@ var _messages = require("../../../../messages");
|
|
|
27
27
|
|
|
28
28
|
var _cross = _interopRequireDefault(require("@atlaskit/icon/glyph/cross"));
|
|
29
29
|
|
|
30
|
+
var _actionMappings;
|
|
31
|
+
|
|
30
32
|
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); }
|
|
31
33
|
|
|
32
34
|
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; }
|
|
@@ -35,7 +37,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
35
37
|
|
|
36
38
|
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; }
|
|
37
39
|
|
|
38
|
-
var actionMappings = (0, _defineProperty2.default)(
|
|
40
|
+
var actionMappings = (_actionMappings = {}, (0, _defineProperty2.default)(_actionMappings, _constants.ActionName.CustomAction, {
|
|
41
|
+
component: _action.default,
|
|
42
|
+
props: {}
|
|
43
|
+
}), (0, _defineProperty2.default)(_actionMappings, _constants.ActionName.DeleteAction, {
|
|
39
44
|
component: _action.default,
|
|
40
45
|
props: {
|
|
41
46
|
testId: 'smart-action-delete-action',
|
|
@@ -45,7 +50,7 @@ var actionMappings = (0, _defineProperty2.default)({}, _constants.ActionName.Del
|
|
|
45
50
|
}),
|
|
46
51
|
toolTipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.delete)
|
|
47
52
|
}
|
|
48
|
-
});
|
|
53
|
+
}), _actionMappings);
|
|
49
54
|
|
|
50
55
|
var getContextKey = function getContextKey(name) {
|
|
51
56
|
// Attempt to predict context prop name in advance to reduce the amount of
|
|
@@ -40,18 +40,26 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
40
40
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
41
41
|
_ref$size = _ref.size,
|
|
42
42
|
size = _ref$size === void 0 ? _constants.SmartLinkSize.Medium : _ref$size,
|
|
43
|
-
appearance = _ref.appearance
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
appearance = _ref.appearance,
|
|
44
|
+
_ref$visibleButtonsNu = _ref.visibleButtonsNum,
|
|
45
|
+
visibleButtonsNum = _ref$visibleButtonsNu === void 0 ? 2 : _ref$visibleButtonsNu,
|
|
46
|
+
onDropdownOpenChange = _ref.onDropdownOpenChange;
|
|
47
|
+
var isMoreThenTwoItems = items.length > visibleButtonsNum;
|
|
48
|
+
var firstActions = isMoreThenTwoItems ? items.slice(0, visibleButtonsNum - 1) : items;
|
|
49
|
+
var restActions = isMoreThenTwoItems ? items.slice(visibleButtonsNum - 1) : [];
|
|
47
50
|
return (0, _core.jsx)("div", {
|
|
48
51
|
css: styles
|
|
49
52
|
}, (0, _core.jsx)(_buttonGroup.default, null, (0, _utils.renderActionItems)(firstActions, size, appearance), restActions.length > 0 ? (0, _core.jsx)(_dropdownMenu.default, {
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
+
onOpenChange: function onOpenChange(_ref2) {
|
|
54
|
+
var isOpen = _ref2.isOpen;
|
|
55
|
+
return onDropdownOpenChange && onDropdownOpenChange(isOpen);
|
|
56
|
+
},
|
|
57
|
+
trigger: function trigger(_ref3) {
|
|
58
|
+
var triggerRef = _ref3.triggerRef,
|
|
59
|
+
props = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
|
|
53
60
|
return (0, _core.jsx)(_standardButton.default, (0, _extends2.default)({}, props, {
|
|
54
61
|
spacing: _action.sizeToSpacing[size],
|
|
62
|
+
className: "action-group-more-button",
|
|
55
63
|
testId: "action-group-more-button",
|
|
56
64
|
iconBefore: (0, _core.jsx)(_more.default, {
|
|
57
65
|
label: "more"
|
|
@@ -30,9 +30,10 @@ var Block = function Block(_ref) {
|
|
|
30
30
|
_ref$size = _ref.size,
|
|
31
31
|
size = _ref$size === void 0 ? _constants.SmartLinkSize.Medium : _ref$size,
|
|
32
32
|
_ref$testId = _ref.testId,
|
|
33
|
-
testId = _ref$testId === void 0 ? 'smart-block' : _ref$testId
|
|
33
|
+
testId = _ref$testId === void 0 ? 'smart-block' : _ref$testId,
|
|
34
|
+
extraCss = _ref.extraCss;
|
|
34
35
|
return (0, _core.jsx)("div", {
|
|
35
|
-
css: getBlockStyles(direction, size),
|
|
36
|
+
css: [getBlockStyles(direction, size), extraCss],
|
|
36
37
|
"data-smart-block": true,
|
|
37
38
|
"data-testid": testId
|
|
38
39
|
}, (0, _utils.renderChildren)(children, size));
|
|
@@ -31,7 +31,7 @@ var _elementGroup = _interopRequireDefault(require("../../element-group"));
|
|
|
31
31
|
|
|
32
32
|
var _token = require("../../../../../../utils/token");
|
|
33
33
|
|
|
34
|
-
var _excluded = ["maxLines", "retry", "position", "testId", "theme"];
|
|
34
|
+
var _excluded = ["maxLines", "retry", "position", "testId", "theme", "text"];
|
|
35
35
|
|
|
36
36
|
var _templateObject, _templateObject2;
|
|
37
37
|
|
|
@@ -48,6 +48,7 @@ var TitleBlockErroredView = function TitleBlockErroredView(_ref) {
|
|
|
48
48
|
position = _ref.position,
|
|
49
49
|
testId = _ref.testId,
|
|
50
50
|
theme = _ref.theme,
|
|
51
|
+
text = _ref.text,
|
|
51
52
|
blockProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
52
53
|
|
|
53
54
|
var _ref2 = retry || {},
|
|
@@ -58,14 +59,17 @@ var TitleBlockErroredView = function TitleBlockErroredView(_ref) {
|
|
|
58
59
|
var _blockProps$size = blockProps.size,
|
|
59
60
|
size = _blockProps$size === void 0 ? _constants.SmartLinkSize.Medium : _blockProps$size;
|
|
60
61
|
var hasAction = onClick !== undefined;
|
|
62
|
+
var overrideText = !!text ? {
|
|
63
|
+
text: text
|
|
64
|
+
} : {};
|
|
61
65
|
return (0, _core.jsx)(_block.default, (0, _extends2.default)({}, blockProps, {
|
|
62
66
|
testId: "".concat(testId, "-errored-view")
|
|
63
67
|
}), (0, _core.jsx)(_elements.LinkIcon, {
|
|
64
68
|
position: position
|
|
65
|
-
}), (0, _core.jsx)(_elements.Title, {
|
|
69
|
+
}), (0, _core.jsx)(_elements.Title, (0, _extends2.default)({}, overrideText, {
|
|
66
70
|
maxLines: maxLines,
|
|
67
71
|
theme: theme
|
|
68
|
-
}), descriptor && (0, _core.jsx)(_elementGroup.default, {
|
|
72
|
+
})), descriptor && (0, _core.jsx)(_elementGroup.default, {
|
|
69
73
|
direction: _constants.SmartLinkDirection.Horizontal,
|
|
70
74
|
align: _constants.SmartLinkAlignment.Right
|
|
71
75
|
}, (0, _core.jsx)("span", {
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
@@ -9,9 +11,15 @@ exports.default = void 0;
|
|
|
9
11
|
|
|
10
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
13
|
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
12
16
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
17
|
|
|
14
|
-
var
|
|
18
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
19
|
+
|
|
20
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
22
|
+
var _core = require("@emotion/core");
|
|
15
23
|
|
|
16
24
|
var _elements = require("../../../elements");
|
|
17
25
|
|
|
@@ -25,7 +33,15 @@ var _utils = require("../../utils");
|
|
|
25
33
|
|
|
26
34
|
var _actionGroup = _interopRequireDefault(require("../../action-group"));
|
|
27
35
|
|
|
28
|
-
var _excluded = ["maxLines", "metadata", "position", "subtitle", "actions", "testId", "theme"];
|
|
36
|
+
var _excluded = ["maxLines", "metadata", "position", "subtitle", "actions", "testId", "theme", "text", "showActionOnHover"];
|
|
37
|
+
|
|
38
|
+
var _templateObject;
|
|
39
|
+
|
|
40
|
+
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); }
|
|
41
|
+
|
|
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; }
|
|
43
|
+
|
|
44
|
+
var actionOnHoverOnlyStyle = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .action-group-more-button {\n visibility: hidden;\n }\n\n &:hover {\n .action-group-more-button {\n visibility: visible;\n }\n }\n"])));
|
|
29
45
|
|
|
30
46
|
var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
|
|
31
47
|
var maxLines = _ref.maxLines,
|
|
@@ -38,26 +54,43 @@ var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
|
|
|
38
54
|
actions = _ref$actions === void 0 ? [] : _ref$actions,
|
|
39
55
|
testId = _ref.testId,
|
|
40
56
|
theme = _ref.theme,
|
|
57
|
+
text = _ref.text,
|
|
58
|
+
showActionOnHover = _ref.showActionOnHover,
|
|
41
59
|
blockProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
60
|
+
|
|
61
|
+
var _useState = (0, _react.useState)(false),
|
|
62
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
63
|
+
actionDropdownOpen = _useState2[0],
|
|
64
|
+
setActionDropdownOpen = _useState2[1];
|
|
65
|
+
|
|
42
66
|
var metadataElements = (0, _utils.renderElementItems)(metadata);
|
|
43
67
|
var subtitleElements = (0, _utils.renderElementItems)(subtitle);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
68
|
+
var overrideText = !!text ? {
|
|
69
|
+
text: text
|
|
70
|
+
} : {};
|
|
71
|
+
var extraCss = showActionOnHover && !actionDropdownOpen ? actionOnHoverOnlyStyle : undefined;
|
|
72
|
+
return (0, _core.jsx)(_block.default, (0, _extends2.default)({}, blockProps, {
|
|
73
|
+
testId: "".concat(testId, "-resolved-view"),
|
|
74
|
+
extraCss: extraCss
|
|
75
|
+
}), (0, _core.jsx)(_elements.LinkIcon, {
|
|
47
76
|
position: position
|
|
48
|
-
}),
|
|
77
|
+
}), (0, _core.jsx)(_elementGroup.default, {
|
|
49
78
|
direction: _constants.SmartLinkDirection.Vertical,
|
|
50
79
|
width: _constants.SmartLinkWidth.Flexible
|
|
51
|
-
},
|
|
80
|
+
}, (0, _core.jsx)(_elements.Title, (0, _extends2.default)({
|
|
52
81
|
maxLines: maxLines,
|
|
53
82
|
theme: theme
|
|
54
|
-
}), subtitleElements &&
|
|
83
|
+
}, overrideText)), subtitleElements && (0, _core.jsx)(_elementGroup.default, {
|
|
55
84
|
direction: _constants.SmartLinkDirection.Horizontal
|
|
56
|
-
}, subtitleElements)), metadataElements &&
|
|
85
|
+
}, subtitleElements)), metadataElements && (0, _core.jsx)(_elementGroup.default, {
|
|
57
86
|
direction: _constants.SmartLinkDirection.Horizontal,
|
|
58
87
|
align: _constants.SmartLinkAlignment.Right
|
|
59
|
-
}, metadataElements), actions.length > 0 &&
|
|
60
|
-
items: actions
|
|
88
|
+
}, metadataElements), actions.length > 0 && (0, _core.jsx)(_actionGroup.default, {
|
|
89
|
+
items: actions,
|
|
90
|
+
visibleButtonsNum: showActionOnHover ? 1 : 2,
|
|
91
|
+
onDropdownOpenChange: function onDropdownOpenChange(isOpen) {
|
|
92
|
+
return setActionDropdownOpen(isOpen);
|
|
93
|
+
}
|
|
61
94
|
}));
|
|
62
95
|
};
|
|
63
96
|
|
|
@@ -23,7 +23,7 @@ var _block = _interopRequireDefault(require("../../block"));
|
|
|
23
23
|
|
|
24
24
|
var _constants = require("../../../../../../constants");
|
|
25
25
|
|
|
26
|
-
var _excluded = ["maxLines", "retry", "position", "testId", "theme"];
|
|
26
|
+
var _excluded = ["maxLines", "retry", "position", "testId", "theme", "text"];
|
|
27
27
|
|
|
28
28
|
var getSpinnerSize = function getSpinnerSize(size) {
|
|
29
29
|
// Spinner sizes should be equivalent or smaller than Icon size
|
|
@@ -50,18 +50,22 @@ var TitleBlockResolvingView = function TitleBlockResolvingView(_ref) {
|
|
|
50
50
|
position = _ref.position,
|
|
51
51
|
testId = _ref.testId,
|
|
52
52
|
theme = _ref.theme,
|
|
53
|
+
text = _ref.text,
|
|
53
54
|
blockProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
54
55
|
var _blockProps$size = blockProps.size,
|
|
55
56
|
size = _blockProps$size === void 0 ? _constants.SmartLinkSize.Medium : _blockProps$size;
|
|
57
|
+
var overrideText = !!text ? {
|
|
58
|
+
text: text
|
|
59
|
+
} : {};
|
|
56
60
|
return (0, _core.jsx)(_block.default, (0, _extends2.default)({}, blockProps, {
|
|
57
61
|
testId: "".concat(testId, "-resolving-view")
|
|
58
62
|
}), (0, _core.jsx)(_spinner.default, {
|
|
59
63
|
size: getSpinnerSize(size),
|
|
60
64
|
testId: "".concat(testId, "-resolving-spinner")
|
|
61
|
-
}), (0, _core.jsx)(_elements.Title, {
|
|
65
|
+
}), (0, _core.jsx)(_elements.Title, (0, _extends2.default)({}, overrideText, {
|
|
62
66
|
maxLines: maxLines,
|
|
63
67
|
theme: theme
|
|
64
|
-
}));
|
|
68
|
+
})));
|
|
65
69
|
};
|
|
66
70
|
|
|
67
71
|
var _default = TitleBlockResolvingView;
|
package/dist/es2019/constants.js
CHANGED
package/dist/es2019/version.json
CHANGED
|
@@ -5,4 +5,5 @@ import { createUIAction } from './utils'; // Attention: Keep the export name and
|
|
|
5
5
|
// UIActions infer that you do not need to get any data from the context.
|
|
6
6
|
// DataActions infer that the action depends on the data from the context.
|
|
7
7
|
|
|
8
|
-
export const DeleteAction = createUIAction(ActionName.DeleteAction);
|
|
8
|
+
export const DeleteAction = createUIAction(ActionName.DeleteAction);
|
|
9
|
+
export const CustomAction = createUIAction(ActionName.CustomAction);
|
|
@@ -7,6 +7,10 @@ import { FormattedMessage } from 'react-intl-next';
|
|
|
7
7
|
import { messages } from '../../../../messages';
|
|
8
8
|
import CrossIcon from '@atlaskit/icon/glyph/cross';
|
|
9
9
|
const actionMappings = {
|
|
10
|
+
[ActionName.CustomAction]: {
|
|
11
|
+
component: Action,
|
|
12
|
+
props: {}
|
|
13
|
+
},
|
|
10
14
|
[ActionName.DeleteAction]: {
|
|
11
15
|
component: Action,
|
|
12
16
|
props: {
|
|
@@ -17,19 +17,25 @@ const styles = css`
|
|
|
17
17
|
const ActionGroup = ({
|
|
18
18
|
items = [],
|
|
19
19
|
size = SmartLinkSize.Medium,
|
|
20
|
-
appearance
|
|
20
|
+
appearance,
|
|
21
|
+
visibleButtonsNum = 2,
|
|
22
|
+
onDropdownOpenChange
|
|
21
23
|
}) => {
|
|
22
|
-
const isMoreThenTwoItems = items.length >
|
|
23
|
-
const firstActions = isMoreThenTwoItems ? items.slice(0, 1) : items;
|
|
24
|
-
const restActions = isMoreThenTwoItems ? items.slice(1) : [];
|
|
24
|
+
const isMoreThenTwoItems = items.length > visibleButtonsNum;
|
|
25
|
+
const firstActions = isMoreThenTwoItems ? items.slice(0, visibleButtonsNum - 1) : items;
|
|
26
|
+
const restActions = isMoreThenTwoItems ? items.slice(visibleButtonsNum - 1) : [];
|
|
25
27
|
return jsx("div", {
|
|
26
28
|
css: styles
|
|
27
29
|
}, jsx(ButtonGroup, null, renderActionItems(firstActions, size, appearance), restActions.length > 0 ? jsx(DropdownMenu, {
|
|
30
|
+
onOpenChange: ({
|
|
31
|
+
isOpen
|
|
32
|
+
}) => onDropdownOpenChange && onDropdownOpenChange(isOpen),
|
|
28
33
|
trigger: ({
|
|
29
34
|
triggerRef,
|
|
30
35
|
...props
|
|
31
36
|
}) => jsx(Button, _extends({}, props, {
|
|
32
37
|
spacing: sizeToSpacing[size],
|
|
38
|
+
className: "action-group-more-button",
|
|
33
39
|
testId: "action-group-more-button",
|
|
34
40
|
iconBefore: jsx(MoreIcon, {
|
|
35
41
|
label: "more"
|
|
@@ -13,9 +13,10 @@ const Block = ({
|
|
|
13
13
|
children,
|
|
14
14
|
direction = SmartLinkDirection.Horizontal,
|
|
15
15
|
size = SmartLinkSize.Medium,
|
|
16
|
-
testId = 'smart-block'
|
|
16
|
+
testId = 'smart-block',
|
|
17
|
+
extraCss
|
|
17
18
|
}) => jsx("div", {
|
|
18
|
-
css: getBlockStyles(direction, size),
|
|
19
|
+
css: [getBlockStyles(direction, size), extraCss],
|
|
19
20
|
"data-smart-block": true,
|
|
20
21
|
"data-testid": testId
|
|
21
22
|
}, renderChildren(children, size));
|
|
@@ -36,6 +36,7 @@ const TitleBlockErroredView = ({
|
|
|
36
36
|
position,
|
|
37
37
|
testId,
|
|
38
38
|
theme,
|
|
39
|
+
text,
|
|
39
40
|
...blockProps
|
|
40
41
|
}) => {
|
|
41
42
|
const {
|
|
@@ -47,14 +48,17 @@ const TitleBlockErroredView = ({
|
|
|
47
48
|
size = SmartLinkSize.Medium
|
|
48
49
|
} = blockProps;
|
|
49
50
|
const hasAction = onClick !== undefined;
|
|
51
|
+
const overrideText = !!text ? {
|
|
52
|
+
text
|
|
53
|
+
} : {};
|
|
50
54
|
return jsx(Block, _extends({}, blockProps, {
|
|
51
55
|
testId: `${testId}-errored-view`
|
|
52
56
|
}), jsx(LinkIcon, {
|
|
53
57
|
position: position
|
|
54
|
-
}), jsx(Title, {
|
|
58
|
+
}), jsx(Title, _extends({}, overrideText, {
|
|
55
59
|
maxLines: maxLines,
|
|
56
60
|
theme: theme
|
|
57
|
-
}), descriptor && jsx(ElementGroup, {
|
|
61
|
+
})), descriptor && jsx(ElementGroup, {
|
|
58
62
|
direction: SmartLinkDirection.Horizontal,
|
|
59
63
|
align: SmartLinkAlignment.Right
|
|
60
64
|
}, jsx("span", {
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
3
6
|
import { LinkIcon, Title } from '../../../elements';
|
|
4
7
|
import Block from '../../block';
|
|
5
8
|
import ElementGroup from '../../element-group';
|
|
6
9
|
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkWidth } from '../../../../../../constants';
|
|
7
10
|
import { renderElementItems } from '../../utils';
|
|
8
11
|
import ActionGroup from '../../action-group';
|
|
12
|
+
const actionOnHoverOnlyStyle = css`
|
|
13
|
+
.action-group-more-button {
|
|
14
|
+
visibility: hidden;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
.action-group-more-button {
|
|
19
|
+
visibility: visible;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
9
23
|
|
|
10
24
|
const TitleBlockResolvedView = ({
|
|
11
25
|
maxLines,
|
|
@@ -15,27 +29,37 @@ const TitleBlockResolvedView = ({
|
|
|
15
29
|
actions = [],
|
|
16
30
|
testId,
|
|
17
31
|
theme,
|
|
32
|
+
text,
|
|
33
|
+
showActionOnHover,
|
|
18
34
|
...blockProps
|
|
19
35
|
}) => {
|
|
36
|
+
const [actionDropdownOpen, setActionDropdownOpen] = useState(false);
|
|
20
37
|
const metadataElements = renderElementItems(metadata);
|
|
21
38
|
const subtitleElements = renderElementItems(subtitle);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
39
|
+
const overrideText = !!text ? {
|
|
40
|
+
text
|
|
41
|
+
} : {};
|
|
42
|
+
const extraCss = showActionOnHover && !actionDropdownOpen ? actionOnHoverOnlyStyle : undefined;
|
|
43
|
+
return jsx(Block, _extends({}, blockProps, {
|
|
44
|
+
testId: `${testId}-resolved-view`,
|
|
45
|
+
extraCss: extraCss
|
|
46
|
+
}), jsx(LinkIcon, {
|
|
25
47
|
position: position
|
|
26
|
-
}),
|
|
48
|
+
}), jsx(ElementGroup, {
|
|
27
49
|
direction: SmartLinkDirection.Vertical,
|
|
28
50
|
width: SmartLinkWidth.Flexible
|
|
29
|
-
},
|
|
51
|
+
}, jsx(Title, _extends({
|
|
30
52
|
maxLines: maxLines,
|
|
31
53
|
theme: theme
|
|
32
|
-
}), subtitleElements &&
|
|
54
|
+
}, overrideText)), subtitleElements && jsx(ElementGroup, {
|
|
33
55
|
direction: SmartLinkDirection.Horizontal
|
|
34
|
-
}, subtitleElements)), metadataElements &&
|
|
56
|
+
}, subtitleElements)), metadataElements && jsx(ElementGroup, {
|
|
35
57
|
direction: SmartLinkDirection.Horizontal,
|
|
36
58
|
align: SmartLinkAlignment.Right
|
|
37
|
-
}, metadataElements), actions.length > 0 &&
|
|
38
|
-
items: actions
|
|
59
|
+
}, metadataElements), actions.length > 0 && jsx(ActionGroup, {
|
|
60
|
+
items: actions,
|
|
61
|
+
visibleButtonsNum: showActionOnHover ? 1 : 2,
|
|
62
|
+
onDropdownOpenChange: isOpen => setActionDropdownOpen(isOpen)
|
|
39
63
|
}));
|
|
40
64
|
};
|
|
41
65
|
|
|
@@ -33,20 +33,24 @@ const TitleBlockResolvingView = ({
|
|
|
33
33
|
position,
|
|
34
34
|
testId,
|
|
35
35
|
theme,
|
|
36
|
+
text,
|
|
36
37
|
...blockProps
|
|
37
38
|
}) => {
|
|
38
39
|
const {
|
|
39
40
|
size = SmartLinkSize.Medium
|
|
40
41
|
} = blockProps;
|
|
42
|
+
const overrideText = !!text ? {
|
|
43
|
+
text
|
|
44
|
+
} : {};
|
|
41
45
|
return jsx(Block, _extends({}, blockProps, {
|
|
42
46
|
testId: `${testId}-resolving-view`
|
|
43
47
|
}), jsx(Spinner, {
|
|
44
48
|
size: getSpinnerSize(size),
|
|
45
49
|
testId: `${testId}-resolving-spinner`
|
|
46
|
-
}), jsx(Title, {
|
|
50
|
+
}), jsx(Title, _extends({}, overrideText, {
|
|
47
51
|
maxLines: maxLines,
|
|
48
52
|
theme: theme
|
|
49
|
-
}));
|
|
53
|
+
})));
|
|
50
54
|
};
|
|
51
55
|
|
|
52
56
|
export default TitleBlockResolvingView;
|
package/dist/esm/constants.js
CHANGED
package/dist/esm/version.json
CHANGED
|
@@ -5,4 +5,5 @@ import { createUIAction } from './utils'; // Attention: Keep the export name and
|
|
|
5
5
|
// UIActions infer that you do not need to get any data from the context.
|
|
6
6
|
// DataActions infer that the action depends on the data from the context.
|
|
7
7
|
|
|
8
|
-
export var DeleteAction = createUIAction(ActionName.DeleteAction);
|
|
8
|
+
export var DeleteAction = createUIAction(ActionName.DeleteAction);
|
|
9
|
+
export var CustomAction = createUIAction(ActionName.CustomAction);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
|
|
4
|
+
var _actionMappings;
|
|
5
|
+
|
|
4
6
|
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; }
|
|
5
7
|
|
|
6
8
|
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) { _defineProperty(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; }
|
|
@@ -12,8 +14,10 @@ import Action from './action';
|
|
|
12
14
|
import { FormattedMessage } from 'react-intl-next';
|
|
13
15
|
import { messages } from '../../../../messages';
|
|
14
16
|
import CrossIcon from '@atlaskit/icon/glyph/cross';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
var actionMappings = (_actionMappings = {}, _defineProperty(_actionMappings, ActionName.CustomAction, {
|
|
18
|
+
component: Action,
|
|
19
|
+
props: {}
|
|
20
|
+
}), _defineProperty(_actionMappings, ActionName.DeleteAction, {
|
|
17
21
|
component: Action,
|
|
18
22
|
props: {
|
|
19
23
|
testId: 'smart-action-delete-action',
|
|
@@ -23,7 +27,7 @@ var actionMappings = _defineProperty({}, ActionName.DeleteAction, {
|
|
|
23
27
|
}),
|
|
24
28
|
toolTipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.delete)
|
|
25
29
|
}
|
|
26
|
-
});
|
|
30
|
+
}), _actionMappings);
|
|
27
31
|
|
|
28
32
|
var getContextKey = function getContextKey(name) {
|
|
29
33
|
// Attempt to predict context prop name in advance to reduce the amount of
|
|
@@ -21,19 +21,27 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
21
21
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
22
22
|
_ref$size = _ref.size,
|
|
23
23
|
size = _ref$size === void 0 ? SmartLinkSize.Medium : _ref$size,
|
|
24
|
-
appearance = _ref.appearance
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
appearance = _ref.appearance,
|
|
25
|
+
_ref$visibleButtonsNu = _ref.visibleButtonsNum,
|
|
26
|
+
visibleButtonsNum = _ref$visibleButtonsNu === void 0 ? 2 : _ref$visibleButtonsNu,
|
|
27
|
+
onDropdownOpenChange = _ref.onDropdownOpenChange;
|
|
28
|
+
var isMoreThenTwoItems = items.length > visibleButtonsNum;
|
|
29
|
+
var firstActions = isMoreThenTwoItems ? items.slice(0, visibleButtonsNum - 1) : items;
|
|
30
|
+
var restActions = isMoreThenTwoItems ? items.slice(visibleButtonsNum - 1) : [];
|
|
28
31
|
return jsx("div", {
|
|
29
32
|
css: styles
|
|
30
33
|
}, jsx(ButtonGroup, null, renderActionItems(firstActions, size, appearance), restActions.length > 0 ? jsx(DropdownMenu, {
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
+
onOpenChange: function onOpenChange(_ref2) {
|
|
35
|
+
var isOpen = _ref2.isOpen;
|
|
36
|
+
return onDropdownOpenChange && onDropdownOpenChange(isOpen);
|
|
37
|
+
},
|
|
38
|
+
trigger: function trigger(_ref3) {
|
|
39
|
+
var triggerRef = _ref3.triggerRef,
|
|
40
|
+
props = _objectWithoutProperties(_ref3, _excluded);
|
|
34
41
|
|
|
35
42
|
return jsx(Button, _extends({}, props, {
|
|
36
43
|
spacing: sizeToSpacing[size],
|
|
44
|
+
className: "action-group-more-button",
|
|
37
45
|
testId: "action-group-more-button",
|
|
38
46
|
iconBefore: jsx(MoreIcon, {
|
|
39
47
|
label: "more"
|
|
@@ -19,9 +19,10 @@ var Block = function Block(_ref) {
|
|
|
19
19
|
_ref$size = _ref.size,
|
|
20
20
|
size = _ref$size === void 0 ? SmartLinkSize.Medium : _ref$size,
|
|
21
21
|
_ref$testId = _ref.testId,
|
|
22
|
-
testId = _ref$testId === void 0 ? 'smart-block' : _ref$testId
|
|
22
|
+
testId = _ref$testId === void 0 ? 'smart-block' : _ref$testId,
|
|
23
|
+
extraCss = _ref.extraCss;
|
|
23
24
|
return jsx("div", {
|
|
24
|
-
css: getBlockStyles(direction, size),
|
|
25
|
+
css: [getBlockStyles(direction, size), extraCss],
|
|
25
26
|
"data-smart-block": true,
|
|
26
27
|
"data-testid": testId
|
|
27
28
|
}, renderChildren(children, size));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
4
|
-
var _excluded = ["maxLines", "retry", "position", "testId", "theme"];
|
|
4
|
+
var _excluded = ["maxLines", "retry", "position", "testId", "theme", "text"];
|
|
5
5
|
|
|
6
6
|
var _templateObject, _templateObject2;
|
|
7
7
|
|
|
@@ -28,6 +28,7 @@ var TitleBlockErroredView = function TitleBlockErroredView(_ref) {
|
|
|
28
28
|
position = _ref.position,
|
|
29
29
|
testId = _ref.testId,
|
|
30
30
|
theme = _ref.theme,
|
|
31
|
+
text = _ref.text,
|
|
31
32
|
blockProps = _objectWithoutProperties(_ref, _excluded);
|
|
32
33
|
|
|
33
34
|
var _ref2 = retry || {},
|
|
@@ -38,14 +39,17 @@ var TitleBlockErroredView = function TitleBlockErroredView(_ref) {
|
|
|
38
39
|
var _blockProps$size = blockProps.size,
|
|
39
40
|
size = _blockProps$size === void 0 ? SmartLinkSize.Medium : _blockProps$size;
|
|
40
41
|
var hasAction = onClick !== undefined;
|
|
42
|
+
var overrideText = !!text ? {
|
|
43
|
+
text: text
|
|
44
|
+
} : {};
|
|
41
45
|
return jsx(Block, _extends({}, blockProps, {
|
|
42
46
|
testId: "".concat(testId, "-errored-view")
|
|
43
47
|
}), jsx(LinkIcon, {
|
|
44
48
|
position: position
|
|
45
|
-
}), jsx(Title, {
|
|
49
|
+
}), jsx(Title, _extends({}, overrideText, {
|
|
46
50
|
maxLines: maxLines,
|
|
47
51
|
theme: theme
|
|
48
|
-
}), descriptor && jsx(ElementGroup, {
|
|
52
|
+
})), descriptor && jsx(ElementGroup, {
|
|
49
53
|
direction: SmartLinkDirection.Horizontal,
|
|
50
54
|
align: SmartLinkAlignment.Right
|
|
51
55
|
}, jsx("span", {
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
5
|
+
var _excluded = ["maxLines", "metadata", "position", "subtitle", "actions", "testId", "theme", "text", "showActionOnHover"];
|
|
6
|
+
|
|
7
|
+
var _templateObject;
|
|
8
|
+
|
|
9
|
+
/** @jsx jsx */
|
|
10
|
+
import React, { useState } from 'react';
|
|
11
|
+
import { css, jsx } from '@emotion/core';
|
|
5
12
|
import { LinkIcon, Title } from '../../../elements';
|
|
6
13
|
import Block from '../../block';
|
|
7
14
|
import ElementGroup from '../../element-group';
|
|
8
15
|
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkWidth } from '../../../../../../constants';
|
|
9
16
|
import { renderElementItems } from '../../utils';
|
|
10
17
|
import ActionGroup from '../../action-group';
|
|
18
|
+
var actionOnHoverOnlyStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .action-group-more-button {\n visibility: hidden;\n }\n\n &:hover {\n .action-group-more-button {\n visibility: visible;\n }\n }\n"])));
|
|
11
19
|
|
|
12
20
|
var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
|
|
13
21
|
var maxLines = _ref.maxLines,
|
|
@@ -20,27 +28,43 @@ var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
|
|
|
20
28
|
actions = _ref$actions === void 0 ? [] : _ref$actions,
|
|
21
29
|
testId = _ref.testId,
|
|
22
30
|
theme = _ref.theme,
|
|
31
|
+
text = _ref.text,
|
|
32
|
+
showActionOnHover = _ref.showActionOnHover,
|
|
23
33
|
blockProps = _objectWithoutProperties(_ref, _excluded);
|
|
24
34
|
|
|
35
|
+
var _useState = useState(false),
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
+
actionDropdownOpen = _useState2[0],
|
|
38
|
+
setActionDropdownOpen = _useState2[1];
|
|
39
|
+
|
|
25
40
|
var metadataElements = renderElementItems(metadata);
|
|
26
41
|
var subtitleElements = renderElementItems(subtitle);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
42
|
+
var overrideText = !!text ? {
|
|
43
|
+
text: text
|
|
44
|
+
} : {};
|
|
45
|
+
var extraCss = showActionOnHover && !actionDropdownOpen ? actionOnHoverOnlyStyle : undefined;
|
|
46
|
+
return jsx(Block, _extends({}, blockProps, {
|
|
47
|
+
testId: "".concat(testId, "-resolved-view"),
|
|
48
|
+
extraCss: extraCss
|
|
49
|
+
}), jsx(LinkIcon, {
|
|
30
50
|
position: position
|
|
31
|
-
}),
|
|
51
|
+
}), jsx(ElementGroup, {
|
|
32
52
|
direction: SmartLinkDirection.Vertical,
|
|
33
53
|
width: SmartLinkWidth.Flexible
|
|
34
|
-
},
|
|
54
|
+
}, jsx(Title, _extends({
|
|
35
55
|
maxLines: maxLines,
|
|
36
56
|
theme: theme
|
|
37
|
-
}), subtitleElements &&
|
|
57
|
+
}, overrideText)), subtitleElements && jsx(ElementGroup, {
|
|
38
58
|
direction: SmartLinkDirection.Horizontal
|
|
39
|
-
}, subtitleElements)), metadataElements &&
|
|
59
|
+
}, subtitleElements)), metadataElements && jsx(ElementGroup, {
|
|
40
60
|
direction: SmartLinkDirection.Horizontal,
|
|
41
61
|
align: SmartLinkAlignment.Right
|
|
42
|
-
}, metadataElements), actions.length > 0 &&
|
|
43
|
-
items: actions
|
|
62
|
+
}, metadataElements), actions.length > 0 && jsx(ActionGroup, {
|
|
63
|
+
items: actions,
|
|
64
|
+
visibleButtonsNum: showActionOnHover ? 1 : 2,
|
|
65
|
+
onDropdownOpenChange: function onDropdownOpenChange(isOpen) {
|
|
66
|
+
return setActionDropdownOpen(isOpen);
|
|
67
|
+
}
|
|
44
68
|
}));
|
|
45
69
|
};
|
|
46
70
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["maxLines", "retry", "position", "testId", "theme"];
|
|
3
|
+
var _excluded = ["maxLines", "retry", "position", "testId", "theme", "text"];
|
|
4
4
|
|
|
5
5
|
/** @jsx jsx */
|
|
6
6
|
import React from 'react';
|
|
@@ -35,19 +35,23 @@ var TitleBlockResolvingView = function TitleBlockResolvingView(_ref) {
|
|
|
35
35
|
position = _ref.position,
|
|
36
36
|
testId = _ref.testId,
|
|
37
37
|
theme = _ref.theme,
|
|
38
|
+
text = _ref.text,
|
|
38
39
|
blockProps = _objectWithoutProperties(_ref, _excluded);
|
|
39
40
|
|
|
40
41
|
var _blockProps$size = blockProps.size,
|
|
41
42
|
size = _blockProps$size === void 0 ? SmartLinkSize.Medium : _blockProps$size;
|
|
43
|
+
var overrideText = !!text ? {
|
|
44
|
+
text: text
|
|
45
|
+
} : {};
|
|
42
46
|
return jsx(Block, _extends({}, blockProps, {
|
|
43
47
|
testId: "".concat(testId, "-resolving-view")
|
|
44
48
|
}), jsx(Spinner, {
|
|
45
49
|
size: getSpinnerSize(size),
|
|
46
50
|
testId: "".concat(testId, "-resolving-spinner")
|
|
47
|
-
}), jsx(Title, {
|
|
51
|
+
}), jsx(Title, _extends({}, overrideText, {
|
|
48
52
|
maxLines: maxLines,
|
|
49
53
|
theme: theme
|
|
50
|
-
}));
|
|
54
|
+
})));
|
|
51
55
|
};
|
|
52
56
|
|
|
53
57
|
export default TitleBlockResolvingView;
|
|
@@ -101,7 +101,8 @@ export declare enum ElementName {
|
|
|
101
101
|
* Flexible UI action (button)
|
|
102
102
|
*/
|
|
103
103
|
export declare enum ActionName {
|
|
104
|
-
DeleteAction = "DeleteAction"
|
|
104
|
+
DeleteAction = "DeleteAction",
|
|
105
|
+
CustomAction = "CustomAction"
|
|
105
106
|
}
|
|
106
107
|
/**
|
|
107
108
|
* Flexible UI icons - each mapped to AK icons.
|
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
import { ActionName, ElementName, SmartLinkDirection, SmartLinkSize, SmartLinkStatus } from '../../../../constants';
|
|
2
|
+
import { SerializedStyles } from '@emotion/core';
|
|
3
|
+
import { ActionProps } from '../actions/action/types';
|
|
2
4
|
export declare type BlockProps = {
|
|
3
5
|
direction?: SmartLinkDirection;
|
|
4
6
|
size?: SmartLinkSize;
|
|
5
7
|
status?: SmartLinkStatus;
|
|
6
8
|
testId?: string;
|
|
9
|
+
extraCss?: SerializedStyles;
|
|
7
10
|
};
|
|
8
11
|
export declare type ElementItem = {
|
|
9
12
|
name: ElementName;
|
|
10
13
|
size?: SmartLinkSize;
|
|
11
14
|
testId?: string;
|
|
12
15
|
};
|
|
13
|
-
export declare type
|
|
14
|
-
name: ActionName;
|
|
16
|
+
export declare type BaseActionItem = {
|
|
15
17
|
testId?: string;
|
|
16
18
|
hideContent?: boolean;
|
|
17
19
|
hideIcon?: boolean;
|
|
18
20
|
onClick: () => any;
|
|
19
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Customer can define named action item. Icon and label will be provided implicitly.
|
|
24
|
+
*/
|
|
25
|
+
export declare type NamedActionItem = BaseActionItem & {
|
|
26
|
+
name: Exclude<ActionName, ActionName.CustomAction>;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Customer can define a custom action item. This will require them to specify
|
|
30
|
+
* either `icon` and `iconPosition` OR `content` OR both BUT not neither of those things.
|
|
31
|
+
*/
|
|
32
|
+
export declare type CustomActionItem = BaseActionItem & {
|
|
33
|
+
name: ActionName.CustomAction;
|
|
34
|
+
} & ((Required<Pick<ActionProps, 'icon' | 'iconPosition'>> & Pick<ActionProps, 'content'>) | ((Required<Pick<ActionProps, 'content'>> & Pick<ActionProps, 'icon' | 'iconPosition'>) & Pick<ActionProps, 'tooltipMessage'>));
|
|
35
|
+
export declare type ActionItem = NamedActionItem | CustomActionItem;
|