@atlaskit/smart-card 17.4.3 → 17.5.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 +6 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +18 -7
- package/dist/cjs/view/FlexibleCard/components/actions/utils.js +8 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +50 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/index.js +8 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +23 -3
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +34 -6
- package/dist/es2019/view/FlexibleCard/components/actions/utils.js +5 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +35 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +19 -5
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +17 -7
- package/dist/esm/view/FlexibleCard/components/actions/utils.js +9 -1
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +3 -2
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +34 -0
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +24 -5
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/action-group/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/blocks/footer-block/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/footer-block/types.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cjs/version.json
CHANGED
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
10
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
13
|
|
|
12
14
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -25,9 +27,9 @@ var _token = require("../../../../../utils/token");
|
|
|
25
27
|
|
|
26
28
|
var _utils2 = require("../../../../../utils");
|
|
27
29
|
|
|
28
|
-
var _templateObject;
|
|
30
|
+
var _templateObject, _templateObject2, _sizeToSpacing;
|
|
29
31
|
|
|
30
|
-
var
|
|
32
|
+
var getIconWidth = function getIconWidth(size) {
|
|
31
33
|
switch (size) {
|
|
32
34
|
case _constants.SmartLinkSize.XLarge:
|
|
33
35
|
case _constants.SmartLinkSize.Large:
|
|
@@ -41,7 +43,11 @@ var getWidth = function getWidth(size) {
|
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
var getIconStyles = function getIconStyles(size) {
|
|
44
|
-
return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n ", ";\n"])), _token.tokens.actionIcon, (0, _utils.getIconSizeStyles)(
|
|
46
|
+
return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n ", ";\n"])), _token.tokens.actionIcon, (0, _utils.getIconSizeStyles)(getIconWidth(size)));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var getButtonStyle = function getButtonStyle(size, iconOnly) {
|
|
50
|
+
return size === _constants.SmartLinkSize.Small ? (0, _core.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n font-size: 0.75rem;\n font-weight: 500;\n line-height: 1rem;\n button,\n button:hover,\n button:focus,\n button:active {\n line-height: 1rem;\n ", "\n }\n "])), iconOnly ? "\n padding: 0.125rem;\n " : "\n padding-left: 0.25rem;\n padding-right: 0.25rem;\n ") : '';
|
|
45
51
|
};
|
|
46
52
|
|
|
47
53
|
var ActionIcon = function ActionIcon(_ref) {
|
|
@@ -54,6 +60,8 @@ var ActionIcon = function ActionIcon(_ref) {
|
|
|
54
60
|
}, icon);
|
|
55
61
|
};
|
|
56
62
|
|
|
63
|
+
var sizeToSpacing = (_sizeToSpacing = {}, (0, _defineProperty2.default)(_sizeToSpacing, _constants.SmartLinkSize.Small, 'none'), (0, _defineProperty2.default)(_sizeToSpacing, _constants.SmartLinkSize.Medium, 'compact'), (0, _defineProperty2.default)(_sizeToSpacing, _constants.SmartLinkSize.Large, 'compact'), (0, _defineProperty2.default)(_sizeToSpacing, _constants.SmartLinkSize.XLarge, 'default'), _sizeToSpacing);
|
|
64
|
+
|
|
57
65
|
var Action = function Action(_ref2) {
|
|
58
66
|
var _ref2$appearance = _ref2.appearance,
|
|
59
67
|
appearance = _ref2$appearance === void 0 ? 'subtle' : _ref2$appearance,
|
|
@@ -72,26 +80,29 @@ var Action = function Action(_ref2) {
|
|
|
72
80
|
return null;
|
|
73
81
|
}
|
|
74
82
|
|
|
75
|
-
var iconBefore = iconPosition === 'before' ? (0, _core.jsx)(ActionIcon, {
|
|
83
|
+
var iconBefore = icon && iconPosition === 'before' ? (0, _core.jsx)(ActionIcon, {
|
|
76
84
|
size: size,
|
|
77
85
|
testId: testId,
|
|
78
86
|
icon: icon
|
|
79
87
|
}) : undefined;
|
|
80
|
-
var iconAfter = iconPosition === 'after' ? (0, _core.jsx)(ActionIcon, {
|
|
88
|
+
var iconAfter = icon && iconPosition === 'after' ? (0, _core.jsx)(ActionIcon, {
|
|
81
89
|
size: size,
|
|
82
90
|
testId: testId,
|
|
83
91
|
icon: icon
|
|
84
92
|
}) : undefined;
|
|
93
|
+
var iconOnly = !content;
|
|
85
94
|
return (0, _core.jsx)(_tooltip.default, {
|
|
86
95
|
content: tooltipMessage
|
|
96
|
+
}, (0, _core.jsx)("div", {
|
|
97
|
+
css: getButtonStyle(size, iconOnly)
|
|
87
98
|
}, (0, _core.jsx)(_customThemeButton.default, {
|
|
88
|
-
spacing:
|
|
99
|
+
spacing: sizeToSpacing[size],
|
|
89
100
|
appearance: appearance,
|
|
90
101
|
testId: testId,
|
|
91
102
|
onClick: (0, _utils2.handleOnClick)(onClick),
|
|
92
103
|
iconBefore: iconBefore,
|
|
93
104
|
iconAfter: iconAfter
|
|
94
|
-
}, content));
|
|
105
|
+
}, content)));
|
|
95
106
|
};
|
|
96
107
|
|
|
97
108
|
var _default = Action;
|
|
@@ -31,10 +31,15 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
31
31
|
|
|
32
32
|
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; }
|
|
33
33
|
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
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
|
+
|
|
34
38
|
var actionMappings = (0, _defineProperty2.default)({}, _constants.ActionName.DeleteAction, {
|
|
35
39
|
component: _action.default,
|
|
36
40
|
props: {
|
|
37
41
|
testId: 'smart-action-delete-action',
|
|
42
|
+
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.delete),
|
|
38
43
|
icon: /*#__PURE__*/_react.default.createElement(_cross.default, {
|
|
39
44
|
label: "Delete"
|
|
40
45
|
}),
|
|
@@ -91,7 +96,9 @@ var createUIAction = function createUIAction(name) {
|
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
return function (overrides) {
|
|
94
|
-
|
|
99
|
+
var combinedProps = _objectSpread(_objectSpread({}, props), overrides);
|
|
100
|
+
|
|
101
|
+
return /*#__PURE__*/_react.default.createElement(BaseAction, combinedProps);
|
|
95
102
|
};
|
|
96
103
|
};
|
|
97
104
|
|
|
@@ -25,12 +25,13 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
25
25
|
var _ref$items = _ref.items,
|
|
26
26
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
27
27
|
_ref$size = _ref.size,
|
|
28
|
-
size = _ref$size === void 0 ? _constants.SmartLinkSize.Medium : _ref$size
|
|
28
|
+
size = _ref$size === void 0 ? _constants.SmartLinkSize.Medium : _ref$size,
|
|
29
|
+
appearance = _ref.appearance;
|
|
29
30
|
// Currently we only have delete action available, this prevents others from adding more delete actions
|
|
30
31
|
var actionsToRender = items.slice(0, 1);
|
|
31
32
|
return (0, _core.jsx)("div", {
|
|
32
33
|
css: styles
|
|
33
|
-
}, (0, _core.jsx)(_buttonGroup.default, null, (0, _utils.renderActionItems)(actionsToRender, size)));
|
|
34
|
+
}, (0, _core.jsx)(_buttonGroup.default, null, (0, _utils.renderActionItems)(actionsToRender, size, appearance)));
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
var _default = ActionGroup;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _constants = require("../../../../../constants");
|
|
15
|
+
|
|
16
|
+
var _block = _interopRequireDefault(require("../block"));
|
|
17
|
+
|
|
18
|
+
var _elementGroup = _interopRequireDefault(require("../element-group"));
|
|
19
|
+
|
|
20
|
+
var _elements = require("../../elements");
|
|
21
|
+
|
|
22
|
+
var _actionGroup = _interopRequireDefault(require("../action-group"));
|
|
23
|
+
|
|
24
|
+
var FooterBlock = function FooterBlock(props) {
|
|
25
|
+
var status = props.status,
|
|
26
|
+
actions = props.actions,
|
|
27
|
+
_props$testId = props.testId,
|
|
28
|
+
testId = _props$testId === void 0 ? 'smart-footer-block' : _props$testId;
|
|
29
|
+
|
|
30
|
+
if (status !== _constants.SmartLinkStatus.Resolved) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_block.default, (0, _extends2.default)({}, props, {
|
|
35
|
+
testId: "".concat(testId, "-resolved-view")
|
|
36
|
+
}), /*#__PURE__*/_react.default.createElement(_elements.Provider, {
|
|
37
|
+
testId: "".concat(testId, "-provider")
|
|
38
|
+
}), actions && actions.length > 0 ? /*#__PURE__*/_react.default.createElement(_elementGroup.default, {
|
|
39
|
+
testId: "smart-element-group-actions",
|
|
40
|
+
align: _constants.SmartLinkAlignment.Right,
|
|
41
|
+
direction: _constants.SmartLinkDirection.Horizontal,
|
|
42
|
+
width: _constants.SmartLinkWidth.Flexible
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement(_actionGroup.default, {
|
|
44
|
+
items: actions,
|
|
45
|
+
appearance: "default"
|
|
46
|
+
})) : null);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var _default = FooterBlock;
|
|
50
|
+
exports.default = _default;
|
|
@@ -5,6 +5,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
Object.defineProperty(exports, "FooterBlock", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _footerBlock.default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
8
14
|
Object.defineProperty(exports, "MetadataBlock", {
|
|
9
15
|
enumerable: true,
|
|
10
16
|
get: function get() {
|
|
@@ -24,6 +30,8 @@ Object.defineProperty(exports, "TitleBlock", {
|
|
|
24
30
|
}
|
|
25
31
|
});
|
|
26
32
|
|
|
33
|
+
var _footerBlock = _interopRequireDefault(require("./footer-block"));
|
|
34
|
+
|
|
27
35
|
var _metadataBlock = _interopRequireDefault(require("./metadata-block"));
|
|
28
36
|
|
|
29
37
|
var _snippetBlock = _interopRequireDefault(require("./snippet-block"));
|
|
@@ -36,7 +36,7 @@ var _actionGroup = _interopRequireDefault(require("./action-group"));
|
|
|
36
36
|
var _elementGroup = _interopRequireDefault(require("./element-group"));
|
|
37
37
|
|
|
38
38
|
var _excluded = ["name"],
|
|
39
|
-
_excluded2 = ["name"];
|
|
39
|
+
_excluded2 = ["name", "hideContent", "hideIcon", "onClick"];
|
|
40
40
|
|
|
41
41
|
var _ElementDisplaySchema, _templateObject, _templateObject2, _templateObject3;
|
|
42
42
|
|
|
@@ -44,6 +44,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
44
44
|
|
|
45
45
|
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
46
|
|
|
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
|
+
|
|
47
51
|
var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CollaboratorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CommentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedOn, ['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.Priority, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ProgrammingLanguage, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Provider, ['inline']), _ElementDisplaySchema);
|
|
48
52
|
exports.ElementDisplaySchema = ElementDisplaySchema;
|
|
49
53
|
|
|
@@ -148,16 +152,32 @@ exports.renderElementItems = renderElementItems;
|
|
|
148
152
|
var renderActionItems = function renderActionItems() {
|
|
149
153
|
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
150
154
|
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.SmartLinkSize.Medium;
|
|
155
|
+
var appearance = arguments.length > 2 ? arguments[2] : undefined;
|
|
151
156
|
var actions = items.reduce(function (acc, curr, idx) {
|
|
152
157
|
var name = curr.name,
|
|
158
|
+
hideContent = curr.hideContent,
|
|
159
|
+
hideIcon = curr.hideIcon,
|
|
160
|
+
onClick = curr.onClick,
|
|
153
161
|
props = (0, _objectWithoutProperties2.default)(curr, _excluded2);
|
|
154
162
|
var Action = Actions[name];
|
|
155
163
|
|
|
164
|
+
var actionProps = _objectSpread({}, props);
|
|
165
|
+
|
|
166
|
+
if (hideContent) {
|
|
167
|
+
actionProps.content = '';
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (hideIcon) {
|
|
171
|
+
actionProps.icon = undefined;
|
|
172
|
+
}
|
|
173
|
+
|
|
156
174
|
if (Action) {
|
|
157
175
|
return [].concat((0, _toConsumableArray2.default)(acc), [/*#__PURE__*/_react.default.createElement(Action, (0, _extends2.default)({
|
|
158
176
|
size: size,
|
|
159
|
-
key: idx
|
|
160
|
-
|
|
177
|
+
key: idx,
|
|
178
|
+
appearance: appearance,
|
|
179
|
+
onClick: onClick
|
|
180
|
+
}, actionProps))]);
|
|
161
181
|
}
|
|
162
182
|
|
|
163
183
|
return acc;
|
|
@@ -300,7 +300,7 @@ var AtlaskitIcon = function AtlaskitIcon(_ref3) {
|
|
|
300
300
|
case _constants.IconType.Jira:
|
|
301
301
|
// Logo component has a different prop set from other icon components
|
|
302
302
|
return /*#__PURE__*/_react.default.createElement(ImportedIcon, {
|
|
303
|
-
"data-
|
|
303
|
+
"data-testid": testId // Confluence and Jira imports don't have native testId prop
|
|
304
304
|
,
|
|
305
305
|
textColor: _colors.N700,
|
|
306
306
|
iconColor: _colors.B200,
|
package/dist/es2019/version.json
CHANGED
|
@@ -8,7 +8,7 @@ import { getIconSizeStyles } from '../../utils';
|
|
|
8
8
|
import { tokens } from '../../../../../utils/token';
|
|
9
9
|
import { handleOnClick } from '../../../../../utils';
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const getIconWidth = size => {
|
|
12
12
|
switch (size) {
|
|
13
13
|
case SmartLinkSize.XLarge:
|
|
14
14
|
case SmartLinkSize.Large:
|
|
@@ -23,9 +23,27 @@ const getWidth = size => {
|
|
|
23
23
|
|
|
24
24
|
const getIconStyles = size => css`
|
|
25
25
|
color: ${tokens.actionIcon};
|
|
26
|
-
${getIconSizeStyles(
|
|
26
|
+
${getIconSizeStyles(getIconWidth(size))};
|
|
27
27
|
`;
|
|
28
28
|
|
|
29
|
+
const getButtonStyle = (size, iconOnly) => size === SmartLinkSize.Small ? css`
|
|
30
|
+
font-size: 0.75rem;
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
line-height: 1rem;
|
|
33
|
+
button,
|
|
34
|
+
button:hover,
|
|
35
|
+
button:focus,
|
|
36
|
+
button:active {
|
|
37
|
+
line-height: 1rem;
|
|
38
|
+
${iconOnly ? `
|
|
39
|
+
padding: 0.125rem;
|
|
40
|
+
` : `
|
|
41
|
+
padding-left: 0.25rem;
|
|
42
|
+
padding-right: 0.25rem;
|
|
43
|
+
`}
|
|
44
|
+
}
|
|
45
|
+
` : '';
|
|
46
|
+
|
|
29
47
|
const ActionIcon = ({
|
|
30
48
|
size,
|
|
31
49
|
testId,
|
|
@@ -35,6 +53,13 @@ const ActionIcon = ({
|
|
|
35
53
|
"data-testid": `${testId}-icon`
|
|
36
54
|
}, icon);
|
|
37
55
|
|
|
56
|
+
const sizeToSpacing = {
|
|
57
|
+
[SmartLinkSize.Small]: 'none',
|
|
58
|
+
[SmartLinkSize.Medium]: 'compact',
|
|
59
|
+
[SmartLinkSize.Large]: 'compact',
|
|
60
|
+
[SmartLinkSize.XLarge]: 'default'
|
|
61
|
+
};
|
|
62
|
+
|
|
38
63
|
const Action = ({
|
|
39
64
|
appearance = 'subtle',
|
|
40
65
|
content,
|
|
@@ -49,26 +74,29 @@ const Action = ({
|
|
|
49
74
|
return null;
|
|
50
75
|
}
|
|
51
76
|
|
|
52
|
-
const iconBefore = iconPosition === 'before' ? jsx(ActionIcon, {
|
|
77
|
+
const iconBefore = icon && iconPosition === 'before' ? jsx(ActionIcon, {
|
|
53
78
|
size: size,
|
|
54
79
|
testId: testId,
|
|
55
80
|
icon: icon
|
|
56
81
|
}) : undefined;
|
|
57
|
-
const iconAfter = iconPosition === 'after' ? jsx(ActionIcon, {
|
|
82
|
+
const iconAfter = icon && iconPosition === 'after' ? jsx(ActionIcon, {
|
|
58
83
|
size: size,
|
|
59
84
|
testId: testId,
|
|
60
85
|
icon: icon
|
|
61
86
|
}) : undefined;
|
|
87
|
+
const iconOnly = !content;
|
|
62
88
|
return jsx(Tooltip, {
|
|
63
89
|
content: tooltipMessage
|
|
90
|
+
}, jsx("div", {
|
|
91
|
+
css: getButtonStyle(size, iconOnly)
|
|
64
92
|
}, jsx(Button, {
|
|
65
|
-
spacing:
|
|
93
|
+
spacing: sizeToSpacing[size],
|
|
66
94
|
appearance: appearance,
|
|
67
95
|
testId: testId,
|
|
68
96
|
onClick: handleOnClick(onClick),
|
|
69
97
|
iconBefore: iconBefore,
|
|
70
98
|
iconAfter: iconAfter
|
|
71
|
-
}, content));
|
|
99
|
+
}, content)));
|
|
72
100
|
};
|
|
73
101
|
|
|
74
102
|
export default Action;
|
|
@@ -11,6 +11,7 @@ const actionMappings = {
|
|
|
11
11
|
component: Action,
|
|
12
12
|
props: {
|
|
13
13
|
testId: 'smart-action-delete-action',
|
|
14
|
+
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.delete),
|
|
14
15
|
icon: /*#__PURE__*/React.createElement(CrossIcon, {
|
|
15
16
|
label: "Delete"
|
|
16
17
|
}),
|
|
@@ -66,6 +67,9 @@ export const createUIAction = name => {
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
return overrides => {
|
|
69
|
-
|
|
70
|
+
const combinedProps = { ...props,
|
|
71
|
+
...overrides
|
|
72
|
+
};
|
|
73
|
+
return /*#__PURE__*/React.createElement(BaseAction, combinedProps);
|
|
70
74
|
};
|
|
71
75
|
};
|
|
@@ -10,13 +10,14 @@ const styles = css`
|
|
|
10
10
|
|
|
11
11
|
const ActionGroup = ({
|
|
12
12
|
items = [],
|
|
13
|
-
size = SmartLinkSize.Medium
|
|
13
|
+
size = SmartLinkSize.Medium,
|
|
14
|
+
appearance
|
|
14
15
|
}) => {
|
|
15
16
|
// Currently we only have delete action available, this prevents others from adding more delete actions
|
|
16
17
|
const actionsToRender = items.slice(0, 1);
|
|
17
18
|
return jsx("div", {
|
|
18
19
|
css: styles
|
|
19
|
-
}, jsx(ButtonGroup, null, renderActionItems(actionsToRender, size)));
|
|
20
|
+
}, jsx(ButtonGroup, null, renderActionItems(actionsToRender, size, appearance)));
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export default ActionGroup;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkStatus, SmartLinkWidth } from '../../../../../constants';
|
|
4
|
+
import Block from '../block';
|
|
5
|
+
import ElementGroup from '../element-group';
|
|
6
|
+
import { Provider } from '../../elements';
|
|
7
|
+
import ActionGroup from '../action-group';
|
|
8
|
+
|
|
9
|
+
const FooterBlock = props => {
|
|
10
|
+
const {
|
|
11
|
+
status,
|
|
12
|
+
actions,
|
|
13
|
+
testId = 'smart-footer-block'
|
|
14
|
+
} = props;
|
|
15
|
+
|
|
16
|
+
if (status !== SmartLinkStatus.Resolved) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
|
|
21
|
+
testId: `${testId}-resolved-view`
|
|
22
|
+
}), /*#__PURE__*/React.createElement(Provider, {
|
|
23
|
+
testId: `${testId}-provider`
|
|
24
|
+
}), actions && actions.length > 0 ? /*#__PURE__*/React.createElement(ElementGroup, {
|
|
25
|
+
testId: "smart-element-group-actions",
|
|
26
|
+
align: SmartLinkAlignment.Right,
|
|
27
|
+
direction: SmartLinkDirection.Horizontal,
|
|
28
|
+
width: SmartLinkWidth.Flexible
|
|
29
|
+
}, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
30
|
+
items: actions,
|
|
31
|
+
appearance: "default"
|
|
32
|
+
})) : null);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default FooterBlock;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,8 +6,7 @@ import * as Elements from '../elements';
|
|
|
6
6
|
import * as Actions from '../actions';
|
|
7
7
|
import { isFlexibleUiElement } from '../../../../utils/flexible';
|
|
8
8
|
import ActionGroup from './action-group';
|
|
9
|
-
import ElementGroup from './element-group';
|
|
10
|
-
|
|
9
|
+
import ElementGroup from './element-group';
|
|
11
10
|
export const ElementDisplaySchema = {
|
|
12
11
|
[ElementName.AuthorGroup]: ['inline'],
|
|
13
12
|
[ElementName.CollaboratorGroup]: ['inline'],
|
|
@@ -130,19 +129,34 @@ export const renderElementItems = (items = [], display = 'inline') => {
|
|
|
130
129
|
return elements;
|
|
131
130
|
}
|
|
132
131
|
};
|
|
133
|
-
export const renderActionItems = (items = [], size = SmartLinkSize.Medium) => {
|
|
132
|
+
export const renderActionItems = (items = [], size = SmartLinkSize.Medium, appearance) => {
|
|
134
133
|
const actions = items.reduce((acc, curr, idx) => {
|
|
135
134
|
const {
|
|
136
135
|
name,
|
|
136
|
+
hideContent,
|
|
137
|
+
hideIcon,
|
|
138
|
+
onClick,
|
|
137
139
|
...props
|
|
138
140
|
} = curr;
|
|
139
141
|
const Action = Actions[name];
|
|
142
|
+
const actionProps = { ...props
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
if (hideContent) {
|
|
146
|
+
actionProps.content = '';
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (hideIcon) {
|
|
150
|
+
actionProps.icon = undefined;
|
|
151
|
+
}
|
|
140
152
|
|
|
141
153
|
if (Action) {
|
|
142
154
|
return [...acc, /*#__PURE__*/React.createElement(Action, _extends({
|
|
143
155
|
size: size,
|
|
144
|
-
key: idx
|
|
145
|
-
|
|
156
|
+
key: idx,
|
|
157
|
+
appearance: appearance,
|
|
158
|
+
onClick: onClick
|
|
159
|
+
}, actionProps))];
|
|
146
160
|
}
|
|
147
161
|
|
|
148
162
|
return acc;
|
|
@@ -217,7 +217,7 @@ const AtlaskitIcon = ({
|
|
|
217
217
|
case IconType.Jira:
|
|
218
218
|
// Logo component has a different prop set from other icon components
|
|
219
219
|
return /*#__PURE__*/React.createElement(ImportedIcon, {
|
|
220
|
-
"data-
|
|
220
|
+
"data-testid": testId // Confluence and Jira imports don't have native testId prop
|
|
221
221
|
,
|
|
222
222
|
textColor: N700,
|
|
223
223
|
iconColor: B200,
|
package/dist/esm/version.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
3
|
|
|
3
|
-
var _templateObject;
|
|
4
|
+
var _templateObject, _templateObject2, _sizeToSpacing;
|
|
4
5
|
|
|
5
6
|
/** @jsx jsx */
|
|
6
7
|
import React from 'react';
|
|
@@ -12,7 +13,7 @@ import { getIconSizeStyles } from '../../utils';
|
|
|
12
13
|
import { tokens } from '../../../../../utils/token';
|
|
13
14
|
import { handleOnClick } from '../../../../../utils';
|
|
14
15
|
|
|
15
|
-
var
|
|
16
|
+
var getIconWidth = function getIconWidth(size) {
|
|
16
17
|
switch (size) {
|
|
17
18
|
case SmartLinkSize.XLarge:
|
|
18
19
|
case SmartLinkSize.Large:
|
|
@@ -26,7 +27,11 @@ var getWidth = function getWidth(size) {
|
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
var getIconStyles = function getIconStyles(size) {
|
|
29
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n ", ";\n"])), tokens.actionIcon, getIconSizeStyles(
|
|
30
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n ", ";\n"])), tokens.actionIcon, getIconSizeStyles(getIconWidth(size)));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var getButtonStyle = function getButtonStyle(size, iconOnly) {
|
|
34
|
+
return size === SmartLinkSize.Small ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 0.75rem;\n font-weight: 500;\n line-height: 1rem;\n button,\n button:hover,\n button:focus,\n button:active {\n line-height: 1rem;\n ", "\n }\n "])), iconOnly ? "\n padding: 0.125rem;\n " : "\n padding-left: 0.25rem;\n padding-right: 0.25rem;\n ") : '';
|
|
30
35
|
};
|
|
31
36
|
|
|
32
37
|
var ActionIcon = function ActionIcon(_ref) {
|
|
@@ -39,6 +44,8 @@ var ActionIcon = function ActionIcon(_ref) {
|
|
|
39
44
|
}, icon);
|
|
40
45
|
};
|
|
41
46
|
|
|
47
|
+
var sizeToSpacing = (_sizeToSpacing = {}, _defineProperty(_sizeToSpacing, SmartLinkSize.Small, 'none'), _defineProperty(_sizeToSpacing, SmartLinkSize.Medium, 'compact'), _defineProperty(_sizeToSpacing, SmartLinkSize.Large, 'compact'), _defineProperty(_sizeToSpacing, SmartLinkSize.XLarge, 'default'), _sizeToSpacing);
|
|
48
|
+
|
|
42
49
|
var Action = function Action(_ref2) {
|
|
43
50
|
var _ref2$appearance = _ref2.appearance,
|
|
44
51
|
appearance = _ref2$appearance === void 0 ? 'subtle' : _ref2$appearance,
|
|
@@ -57,26 +64,29 @@ var Action = function Action(_ref2) {
|
|
|
57
64
|
return null;
|
|
58
65
|
}
|
|
59
66
|
|
|
60
|
-
var iconBefore = iconPosition === 'before' ? jsx(ActionIcon, {
|
|
67
|
+
var iconBefore = icon && iconPosition === 'before' ? jsx(ActionIcon, {
|
|
61
68
|
size: size,
|
|
62
69
|
testId: testId,
|
|
63
70
|
icon: icon
|
|
64
71
|
}) : undefined;
|
|
65
|
-
var iconAfter = iconPosition === 'after' ? jsx(ActionIcon, {
|
|
72
|
+
var iconAfter = icon && iconPosition === 'after' ? jsx(ActionIcon, {
|
|
66
73
|
size: size,
|
|
67
74
|
testId: testId,
|
|
68
75
|
icon: icon
|
|
69
76
|
}) : undefined;
|
|
77
|
+
var iconOnly = !content;
|
|
70
78
|
return jsx(Tooltip, {
|
|
71
79
|
content: tooltipMessage
|
|
80
|
+
}, jsx("div", {
|
|
81
|
+
css: getButtonStyle(size, iconOnly)
|
|
72
82
|
}, jsx(Button, {
|
|
73
|
-
spacing:
|
|
83
|
+
spacing: sizeToSpacing[size],
|
|
74
84
|
appearance: appearance,
|
|
75
85
|
testId: testId,
|
|
76
86
|
onClick: handleOnClick(onClick),
|
|
77
87
|
iconBefore: iconBefore,
|
|
78
88
|
iconAfter: iconAfter
|
|
79
|
-
}, content));
|
|
89
|
+
}, content)));
|
|
80
90
|
};
|
|
81
91
|
|
|
82
92
|
export default Action;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
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
|
+
|
|
6
|
+
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; }
|
|
7
|
+
|
|
3
8
|
import { ActionName } from '../../../../constants';
|
|
4
9
|
import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
5
10
|
import React, { useContext } from 'react';
|
|
@@ -12,6 +17,7 @@ var actionMappings = _defineProperty({}, ActionName.DeleteAction, {
|
|
|
12
17
|
component: Action,
|
|
13
18
|
props: {
|
|
14
19
|
testId: 'smart-action-delete-action',
|
|
20
|
+
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.delete),
|
|
15
21
|
icon: /*#__PURE__*/React.createElement(CrossIcon, {
|
|
16
22
|
label: "Delete"
|
|
17
23
|
}),
|
|
@@ -65,6 +71,8 @@ export var createUIAction = function createUIAction(name) {
|
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
return function (overrides) {
|
|
68
|
-
|
|
74
|
+
var combinedProps = _objectSpread(_objectSpread({}, props), overrides);
|
|
75
|
+
|
|
76
|
+
return /*#__PURE__*/React.createElement(BaseAction, combinedProps);
|
|
69
77
|
};
|
|
70
78
|
};
|
|
@@ -13,12 +13,13 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
13
13
|
var _ref$items = _ref.items,
|
|
14
14
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
15
15
|
_ref$size = _ref.size,
|
|
16
|
-
size = _ref$size === void 0 ? SmartLinkSize.Medium : _ref$size
|
|
16
|
+
size = _ref$size === void 0 ? SmartLinkSize.Medium : _ref$size,
|
|
17
|
+
appearance = _ref.appearance;
|
|
17
18
|
// Currently we only have delete action available, this prevents others from adding more delete actions
|
|
18
19
|
var actionsToRender = items.slice(0, 1);
|
|
19
20
|
return jsx("div", {
|
|
20
21
|
css: styles
|
|
21
|
-
}, jsx(ButtonGroup, null, renderActionItems(actionsToRender, size)));
|
|
22
|
+
}, jsx(ButtonGroup, null, renderActionItems(actionsToRender, size, appearance)));
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
export default ActionGroup;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkStatus, SmartLinkWidth } from '../../../../../constants';
|
|
4
|
+
import Block from '../block';
|
|
5
|
+
import ElementGroup from '../element-group';
|
|
6
|
+
import { Provider } from '../../elements';
|
|
7
|
+
import ActionGroup from '../action-group';
|
|
8
|
+
|
|
9
|
+
var FooterBlock = function FooterBlock(props) {
|
|
10
|
+
var status = props.status,
|
|
11
|
+
actions = props.actions,
|
|
12
|
+
_props$testId = props.testId,
|
|
13
|
+
testId = _props$testId === void 0 ? 'smart-footer-block' : _props$testId;
|
|
14
|
+
|
|
15
|
+
if (status !== SmartLinkStatus.Resolved) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
|
|
20
|
+
testId: "".concat(testId, "-resolved-view")
|
|
21
|
+
}), /*#__PURE__*/React.createElement(Provider, {
|
|
22
|
+
testId: "".concat(testId, "-provider")
|
|
23
|
+
}), actions && actions.length > 0 ? /*#__PURE__*/React.createElement(ElementGroup, {
|
|
24
|
+
testId: "smart-element-group-actions",
|
|
25
|
+
align: SmartLinkAlignment.Right,
|
|
26
|
+
direction: SmartLinkDirection.Horizontal,
|
|
27
|
+
width: SmartLinkWidth.Flexible
|
|
28
|
+
}, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
29
|
+
items: actions,
|
|
30
|
+
appearance: "default"
|
|
31
|
+
})) : null);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default FooterBlock;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,10 +4,14 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
4
4
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
6
|
var _excluded = ["name"],
|
|
7
|
-
_excluded2 = ["name"];
|
|
7
|
+
_excluded2 = ["name", "hideContent", "hideIcon", "onClick"];
|
|
8
8
|
|
|
9
9
|
var _ElementDisplaySchema, _templateObject, _templateObject2, _templateObject3;
|
|
10
10
|
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
11
15
|
import React from 'react';
|
|
12
16
|
import { css } from '@emotion/core';
|
|
13
17
|
import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
|
|
@@ -15,8 +19,7 @@ import * as Elements from '../elements';
|
|
|
15
19
|
import * as Actions from '../actions';
|
|
16
20
|
import { isFlexibleUiElement } from '../../../../utils/flexible';
|
|
17
21
|
import ActionGroup from './action-group';
|
|
18
|
-
import ElementGroup from './element-group';
|
|
19
|
-
|
|
22
|
+
import ElementGroup from './element-group';
|
|
20
23
|
export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _ElementDisplaySchema);
|
|
21
24
|
|
|
22
25
|
var getDirectionStyles = function getDirectionStyles(direction) {
|
|
@@ -110,17 +113,33 @@ export var renderElementItems = function renderElementItems() {
|
|
|
110
113
|
export var renderActionItems = function renderActionItems() {
|
|
111
114
|
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
112
115
|
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SmartLinkSize.Medium;
|
|
116
|
+
var appearance = arguments.length > 2 ? arguments[2] : undefined;
|
|
113
117
|
var actions = items.reduce(function (acc, curr, idx) {
|
|
114
118
|
var name = curr.name,
|
|
119
|
+
hideContent = curr.hideContent,
|
|
120
|
+
hideIcon = curr.hideIcon,
|
|
121
|
+
onClick = curr.onClick,
|
|
115
122
|
props = _objectWithoutProperties(curr, _excluded2);
|
|
116
123
|
|
|
117
124
|
var Action = Actions[name];
|
|
118
125
|
|
|
126
|
+
var actionProps = _objectSpread({}, props);
|
|
127
|
+
|
|
128
|
+
if (hideContent) {
|
|
129
|
+
actionProps.content = '';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (hideIcon) {
|
|
133
|
+
actionProps.icon = undefined;
|
|
134
|
+
}
|
|
135
|
+
|
|
119
136
|
if (Action) {
|
|
120
137
|
return [].concat(_toConsumableArray(acc), [/*#__PURE__*/React.createElement(Action, _extends({
|
|
121
138
|
size: size,
|
|
122
|
-
key: idx
|
|
123
|
-
|
|
139
|
+
key: idx,
|
|
140
|
+
appearance: appearance,
|
|
141
|
+
onClick: onClick
|
|
142
|
+
}, actionProps))]);
|
|
124
143
|
}
|
|
125
144
|
|
|
126
145
|
return acc;
|
|
@@ -281,7 +281,7 @@ var AtlaskitIcon = function AtlaskitIcon(_ref3) {
|
|
|
281
281
|
case IconType.Jira:
|
|
282
282
|
// Logo component has a different prop set from other icon components
|
|
283
283
|
return /*#__PURE__*/React.createElement(ImportedIcon, {
|
|
284
|
-
"data-
|
|
284
|
+
"data-testid": testId // Confluence and Jira imports don't have native testId prop
|
|
285
285
|
,
|
|
286
286
|
textColor: N700,
|
|
287
287
|
iconColor: B200,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { SmartLinkSize, SmartLinkDirection } from '../../../../../constants';
|
|
2
2
|
import { ActionItem } from '../types';
|
|
3
|
+
import { Appearance } from '@atlaskit/button';
|
|
3
4
|
export declare type ActionGroupProps = {
|
|
4
5
|
items: ActionItem[];
|
|
5
6
|
size?: SmartLinkSize;
|
|
6
7
|
direction?: SmartLinkDirection;
|
|
7
8
|
testId?: string;
|
|
9
|
+
appearance?: Appearance;
|
|
8
10
|
};
|
|
@@ -8,4 +8,4 @@ export declare const getGapSize: (size: SmartLinkSize) => number;
|
|
|
8
8
|
export declare const getBaseStyles: (direction: SmartLinkDirection, size: SmartLinkSize) => SerializedStyles;
|
|
9
9
|
export declare const renderChildren: (children: React.ReactNode, size: SmartLinkSize) => React.ReactNode;
|
|
10
10
|
export declare const renderElementItems: (items?: ElementItem[], display?: ElementDisplaySchemaType) => React.ReactNode | undefined;
|
|
11
|
-
export declare const renderActionItems: (items?: ActionItem[], size?: SmartLinkSize) => React.ReactNode | undefined;
|
|
11
|
+
export declare const renderActionItems: (items?: ActionItem[], size?: SmartLinkSize, appearance?: "link" | "default" | "danger" | "primary" | "subtle" | "subtle-link" | "warning" | undefined) => React.ReactNode | undefined;
|