@atlaskit/smart-card 23.0.1 → 23.1.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/constants.js +2 -0
  3. package/dist/cjs/extractors/block/index.js +1 -1
  4. package/dist/cjs/extractors/common/detail/extractAttachmentCount.js +33 -0
  5. package/dist/cjs/extractors/common/detail/index.js +9 -1
  6. package/dist/cjs/extractors/flexible/index.js +1 -0
  7. package/dist/cjs/extractors/flexible/utils.js +7 -1
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
  10. package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +4 -0
  11. package/dist/cjs/view/FlexibleCard/components/elements/index.js +8 -1
  12. package/dist/cjs/view/FlexibleCard/components/elements/utils.js +7 -1
  13. package/dist/es2019/constants.js +2 -0
  14. package/dist/es2019/extractors/block/index.js +2 -2
  15. package/dist/es2019/extractors/common/detail/extractAttachmentCount.js +18 -0
  16. package/dist/es2019/extractors/common/detail/index.js +2 -1
  17. package/dist/es2019/extractors/flexible/index.js +2 -1
  18. package/dist/es2019/extractors/flexible/utils.js +1 -0
  19. package/dist/es2019/version.json +1 -1
  20. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +1 -0
  21. package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +3 -0
  22. package/dist/es2019/view/FlexibleCard/components/elements/index.js +6 -0
  23. package/dist/es2019/view/FlexibleCard/components/elements/utils.js +7 -0
  24. package/dist/esm/constants.js +2 -0
  25. package/dist/esm/extractors/block/index.js +2 -2
  26. package/dist/esm/extractors/common/detail/extractAttachmentCount.js +18 -0
  27. package/dist/esm/extractors/common/detail/index.js +2 -1
  28. package/dist/esm/extractors/flexible/index.js +2 -1
  29. package/dist/esm/extractors/flexible/utils.js +3 -0
  30. package/dist/esm/version.json +1 -1
  31. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
  32. package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +4 -0
  33. package/dist/esm/view/FlexibleCard/components/elements/index.js +6 -0
  34. package/dist/esm/view/FlexibleCard/components/elements/utils.js +7 -1
  35. package/dist/types/constants.d.ts +2 -0
  36. package/dist/types/extractors/common/__mocks__/jsonld.d.ts +2 -0
  37. package/dist/types/extractors/common/detail/extractAttachmentCount.d.ts +4 -0
  38. package/dist/types/extractors/common/detail/index.d.ts +2 -0
  39. package/dist/types/extractors/flexible/utils.d.ts +1 -0
  40. package/dist/types/state/flexible-ui-context/types.d.ts +6 -0
  41. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +8 -1
  42. package/dist/types/view/FlexibleCard/components/elements/index.d.ts +5 -0
  43. package/dist/types-ts4.0/constants.d.ts +2 -0
  44. package/dist/types-ts4.0/extractors/common/__mocks__/jsonld.d.ts +2 -0
  45. package/dist/types-ts4.0/extractors/common/detail/extractAttachmentCount.d.ts +4 -0
  46. package/dist/types-ts4.0/extractors/common/detail/index.d.ts +2 -0
  47. package/dist/types-ts4.0/extractors/flexible/utils.d.ts +1 -0
  48. package/dist/types-ts4.0/state/flexible-ui-context/types.d.ts +6 -0
  49. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/types.d.ts +8 -1
  50. package/dist/types-ts4.0/view/FlexibleCard/components/elements/index.d.ts +5 -0
  51. package/package.json +3 -3
  52. package/report.api.md +8 -0
  53. package/tmp/api-report-tmp.d.ts +8 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 23.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b3ba198b928`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b3ba198b928) - [ux] Adds attachment count widget to metadata section
8
+
9
+ ## 23.0.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`6af519d2a17`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6af519d2a17) - Upgrade json-ld-types from 3.0.2 to 3.1.0
14
+ - Updated dependencies
15
+
3
16
  ## 23.0.1
4
17
 
5
18
  ### Patch Changes
@@ -129,6 +129,7 @@ var ElementName;
129
129
  exports.ElementName = ElementName;
130
130
 
131
131
  (function (ElementName) {
132
+ ElementName["AttachmentCount"] = "AttachmentCount";
132
133
  ElementName["AuthorGroup"] = "AuthorGroup";
133
134
  ElementName["CollaboratorGroup"] = "CollaboratorGroup";
134
135
  ElementName["CommentCount"] = "CommentCount";
@@ -218,6 +219,7 @@ exports.IconType = IconType;
218
219
  IconType["Default"] = "Default";
219
220
  IconType["Error"] = "Default:Error";
220
221
  IconType["Forbidden"] = "Default:Forbidden";
222
+ IconType["Attachment"] = "Badge:Attachment";
221
223
  IconType["Comment"] = "Badge:Comment";
222
224
  IconType["View"] = "Badge:View";
223
225
  IconType["React"] = "Badge:React";
@@ -48,7 +48,7 @@ var extractBlockIcon = function extractBlockIcon(jsonLd) {
48
48
  };
49
49
 
50
50
  var extractBlockDetails = function extractBlockDetails(jsonLd) {
51
- return [(0, _detail.extractCommentCount)(jsonLd), (0, _detail.extractProgrammingLanguage)(jsonLd), (0, _detail.extractSubscriberCount)(jsonLd)].filter(function (detail) {
51
+ return [(0, _detail.extractCommentCount)(jsonLd), (0, _detail.extractProgrammingLanguage)(jsonLd), (0, _detail.extractSubscriberCount)(jsonLd), (0, _detail.extractAttachmentCount)(jsonLd)].filter(function (detail) {
52
52
  return !!detail;
53
53
  });
54
54
  };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.extractAttachmentCount = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _colors = require("@atlaskit/theme/colors");
13
+
14
+ var _attachment = _interopRequireDefault(require("@atlaskit/icon/glyph/attachment"));
15
+
16
+ var _tokens = require("@atlaskit/tokens");
17
+
18
+ var extractAttachmentCount = function extractAttachmentCount(jsonLd) {
19
+ var attachmentCount = jsonLd['atlassian:attachmentCount'];
20
+
21
+ if (attachmentCount) {
22
+ return {
23
+ text: attachmentCount.toString(),
24
+ icon: /*#__PURE__*/_react.default.createElement(_attachment.default, {
25
+ size: "small",
26
+ label: "attachments",
27
+ primaryColor: (0, _tokens.token)('color.icon.subtle', _colors.N600)
28
+ })
29
+ };
30
+ }
31
+ };
32
+
33
+ exports.extractAttachmentCount = extractAttachmentCount;
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "extractAttachmentCount", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _extractAttachmentCount.extractAttachmentCount;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "extractCommentCount", {
7
13
  enumerable: true,
8
14
  get: function get() {
@@ -34,4 +40,6 @@ var _extractDownloadUrl = require("./extractDownloadUrl");
34
40
 
35
41
  var _extractProgrammingLanguage = require("./extractProgrammingLanguage");
36
42
 
37
- var _extractSubscriberCount = require("./extractSubscriberCount");
43
+ var _extractSubscriberCount = require("./extractSubscriberCount");
44
+
45
+ var _extractAttachmentCount = require("./extractAttachmentCount");
@@ -35,6 +35,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
35
35
  var data = response.data;
36
36
  var url = (0, _extractors.extractLink)(data);
37
37
  return {
38
+ attachmentCount: (0, _utils.extractAttachmentCount)(data),
38
39
  authorGroup: (0, _extractors.extractPersonCreatedBy)(data),
39
40
  collaboratorGroup: (0, _collaboratorGroup.extractPersonsUpdatedBy)(data),
40
41
  commentCount: (0, _utils.extractCommentCount)(data),
@@ -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.extractVoteCount = exports.extractViewCount = exports.extractTargetBranch = exports.extractSubscriberCount = exports.extractSourceBranch = exports.extractReactCount = exports.extractProgrammingLanguage = exports.extractModifiedBy = exports.extractDueOn = exports.extractCreatedBy = exports.extractCommentCount = void 0;
8
+ exports.extractVoteCount = exports.extractViewCount = exports.extractTargetBranch = exports.extractSubscriberCount = exports.extractSourceBranch = exports.extractReactCount = exports.extractProgrammingLanguage = exports.extractModifiedBy = exports.extractDueOn = exports.extractCreatedBy = exports.extractCommentCount = exports.extractAttachmentCount = void 0;
9
9
 
10
10
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
11
 
@@ -89,6 +89,12 @@ var extractSubscriberCount = function extractSubscriberCount(data) {
89
89
 
90
90
  exports.extractSubscriberCount = extractSubscriberCount;
91
91
 
92
+ var extractAttachmentCount = function extractAttachmentCount(data) {
93
+ return extractValue(data, 'atlassian:attachmentCount');
94
+ };
95
+
96
+ exports.extractAttachmentCount = extractAttachmentCount;
97
+
92
98
  var extractTargetBranch = function extractTargetBranch(data) {
93
99
  return extractLinkName(data['atlassian:mergeDestination']);
94
100
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.0.1",
3
+ "version": "23.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -48,7 +48,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
48
48
 
49
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
50
 
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.ViewCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ReactCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.VoteCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.DueOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LatestCommit, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LinkIcon, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Preview, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Priority, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ProgrammingLanguage, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Provider, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SourceBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.TargetBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), _ElementDisplaySchema);
51
+ var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AttachmentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CollaboratorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CommentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ViewCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ReactCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.VoteCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.DueOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LatestCommit, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LinkIcon, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Preview, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Priority, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ProgrammingLanguage, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Provider, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SourceBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.TargetBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), _ElementDisplaySchema);
52
52
  exports.ElementDisplaySchema = ElementDisplaySchema;
53
53
 
54
54
  var getDirectionStyles = function getDirectionStyles(direction) {
@@ -206,6 +206,10 @@ var importIconMapper = (_importIconMapper = {}, (0, _defineProperty2.default)(_i
206
206
  return Promise.resolve().then(function () {
207
207
  return _interopRequireWildcard(require('@atlaskit/icon/glyph/lock-filled'));
208
208
  });
209
+ }), (0, _defineProperty2.default)(_importIconMapper, _constants.IconType.Attachment, function () {
210
+ return Promise.resolve().then(function () {
211
+ return _interopRequireWildcard(require('@atlaskit/icon/glyph/attachment'));
212
+ });
209
213
  }), (0, _defineProperty2.default)(_importIconMapper, _constants.IconType.Comment, function () {
210
214
  return Promise.resolve().then(function () {
211
215
  return _interopRequireWildcard(require('@atlaskit/icon/glyph/comment'));
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.VoteCount = exports.ViewCount = exports.Title = exports.TargetBranch = exports.SubscriberCount = exports.State = exports.SourceBranch = exports.Snippet = exports.ReactCount = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.LatestCommit = exports.DueOn = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.AuthorGroup = void 0;
6
+ exports.VoteCount = exports.ViewCount = exports.Title = exports.TargetBranch = exports.SubscriberCount = exports.State = exports.SourceBranch = exports.Snippet = exports.ReactCount = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.LatestCommit = exports.DueOn = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.AuthorGroup = exports.AttachmentCount = void 0;
7
7
 
8
8
  var _utils = require("./utils");
9
9
 
@@ -13,10 +13,17 @@ var _constants = require("../../../../constants");
13
13
  // This will help reducing the code for mapping elements inside
14
14
  // createElement and renderElementItems
15
15
 
16
+ /**
17
+ * Creates a AttachmentCount Badge element using the data from AttachmentCount in the Flexible UI Context.
18
+ * @see Badge
19
+ */
20
+ var AttachmentCount = (0, _utils.createElement)(_constants.ElementName.AttachmentCount);
16
21
  /**
17
22
  * An AvatarGroup element using the data from AuthorGroup in the Flexible UI Context.
18
23
  * @see AvatarGroup
19
24
  */
25
+
26
+ exports.AttachmentCount = AttachmentCount;
20
27
  var AuthorGroup = (0, _utils.createElement)(_constants.ElementName.AuthorGroup);
21
28
  /**
22
29
  * An AvatarGroup element using the data from CollaboratorGroup in the Flexible UI Context.
@@ -52,7 +52,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
52
52
  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; }
53
53
 
54
54
  var SNIPPET_DEFAULT_MAX_LINES = 3;
55
- var elementMappings = (_elementMappings = {}, (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.AuthorGroup, {
55
+ var elementMappings = (_elementMappings = {}, (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.AttachmentCount, {
56
+ component: _badge.default,
57
+ props: {
58
+ icon: _constants.IconType.Attachment
59
+ }
60
+ }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.AuthorGroup, {
56
61
  component: _avatarGroup.default
57
62
  }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.CollaboratorGroup, {
58
63
  component: _avatarGroup.default
@@ -143,6 +148,7 @@ var getData = function getData(elementName, contextKey, context) {
143
148
  case _constants.ElementName.CollaboratorGroup:
144
149
  return toAvatarGroupProps(data);
145
150
 
151
+ case _constants.ElementName.AttachmentCount:
146
152
  case _constants.ElementName.CommentCount:
147
153
  case _constants.ElementName.ViewCount:
148
154
  case _constants.ElementName.ReactCount:
@@ -106,6 +106,7 @@ export let ElementName;
106
106
  */
107
107
 
108
108
  (function (ElementName) {
109
+ ElementName["AttachmentCount"] = "AttachmentCount";
109
110
  ElementName["AuthorGroup"] = "AuthorGroup";
110
111
  ElementName["CollaboratorGroup"] = "CollaboratorGroup";
111
112
  ElementName["CommentCount"] = "CommentCount";
@@ -191,6 +192,7 @@ export let IconType;
191
192
  IconType["Default"] = "Default";
192
193
  IconType["Error"] = "Default:Error";
193
194
  IconType["Forbidden"] = "Default:Forbidden";
195
+ IconType["Attachment"] = "Badge:Attachment";
194
196
  IconType["Comment"] = "Badge:Comment";
195
197
  IconType["View"] = "Badge:View";
196
198
  IconType["React"] = "Badge:React";
@@ -1,7 +1,7 @@
1
1
  import { extractTitleTextColor, extractSummary } from '../common/primitives';
2
2
  import { extractLozenge } from '../common/lozenge';
3
3
  import { extractIcon } from '../common/icon';
4
- import { extractCommentCount, extractProgrammingLanguage, extractSubscriberCount } from '../common/detail';
4
+ import { extractCommentCount, extractProgrammingLanguage, extractSubscriberCount, extractAttachmentCount } from '../common/detail';
5
5
  import { extractLink, extractTitle, extractProvider, extractMembers, extractPersonAssignedTo, extractPersonCreatedBy, extractPersonUpdatedBy, extractImage } from '@atlaskit/linking-common/extractors';
6
6
  import { extractByline } from '../common/byline/extractByline';
7
7
  import { extractTitlePrefix } from '../common/title-prefix/extractTitlePrefix';
@@ -23,7 +23,7 @@ const extractBlockIcon = jsonLd => {
23
23
  }
24
24
  };
25
25
 
26
- const extractBlockDetails = jsonLd => [extractCommentCount(jsonLd), extractProgrammingLanguage(jsonLd), extractSubscriberCount(jsonLd)].filter(detail => !!detail);
26
+ const extractBlockDetails = jsonLd => [extractCommentCount(jsonLd), extractProgrammingLanguage(jsonLd), extractSubscriberCount(jsonLd), extractAttachmentCount(jsonLd)].filter(detail => !!detail);
27
27
 
28
28
  export const extractBlockActions = (props, jsonLd, opts, platform) => {
29
29
  if (opts) {
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { N600 } from '@atlaskit/theme/colors';
3
+ import AttachmentIcon from '@atlaskit/icon/glyph/attachment';
4
+ import { token } from '@atlaskit/tokens';
5
+ export const extractAttachmentCount = jsonLd => {
6
+ const attachmentCount = jsonLd['atlassian:attachmentCount'];
7
+
8
+ if (attachmentCount) {
9
+ return {
10
+ text: attachmentCount.toString(),
11
+ icon: /*#__PURE__*/React.createElement(AttachmentIcon, {
12
+ size: "small",
13
+ label: "attachments",
14
+ primaryColor: token('color.icon.subtle', N600)
15
+ })
16
+ };
17
+ }
18
+ };
@@ -1,4 +1,5 @@
1
1
  export { extractCommentCount } from './extractCommentCount';
2
2
  export { extractDownloadUrl } from './extractDownloadUrl';
3
3
  export { extractProgrammingLanguage } from './extractProgrammingLanguage';
4
- export { extractSubscriberCount } from './extractSubscriberCount';
4
+ export { extractSubscriberCount } from './extractSubscriberCount';
5
+ export { extractAttachmentCount } from './extractAttachmentCount';
@@ -1,7 +1,7 @@
1
1
  import { extractSummary } from '../common/primitives';
2
2
  import { extractLozenge } from '../common/lozenge';
3
3
  import { extractLinkIcon } from './icon';
4
- import { extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn } from './utils';
4
+ import { extractAttachmentCount, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn } from './utils';
5
5
  import { extractPersonsUpdatedBy } from './collaboratorGroup';
6
6
  import { extractPersonCreatedBy, extractLink, extractTitle, extractDateUpdated, extractDateCreated } from '@atlaskit/linking-common/extractors';
7
7
  import extractPriority from './extract-priority';
@@ -17,6 +17,7 @@ const extractFlexibleUiContext = (response, renderers) => {
17
17
  const data = response.data;
18
18
  const url = extractLink(data);
19
19
  return {
20
+ attachmentCount: extractAttachmentCount(data),
20
21
  authorGroup: extractPersonCreatedBy(data),
21
22
  collaboratorGroup: extractPersonsUpdatedBy(data),
22
23
  commentCount: extractCommentCount(data),
@@ -32,4 +32,5 @@ export const extractModifiedBy = data => {
32
32
  export const extractProgrammingLanguage = data => extractValue(data, 'schema:programmingLanguage');
33
33
  export const extractSourceBranch = data => extractLinkName(data['atlassian:mergeSource']);
34
34
  export const extractSubscriberCount = data => extractValue(data, 'atlassian:subscriberCount');
35
+ export const extractAttachmentCount = data => extractValue(data, 'atlassian:attachmentCount');
35
36
  export const extractTargetBranch = data => extractLinkName(data['atlassian:mergeDestination']);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.0.1",
3
+ "version": "23.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -8,6 +8,7 @@ import { isFlexibleUiElement } from '../../../../utils/flexible';
8
8
  import ActionGroup from './action-group';
9
9
  import ElementGroup from './element-group';
10
10
  export const ElementDisplaySchema = {
11
+ [ElementName.AttachmentCount]: ['inline'],
11
12
  [ElementName.AuthorGroup]: ['inline'],
12
13
  [ElementName.CollaboratorGroup]: ['inline'],
13
14
  [ElementName.CommentCount]: ['inline'],
@@ -143,6 +143,9 @@ const importIconMapper = {
143
143
  /* webpackChunkName: "glyphForbidden" */
144
144
  '@atlaskit/icon/glyph/lock-filled'),
145
145
  // Badge
146
+ [IconType.Attachment]: () => import(
147
+ /* webpackChunkName: "glyphAttachment" */
148
+ '@atlaskit/icon/glyph/attachment'),
146
149
  [IconType.Comment]: () => import(
147
150
  /* webpackChunkName: "glyphComment" */
148
151
  '@atlaskit/icon/glyph/comment'),
@@ -4,10 +4,16 @@ import { ElementName } from '../../../../constants';
4
4
  // This will help reducing the code for mapping elements inside
5
5
  // createElement and renderElementItems
6
6
 
7
+ /**
8
+ * Creates a AttachmentCount Badge element using the data from AttachmentCount in the Flexible UI Context.
9
+ * @see Badge
10
+ */
11
+ export const AttachmentCount = createElement(ElementName.AttachmentCount);
7
12
  /**
8
13
  * An AvatarGroup element using the data from AuthorGroup in the Flexible UI Context.
9
14
  * @see AvatarGroup
10
15
  */
16
+
11
17
  export const AuthorGroup = createElement(ElementName.AuthorGroup);
12
18
  /**
13
19
  * An AvatarGroup element using the data from CollaboratorGroup in the Flexible UI Context.
@@ -16,6 +16,12 @@ import DateTime from './date-time';
16
16
  import { tokens } from '../../../../utils/token';
17
17
  const SNIPPET_DEFAULT_MAX_LINES = 3;
18
18
  const elementMappings = {
19
+ [ElementName.AttachmentCount]: {
20
+ component: Badge,
21
+ props: {
22
+ icon: IconType.Attachment
23
+ }
24
+ },
19
25
  [ElementName.AuthorGroup]: {
20
26
  component: AvatarGroup
21
27
  },
@@ -132,6 +138,7 @@ const getData = (elementName, contextKey, context) => {
132
138
  case ElementName.CollaboratorGroup:
133
139
  return toAvatarGroupProps(data);
134
140
 
141
+ case ElementName.AttachmentCount:
135
142
  case ElementName.CommentCount:
136
143
  case ElementName.ViewCount:
137
144
  case ElementName.ReactCount:
@@ -106,6 +106,7 @@ export var ElementName;
106
106
  */
107
107
 
108
108
  (function (ElementName) {
109
+ ElementName["AttachmentCount"] = "AttachmentCount";
109
110
  ElementName["AuthorGroup"] = "AuthorGroup";
110
111
  ElementName["CollaboratorGroup"] = "CollaboratorGroup";
111
112
  ElementName["CommentCount"] = "CommentCount";
@@ -191,6 +192,7 @@ export var IconType;
191
192
  IconType["Default"] = "Default";
192
193
  IconType["Error"] = "Default:Error";
193
194
  IconType["Forbidden"] = "Default:Forbidden";
195
+ IconType["Attachment"] = "Badge:Attachment";
194
196
  IconType["Comment"] = "Badge:Comment";
195
197
  IconType["View"] = "Badge:View";
196
198
  IconType["React"] = "Badge:React";
@@ -7,7 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
7
7
  import { extractTitleTextColor, extractSummary } from '../common/primitives';
8
8
  import { extractLozenge } from '../common/lozenge';
9
9
  import { extractIcon } from '../common/icon';
10
- import { extractCommentCount, extractProgrammingLanguage, extractSubscriberCount } from '../common/detail';
10
+ import { extractCommentCount, extractProgrammingLanguage, extractSubscriberCount, extractAttachmentCount } from '../common/detail';
11
11
  import { extractLink, extractTitle, extractProvider, extractMembers, extractPersonAssignedTo, extractPersonCreatedBy, extractPersonUpdatedBy, extractImage } from '@atlaskit/linking-common/extractors';
12
12
  import { extractByline } from '../common/byline/extractByline';
13
13
  import { extractTitlePrefix } from '../common/title-prefix/extractTitlePrefix';
@@ -30,7 +30,7 @@ var extractBlockIcon = function extractBlockIcon(jsonLd) {
30
30
  };
31
31
 
32
32
  var extractBlockDetails = function extractBlockDetails(jsonLd) {
33
- return [extractCommentCount(jsonLd), extractProgrammingLanguage(jsonLd), extractSubscriberCount(jsonLd)].filter(function (detail) {
33
+ return [extractCommentCount(jsonLd), extractProgrammingLanguage(jsonLd), extractSubscriberCount(jsonLd), extractAttachmentCount(jsonLd)].filter(function (detail) {
34
34
  return !!detail;
35
35
  });
36
36
  };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { N600 } from '@atlaskit/theme/colors';
3
+ import AttachmentIcon from '@atlaskit/icon/glyph/attachment';
4
+ import { token } from '@atlaskit/tokens';
5
+ export var extractAttachmentCount = function extractAttachmentCount(jsonLd) {
6
+ var attachmentCount = jsonLd['atlassian:attachmentCount'];
7
+
8
+ if (attachmentCount) {
9
+ return {
10
+ text: attachmentCount.toString(),
11
+ icon: /*#__PURE__*/React.createElement(AttachmentIcon, {
12
+ size: "small",
13
+ label: "attachments",
14
+ primaryColor: token('color.icon.subtle', N600)
15
+ })
16
+ };
17
+ }
18
+ };
@@ -1,4 +1,5 @@
1
1
  export { extractCommentCount } from './extractCommentCount';
2
2
  export { extractDownloadUrl } from './extractDownloadUrl';
3
3
  export { extractProgrammingLanguage } from './extractProgrammingLanguage';
4
- export { extractSubscriberCount } from './extractSubscriberCount';
4
+ export { extractSubscriberCount } from './extractSubscriberCount';
5
+ export { extractAttachmentCount } from './extractAttachmentCount';
@@ -1,7 +1,7 @@
1
1
  import { extractSummary } from '../common/primitives';
2
2
  import { extractLozenge } from '../common/lozenge';
3
3
  import { extractLinkIcon } from './icon';
4
- import { extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn } from './utils';
4
+ import { extractAttachmentCount, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn } from './utils';
5
5
  import { extractPersonsUpdatedBy } from './collaboratorGroup';
6
6
  import { extractPersonCreatedBy, extractLink, extractTitle, extractDateUpdated, extractDateCreated } from '@atlaskit/linking-common/extractors';
7
7
  import extractPriority from './extract-priority';
@@ -17,6 +17,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
17
17
  var data = response.data;
18
18
  var url = extractLink(data);
19
19
  return {
20
+ attachmentCount: extractAttachmentCount(data),
20
21
  authorGroup: extractPersonCreatedBy(data),
21
22
  collaboratorGroup: extractPersonsUpdatedBy(data),
22
23
  commentCount: extractCommentCount(data),
@@ -49,6 +49,9 @@ export var extractSourceBranch = function extractSourceBranch(data) {
49
49
  export var extractSubscriberCount = function extractSubscriberCount(data) {
50
50
  return extractValue(data, 'atlassian:subscriberCount');
51
51
  };
52
+ export var extractAttachmentCount = function extractAttachmentCount(data) {
53
+ return extractValue(data, 'atlassian:attachmentCount');
54
+ };
52
55
  export var extractTargetBranch = function extractTargetBranch(data) {
53
56
  return extractLinkName(data['atlassian:mergeDestination']);
54
57
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.0.1",
3
+ "version": "23.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -20,7 +20,7 @@ import * as Actions from '../actions';
20
20
  import { isFlexibleUiElement } from '../../../../utils/flexible';
21
21
  import ActionGroup from './action-group';
22
22
  import ElementGroup from './element-group';
23
- export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ViewCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ReactCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.VoteCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.DueOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LatestCommit, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.SourceBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.TargetBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _ElementDisplaySchema);
23
+ export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AttachmentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ViewCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ReactCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.VoteCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.DueOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LatestCommit, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.SourceBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.TargetBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _ElementDisplaySchema);
24
24
 
25
25
  var getDirectionStyles = function getDirectionStyles(direction) {
26
26
  switch (direction) {
@@ -184,6 +184,10 @@ var importIconMapper = (_importIconMapper = {}, _defineProperty(_importIconMappe
184
184
  return import(
185
185
  /* webpackChunkName: "glyphForbidden" */
186
186
  '@atlaskit/icon/glyph/lock-filled');
187
+ }), _defineProperty(_importIconMapper, IconType.Attachment, function () {
188
+ return import(
189
+ /* webpackChunkName: "glyphAttachment" */
190
+ '@atlaskit/icon/glyph/attachment');
187
191
  }), _defineProperty(_importIconMapper, IconType.Comment, function () {
188
192
  return import(
189
193
  /* webpackChunkName: "glyphComment" */
@@ -4,10 +4,16 @@ import { ElementName } from '../../../../constants';
4
4
  // This will help reducing the code for mapping elements inside
5
5
  // createElement and renderElementItems
6
6
 
7
+ /**
8
+ * Creates a AttachmentCount Badge element using the data from AttachmentCount in the Flexible UI Context.
9
+ * @see Badge
10
+ */
11
+ export var AttachmentCount = createElement(ElementName.AttachmentCount);
7
12
  /**
8
13
  * An AvatarGroup element using the data from AuthorGroup in the Flexible UI Context.
9
14
  * @see AvatarGroup
10
15
  */
16
+
11
17
  export var AuthorGroup = createElement(ElementName.AuthorGroup);
12
18
  /**
13
19
  * An AvatarGroup element using the data from CollaboratorGroup in the Flexible UI Context.
@@ -20,7 +20,12 @@ import { messages } from '../../../../messages';
20
20
  import DateTime from './date-time';
21
21
  import { tokens } from '../../../../utils/token';
22
22
  var SNIPPET_DEFAULT_MAX_LINES = 3;
23
- var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings, ElementName.AuthorGroup, {
23
+ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings, ElementName.AttachmentCount, {
24
+ component: Badge,
25
+ props: {
26
+ icon: IconType.Attachment
27
+ }
28
+ }), _defineProperty(_elementMappings, ElementName.AuthorGroup, {
24
29
  component: AvatarGroup
25
30
  }), _defineProperty(_elementMappings, ElementName.CollaboratorGroup, {
26
31
  component: AvatarGroup
@@ -111,6 +116,7 @@ var getData = function getData(elementName, contextKey, context) {
111
116
  case ElementName.CollaboratorGroup:
112
117
  return toAvatarGroupProps(data);
113
118
 
119
+ case ElementName.AttachmentCount:
114
120
  case ElementName.CommentCount:
115
121
  case ElementName.ViewCount:
116
122
  case ElementName.ReactCount:
@@ -80,6 +80,7 @@ export declare enum SmartLinkWidth {
80
80
  * (src/view/FlexibleCard/components/blocks/utils.tsx)
81
81
  */
82
82
  export declare enum ElementName {
83
+ AttachmentCount = "AttachmentCount",
83
84
  AuthorGroup = "AuthorGroup",
84
85
  CollaboratorGroup = "CollaboratorGroup",
85
86
  CommentCount = "CommentCount",
@@ -159,6 +160,7 @@ export declare enum IconType {
159
160
  Default = "Default",
160
161
  Error = "Default:Error",
161
162
  Forbidden = "Default:Forbidden",
163
+ Attachment = "Badge:Attachment",
162
164
  Comment = "Badge:Comment",
163
165
  View = "Badge:View",
164
166
  React = "Badge:React",
@@ -33,6 +33,7 @@ export declare const TEST_DOCUMENT_WITH_ACTIONS: {
33
33
  'atlassian:fileSize'?: number | undefined;
34
34
  'schema:commentCount'?: number | undefined;
35
35
  'atlassian:isDeleted'?: boolean | undefined;
36
+ 'atlassian:attachmentCount'?: number | undefined;
36
37
  'atlassian:dateViewed'?: string | undefined;
37
38
  'atlassian:reactCount'?: number | undefined;
38
39
  'atlassian:state'?: string | JsonLd.Primitives.Object<any> | undefined;
@@ -89,6 +90,7 @@ export declare const TEST_DOCUMENT_WITH_PREVIEW: {
89
90
  'schema:commentCount'?: number | undefined;
90
91
  'atlassian:isDeleted'?: boolean | undefined;
91
92
  'schema:potentialAction'?: JsonLd.Primitives.Property<JsonLd.Data.DocumentAction> | undefined;
93
+ 'atlassian:attachmentCount'?: number | undefined;
92
94
  'atlassian:dateViewed'?: string | undefined;
93
95
  'atlassian:reactCount'?: number | undefined;
94
96
  'atlassian:state'?: string | JsonLd.Primitives.Object<any> | undefined;
@@ -0,0 +1,4 @@
1
+ import { JsonLd } from 'json-ld-types';
2
+ import { LinkDetail } from './types';
3
+ export declare type LinkAttachmentType = JsonLd.Data.Document | JsonLd.Data.Task | JsonLd.Data.TaskType | JsonLd.Data.Project;
4
+ export declare const extractAttachmentCount: (jsonLd: LinkAttachmentType) => LinkDetail | undefined;
@@ -5,3 +5,5 @@ export { extractProgrammingLanguage } from './extractProgrammingLanguage';
5
5
  export type { LinkProgrammingLanguageType } from './extractProgrammingLanguage';
6
6
  export { extractSubscriberCount } from './extractSubscriberCount';
7
7
  export type { LinkSubscriberType } from './extractSubscriberCount';
8
+ export { extractAttachmentCount } from './extractAttachmentCount';
9
+ export type { LinkAttachmentType } from './extractAttachmentCount';
@@ -9,4 +9,5 @@ export declare const extractModifiedBy: (data: JsonLd.Data.BaseData) => string |
9
9
  export declare const extractProgrammingLanguage: (data: JsonLd.Data.BaseData) => string | undefined;
10
10
  export declare const extractSourceBranch: (data: JsonLd.Data.SourceCodePullRequest) => string | undefined;
11
11
  export declare const extractSubscriberCount: (data: JsonLd.Data.BaseData) => number | undefined;
12
+ export declare const extractAttachmentCount: (data: JsonLd.Data.BaseData) => number | undefined;
12
13
  export declare const extractTargetBranch: (data: JsonLd.Data.SourceCodePullRequest) => string | undefined;
@@ -6,6 +6,12 @@ import { IconType, MediaType } from '../../constants';
6
6
  * underlying elements.
7
7
  */
8
8
  export declare type FlexibleUiDataContext = {
9
+ /**
10
+ * Contains the number of attachments on the linked resource.
11
+ * @type number
12
+ * @see AttachmentCount
13
+ */
14
+ attachmentCount?: number;
9
15
  /**
10
16
  * An array containing data used to populate the AuthorGroup element.
11
17
  * @see AvatarGroup
@@ -121,7 +121,14 @@ export declare type OnActionMenuOpenChangeOptions = {
121
121
  /**
122
122
  * A type that contains all the possible combinations of elements with their corresponding props.
123
123
  */
124
- export declare type ElementItemProps = AuthorGroup | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
124
+ export declare type ElementItemProps = AttachmentCount | AuthorGroup | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
125
+ /**
126
+ * Represents the props available for an AttachmentCount element.
127
+ * @see AttachmentCount
128
+ */
129
+ export declare type AttachmentCount = {
130
+ name: ElementName.AttachmentCount;
131
+ };
125
132
  /**
126
133
  * Represents the props available for an AuthorGroup element.
127
134
  * @see AuthorGroup
@@ -7,6 +7,11 @@ import { AvatarGroupProps } from './avatar-group/types';
7
7
  import { TextProps } from './text/types';
8
8
  import { DateTimeProps } from './date-time/types';
9
9
  import { MediaProps } from './media/types';
10
+ /**
11
+ * Creates a AttachmentCount Badge element using the data from AttachmentCount in the Flexible UI Context.
12
+ * @see Badge
13
+ */
14
+ export declare const AttachmentCount: import("react").FC<BadgeProps>;
10
15
  /**
11
16
  * An AvatarGroup element using the data from AuthorGroup in the Flexible UI Context.
12
17
  * @see AvatarGroup
@@ -80,6 +80,7 @@ export declare enum SmartLinkWidth {
80
80
  * (src/view/FlexibleCard/components/blocks/utils.tsx)
81
81
  */
82
82
  export declare enum ElementName {
83
+ AttachmentCount = "AttachmentCount",
83
84
  AuthorGroup = "AuthorGroup",
84
85
  CollaboratorGroup = "CollaboratorGroup",
85
86
  CommentCount = "CommentCount",
@@ -159,6 +160,7 @@ export declare enum IconType {
159
160
  Default = "Default",
160
161
  Error = "Default:Error",
161
162
  Forbidden = "Default:Forbidden",
163
+ Attachment = "Badge:Attachment",
162
164
  Comment = "Badge:Comment",
163
165
  View = "Badge:View",
164
166
  React = "Badge:React",
@@ -33,6 +33,7 @@ export declare const TEST_DOCUMENT_WITH_ACTIONS: {
33
33
  'atlassian:fileSize'?: number | undefined;
34
34
  'schema:commentCount'?: number | undefined;
35
35
  'atlassian:isDeleted'?: boolean | undefined;
36
+ 'atlassian:attachmentCount'?: number | undefined;
36
37
  'atlassian:dateViewed'?: string | undefined;
37
38
  'atlassian:reactCount'?: number | undefined;
38
39
  'atlassian:state'?: string | JsonLd.Primitives.Object<any> | undefined;
@@ -89,6 +90,7 @@ export declare const TEST_DOCUMENT_WITH_PREVIEW: {
89
90
  'schema:commentCount'?: number | undefined;
90
91
  'atlassian:isDeleted'?: boolean | undefined;
91
92
  'schema:potentialAction'?: JsonLd.Primitives.Property<JsonLd.Data.DocumentAction> | undefined;
93
+ 'atlassian:attachmentCount'?: number | undefined;
92
94
  'atlassian:dateViewed'?: string | undefined;
93
95
  'atlassian:reactCount'?: number | undefined;
94
96
  'atlassian:state'?: string | JsonLd.Primitives.Object<any> | undefined;
@@ -0,0 +1,4 @@
1
+ import { JsonLd } from 'json-ld-types';
2
+ import { LinkDetail } from './types';
3
+ export declare type LinkAttachmentType = JsonLd.Data.Document | JsonLd.Data.Task | JsonLd.Data.TaskType | JsonLd.Data.Project;
4
+ export declare const extractAttachmentCount: (jsonLd: LinkAttachmentType) => LinkDetail | undefined;
@@ -5,3 +5,5 @@ export { extractProgrammingLanguage } from './extractProgrammingLanguage';
5
5
  export type { LinkProgrammingLanguageType } from './extractProgrammingLanguage';
6
6
  export { extractSubscriberCount } from './extractSubscriberCount';
7
7
  export type { LinkSubscriberType } from './extractSubscriberCount';
8
+ export { extractAttachmentCount } from './extractAttachmentCount';
9
+ export type { LinkAttachmentType } from './extractAttachmentCount';
@@ -9,4 +9,5 @@ export declare const extractModifiedBy: (data: JsonLd.Data.BaseData) => string |
9
9
  export declare const extractProgrammingLanguage: (data: JsonLd.Data.BaseData) => string | undefined;
10
10
  export declare const extractSourceBranch: (data: JsonLd.Data.SourceCodePullRequest) => string | undefined;
11
11
  export declare const extractSubscriberCount: (data: JsonLd.Data.BaseData) => number | undefined;
12
+ export declare const extractAttachmentCount: (data: JsonLd.Data.BaseData) => number | undefined;
12
13
  export declare const extractTargetBranch: (data: JsonLd.Data.SourceCodePullRequest) => string | undefined;
@@ -6,6 +6,12 @@ import { IconType, MediaType } from '../../constants';
6
6
  * underlying elements.
7
7
  */
8
8
  export declare type FlexibleUiDataContext = {
9
+ /**
10
+ * Contains the number of attachments on the linked resource.
11
+ * @type number
12
+ * @see AttachmentCount
13
+ */
14
+ attachmentCount?: number;
9
15
  /**
10
16
  * An array containing data used to populate the AuthorGroup element.
11
17
  * @see AvatarGroup
@@ -121,7 +121,14 @@ export declare type OnActionMenuOpenChangeOptions = {
121
121
  /**
122
122
  * A type that contains all the possible combinations of elements with their corresponding props.
123
123
  */
124
- export declare type ElementItemProps = AuthorGroup | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
124
+ export declare type ElementItemProps = AttachmentCount | AuthorGroup | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
125
+ /**
126
+ * Represents the props available for an AttachmentCount element.
127
+ * @see AttachmentCount
128
+ */
129
+ export declare type AttachmentCount = {
130
+ name: ElementName.AttachmentCount;
131
+ };
125
132
  /**
126
133
  * Represents the props available for an AuthorGroup element.
127
134
  * @see AuthorGroup
@@ -7,6 +7,11 @@ import { AvatarGroupProps } from './avatar-group/types';
7
7
  import { TextProps } from './text/types';
8
8
  import { DateTimeProps } from './date-time/types';
9
9
  import { MediaProps } from './media/types';
10
+ /**
11
+ * Creates a AttachmentCount Badge element using the data from AttachmentCount in the Flexible UI Context.
12
+ * @see Badge
13
+ */
14
+ export declare const AttachmentCount: import("react").FC<BadgeProps>;
10
15
  /**
11
16
  * An AvatarGroup element using the data from AuthorGroup in the Flexible UI Context.
12
17
  * @see AvatarGroup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.0.1",
3
+ "version": "23.1.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -58,7 +58,7 @@
58
58
  "@emotion/styled": "^10.0.7",
59
59
  "@formatjs/intl-utils": "^3.8.4",
60
60
  "facepaint": "^1.2.1",
61
- "json-ld-types": "3.0.2",
61
+ "json-ld-types": "3.1.0",
62
62
  "react-error-boundary": "^3.1.3",
63
63
  "react-lazily-render": "^1.2.0",
64
64
  "react-loadable": "^5.1.0",
@@ -66,7 +66,7 @@
66
66
  "uuid": "^3.1.0"
67
67
  },
68
68
  "peerDependencies": {
69
- "@atlaskit/link-provider": "^1.3.0",
69
+ "@atlaskit/link-provider": "^1.3.2",
70
70
  "react": "^16.8.0",
71
71
  "react-dom": "^16.8.0",
72
72
  "react-intl-next": "npm:react-intl@^5.18.1"
package/report.api.md CHANGED
@@ -124,6 +124,11 @@ type AnchorTarget = '_blank' | '_parent' | '_self' | '_top';
124
124
 
125
125
  export { APIError };
126
126
 
127
+ // @public
128
+ type AttachmentCount = {
129
+ name: ElementName.AttachmentCount;
130
+ };
131
+
127
132
  // @public
128
133
  type AuthorGroup = {
129
134
  name: ElementName.AuthorGroup;
@@ -380,6 +385,7 @@ export type ElementItem = {
380
385
 
381
386
  // @public
382
387
  type ElementItemProps =
388
+ | AttachmentCount
383
389
  | AuthorGroup
384
390
  | CollaboratorGroup
385
391
  | CommentCount
@@ -406,6 +412,8 @@ type ElementItemProps =
406
412
 
407
413
  // @public
408
414
  export enum ElementName {
415
+ // (undocumented)
416
+ AttachmentCount = 'AttachmentCount',
409
417
  // (undocumented)
410
418
  AuthorGroup = 'AuthorGroup',
411
419
  // (undocumented)
@@ -92,6 +92,11 @@ type AnchorTarget = '_blank' | '_parent' | '_self' | '_top';
92
92
 
93
93
  export { APIError }
94
94
 
95
+ // @public
96
+ type AttachmentCount = {
97
+ name: ElementName.AttachmentCount;
98
+ };
99
+
95
100
  // @public
96
101
  type AuthorGroup = {
97
102
  name: ElementName.AuthorGroup;
@@ -302,10 +307,12 @@ export type ElementItem = {
302
307
  } & ElementItemProps;
303
308
 
304
309
  // @public
305
- type ElementItemProps = AuthorGroup | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider_2 | ReactCount | Snippet | SourceBranch | State_2 | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
310
+ type ElementItemProps = AttachmentCount | AuthorGroup | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider_2 | ReactCount | Snippet | SourceBranch | State_2 | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
306
311
 
307
312
  // @public
308
313
  export enum ElementName {
314
+ // (undocumented)
315
+ AttachmentCount = "AttachmentCount",
309
316
  // (undocumented)
310
317
  AuthorGroup = "AuthorGroup",
311
318
  // (undocumented)