@atlaskit/smart-card 17.5.3 → 17.6.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 17.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`0cab291e19e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0cab291e19e) - Add "more" and dopdown for actions when there is more then 2
8
+
3
9
  ## 17.5.3
4
10
 
5
11
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -53,6 +53,12 @@ Object.defineProperty(exports, "EmbedResizeMessageListener", {
53
53
  return _EmbedResizeMessageListener.EmbedResizeMessageListener;
54
54
  }
55
55
  });
56
+ Object.defineProperty(exports, "FooterBlock", {
57
+ enumerable: true,
58
+ get: function get() {
59
+ return _blocks.FooterBlock;
60
+ }
61
+ });
56
62
  Object.defineProperty(exports, "MetadataBlock", {
57
63
  enumerable: true,
58
64
  get: function get() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.5.3",
3
+ "version": "17.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.sizeToSpacing = exports.default = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
@@ -21,6 +21,8 @@ var _constants = require("../../../../../constants");
21
21
 
22
22
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
23
23
 
24
+ var _dropdownMenu = require("@atlaskit/dropdown-menu");
25
+
24
26
  var _utils = require("../../utils");
25
27
 
26
28
  var _token = require("../../../../../utils/token");
@@ -61,6 +63,7 @@ var ActionIcon = function ActionIcon(_ref) {
61
63
  };
62
64
 
63
65
  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);
66
+ exports.sizeToSpacing = sizeToSpacing;
64
67
 
65
68
  var Action = function Action(_ref2) {
66
69
  var _ref2$appearance = _ref2.appearance,
@@ -74,7 +77,8 @@ var Action = function Action(_ref2) {
74
77
  icon = _ref2.icon,
75
78
  _ref2$iconPosition = _ref2.iconPosition,
76
79
  iconPosition = _ref2$iconPosition === void 0 ? 'before' : _ref2$iconPosition,
77
- tooltipMessage = _ref2.tooltipMessage;
80
+ tooltipMessage = _ref2.tooltipMessage,
81
+ asDropDownItem = _ref2.asDropDownItem;
78
82
 
79
83
  if (!onClick) {
80
84
  return null;
@@ -91,18 +95,28 @@ var Action = function Action(_ref2) {
91
95
  icon: icon
92
96
  }) : undefined;
93
97
  var iconOnly = !content;
94
- return (0, _core.jsx)(_tooltip.default, {
95
- content: tooltipMessage
96
- }, (0, _core.jsx)("div", {
97
- css: getButtonStyle(size, iconOnly)
98
- }, (0, _core.jsx)(_customThemeButton.default, {
99
- spacing: sizeToSpacing[size],
100
- appearance: appearance,
101
- testId: testId,
102
- onClick: (0, _utils2.handleOnClick)(onClick),
103
- iconBefore: iconBefore,
104
- iconAfter: iconAfter
105
- }, content)));
98
+
99
+ if (asDropDownItem) {
100
+ return (0, _core.jsx)(_dropdownMenu.DropdownItem, {
101
+ elemBefore: iconBefore,
102
+ elemAfter: iconAfter,
103
+ testId: testId,
104
+ onClick: (0, _utils2.handleOnClick)(onClick)
105
+ }, content);
106
+ } else {
107
+ return (0, _core.jsx)(_tooltip.default, {
108
+ content: tooltipMessage
109
+ }, (0, _core.jsx)("div", {
110
+ css: getButtonStyle(size, iconOnly)
111
+ }, (0, _core.jsx)(_customThemeButton.default, {
112
+ spacing: sizeToSpacing[size],
113
+ appearance: appearance,
114
+ testId: testId,
115
+ onClick: (0, _utils2.handleOnClick)(onClick),
116
+ iconBefore: iconBefore,
117
+ iconAfter: iconAfter
118
+ }, content)));
119
+ }
106
120
  };
107
121
 
108
122
  var _default = Action;
@@ -7,6 +7,10 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
+
10
14
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
15
 
12
16
  var _core = require("@emotion/core");
@@ -15,8 +19,18 @@ var _buttonGroup = _interopRequireDefault(require("@atlaskit/button/button-group
15
19
 
16
20
  var _utils = require("../utils");
17
21
 
22
+ var _dropdownMenu = _interopRequireDefault(require("@atlaskit/dropdown-menu"));
23
+
18
24
  var _constants = require("../../../../../constants");
19
25
 
26
+ var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
27
+
28
+ var _more = _interopRequireDefault(require("@atlaskit/icon/glyph/more"));
29
+
30
+ var _action = require("../../actions/action");
31
+
32
+ var _excluded = ["triggerRef"];
33
+
20
34
  var _templateObject;
21
35
 
22
36
  var styles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: inline-flex;\n line-height: 1rem;\n"])));
@@ -27,11 +41,25 @@ var ActionGroup = function ActionGroup(_ref) {
27
41
  _ref$size = _ref.size,
28
42
  size = _ref$size === void 0 ? _constants.SmartLinkSize.Medium : _ref$size,
29
43
  appearance = _ref.appearance;
30
- // Currently we only have delete action available, this prevents others from adding more delete actions
31
- var actionsToRender = items.slice(0, 1);
44
+ var isMoreThenTwoItems = items.length > 2;
45
+ var firstActions = isMoreThenTwoItems ? items.slice(0, 1) : items;
46
+ var restActions = isMoreThenTwoItems ? items.slice(1) : [];
32
47
  return (0, _core.jsx)("div", {
33
48
  css: styles
34
- }, (0, _core.jsx)(_buttonGroup.default, null, (0, _utils.renderActionItems)(actionsToRender, size, appearance)));
49
+ }, (0, _core.jsx)(_buttonGroup.default, null, (0, _utils.renderActionItems)(firstActions, size, appearance), restActions.length > 0 ? (0, _core.jsx)(_dropdownMenu.default, {
50
+ trigger: function trigger(_ref2) {
51
+ var triggerRef = _ref2.triggerRef,
52
+ props = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
53
+ return (0, _core.jsx)(_standardButton.default, (0, _extends2.default)({}, props, {
54
+ spacing: _action.sizeToSpacing[size],
55
+ testId: "action-group-more-button",
56
+ iconBefore: (0, _core.jsx)(_more.default, {
57
+ label: "more"
58
+ }),
59
+ ref: triggerRef
60
+ }));
61
+ }
62
+ }, (0, _utils.renderActionItems)(restActions, size, appearance, true)) : null));
35
63
  };
36
64
 
37
65
  var _default = ActionGroup;
@@ -153,6 +153,7 @@ var renderActionItems = function renderActionItems() {
153
153
  var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
154
154
  var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.SmartLinkSize.Medium;
155
155
  var appearance = arguments.length > 2 ? arguments[2] : undefined;
156
+ var asDropDownItems = arguments.length > 3 ? arguments[3] : undefined;
156
157
  var actions = items.reduce(function (acc, curr, idx) {
157
158
  var name = curr.name,
158
159
  hideContent = curr.hideContent,
@@ -163,7 +164,7 @@ var renderActionItems = function renderActionItems() {
163
164
 
164
165
  var actionProps = _objectSpread({}, props);
165
166
 
166
- if (hideContent) {
167
+ if (hideContent && !asDropDownItems) {
167
168
  actionProps.content = '';
168
169
  }
169
170
 
@@ -173,6 +174,7 @@ var renderActionItems = function renderActionItems() {
173
174
 
174
175
  if (Action) {
175
176
  return [].concat((0, _toConsumableArray2.default)(acc), [/*#__PURE__*/_react.default.createElement(Action, (0, _extends2.default)({
177
+ asDropDownItem: asDropDownItems,
176
178
  size: size,
177
179
  key: idx,
178
180
  appearance: appearance,
@@ -13,4 +13,4 @@ export { contentFooterClassName, metadataListClassName, blockCardResolvingViewCl
13
13
  export { loadingPlaceholderClassName } from './view/CardWithUrl/component-lazy/LazyFallback'; // Flexible UI
14
14
 
15
15
  export { ActionName, ElementName, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkTheme } from './constants';
16
- export { MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from './view/FlexibleCard/components/blocks';
16
+ export { MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock, FooterBlock } from './view/FlexibleCard/components/blocks';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.5.3",
3
+ "version": "17.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -4,6 +4,7 @@ import { css, jsx } from '@emotion/core';
4
4
  import Button from '@atlaskit/button/custom-theme-button';
5
5
  import { SmartLinkSize } from '../../../../../constants';
6
6
  import Tooltip from '@atlaskit/tooltip';
7
+ import { DropdownItem } from '@atlaskit/dropdown-menu';
7
8
  import { getIconSizeStyles } from '../../utils';
8
9
  import { tokens } from '../../../../../utils/token';
9
10
  import { handleOnClick } from '../../../../../utils';
@@ -53,7 +54,7 @@ const ActionIcon = ({
53
54
  "data-testid": `${testId}-icon`
54
55
  }, icon);
55
56
 
56
- const sizeToSpacing = {
57
+ export const sizeToSpacing = {
57
58
  [SmartLinkSize.Small]: 'none',
58
59
  [SmartLinkSize.Medium]: 'compact',
59
60
  [SmartLinkSize.Large]: 'compact',
@@ -68,7 +69,8 @@ const Action = ({
68
69
  testId = 'smart-action',
69
70
  icon,
70
71
  iconPosition = 'before',
71
- tooltipMessage
72
+ tooltipMessage,
73
+ asDropDownItem
72
74
  }) => {
73
75
  if (!onClick) {
74
76
  return null;
@@ -85,18 +87,28 @@ const Action = ({
85
87
  icon: icon
86
88
  }) : undefined;
87
89
  const iconOnly = !content;
88
- return jsx(Tooltip, {
89
- content: tooltipMessage
90
- }, jsx("div", {
91
- css: getButtonStyle(size, iconOnly)
92
- }, jsx(Button, {
93
- spacing: sizeToSpacing[size],
94
- appearance: appearance,
95
- testId: testId,
96
- onClick: handleOnClick(onClick),
97
- iconBefore: iconBefore,
98
- iconAfter: iconAfter
99
- }, content)));
90
+
91
+ if (asDropDownItem) {
92
+ return jsx(DropdownItem, {
93
+ elemBefore: iconBefore,
94
+ elemAfter: iconAfter,
95
+ testId: testId,
96
+ onClick: handleOnClick(onClick)
97
+ }, content);
98
+ } else {
99
+ return jsx(Tooltip, {
100
+ content: tooltipMessage
101
+ }, jsx("div", {
102
+ css: getButtonStyle(size, iconOnly)
103
+ }, jsx(Button, {
104
+ spacing: sizeToSpacing[size],
105
+ appearance: appearance,
106
+ testId: testId,
107
+ onClick: handleOnClick(onClick),
108
+ iconBefore: iconBefore,
109
+ iconAfter: iconAfter
110
+ }, content)));
111
+ }
100
112
  };
101
113
 
102
114
  export default Action;
@@ -1,8 +1,14 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+
1
3
  /** @jsx jsx */
2
4
  import { css, jsx } from '@emotion/core';
3
5
  import ButtonGroup from '@atlaskit/button/button-group';
4
6
  import { renderActionItems } from '../utils';
7
+ import DropdownMenu from '@atlaskit/dropdown-menu';
5
8
  import { SmartLinkSize } from '../../../../../constants';
9
+ import Button from '@atlaskit/button/standard-button';
10
+ import MoreIcon from '@atlaskit/icon/glyph/more';
11
+ import { sizeToSpacing } from '../../actions/action';
6
12
  const styles = css`
7
13
  display: inline-flex;
8
14
  line-height: 1rem;
@@ -13,11 +19,24 @@ const ActionGroup = ({
13
19
  size = SmartLinkSize.Medium,
14
20
  appearance
15
21
  }) => {
16
- // Currently we only have delete action available, this prevents others from adding more delete actions
17
- const actionsToRender = items.slice(0, 1);
22
+ const isMoreThenTwoItems = items.length > 2;
23
+ const firstActions = isMoreThenTwoItems ? items.slice(0, 1) : items;
24
+ const restActions = isMoreThenTwoItems ? items.slice(1) : [];
18
25
  return jsx("div", {
19
26
  css: styles
20
- }, jsx(ButtonGroup, null, renderActionItems(actionsToRender, size, appearance)));
27
+ }, jsx(ButtonGroup, null, renderActionItems(firstActions, size, appearance), restActions.length > 0 ? jsx(DropdownMenu, {
28
+ trigger: ({
29
+ triggerRef,
30
+ ...props
31
+ }) => jsx(Button, _extends({}, props, {
32
+ spacing: sizeToSpacing[size],
33
+ testId: "action-group-more-button",
34
+ iconBefore: jsx(MoreIcon, {
35
+ label: "more"
36
+ }),
37
+ ref: triggerRef
38
+ }))
39
+ }, renderActionItems(restActions, size, appearance, true)) : null));
21
40
  };
22
41
 
23
42
  export default ActionGroup;
@@ -130,7 +130,7 @@ export const renderElementItems = (items = [], display = 'inline') => {
130
130
  return elements;
131
131
  }
132
132
  };
133
- export const renderActionItems = (items = [], size = SmartLinkSize.Medium, appearance) => {
133
+ export const renderActionItems = (items = [], size = SmartLinkSize.Medium, appearance, asDropDownItems) => {
134
134
  const actions = items.reduce((acc, curr, idx) => {
135
135
  const {
136
136
  name,
@@ -143,7 +143,7 @@ export const renderActionItems = (items = [], size = SmartLinkSize.Medium, appea
143
143
  const actionProps = { ...props
144
144
  };
145
145
 
146
- if (hideContent) {
146
+ if (hideContent && !asDropDownItems) {
147
147
  actionProps.content = '';
148
148
  }
149
149
 
@@ -153,6 +153,7 @@ export const renderActionItems = (items = [], size = SmartLinkSize.Medium, appea
153
153
 
154
154
  if (Action) {
155
155
  return [...acc, /*#__PURE__*/React.createElement(Action, _extends({
156
+ asDropDownItem: asDropDownItems,
156
157
  size: size,
157
158
  key: idx,
158
159
  appearance: appearance,
package/dist/esm/index.js CHANGED
@@ -13,4 +13,4 @@ export { contentFooterClassName, metadataListClassName, blockCardResolvingViewCl
13
13
  export { loadingPlaceholderClassName } from './view/CardWithUrl/component-lazy/LazyFallback'; // Flexible UI
14
14
 
15
15
  export { ActionName, ElementName, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkTheme } from './constants';
16
- export { MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from './view/FlexibleCard/components/blocks';
16
+ export { MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock, FooterBlock } from './view/FlexibleCard/components/blocks';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.5.3",
3
+ "version": "17.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -9,6 +9,7 @@ import { css, jsx } from '@emotion/core';
9
9
  import Button from '@atlaskit/button/custom-theme-button';
10
10
  import { SmartLinkSize } from '../../../../../constants';
11
11
  import Tooltip from '@atlaskit/tooltip';
12
+ import { DropdownItem } from '@atlaskit/dropdown-menu';
12
13
  import { getIconSizeStyles } from '../../utils';
13
14
  import { tokens } from '../../../../../utils/token';
14
15
  import { handleOnClick } from '../../../../../utils';
@@ -44,7 +45,7 @@ var ActionIcon = function ActionIcon(_ref) {
44
45
  }, icon);
45
46
  };
46
47
 
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
+ export 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
49
 
49
50
  var Action = function Action(_ref2) {
50
51
  var _ref2$appearance = _ref2.appearance,
@@ -58,7 +59,8 @@ var Action = function Action(_ref2) {
58
59
  icon = _ref2.icon,
59
60
  _ref2$iconPosition = _ref2.iconPosition,
60
61
  iconPosition = _ref2$iconPosition === void 0 ? 'before' : _ref2$iconPosition,
61
- tooltipMessage = _ref2.tooltipMessage;
62
+ tooltipMessage = _ref2.tooltipMessage,
63
+ asDropDownItem = _ref2.asDropDownItem;
62
64
 
63
65
  if (!onClick) {
64
66
  return null;
@@ -75,18 +77,28 @@ var Action = function Action(_ref2) {
75
77
  icon: icon
76
78
  }) : undefined;
77
79
  var iconOnly = !content;
78
- return jsx(Tooltip, {
79
- content: tooltipMessage
80
- }, jsx("div", {
81
- css: getButtonStyle(size, iconOnly)
82
- }, jsx(Button, {
83
- spacing: sizeToSpacing[size],
84
- appearance: appearance,
85
- testId: testId,
86
- onClick: handleOnClick(onClick),
87
- iconBefore: iconBefore,
88
- iconAfter: iconAfter
89
- }, content)));
80
+
81
+ if (asDropDownItem) {
82
+ return jsx(DropdownItem, {
83
+ elemBefore: iconBefore,
84
+ elemAfter: iconAfter,
85
+ testId: testId,
86
+ onClick: handleOnClick(onClick)
87
+ }, content);
88
+ } else {
89
+ return jsx(Tooltip, {
90
+ content: tooltipMessage
91
+ }, jsx("div", {
92
+ css: getButtonStyle(size, iconOnly)
93
+ }, jsx(Button, {
94
+ spacing: sizeToSpacing[size],
95
+ appearance: appearance,
96
+ testId: testId,
97
+ onClick: handleOnClick(onClick),
98
+ iconBefore: iconBefore,
99
+ iconAfter: iconAfter
100
+ }, content)));
101
+ }
90
102
  };
91
103
 
92
104
  export default Action;
@@ -1,4 +1,7 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
1
3
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
4
+ var _excluded = ["triggerRef"];
2
5
 
3
6
  var _templateObject;
4
7
 
@@ -6,7 +9,11 @@ var _templateObject;
6
9
  import { css, jsx } from '@emotion/core';
7
10
  import ButtonGroup from '@atlaskit/button/button-group';
8
11
  import { renderActionItems } from '../utils';
12
+ import DropdownMenu from '@atlaskit/dropdown-menu';
9
13
  import { SmartLinkSize } from '../../../../../constants';
14
+ import Button from '@atlaskit/button/standard-button';
15
+ import MoreIcon from '@atlaskit/icon/glyph/more';
16
+ import { sizeToSpacing } from '../../actions/action';
10
17
  var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n line-height: 1rem;\n"])));
11
18
 
12
19
  var ActionGroup = function ActionGroup(_ref) {
@@ -15,11 +22,26 @@ var ActionGroup = function ActionGroup(_ref) {
15
22
  _ref$size = _ref.size,
16
23
  size = _ref$size === void 0 ? SmartLinkSize.Medium : _ref$size,
17
24
  appearance = _ref.appearance;
18
- // Currently we only have delete action available, this prevents others from adding more delete actions
19
- var actionsToRender = items.slice(0, 1);
25
+ var isMoreThenTwoItems = items.length > 2;
26
+ var firstActions = isMoreThenTwoItems ? items.slice(0, 1) : items;
27
+ var restActions = isMoreThenTwoItems ? items.slice(1) : [];
20
28
  return jsx("div", {
21
29
  css: styles
22
- }, jsx(ButtonGroup, null, renderActionItems(actionsToRender, size, appearance)));
30
+ }, jsx(ButtonGroup, null, renderActionItems(firstActions, size, appearance), restActions.length > 0 ? jsx(DropdownMenu, {
31
+ trigger: function trigger(_ref2) {
32
+ var triggerRef = _ref2.triggerRef,
33
+ props = _objectWithoutProperties(_ref2, _excluded);
34
+
35
+ return jsx(Button, _extends({}, props, {
36
+ spacing: sizeToSpacing[size],
37
+ testId: "action-group-more-button",
38
+ iconBefore: jsx(MoreIcon, {
39
+ label: "more"
40
+ }),
41
+ ref: triggerRef
42
+ }));
43
+ }
44
+ }, renderActionItems(restActions, size, appearance, true)) : null));
23
45
  };
24
46
 
25
47
  export default ActionGroup;
@@ -114,6 +114,7 @@ export var renderActionItems = function renderActionItems() {
114
114
  var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
115
115
  var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SmartLinkSize.Medium;
116
116
  var appearance = arguments.length > 2 ? arguments[2] : undefined;
117
+ var asDropDownItems = arguments.length > 3 ? arguments[3] : undefined;
117
118
  var actions = items.reduce(function (acc, curr, idx) {
118
119
  var name = curr.name,
119
120
  hideContent = curr.hideContent,
@@ -125,7 +126,7 @@ export var renderActionItems = function renderActionItems() {
125
126
 
126
127
  var actionProps = _objectSpread({}, props);
127
128
 
128
- if (hideContent) {
129
+ if (hideContent && !asDropDownItems) {
129
130
  actionProps.content = '';
130
131
  }
131
132
 
@@ -135,6 +136,7 @@ export var renderActionItems = function renderActionItems() {
135
136
 
136
137
  if (Action) {
137
138
  return [].concat(_toConsumableArray(acc), [/*#__PURE__*/React.createElement(Action, _extends({
139
+ asDropDownItem: asDropDownItems,
138
140
  size: size,
139
141
  key: idx,
140
142
  appearance: appearance,
@@ -1,5 +1,4 @@
1
1
  /// <reference types="cypress" />
2
- /// <reference types="jquery" />
3
2
  import { InProductTestPageObject, CypressType } from '@atlaskit/in-product-testing';
4
3
  import { CardType } from '../../state/store/types';
5
4
  import { CardAppearance } from '../../view/Card';
@@ -17,5 +17,5 @@ export { useSmartLinkEvents } from './view/SmartLinkEvents/useSmartLinkEvents';
17
17
  export { contentFooterClassName, metadataListClassName, blockCardResolvingViewClassName, blockCardResolvedViewClassName, blockCardForbiddenViewClassName, blockCardIconImageClassName, blockCardResolvedViewByClassName, blockCardForbiddenViewLinkClassName, blockCardContentClassName, blockCardContentHeaderClassName, blockCardContentHeaderNameClassName, blockCardNotFoundViewClassName, blockCardErroredViewClassName, } from './classNames';
18
18
  export { loadingPlaceholderClassName } from './view/CardWithUrl/component-lazy/LazyFallback';
19
19
  export { ActionName, ElementName, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkTheme, } from './constants';
20
- export { MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock, } from './view/FlexibleCard/components/blocks';
20
+ export { MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock, FooterBlock, } from './view/FlexibleCard/components/blocks';
21
21
  export type { ActionItem, ElementItem, } from './view/FlexibleCard/components/blocks/types';
@@ -8,4 +8,4 @@ export declare const isSpecialClick: (event: React.MouseEvent) => boolean;
8
8
  export declare const getIconForFileType: (fileMimeType: string) => React.ReactNode | undefined;
9
9
  export declare const getLabelForFileType: (fileMimeType: string) => React.ReactNode | undefined;
10
10
  export declare const getIframeSandboxAttribute: (isTrusted: boolean) => "allow-downloads allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts" | undefined;
11
- export declare const handleOnClick: (handler: Function) => (e: React.MouseEvent<HTMLElement>) => void;
11
+ export declare const handleOnClick: (handler: Function) => (e: React.BaseSyntheticEvent) => void;
@@ -1,5 +1,8 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
+ import { Spacing } from '@atlaskit/button';
4
+ import { SmartLinkSize } from '../../../../../constants';
3
5
  import { ActionProps } from './types';
6
+ export declare const sizeToSpacing: Record<SmartLinkSize, Spacing>;
4
7
  declare const Action: React.FC<ActionProps>;
5
8
  export default Action;
@@ -10,6 +10,7 @@ export declare type ActionProps = {
10
10
  icon?: ReactChild;
11
11
  iconPosition?: 'before' | 'after';
12
12
  tooltipMessage?: React.ReactNode;
13
+ asDropDownItem?: boolean;
13
14
  };
14
15
  export declare type ActionIconProps = {
15
16
  size?: SmartLinkSize;
@@ -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, appearance?: "link" | "default" | "danger" | "primary" | "subtle" | "subtle-link" | "warning" | undefined) => React.ReactNode | undefined;
11
+ export declare const renderActionItems: (items?: ActionItem[], size?: SmartLinkSize, appearance?: "link" | "default" | "danger" | "primary" | "subtle" | "subtle-link" | "warning" | undefined, asDropDownItems?: boolean | undefined) => React.ReactNode | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.5.3",
3
+ "version": "17.6.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -27,6 +27,7 @@
27
27
  "@atlaskit/avatar": "^20.5.0",
28
28
  "@atlaskit/avatar-group": "^8.5.5",
29
29
  "@atlaskit/button": "^16.1.4",
30
+ "@atlaskit/dropdown-menu": "^11.1.0",
30
31
  "@atlaskit/droplist": "^11.0.0",
31
32
  "@atlaskit/icon": "^21.10.0",
32
33
  "@atlaskit/icon-file-type": "^6.3.0",
@@ -80,6 +81,7 @@
80
81
  "@atlaskit/media-test-helpers": "^29.1.0",
81
82
  "@atlaskit/page": "^12.1.0",
82
83
  "@atlaskit/radio": "^5.3.0",
84
+ "@atlaskit/range": "^6.0.0",
83
85
  "@atlaskit/section-message": "^6.1.5",
84
86
  "@atlaskit/select": "^15.2.0",
85
87
  "@atlaskit/table-tree": "^9.1.0",