@atlaskit/smart-card 26.52.2 → 26.52.4

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/extractors/flexible/actions/index.js +1 -1
  3. package/dist/cjs/messages.js +5 -0
  4. package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +72 -102
  5. package/dist/cjs/utils/analytics/analytics.js +1 -1
  6. package/dist/cjs/view/FlexibleCard/components/actions/action/action-icon/index.js +23 -6
  7. package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/index.js +94 -0
  8. package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/types.js +5 -0
  9. package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +36 -20
  10. package/dist/cjs/view/FlexibleCard/components/actions/delete-action/index.js +24 -0
  11. package/dist/cjs/view/FlexibleCard/components/actions/delete-action/types.js +5 -0
  12. package/dist/cjs/view/FlexibleCard/components/actions/edit-action/index.js +24 -0
  13. package/dist/cjs/view/FlexibleCard/components/actions/edit-action/types.js +5 -0
  14. package/dist/cjs/view/FlexibleCard/components/actions/index.js +15 -15
  15. package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +6 -2
  16. package/dist/cjs/view/FlexibleCard/components/actions/preview-action/preview-icon/index.js +19 -0
  17. package/dist/cjs/view/FlexibleCard/components/actions/utils.js +0 -22
  18. package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +72 -0
  19. package/dist/cjs/view/FlexibleCard/components/blocks/action-block/types.js +5 -0
  20. package/dist/cjs/view/FlexibleCard/components/blocks/index.js +8 -1
  21. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +6 -0
  22. package/dist/cjs/view/FlexibleCard/components/container/index.js +26 -5
  23. package/dist/cjs/view/FlexibleCard/components/utils.js +76 -8
  24. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +2 -0
  25. package/dist/cjs/view/LinkUrl/index.js +1 -1
  26. package/dist/es2019/extractors/flexible/actions/index.js +2 -2
  27. package/dist/es2019/messages.js +5 -0
  28. package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +4 -4
  29. package/dist/es2019/utils/analytics/analytics.js +1 -1
  30. package/dist/es2019/view/FlexibleCard/components/actions/action/action-icon/index.js +21 -6
  31. package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/index.js +83 -0
  32. package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/types.js +1 -0
  33. package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +34 -17
  34. package/dist/es2019/view/FlexibleCard/components/actions/delete-action/index.js +15 -0
  35. package/dist/es2019/view/FlexibleCard/components/actions/delete-action/types.js +1 -0
  36. package/dist/es2019/view/FlexibleCard/components/actions/edit-action/index.js +15 -0
  37. package/dist/es2019/view/FlexibleCard/components/actions/edit-action/types.js +1 -0
  38. package/dist/es2019/view/FlexibleCard/components/actions/index.js +2 -13
  39. package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +6 -2
  40. package/dist/es2019/view/FlexibleCard/components/actions/preview-action/preview-icon/index.js +10 -0
  41. package/dist/es2019/view/FlexibleCard/components/actions/utils.js +0 -24
  42. package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +61 -0
  43. package/dist/es2019/view/FlexibleCard/components/blocks/action-block/types.js +1 -0
  44. package/dist/es2019/view/FlexibleCard/components/blocks/index.js +2 -1
  45. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +6 -0
  46. package/dist/es2019/view/FlexibleCard/components/container/index.js +23 -24
  47. package/dist/es2019/view/FlexibleCard/components/utils.js +73 -38
  48. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +3 -1
  49. package/dist/es2019/view/LinkUrl/index.js +1 -1
  50. package/dist/esm/extractors/flexible/actions/index.js +1 -1
  51. package/dist/esm/messages.js +5 -0
  52. package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +72 -102
  53. package/dist/esm/utils/analytics/analytics.js +1 -1
  54. package/dist/esm/view/FlexibleCard/components/actions/action/action-icon/index.js +22 -6
  55. package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/index.js +84 -0
  56. package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/types.js +1 -0
  57. package/dist/esm/view/FlexibleCard/components/actions/action/index.js +35 -18
  58. package/dist/esm/view/FlexibleCard/components/actions/delete-action/index.js +17 -0
  59. package/dist/esm/view/FlexibleCard/components/actions/delete-action/types.js +1 -0
  60. package/dist/esm/view/FlexibleCard/components/actions/edit-action/index.js +17 -0
  61. package/dist/esm/view/FlexibleCard/components/actions/edit-action/types.js +1 -0
  62. package/dist/esm/view/FlexibleCard/components/actions/index.js +2 -13
  63. package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +6 -2
  64. package/dist/esm/view/FlexibleCard/components/actions/preview-action/preview-icon/index.js +12 -0
  65. package/dist/esm/view/FlexibleCard/components/actions/utils.js +0 -22
  66. package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +63 -0
  67. package/dist/esm/view/FlexibleCard/components/blocks/action-block/types.js +1 -0
  68. package/dist/esm/view/FlexibleCard/components/blocks/index.js +2 -1
  69. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +6 -0
  70. package/dist/esm/view/FlexibleCard/components/container/index.js +26 -5
  71. package/dist/esm/view/FlexibleCard/components/utils.js +75 -7
  72. package/dist/esm/view/HoverCard/components/views/resolved/index.js +3 -1
  73. package/dist/esm/view/LinkUrl/index.js +1 -1
  74. package/dist/types/messages.d.ts +1 -1
  75. package/dist/types/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +2 -2
  76. package/dist/types/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +4 -4
  77. package/dist/types/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +4 -3
  78. package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +4 -0
  79. package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +10 -0
  80. package/dist/types/view/FlexibleCard/components/actions/action/index.d.ts +3 -6
  81. package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +24 -16
  82. package/dist/types/view/FlexibleCard/components/actions/delete-action/index.d.ts +4 -0
  83. package/dist/types/view/FlexibleCard/components/actions/delete-action/types.d.ts +2 -0
  84. package/dist/types/view/FlexibleCard/components/actions/edit-action/index.d.ts +4 -0
  85. package/dist/types/view/FlexibleCard/components/actions/edit-action/types.d.ts +2 -0
  86. package/dist/types/view/FlexibleCard/components/actions/index.d.ts +2 -12
  87. package/dist/types/view/FlexibleCard/components/actions/preview-action/preview-icon/index.d.ts +4 -0
  88. package/dist/types/view/FlexibleCard/components/blocks/action-block/index.d.ts +4 -0
  89. package/dist/types/view/FlexibleCard/components/blocks/action-block/types.d.ts +17 -0
  90. package/dist/types/view/FlexibleCard/components/blocks/index.d.ts +1 -0
  91. package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +5 -0
  92. package/dist/types/view/FlexibleCard/components/utils.d.ts +11 -0
  93. package/dist/types-ts4.5/messages.d.ts +1 -1
  94. package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +2 -2
  95. package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +4 -4
  96. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +4 -3
  97. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +4 -0
  98. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +10 -0
  99. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/index.d.ts +3 -6
  100. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/types.d.ts +24 -16
  101. package/dist/types-ts4.5/view/FlexibleCard/components/actions/delete-action/index.d.ts +4 -0
  102. package/dist/types-ts4.5/view/FlexibleCard/components/actions/delete-action/types.d.ts +2 -0
  103. package/dist/types-ts4.5/view/FlexibleCard/components/actions/edit-action/index.d.ts +4 -0
  104. package/dist/types-ts4.5/view/FlexibleCard/components/actions/edit-action/types.d.ts +2 -0
  105. package/dist/types-ts4.5/view/FlexibleCard/components/actions/index.d.ts +2 -12
  106. package/dist/types-ts4.5/view/FlexibleCard/components/actions/preview-action/preview-icon/index.d.ts +4 -0
  107. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-block/index.d.ts +4 -0
  108. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-block/types.d.ts +17 -0
  109. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/index.d.ts +1 -0
  110. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/utils.d.ts +5 -0
  111. package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +11 -0
  112. package/package.json +4 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.52.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#88718](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88718) [`c0c472e0dc0b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c0c472e0dc0b) - Refactoring FlexibleCard's EditAction and DeleteAction creation
8
+
9
+ ## 26.52.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#88485](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88485) [`1b538a48d41d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1b538a48d41d) - Update aAiSummary service call to use smart_links prompt_id
14
+ - [#87234](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87234) [`62622d539ca6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/62622d539ca6) - Add ActionBlock
15
+
3
16
  ## 26.52.2
4
17
 
5
18
  ### Patch Changes
@@ -12,7 +12,7 @@ var _extractPreviewAction = require("./extract-preview-action");
12
12
  var _extractFollowAction = _interopRequireDefault(require("./extract-follow-action"));
13
13
  var extractActions = function extractActions(response, data, actionOptions, id) {
14
14
  var _action;
15
- var action = (_action = {}, (0, _defineProperty2.default)(_action, _constants.ActionName.PreviewAction, (0, _extractPreviewAction.extractPreviewAction)(response, actionOptions)), (0, _defineProperty2.default)(_action, _constants.ActionName.DownloadAction, (0, _extractDownloadAction.extractDownloadAction)(data, actionOptions)), (0, _defineProperty2.default)(_action, _constants.ActionName.FollowAction, (0, _extractFollowAction.default)(response, actionOptions, id)), _action);
15
+ var action = (_action = {}, (0, _defineProperty2.default)(_action, _constants.ActionName.DownloadAction, (0, _extractDownloadAction.extractDownloadAction)(data, actionOptions)), (0, _defineProperty2.default)(_action, _constants.ActionName.FollowAction, (0, _extractFollowAction.default)(response, actionOptions, id)), (0, _defineProperty2.default)(_action, _constants.ActionName.PreviewAction, (0, _extractPreviewAction.extractPreviewAction)(response, actionOptions)), _action);
16
16
  return Object.values(action).some(function (value) {
17
17
  return Boolean(value);
18
18
  }) ? action : undefined;
@@ -261,6 +261,11 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
261
261
  defaultMessage: 'Owned by {context}',
262
262
  description: 'Indicates the person or entity that owns or maintains the resource.'
263
263
  },
264
+ preview_description: {
265
+ id: 'fabric.linking.preview_description.nonfinal',
266
+ defaultMessage: 'Open a full screen preview of this link',
267
+ description: 'Description on what Preview does'
268
+ },
264
269
  preview_improved: {
265
270
  id: 'fabric.linking.preview_improved',
266
271
  defaultMessage: 'Open preview',
@@ -29,49 +29,44 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
29
29
  status: 'ready'
30
30
  });
31
31
  (0, _defineProperty2.default)(this, "subscribedStateSetters", new Set());
32
- (0, _defineProperty2.default)(this, "fetchStream", /*#__PURE__*/function () {
33
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(summaryStyle) {
34
- var payload, options, path, requestUrl, response;
35
- return _regenerator.default.wrap(function _callee$(_context) {
36
- while (1) switch (_context.prev = _context.next) {
37
- case 0:
38
- payload = {
39
- recipient_agent_named_id: 'summary_agent',
40
- agent_input_context: {
41
- content_url: _this.url,
42
- content_ari: _this.ari,
43
- summary_style: summaryStyle,
44
- summary_output_mimetype: 'text/markdown'
45
- }
46
- };
47
- options = {
48
- method: 'POST',
49
- headers: _this.config.headers,
50
- body: JSON.stringify(payload)
51
- };
52
- path = 'chat/v1/invoke_agent/stream';
53
- requestUrl = (0, _utils.addPath)(_this.config.baseUrl, path);
54
- _context.next = 6;
55
- return fetch(requestUrl, options);
56
- case 6:
57
- response = _context.sent;
58
- if (!(!response.ok || response.status >= 400)) {
59
- _context.next = 11;
60
- break;
32
+ (0, _defineProperty2.default)(this, "fetchStream", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
33
+ var payload, options, path, requestUrl, response;
34
+ return _regenerator.default.wrap(function _callee$(_context) {
35
+ while (1) switch (_context.prev = _context.next) {
36
+ case 0:
37
+ payload = {
38
+ recipient_agent_named_id: 'summary_agent',
39
+ agent_input_context: {
40
+ content_url: _this.url,
41
+ content_ari: _this.ari,
42
+ prompt_id: 'smart_links',
43
+ summary_output_mimetype: 'text/markdown'
61
44
  }
62
- throw new Error("Status: ".concat(response.status, "\n URL: ").concat(_this.url, "\n StatusText ").concat(response.statusText));
63
- case 11:
64
- return _context.abrupt("return", (0, _utils.readStream)(response));
65
- case 12:
66
- case "end":
67
- return _context.stop();
68
- }
69
- }, _callee);
70
- }));
71
- return function (_x) {
72
- return _ref.apply(this, arguments);
73
- };
74
- }());
45
+ };
46
+ options = {
47
+ method: 'POST',
48
+ headers: _this.config.headers,
49
+ body: JSON.stringify(payload)
50
+ };
51
+ path = 'chat/v1/invoke_agent/stream';
52
+ requestUrl = (0, _utils.addPath)(_this.config.baseUrl, path);
53
+ _context.next = 6;
54
+ return fetch(requestUrl, options);
55
+ case 6:
56
+ response = _context.sent;
57
+ if (!(!response.ok || response.status >= 400)) {
58
+ _context.next = 11;
59
+ break;
60
+ }
61
+ throw new Error("Status: ".concat(response.status, "\n URL: ").concat(_this.url, "\n StatusText ").concat(response.statusText));
62
+ case 11:
63
+ return _context.abrupt("return", (0, _utils.readStream)(response));
64
+ case 12:
65
+ case "end":
66
+ return _context.stop();
67
+ }
68
+ }, _callee);
69
+ })));
75
70
  var defaultConfig = {
76
71
  baseUrl: '/gateway/api/assist',
77
72
  headers: {
@@ -95,35 +90,10 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
95
90
  key: "summariseUrl",
96
91
  value: function () {
97
92
  var _summariseUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
98
- var summaryStyle,
99
- _iterator2,
100
- _step2,
101
- _subscriber,
102
- id,
103
- _this$onStart,
104
- _this$onSuccess,
105
- stream,
106
- bufferContent,
107
- _iteratorAbruptCompletion,
108
- _didIteratorError,
109
- _iteratorError,
110
- _iterator,
111
- _step,
112
- chunk,
113
- _iterator3,
114
- _step3,
115
- subscriber,
116
- _chunk$message,
117
- _this$onError,
118
- message,
119
- _iterator4,
120
- _step4,
121
- _subscriber2,
122
- _args2 = arguments;
93
+ var _iterator2, _step2, _subscriber, id, _this$onStart, _this$onSuccess, stream, bufferContent, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, _iterator3, _step3, subscriber, _chunk$message, _this$onError, message, _iterator4, _step4, _subscriber2;
123
94
  return _regenerator.default.wrap(function _callee2$(_context2) {
124
95
  while (1) switch (_context2.prev = _context2.next) {
125
96
  case 0:
126
- summaryStyle = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : 'medium';
127
97
  this.state = {
128
98
  status: 'loading',
129
99
  content: ''
@@ -140,23 +110,23 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
140
110
  _iterator2.f();
141
111
  }
142
112
  id = (0, _uuid.default)();
143
- _context2.prev = 5;
113
+ _context2.prev = 4;
144
114
  (_this$onStart = this.onStart) === null || _this$onStart === void 0 || _this$onStart.call(this, id);
145
- _context2.next = 9;
146
- return this.fetchStream(summaryStyle);
147
- case 9:
115
+ _context2.next = 8;
116
+ return this.fetchStream();
117
+ case 8:
148
118
  stream = _context2.sent;
149
119
  bufferContent = '';
150
120
  _iteratorAbruptCompletion = false;
151
121
  _didIteratorError = false;
152
- _context2.prev = 13;
122
+ _context2.prev = 12;
153
123
  _iterator = _asyncIterator(stream);
154
- case 15:
155
- _context2.next = 17;
124
+ case 14:
125
+ _context2.next = 16;
156
126
  return _iterator.next();
157
- case 17:
127
+ case 16:
158
128
  if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
159
- _context2.next = 26;
129
+ _context2.next = 25;
160
130
  break;
161
131
  }
162
132
  chunk = _step.value;
@@ -182,53 +152,53 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
182
152
  bufferContent = chunk.message.message.content;
183
153
  }
184
154
  if (!(chunk.type === 'ERROR')) {
185
- _context2.next = 23;
155
+ _context2.next = 22;
186
156
  break;
187
157
  }
188
158
  throw new Error(chunk === null || chunk === void 0 || (_chunk$message = chunk.message) === null || _chunk$message === void 0 ? void 0 : _chunk$message.message_template);
189
- case 23:
159
+ case 22:
190
160
  _iteratorAbruptCompletion = false;
191
- _context2.next = 15;
161
+ _context2.next = 14;
192
162
  break;
193
- case 26:
194
- _context2.next = 32;
163
+ case 25:
164
+ _context2.next = 31;
195
165
  break;
196
- case 28:
197
- _context2.prev = 28;
198
- _context2.t0 = _context2["catch"](13);
166
+ case 27:
167
+ _context2.prev = 27;
168
+ _context2.t0 = _context2["catch"](12);
199
169
  _didIteratorError = true;
200
170
  _iteratorError = _context2.t0;
201
- case 32:
171
+ case 31:
172
+ _context2.prev = 31;
202
173
  _context2.prev = 32;
203
- _context2.prev = 33;
204
174
  if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
205
- _context2.next = 37;
175
+ _context2.next = 36;
206
176
  break;
207
177
  }
208
- _context2.next = 37;
178
+ _context2.next = 36;
209
179
  return _iterator.return();
210
- case 37:
211
- _context2.prev = 37;
180
+ case 36:
181
+ _context2.prev = 36;
212
182
  if (!_didIteratorError) {
213
- _context2.next = 40;
183
+ _context2.next = 39;
214
184
  break;
215
185
  }
216
186
  throw _iteratorError;
187
+ case 39:
188
+ return _context2.finish(36);
217
189
  case 40:
218
- return _context2.finish(37);
190
+ return _context2.finish(31);
219
191
  case 41:
220
- return _context2.finish(32);
221
- case 42:
222
192
  (_this$onSuccess = this.onSuccess) === null || _this$onSuccess === void 0 || _this$onSuccess.call(this, id);
223
193
  this.state = {
224
194
  status: 'done',
225
195
  content: bufferContent
226
196
  };
227
- _context2.next = 51;
197
+ _context2.next = 50;
228
198
  break;
229
- case 46:
230
- _context2.prev = 46;
231
- _context2.t1 = _context2["catch"](5);
199
+ case 45:
200
+ _context2.prev = 45;
201
+ _context2.t1 = _context2["catch"](4);
232
202
  message = _context2.t1 instanceof Error && this.isExpectedError(_context2.t1.message) ? _context2.t1.message : 'UNEXPECTED';
233
203
  (_this$onError = this.onError) === null || _this$onError === void 0 || _this$onError.call(this, id, message);
234
204
  this.state = {
@@ -236,7 +206,7 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
236
206
  content: '',
237
207
  error: message
238
208
  };
239
- case 51:
209
+ case 50:
240
210
  _iterator4 = _createForOfIteratorHelper(this.subscribedStateSetters);
241
211
  try {
242
212
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
@@ -248,11 +218,11 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
248
218
  } finally {
249
219
  _iterator4.f();
250
220
  }
251
- case 53:
221
+ case 52:
252
222
  case "end":
253
223
  return _context2.stop();
254
224
  }
255
- }, _callee2, this, [[5, 46], [13, 28, 32, 42], [33,, 37, 41]]);
225
+ }, _callee2, this, [[4, 45], [12, 27, 31, 41], [32,, 36, 40]]);
256
226
  }));
257
227
  function summariseUrl() {
258
228
  return _summariseUrl.apply(this, arguments);
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
22
22
  var context = exports.context = {
23
23
  componentName: 'smart-cards',
24
24
  packageName: "@atlaskit/smart-card",
25
- packageVersion: "26.52.2"
25
+ packageVersion: "26.52.4"
26
26
  };
27
27
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
28
28
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -5,13 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
8
  var _react = _interopRequireDefault(require("react"));
10
9
  var _react2 = require("@emotion/react");
11
10
  var _constants = require("../../../../../../constants");
12
11
  var _utils = require("../../../utils");
13
- var _templateObject;
14
12
  /** @jsx jsx */
13
+
15
14
  var getIconWidth = function getIconWidth(size) {
16
15
  switch (size) {
17
16
  case _constants.SmartLinkSize.XLarge:
@@ -23,16 +22,34 @@ var getIconWidth = function getIconWidth(size) {
23
22
  return '1rem';
24
23
  }
25
24
  };
26
- var getIconStyles = function getIconStyles(size, isDisabled) {
27
- return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n ", ";\n"])), isDisabled ? "var(--ds-text-disabled, #6B778C)" : "var(--ds-icon, #44546F)", (0, _utils.getIconSizeStyles)(getIconWidth(size)));
25
+ var getIconStyles = function getIconStyles(isDisabled) {
26
+ return (0, _react2.css)({
27
+ color: isDisabled ? "var(--ds-text-disabled, #6B778C)" : "var(--ds-icon, #44546F)"
28
+ });
28
29
  };
30
+ var backgroundStyles = (0, _react2.css)({
31
+ backgroundColor: "var(--ds-background-brand-subtlest, #E9F2FF)",
32
+ borderRadius: "var(--ds-border-radius-050, 2px)",
33
+ color: "var(--ds-icon-brand, #0C66E4)",
34
+ display: 'inline-block',
35
+ lineHeight: 0,
36
+ padding: "var(--ds-space-025, 2px)",
37
+ 'span,svg,img': {
38
+ lineHeight: 0
39
+ },
40
+ // Use !important to win over `style` prop specificity in DS Spinner. :(
41
+ circle: {
42
+ stroke: "var(--ds-icon-brand, #0C66E4)".concat(" !important")
43
+ }
44
+ });
29
45
  var ActionIcon = function ActionIcon(_ref) {
30
46
  var size = _ref.size,
31
47
  testId = _ref.testId,
32
48
  icon = _ref.icon,
33
- isDisabled = _ref.isDisabled;
49
+ isDisabled = _ref.isDisabled,
50
+ showBackground = _ref.showBackground;
34
51
  return (0, _react2.jsx)("span", {
35
- css: getIconStyles(size, isDisabled),
52
+ css: [getIconStyles(isDisabled), (0, _utils.getIconSizeStyles)(getIconWidth(size)), showBackground && backgroundStyles],
36
53
  "data-testid": "".concat(testId, "-icon")
37
54
  }, icon);
38
55
  };
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _primitives = require("@atlaskit/primitives");
11
+ var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
12
+ var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
13
+ var _react = _interopRequireWildcard(require("react"));
14
+ var _utils = require("../../../utils");
15
+ var _actionIcon = _interopRequireDefault(require("../action-icon"));
16
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
17
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
+ var buttonStyles = (0, _primitives.xcss)({
19
+ all: 'unset',
20
+ padding: 'space.050',
21
+ width: '100%',
22
+ ':focus:not(:focus-visible)': {
23
+ outline: 'none'
24
+ },
25
+ ':focus': {
26
+ outlineColor: 'color.border.focused',
27
+ // xcss outlineOffset does not support space.negative.025
28
+ // @ts-ignore-next-line TS2322: Type "var(--ds-space-negative-025)" is not assignable to type
29
+ outlineOffset: "var(--ds-space-negative-025, -2px)",
30
+ outlineStyle: 'solid',
31
+ outlineWidth: 'border.width.outline'
32
+ },
33
+ ':hover': {
34
+ backgroundColor: 'color.background.neutral.subtle.hovered'
35
+ },
36
+ ':active': {
37
+ backgroundColor: 'color.background.neutral.subtle.pressed'
38
+ }
39
+ });
40
+ var contentStyles = (0, _primitives.xcss)({
41
+ color: 'color.text',
42
+ // Replace with font token once it becomes stable (currently alpha)
43
+ // font: 'font.body.small',
44
+ fontSize: '12px',
45
+ fontStyle: 'normal',
46
+ fontWeight: '400',
47
+ lineHeight: '20px'
48
+ });
49
+ var ActionStackItem = function ActionStackItem(_ref) {
50
+ var content = _ref.content,
51
+ iconOption = _ref.icon,
52
+ isDisabled = _ref.isDisabled,
53
+ isLoading = _ref.isLoading,
54
+ onClickCallback = _ref.onClick,
55
+ size = _ref.size,
56
+ spaceOption = _ref.space,
57
+ testId = _ref.testId,
58
+ tooltipMessage = _ref.tooltipMessage,
59
+ xcss = _ref.xcss;
60
+ var space = spaceOption !== null && spaceOption !== void 0 ? spaceOption : (0, _utils.getPrimitivesInlineSpaceBySize)(size);
61
+ var onClick = (0, _react.useCallback)(function () {
62
+ if (!isDisabled && !isLoading && onClickCallback) {
63
+ onClickCallback();
64
+ }
65
+ }, [isDisabled, isLoading, onClickCallback]);
66
+ var icon = iconOption && isLoading ? /*#__PURE__*/_react.default.createElement(_actionIcon.default, {
67
+ icon: /*#__PURE__*/_react.default.createElement(_spinner.default, {
68
+ testId: "".concat(testId, "-loading")
69
+ }),
70
+ showBackground: true,
71
+ size: size
72
+ }) : iconOption;
73
+
74
+ // Replace Box with Pressable once it becomes stable (currently beta)
75
+ return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
76
+ content: tooltipMessage || content,
77
+ hideTooltipOnMouseDown: true
78
+ }, function (tooltipProps) {
79
+ return /*#__PURE__*/_react.default.createElement(_primitives.Box, (0, _extends2.default)({
80
+ as: "button",
81
+ xcss: [buttonStyles, xcss]
82
+ }, tooltipProps, {
83
+ onClick: onClick
84
+ }), /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
85
+ alignBlock: "center",
86
+ grow: "fill",
87
+ space: space,
88
+ testId: testId
89
+ }, icon, /*#__PURE__*/_react.default.createElement(_primitives.Box, {
90
+ xcss: contentStyles
91
+ }, content)));
92
+ });
93
+ };
94
+ var _default = exports.default = ActionStackItem;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _react2 = require("@emotion/react");
8
+ var _react = require("@emotion/react");
10
9
  var _constants = require("../../../../../constants");
10
+ var _actionStackItem = _interopRequireDefault(require("./action-stack-item"));
11
11
  var _actionButton = _interopRequireDefault(require("./action-button"));
12
12
  var _actionDropdownItem = _interopRequireDefault(require("./action-dropdown-item"));
13
13
  var _actionIcon = _interopRequireDefault(require("./action-icon"));
@@ -17,12 +17,10 @@ var _actionIcon = _interopRequireDefault(require("./action-icon"));
17
17
  * A base action that can be triggered with an on click.
18
18
  * @internal
19
19
  * @param {ActionProps} ActionProps - The props necessary for the Action.
20
- * @see DeleteAction
21
- * @see EditAction
22
- * @see CustomAction
23
20
  */
24
21
  var Action = function Action(_ref) {
25
- var _ref$appearance = _ref.appearance,
22
+ var as = _ref.as,
23
+ _ref$appearance = _ref.appearance,
26
24
  appearance = _ref$appearance === void 0 ? 'subtle' : _ref$appearance,
27
25
  content = _ref.content,
28
26
  _ref$isLoading = _ref.isLoading,
@@ -35,44 +33,62 @@ var Action = function Action(_ref) {
35
33
  icon = _ref.icon,
36
34
  _ref$iconPosition = _ref.iconPosition,
37
35
  iconPosition = _ref$iconPosition === void 0 ? 'before' : _ref$iconPosition,
36
+ spaceInline = _ref.spaceInline,
38
37
  tooltipMessage = _ref.tooltipMessage,
38
+ xcss = _ref.xcss,
39
39
  asDropDownItem = _ref.asDropDownItem,
40
40
  overrideCss = _ref.overrideCss,
41
41
  isDisabled = _ref.isDisabled;
42
42
  if (!onClick) {
43
43
  return null;
44
44
  }
45
- var actionIcon = icon && (0, _react2.jsx)(_actionIcon.default, {
45
+ var isStackItem = as === 'stack-item';
46
+ var isDropdownItem = as === 'dropdown-item' || asDropDownItem;
47
+ var actionIcon = icon && (0, _react.jsx)(_actionIcon.default, {
46
48
  isDisabled: isDisabled,
47
49
  icon: icon,
48
50
  size: size,
51
+ showBackground: isStackItem,
49
52
  testId: testId
50
53
  });
51
54
  var iconBefore = icon && iconPosition === 'before' ? actionIcon : undefined;
52
55
  var iconAfter = icon && iconPosition === 'after' ? actionIcon : undefined;
53
- if (asDropDownItem) {
54
- return (0, _react2.jsx)(_actionDropdownItem.default, {
56
+ if (isStackItem) {
57
+ return (0, _react.jsx)(_actionStackItem.default, {
55
58
  content: content,
56
- iconAfter: iconAfter,
57
- iconBefore: iconBefore,
59
+ icon: actionIcon,
60
+ space: spaceInline,
61
+ isDisabled: isDisabled,
58
62
  isLoading: isLoading,
59
63
  onClick: onClick,
60
- testId: testId
64
+ size: size,
65
+ testId: testId,
66
+ tooltipMessage: tooltipMessage || content,
67
+ xcss: xcss
61
68
  });
62
- } else {
63
- return (0, _react2.jsx)(_actionButton.default, {
64
- appearance: appearance,
69
+ }
70
+ if (isDropdownItem) {
71
+ return (0, _react.jsx)(_actionDropdownItem.default, {
65
72
  content: content,
66
73
  iconAfter: iconAfter,
67
74
  iconBefore: iconBefore,
68
75
  isLoading: isLoading,
69
76
  onClick: onClick,
70
- overrideCss: overrideCss,
71
- size: size,
72
- testId: testId,
73
- tooltipMessage: tooltipMessage || content,
74
- isDisabled: isDisabled
77
+ testId: testId
75
78
  });
76
79
  }
80
+ return (0, _react.jsx)(_actionButton.default, {
81
+ appearance: appearance,
82
+ content: content,
83
+ iconAfter: iconAfter,
84
+ iconBefore: iconBefore,
85
+ isLoading: isLoading,
86
+ onClick: onClick,
87
+ overrideCss: overrideCss,
88
+ size: size,
89
+ testId: testId,
90
+ tooltipMessage: tooltipMessage || content,
91
+ isDisabled: isDisabled
92
+ });
77
93
  };
78
94
  var _default = exports.default = Action;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _action = _interopRequireDefault(require("../action"));
11
+ var _messages = require("../../../../../messages");
12
+ var _reactIntlNext = require("react-intl-next");
13
+ var _cross = _interopRequireDefault(require("@atlaskit/icon/glyph/cross"));
14
+ var DeleteAction = function DeleteAction(props) {
15
+ return /*#__PURE__*/_react.default.createElement(_action.default, (0, _extends2.default)({
16
+ content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.delete),
17
+ icon: /*#__PURE__*/_react.default.createElement(_cross.default, {
18
+ label: "Delete"
19
+ }),
20
+ testId: "smart-action-delete-action",
21
+ tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.delete)
22
+ }, props));
23
+ };
24
+ var _default = exports.default = DeleteAction;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _action = _interopRequireDefault(require("../action"));
11
+ var _messages = require("../../../../../messages");
12
+ var _reactIntlNext = require("react-intl-next");
13
+ var _edit = _interopRequireDefault(require("@atlaskit/icon/glyph/edit"));
14
+ var EditAction = function EditAction(props) {
15
+ return /*#__PURE__*/_react.default.createElement(_action.default, (0, _extends2.default)({
16
+ content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.edit),
17
+ icon: /*#__PURE__*/_react.default.createElement(_edit.default, {
18
+ label: "Edit"
19
+ }),
20
+ testId: "smart-action-edit-action",
21
+ tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.edit)
22
+ }, props));
23
+ };
24
+ var _default = exports.default = EditAction;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });