@atlaskit/smart-card 17.7.11 → 18.0.1

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 (43) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/constants.js +6 -0
  3. package/dist/cjs/extractors/flexible/index.js +3 -0
  4. package/dist/cjs/extractors/flexible/utils.js +19 -1
  5. package/dist/cjs/version.json +1 -1
  6. package/dist/cjs/view/EmbedCard/components/styled.js +1 -1
  7. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
  8. package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +12 -0
  9. package/dist/cjs/view/FlexibleCard/components/elements/index.js +7 -1
  10. package/dist/cjs/view/FlexibleCard/components/elements/utils.js +18 -0
  11. package/dist/cjs/view/HoverCard/index.js +68 -12
  12. package/dist/cjs/view/InlineCard/IconAndTitleLayout/styled.js +2 -2
  13. package/dist/cjs/view/InlineCard/styled.js +1 -1
  14. package/dist/es2019/constants.js +6 -0
  15. package/dist/es2019/extractors/flexible/index.js +4 -1
  16. package/dist/es2019/extractors/flexible/utils.js +3 -0
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/es2019/view/EmbedCard/components/styled.js +0 -2
  19. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +3 -0
  20. package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +9 -0
  21. package/dist/es2019/view/FlexibleCard/components/elements/index.js +3 -0
  22. package/dist/es2019/view/FlexibleCard/components/elements/utils.js +21 -0
  23. package/dist/es2019/view/HoverCard/index.js +49 -11
  24. package/dist/es2019/view/InlineCard/IconAndTitleLayout/styled.js +2 -4
  25. package/dist/es2019/view/InlineCard/styled.js +1 -1
  26. package/dist/esm/constants.js +6 -0
  27. package/dist/esm/extractors/flexible/index.js +4 -1
  28. package/dist/esm/extractors/flexible/utils.js +9 -0
  29. package/dist/esm/version.json +1 -1
  30. package/dist/esm/view/EmbedCard/components/styled.js +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 +12 -0
  33. package/dist/esm/view/FlexibleCard/components/elements/index.js +3 -0
  34. package/dist/esm/view/FlexibleCard/components/elements/utils.js +18 -0
  35. package/dist/esm/view/HoverCard/index.js +62 -12
  36. package/dist/esm/view/InlineCard/IconAndTitleLayout/styled.js +2 -2
  37. package/dist/esm/view/InlineCard/styled.js +1 -1
  38. package/dist/types/constants.d.ts +6 -0
  39. package/dist/types/extractors/common/__mocks__/jsonld.d.ts +8 -0
  40. package/dist/types/extractors/flexible/utils.d.ts +3 -0
  41. package/dist/types/state/flexible-ui-context/types.d.ts +3 -0
  42. package/dist/types/view/FlexibleCard/components/elements/index.d.ts +3 -0
  43. package/package.json +6 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 18.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`75c16ae4964`](https://bitbucket.org/atlassian/atlassian-frontend/commits/75c16ae4964) - refactor code to use atlaskit/popup instead of atlaskit/tooltip as a base component
8
+
9
+ ## 18.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [`dd429d9fdca`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dd429d9fdca) - [ux] EDM-2822: Fix smart link wraps just after the icon
14
+
15
+ ### Patch Changes
16
+
17
+ - [`fb1cf506701`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fb1cf506701) - [ux] ED-14487: polyfill ResizeObserver and IntersectionObserver for unit tests, but mock isIntersectionObserverSupported() for tests related to smart-cards
18
+ - Updated dependencies
19
+
20
+ ## 17.7.12
21
+
22
+ ### Patch Changes
23
+
24
+ - [`f9bbe6d0a56`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f9bbe6d0a56) - Add View, Vote and React badge elements
25
+
3
26
  ## 17.7.11
4
27
 
5
28
  ### Patch Changes
@@ -132,6 +132,9 @@ exports.ElementName = ElementName;
132
132
  ElementName["AuthorGroup"] = "AuthorGroup";
133
133
  ElementName["CollaboratorGroup"] = "CollaboratorGroup";
134
134
  ElementName["CommentCount"] = "CommentCount";
135
+ ElementName["ViewCount"] = "ViewCount";
136
+ ElementName["ReactCount"] = "ReactCount";
137
+ ElementName["VoteCount"] = "VoteCount";
135
138
  ElementName["CreatedBy"] = "CreatedBy";
136
139
  ElementName["CreatedOn"] = "CreatedOn";
137
140
  ElementName["LinkIcon"] = "LinkIcon";
@@ -212,6 +215,9 @@ exports.IconType = IconType;
212
215
  IconType["Error"] = "Default:Error";
213
216
  IconType["Forbidden"] = "Default:Forbidden";
214
217
  IconType["Comment"] = "Badge:Comment";
218
+ IconType["View"] = "Badge:View";
219
+ IconType["React"] = "Badge:React";
220
+ IconType["Vote"] = "Badge:Vote";
215
221
  IconType["PriorityBlocker"] = "Badge:PriorityBlocker";
216
222
  IconType["PriorityCritical"] = "Badge:PriorityCritical";
217
223
  IconType["PriorityHigh"] = "Badge:PriorityHigh";
@@ -40,6 +40,9 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
40
40
  authorGroup: (0, _person.extractPersonCreatedBy)(data),
41
41
  collaboratorGroup: (0, _collaboratorGroup.extractPersonsUpdatedBy)(data),
42
42
  commentCount: (0, _utils.extractCommentCount)(data),
43
+ viewCount: (0, _utils.extractViewCount)(data),
44
+ reactCount: (0, _utils.extractReactCount)(data),
45
+ voteCount: (0, _utils.extractVoteCount)(data),
43
46
  createdBy: (0, _utils.extractCreatedBy)(data),
44
47
  createdOn: (0, _extractDateCreated.extractDateCreated)(data),
45
48
  linkIcon: (0, _icon.extractLinkIcon)(response, renderers),
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.extractSubscriberCount = exports.extractProgrammingLanguage = exports.extractModifiedBy = exports.extractCreatedBy = exports.extractCommentCount = void 0;
6
+ exports.extractVoteCount = exports.extractViewCount = exports.extractSubscriberCount = exports.extractReactCount = exports.extractProgrammingLanguage = exports.extractModifiedBy = exports.extractCreatedBy = exports.extractCommentCount = void 0;
7
7
 
8
8
  var _person = require("../common/person");
9
9
 
@@ -17,6 +17,24 @@ var extractCommentCount = function extractCommentCount(data) {
17
17
 
18
18
  exports.extractCommentCount = extractCommentCount;
19
19
 
20
+ var extractViewCount = function extractViewCount(data) {
21
+ return extractValue(data, 'atlassian:viewCount');
22
+ };
23
+
24
+ exports.extractViewCount = extractViewCount;
25
+
26
+ var extractReactCount = function extractReactCount(data) {
27
+ return extractValue(data, 'atlassian:reactCount');
28
+ };
29
+
30
+ exports.extractReactCount = extractReactCount;
31
+
32
+ var extractVoteCount = function extractVoteCount(data) {
33
+ return extractValue(data, 'atlassian:voteCount');
34
+ };
35
+
36
+ exports.extractVoteCount = extractVoteCount;
37
+
20
38
  var extractCreatedBy = function extractCreatedBy(data) {
21
39
  var persons = (0, _person.extractPersonCreatedBy)(data);
22
40
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.7.11",
3
+ "version": "18.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -126,7 +126,7 @@ exports.TextWrapper = TextWrapper;
126
126
  // NB: `overflow` is kept as `hidden` since
127
127
  // the internal contents of the `iframe` should
128
128
  // manage scrolling behaviour.
129
- var Content = _styled.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n\n ", "\n ", "\n background-color: white;\n position: absolute;\n z-index: 1;\n width: 100%;\n top: ", ";\n overflow: hidden;\n height: calc(100% - ", ");\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n"])), _mediaUi.borderRadius, cardShadow, (0, _utils.gs)(4), (0, _utils.gs)(4), function (_ref9) {
129
+ var Content = _styled.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n background-color: white;\n position: absolute;\n z-index: 1;\n width: 100%;\n top: ", ";\n overflow: hidden;\n height: calc(100% - ", ");\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n"])), _mediaUi.borderRadius, cardShadow, (0, _utils.gs)(4), (0, _utils.gs)(4), function (_ref9) {
130
130
  var isInteractive = _ref9.isInteractive;
131
131
 
132
132
  if (isInteractive) {
@@ -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.CreatedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LinkIcon, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Preview, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Priority, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ProgrammingLanguage, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Provider, ['inline']), _ElementDisplaySchema);
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.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.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Provider, ['inline']), _ElementDisplaySchema);
52
52
  exports.ElementDisplaySchema = ElementDisplaySchema;
53
53
 
54
54
  var getDirectionStyles = function getDirectionStyles(direction) {
@@ -212,6 +212,18 @@ var importIconMapper = (_importIconMapper = {}, (0, _defineProperty2.default)(_i
212
212
  return Promise.resolve().then(function () {
213
213
  return _interopRequireWildcard(require('@atlaskit/icon/glyph/comment'));
214
214
  });
215
+ }), (0, _defineProperty2.default)(_importIconMapper, _constants.IconType.View, function () {
216
+ return Promise.resolve().then(function () {
217
+ return _interopRequireWildcard(require('@atlaskit/icon/glyph/watch'));
218
+ });
219
+ }), (0, _defineProperty2.default)(_importIconMapper, _constants.IconType.React, function () {
220
+ return Promise.resolve().then(function () {
221
+ return _interopRequireWildcard(require('@atlaskit/icon/glyph/like'));
222
+ });
223
+ }), (0, _defineProperty2.default)(_importIconMapper, _constants.IconType.Vote, function () {
224
+ return Promise.resolve().then(function () {
225
+ return _interopRequireWildcard(require('@atlaskit/icon/glyph/arrow-up'));
226
+ });
215
227
  }), (0, _defineProperty2.default)(_importIconMapper, _constants.IconType.PriorityBlocker, function () {
216
228
  return Promise.resolve().then(function () {
217
229
  return _interopRequireWildcard(require('@atlaskit/icon-priority/glyph/priority-blocker'));
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Title = exports.SubscriberCount = exports.State = exports.Snippet = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.AuthorGroup = void 0;
6
+ exports.VoteCount = exports.ViewCount = exports.Title = exports.SubscriberCount = exports.State = exports.Snippet = exports.ReactCount = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.AuthorGroup = void 0;
7
7
 
8
8
  var _utils = require("./utils");
9
9
 
@@ -18,6 +18,12 @@ var CollaboratorGroup = (0, _utils.createElement)(_constants.ElementName.Collabo
18
18
  exports.CollaboratorGroup = CollaboratorGroup;
19
19
  var CommentCount = (0, _utils.createElement)(_constants.ElementName.CommentCount);
20
20
  exports.CommentCount = CommentCount;
21
+ var ViewCount = (0, _utils.createElement)(_constants.ElementName.ViewCount);
22
+ exports.ViewCount = ViewCount;
23
+ var ReactCount = (0, _utils.createElement)(_constants.ElementName.ReactCount);
24
+ exports.ReactCount = ReactCount;
25
+ var VoteCount = (0, _utils.createElement)(_constants.ElementName.VoteCount);
26
+ exports.VoteCount = VoteCount;
21
27
  var CreatedBy = (0, _utils.createElement)(_constants.ElementName.CreatedBy);
22
28
  exports.CreatedBy = CreatedBy;
23
29
  var CreatedOn = (0, _utils.createElement)(_constants.ElementName.CreatedOn);
@@ -55,6 +55,21 @@ var elementMappings = (_elementMappings = {}, (0, _defineProperty2.default)(_ele
55
55
  props: {
56
56
  icon: _constants.IconType.Comment
57
57
  }
58
+ }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.ViewCount, {
59
+ component: _badge.default,
60
+ props: {
61
+ icon: _constants.IconType.View
62
+ }
63
+ }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.ReactCount, {
64
+ component: _badge.default,
65
+ props: {
66
+ icon: _constants.IconType.React
67
+ }
68
+ }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.VoteCount, {
69
+ component: _badge.default,
70
+ props: {
71
+ icon: _constants.IconType.Vote
72
+ }
58
73
  }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.CreatedBy, {
59
74
  component: _text.default
60
75
  }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.LinkIcon, {
@@ -112,6 +127,9 @@ var getData = function getData(elementName, contextKey, context) {
112
127
  return toAvatarGroupProps(data);
113
128
 
114
129
  case _constants.ElementName.CommentCount:
130
+ case _constants.ElementName.ViewCount:
131
+ case _constants.ElementName.ReactCount:
132
+ case _constants.ElementName.VoteCount:
115
133
  case _constants.ElementName.ProgrammingLanguage:
116
134
  case _constants.ElementName.SubscriberCount:
117
135
  return toBadgeProps(data);
@@ -2,36 +2,92 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
8
10
  exports.HoverCard = void 0;
9
11
 
10
- var _react = _interopRequireDefault(require("react"));
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
15
 
12
- var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
16
+ var _react = _interopRequireWildcard(require("react"));
13
17
 
14
18
  var _blocks = require("../FlexibleCard/components/blocks");
15
19
 
16
20
  var _Card = require("../Card");
17
21
 
18
- var _styled = require("./styled");
22
+ var _popup = _interopRequireDefault(require("@atlaskit/popup"));
23
+
24
+ var _constants = require("../../constants");
25
+
26
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
+
28
+ 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; }
19
29
 
20
30
  var HoverCard = function HoverCard(_ref) {
21
31
  var children = _ref.children,
22
32
  url = _ref.url;
33
+ var delay = 300;
23
34
 
24
- var cardComponent = /*#__PURE__*/_react.default.createElement(_Card.Card, {
25
- appearance: "block",
26
- url: url
27
- }, /*#__PURE__*/_react.default.createElement(_blocks.TitleBlock, null), /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, null), /*#__PURE__*/_react.default.createElement(_blocks.FooterBlock, null));
35
+ var _React$useState = _react.default.useState(false),
36
+ _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
37
+ isOpen = _React$useState2[0],
38
+ setIsOpen = _React$useState2[1];
28
39
 
29
- return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
30
- content: cardComponent,
31
- component: _styled.HoverCardContainer,
40
+ var fadeOutTimeoutId = (0, _react.useRef)();
41
+ var fadeInTimeoutId = (0, _react.useRef)();
42
+ var initHideCard = (0, _react.useCallback)(function () {
43
+ if (fadeInTimeoutId.current) {
44
+ clearTimeout(fadeInTimeoutId.current);
45
+ }
46
+
47
+ fadeOutTimeoutId.current = setTimeout(function () {
48
+ setIsOpen(false);
49
+ }, delay);
50
+ }, [delay]);
51
+ var initShowCard = (0, _react.useCallback)(function () {
52
+ if (fadeOutTimeoutId.current) {
53
+ clearTimeout(fadeOutTimeoutId.current);
54
+ }
55
+
56
+ fadeInTimeoutId.current = setTimeout(function () {
57
+ setIsOpen(true);
58
+ }, delay);
59
+ }, [delay]);
60
+
61
+ var cardComponent = function cardComponent() {
62
+ return /*#__PURE__*/_react.default.createElement("span", {
63
+ onMouseEnter: initShowCard,
64
+ onMouseLeave: initHideCard
65
+ }, /*#__PURE__*/_react.default.createElement(_Card.Card, {
66
+ appearance: "block",
67
+ url: url,
68
+ ui: {
69
+ hideElevation: true,
70
+ size: _constants.SmartLinkSize.Large
71
+ }
72
+ }, /*#__PURE__*/_react.default.createElement(_blocks.TitleBlock, null), /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, null), /*#__PURE__*/_react.default.createElement(_blocks.FooterBlock, null)));
73
+ };
74
+
75
+ var onClose = (0, _react.useCallback)(function () {
76
+ return setIsOpen(false);
77
+ }, []);
78
+ return /*#__PURE__*/_react.default.createElement(_popup.default, {
32
79
  testId: "hover-card",
33
- tag: "span"
34
- }, children);
80
+ isOpen: isOpen,
81
+ onClose: onClose,
82
+ placement: "bottom",
83
+ content: cardComponent,
84
+ trigger: function trigger(triggerProps) {
85
+ return /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({}, triggerProps, {
86
+ onMouseEnter: initShowCard,
87
+ onMouseLeave: initHideCard
88
+ }), children);
89
+ }
90
+ });
35
91
  };
36
92
 
37
93
  exports.HoverCard = HoverCard;
@@ -33,12 +33,12 @@ exports.IconWrapper = IconWrapper;
33
33
 
34
34
  var EmojiWrapper = _styled.default.span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: inline-block;\n margin-right: 2px;\n user-select: none;\n ", "\n ", "\n"])), IconOverrides, IconObjectOverrides); // The main 'wrapping' element, title of the content.
35
35
  // NB: `white-space` adds little whitespace before wrapping.
36
- // NB: `hyphens` enables hyphenation on word break.
36
+ // NB: `word-break` line breaks as soon as an overflow takes place.
37
37
 
38
38
 
39
39
  exports.EmojiWrapper = EmojiWrapper;
40
40
 
41
- var IconTitleWrapper = _styled.default.span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n hyphens: auto;\n white-space: pre-wrap;\n overflow-wrap: break-word;\n word-break: break-word;\n"]))); // TODO: Replace overrides with proper AtlasKit solution.
41
+ var IconTitleWrapper = _styled.default.span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n white-space: pre-wrap;\n word-break: break-all;\n"]))); // TODO: Replace overrides with proper AtlasKit solution.
42
42
 
43
43
 
44
44
  exports.IconTitleWrapper = IconTitleWrapper;
@@ -20,7 +20,7 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
20
20
  var LINK_COLOR_DARK = '#4794FF'; // By default buttons will hide overflow and ellipsis content instead of wrapping.
21
21
  // This basically turns the button back into inline content
22
22
 
23
- var IconStyledButton = _styled.default.span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n text-align: initial !important;\n display: inline !important;\n\n &:hover {\n /* Remove the text-decoration to match other inline card hover states*/\n text-decoration: none !important;\n }\n\n > span {\n display: inline;\n > span {\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n }\n }\n"])));
23
+ var IconStyledButton = _styled.default.span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n text-align: initial !important;\n display: inline !important;\n\n &:hover {\n /* Remove the text-decoration to match other inline card hover states */\n text-decoration: none !important;\n }\n\n > span {\n display: inline;\n > span {\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n }\n }\n"])));
24
24
 
25
25
  exports.IconStyledButton = IconStyledButton;
26
26
 
@@ -109,6 +109,9 @@ export let ElementName;
109
109
  ElementName["AuthorGroup"] = "AuthorGroup";
110
110
  ElementName["CollaboratorGroup"] = "CollaboratorGroup";
111
111
  ElementName["CommentCount"] = "CommentCount";
112
+ ElementName["ViewCount"] = "ViewCount";
113
+ ElementName["ReactCount"] = "ReactCount";
114
+ ElementName["VoteCount"] = "VoteCount";
112
115
  ElementName["CreatedBy"] = "CreatedBy";
113
116
  ElementName["CreatedOn"] = "CreatedOn";
114
117
  ElementName["LinkIcon"] = "LinkIcon";
@@ -185,6 +188,9 @@ export let IconType;
185
188
  IconType["Error"] = "Default:Error";
186
189
  IconType["Forbidden"] = "Default:Forbidden";
187
190
  IconType["Comment"] = "Badge:Comment";
191
+ IconType["View"] = "Badge:View";
192
+ IconType["React"] = "Badge:React";
193
+ IconType["Vote"] = "Badge:Vote";
188
194
  IconType["PriorityBlocker"] = "Badge:PriorityBlocker";
189
195
  IconType["PriorityCritical"] = "Badge:PriorityCritical";
190
196
  IconType["PriorityHigh"] = "Badge:PriorityHigh";
@@ -1,7 +1,7 @@
1
1
  import { extractLink, extractSummary, extractTitle } from '../common/primitives';
2
2
  import { extractLozenge } from '../common/lozenge';
3
3
  import { extractLinkIcon } from './icon';
4
- import { extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount } from './utils';
4
+ import { extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount } from './utils';
5
5
  import { extractPersonCreatedBy } from '../common/person';
6
6
  import { extractPersonsUpdatedBy } from './collaboratorGroup';
7
7
  import { extractDateUpdated } from '../common/date/extractDateUpdated';
@@ -21,6 +21,9 @@ const extractFlexibleUiContext = (response, renderers) => {
21
21
  authorGroup: extractPersonCreatedBy(data),
22
22
  collaboratorGroup: extractPersonsUpdatedBy(data),
23
23
  commentCount: extractCommentCount(data),
24
+ viewCount: extractViewCount(data),
25
+ reactCount: extractReactCount(data),
26
+ voteCount: extractVoteCount(data),
24
27
  createdBy: extractCreatedBy(data),
25
28
  createdOn: extractDateCreated(data),
26
29
  linkIcon: extractLinkIcon(response, renderers),
@@ -5,6 +5,9 @@ const extractValue = (data, key) => {
5
5
  };
6
6
 
7
7
  export const extractCommentCount = data => extractValue(data, 'schema:commentCount');
8
+ export const extractViewCount = data => extractValue(data, 'atlassian:viewCount');
9
+ export const extractReactCount = data => extractValue(data, 'atlassian:reactCount');
10
+ export const extractVoteCount = data => extractValue(data, 'atlassian:voteCount');
8
11
  export const extractCreatedBy = data => {
9
12
  const persons = extractPersonCreatedBy(data);
10
13
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.7.11",
3
+ "version": "18.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -170,8 +170,6 @@ export const TextWrapper = styled.div`
170
170
  // the internal contents of the `iframe` should
171
171
  // manage scrolling behaviour.
172
172
  export const Content = styled.div`
173
- position: relative;
174
-
175
173
  ${borderRadius}
176
174
  ${cardShadow}
177
175
  background-color: white;
@@ -11,6 +11,9 @@ export const ElementDisplaySchema = {
11
11
  [ElementName.AuthorGroup]: ['inline'],
12
12
  [ElementName.CollaboratorGroup]: ['inline'],
13
13
  [ElementName.CommentCount]: ['inline'],
14
+ [ElementName.ViewCount]: ['inline'],
15
+ [ElementName.ReactCount]: ['inline'],
16
+ [ElementName.VoteCount]: ['inline'],
14
17
  [ElementName.CreatedBy]: ['inline'],
15
18
  [ElementName.CreatedOn]: ['inline'],
16
19
  [ElementName.LinkIcon]: ['inline'],
@@ -149,6 +149,15 @@ const importIconMapper = {
149
149
  [IconType.Comment]: () => import(
150
150
  /* webpackChunkName: "glyphComment" */
151
151
  '@atlaskit/icon/glyph/comment'),
152
+ [IconType.View]: () => import(
153
+ /* webpackChunkName: "glyphComment" */
154
+ '@atlaskit/icon/glyph/watch'),
155
+ [IconType.React]: () => import(
156
+ /* webpackChunkName: "glyphComment" */
157
+ '@atlaskit/icon/glyph/like'),
158
+ [IconType.Vote]: () => import(
159
+ /* webpackChunkName: "glyphComment" */
160
+ '@atlaskit/icon/glyph/arrow-up'),
152
161
  [IconType.PriorityBlocker]: () => import(
153
162
  /* webpackChunkName: "glyphBlocker" */
154
163
  '@atlaskit/icon-priority/glyph/priority-blocker'),
@@ -6,6 +6,9 @@ import { ElementName } from '../../../../constants';
6
6
  export const AuthorGroup = createElement(ElementName.AuthorGroup);
7
7
  export const CollaboratorGroup = createElement(ElementName.CollaboratorGroup);
8
8
  export const CommentCount = createElement(ElementName.CommentCount);
9
+ export const ViewCount = createElement(ElementName.ViewCount);
10
+ export const ReactCount = createElement(ElementName.ReactCount);
11
+ export const VoteCount = createElement(ElementName.VoteCount);
9
12
  export const CreatedBy = createElement(ElementName.CreatedBy);
10
13
  export const CreatedOn = createElement(ElementName.CreatedOn);
11
14
  export const LinkIcon = createElement(ElementName.LinkIcon);
@@ -26,6 +26,24 @@ const elementMappings = {
26
26
  icon: IconType.Comment
27
27
  }
28
28
  },
29
+ [ElementName.ViewCount]: {
30
+ component: Badge,
31
+ props: {
32
+ icon: IconType.View
33
+ }
34
+ },
35
+ [ElementName.ReactCount]: {
36
+ component: Badge,
37
+ props: {
38
+ icon: IconType.React
39
+ }
40
+ },
41
+ [ElementName.VoteCount]: {
42
+ component: Badge,
43
+ props: {
44
+ icon: IconType.Vote
45
+ }
46
+ },
29
47
  [ElementName.CreatedBy]: {
30
48
  component: Text
31
49
  },
@@ -96,6 +114,9 @@ const getData = (elementName, contextKey, context) => {
96
114
  return toAvatarGroupProps(data);
97
115
 
98
116
  case ElementName.CommentCount:
117
+ case ElementName.ViewCount:
118
+ case ElementName.ReactCount:
119
+ case ElementName.VoteCount:
99
120
  case ElementName.ProgrammingLanguage:
100
121
  case ElementName.SubscriberCount:
101
122
  return toBadgeProps(data);
@@ -1,20 +1,58 @@
1
- import React from 'react';
2
- import Tooltip from '@atlaskit/tooltip';
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useCallback, useRef } from 'react';
3
3
  import { TitleBlock, SnippetBlock, FooterBlock } from '../FlexibleCard/components/blocks';
4
4
  import { Card } from '../Card';
5
- import { HoverCardContainer } from './styled';
5
+ import Popup from '@atlaskit/popup';
6
+ import { SmartLinkSize } from '../../constants';
6
7
  export const HoverCard = ({
7
8
  children,
8
9
  url
9
10
  }) => {
10
- const cardComponent = /*#__PURE__*/React.createElement(Card, {
11
+ const delay = 300;
12
+ const [isOpen, setIsOpen] = React.useState(false);
13
+ const fadeOutTimeoutId = useRef();
14
+ const fadeInTimeoutId = useRef();
15
+ const initHideCard = useCallback(() => {
16
+ if (fadeInTimeoutId.current) {
17
+ clearTimeout(fadeInTimeoutId.current);
18
+ }
19
+
20
+ fadeOutTimeoutId.current = setTimeout(() => {
21
+ setIsOpen(false);
22
+ }, delay);
23
+ }, [delay]);
24
+ const initShowCard = useCallback(() => {
25
+ if (fadeOutTimeoutId.current) {
26
+ clearTimeout(fadeOutTimeoutId.current);
27
+ }
28
+
29
+ fadeInTimeoutId.current = setTimeout(() => {
30
+ setIsOpen(true);
31
+ }, delay);
32
+ }, [delay]);
33
+
34
+ const cardComponent = () => /*#__PURE__*/React.createElement("span", {
35
+ onMouseEnter: initShowCard,
36
+ onMouseLeave: initHideCard
37
+ }, /*#__PURE__*/React.createElement(Card, {
11
38
  appearance: "block",
12
- url: url
13
- }, /*#__PURE__*/React.createElement(TitleBlock, null), /*#__PURE__*/React.createElement(SnippetBlock, null), /*#__PURE__*/React.createElement(FooterBlock, null));
14
- return /*#__PURE__*/React.createElement(Tooltip, {
15
- content: cardComponent,
16
- component: HoverCardContainer,
39
+ url: url,
40
+ ui: {
41
+ hideElevation: true,
42
+ size: SmartLinkSize.Large
43
+ }
44
+ }, /*#__PURE__*/React.createElement(TitleBlock, null), /*#__PURE__*/React.createElement(SnippetBlock, null), /*#__PURE__*/React.createElement(FooterBlock, null)));
45
+
46
+ const onClose = useCallback(() => setIsOpen(false), []);
47
+ return /*#__PURE__*/React.createElement(Popup, {
17
48
  testId: "hover-card",
18
- tag: "span"
19
- }, children);
49
+ isOpen: isOpen,
50
+ onClose: onClose,
51
+ placement: "bottom",
52
+ content: cardComponent,
53
+ trigger: triggerProps => /*#__PURE__*/React.createElement("span", _extends({}, triggerProps, {
54
+ onMouseEnter: initShowCard,
55
+ onMouseLeave: initHideCard
56
+ }), children)
57
+ });
20
58
  };
@@ -52,13 +52,11 @@ export const EmojiWrapper = styled.span`
52
52
  ${IconObjectOverrides}
53
53
  `; // The main 'wrapping' element, title of the content.
54
54
  // NB: `white-space` adds little whitespace before wrapping.
55
- // NB: `hyphens` enables hyphenation on word break.
55
+ // NB: `word-break` line breaks as soon as an overflow takes place.
56
56
 
57
57
  export const IconTitleWrapper = styled.span`
58
- hyphens: auto;
59
58
  white-space: pre-wrap;
60
- overflow-wrap: break-word;
61
- word-break: break-word;
59
+ word-break: break-all;
62
60
  `; // TODO: Replace overrides with proper AtlasKit solution.
63
61
 
64
62
  export const LozengeWrapper = styled.span`
@@ -9,7 +9,7 @@ export const IconStyledButton = styled.span`
9
9
  display: inline !important;
10
10
 
11
11
  &:hover {
12
- /* Remove the text-decoration to match other inline card hover states*/
12
+ /* Remove the text-decoration to match other inline card hover states */
13
13
  text-decoration: none !important;
14
14
  }
15
15
 
@@ -109,6 +109,9 @@ export var ElementName;
109
109
  ElementName["AuthorGroup"] = "AuthorGroup";
110
110
  ElementName["CollaboratorGroup"] = "CollaboratorGroup";
111
111
  ElementName["CommentCount"] = "CommentCount";
112
+ ElementName["ViewCount"] = "ViewCount";
113
+ ElementName["ReactCount"] = "ReactCount";
114
+ ElementName["VoteCount"] = "VoteCount";
112
115
  ElementName["CreatedBy"] = "CreatedBy";
113
116
  ElementName["CreatedOn"] = "CreatedOn";
114
117
  ElementName["LinkIcon"] = "LinkIcon";
@@ -185,6 +188,9 @@ export var IconType;
185
188
  IconType["Error"] = "Default:Error";
186
189
  IconType["Forbidden"] = "Default:Forbidden";
187
190
  IconType["Comment"] = "Badge:Comment";
191
+ IconType["View"] = "Badge:View";
192
+ IconType["React"] = "Badge:React";
193
+ IconType["Vote"] = "Badge:Vote";
188
194
  IconType["PriorityBlocker"] = "Badge:PriorityBlocker";
189
195
  IconType["PriorityCritical"] = "Badge:PriorityCritical";
190
196
  IconType["PriorityHigh"] = "Badge:PriorityHigh";
@@ -1,7 +1,7 @@
1
1
  import { extractLink, extractSummary, extractTitle } from '../common/primitives';
2
2
  import { extractLozenge } from '../common/lozenge';
3
3
  import { extractLinkIcon } from './icon';
4
- import { extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount } from './utils';
4
+ import { extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount } from './utils';
5
5
  import { extractPersonCreatedBy } from '../common/person';
6
6
  import { extractPersonsUpdatedBy } from './collaboratorGroup';
7
7
  import { extractDateUpdated } from '../common/date/extractDateUpdated';
@@ -21,6 +21,9 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
21
21
  authorGroup: extractPersonCreatedBy(data),
22
22
  collaboratorGroup: extractPersonsUpdatedBy(data),
23
23
  commentCount: extractCommentCount(data),
24
+ viewCount: extractViewCount(data),
25
+ reactCount: extractReactCount(data),
26
+ voteCount: extractVoteCount(data),
24
27
  createdBy: extractCreatedBy(data),
25
28
  createdOn: extractDateCreated(data),
26
29
  linkIcon: extractLinkIcon(response, renderers),
@@ -7,6 +7,15 @@ var extractValue = function extractValue(data, key) {
7
7
  export var extractCommentCount = function extractCommentCount(data) {
8
8
  return extractValue(data, 'schema:commentCount');
9
9
  };
10
+ export var extractViewCount = function extractViewCount(data) {
11
+ return extractValue(data, 'atlassian:viewCount');
12
+ };
13
+ export var extractReactCount = function extractReactCount(data) {
14
+ return extractValue(data, 'atlassian:reactCount');
15
+ };
16
+ export var extractVoteCount = function extractVoteCount(data) {
17
+ return extractValue(data, 'atlassian:voteCount');
18
+ };
10
19
  export var extractCreatedBy = function extractCreatedBy(data) {
11
20
  var persons = extractPersonCreatedBy(data);
12
21
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.7.11",
3
+ "version": "18.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -88,7 +88,7 @@ export var TextWrapper = styled.div(_templateObject5 || (_templateObject5 = _tag
88
88
  // NB: `overflow` is kept as `hidden` since
89
89
  // the internal contents of the `iframe` should
90
90
  // manage scrolling behaviour.
91
- export var Content = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: relative;\n\n ", "\n ", "\n background-color: white;\n position: absolute;\n z-index: 1;\n width: 100%;\n top: ", ";\n overflow: hidden;\n height: calc(100% - ", ");\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n"])), borderRadius, cardShadow, gridSize(4), gridSize(4), function (_ref9) {
91
+ export var Content = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n background-color: white;\n position: absolute;\n z-index: 1;\n width: 100%;\n top: ", ";\n overflow: hidden;\n height: calc(100% - ", ");\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n"])), borderRadius, cardShadow, gridSize(4), gridSize(4), function (_ref9) {
92
92
  var isInteractive = _ref9.isInteractive;
93
93
 
94
94
  if (isInteractive) {
@@ -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.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _ElementDisplaySchema);
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.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.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _ElementDisplaySchema);
24
24
 
25
25
  var getDirectionStyles = function getDirectionStyles(direction) {
26
26
  switch (direction) {
@@ -193,6 +193,18 @@ var importIconMapper = (_importIconMapper = {}, _defineProperty(_importIconMappe
193
193
  return import(
194
194
  /* webpackChunkName: "glyphComment" */
195
195
  '@atlaskit/icon/glyph/comment');
196
+ }), _defineProperty(_importIconMapper, IconType.View, function () {
197
+ return import(
198
+ /* webpackChunkName: "glyphComment" */
199
+ '@atlaskit/icon/glyph/watch');
200
+ }), _defineProperty(_importIconMapper, IconType.React, function () {
201
+ return import(
202
+ /* webpackChunkName: "glyphComment" */
203
+ '@atlaskit/icon/glyph/like');
204
+ }), _defineProperty(_importIconMapper, IconType.Vote, function () {
205
+ return import(
206
+ /* webpackChunkName: "glyphComment" */
207
+ '@atlaskit/icon/glyph/arrow-up');
196
208
  }), _defineProperty(_importIconMapper, IconType.PriorityBlocker, function () {
197
209
  return import(
198
210
  /* webpackChunkName: "glyphBlocker" */
@@ -6,6 +6,9 @@ import { ElementName } from '../../../../constants';
6
6
  export var AuthorGroup = createElement(ElementName.AuthorGroup);
7
7
  export var CollaboratorGroup = createElement(ElementName.CollaboratorGroup);
8
8
  export var CommentCount = createElement(ElementName.CommentCount);
9
+ export var ViewCount = createElement(ElementName.ViewCount);
10
+ export var ReactCount = createElement(ElementName.ReactCount);
11
+ export var VoteCount = createElement(ElementName.VoteCount);
9
12
  export var CreatedBy = createElement(ElementName.CreatedBy);
10
13
  export var CreatedOn = createElement(ElementName.CreatedOn);
11
14
  export var LinkIcon = createElement(ElementName.LinkIcon);
@@ -26,6 +26,21 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
26
26
  props: {
27
27
  icon: IconType.Comment
28
28
  }
29
+ }), _defineProperty(_elementMappings, ElementName.ViewCount, {
30
+ component: Badge,
31
+ props: {
32
+ icon: IconType.View
33
+ }
34
+ }), _defineProperty(_elementMappings, ElementName.ReactCount, {
35
+ component: Badge,
36
+ props: {
37
+ icon: IconType.React
38
+ }
39
+ }), _defineProperty(_elementMappings, ElementName.VoteCount, {
40
+ component: Badge,
41
+ props: {
42
+ icon: IconType.Vote
43
+ }
29
44
  }), _defineProperty(_elementMappings, ElementName.CreatedBy, {
30
45
  component: Text
31
46
  }), _defineProperty(_elementMappings, ElementName.LinkIcon, {
@@ -83,6 +98,9 @@ var getData = function getData(elementName, contextKey, context) {
83
98
  return toAvatarGroupProps(data);
84
99
 
85
100
  case ElementName.CommentCount:
101
+ case ElementName.ViewCount:
102
+ case ElementName.ReactCount:
103
+ case ElementName.VoteCount:
86
104
  case ElementName.ProgrammingLanguage:
87
105
  case ElementName.SubscriberCount:
88
106
  return toBadgeProps(data);
@@ -1,19 +1,69 @@
1
- import React from 'react';
2
- import Tooltip from '@atlaskit/tooltip';
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import React, { useCallback, useRef } from 'react';
3
4
  import { TitleBlock, SnippetBlock, FooterBlock } from '../FlexibleCard/components/blocks';
4
5
  import { Card } from '../Card';
5
- import { HoverCardContainer } from './styled';
6
+ import Popup from '@atlaskit/popup';
7
+ import { SmartLinkSize } from '../../constants';
6
8
  export var HoverCard = function HoverCard(_ref) {
7
9
  var children = _ref.children,
8
10
  url = _ref.url;
9
- var cardComponent = /*#__PURE__*/React.createElement(Card, {
10
- appearance: "block",
11
- url: url
12
- }, /*#__PURE__*/React.createElement(TitleBlock, null), /*#__PURE__*/React.createElement(SnippetBlock, null), /*#__PURE__*/React.createElement(FooterBlock, null));
13
- return /*#__PURE__*/React.createElement(Tooltip, {
14
- content: cardComponent,
15
- component: HoverCardContainer,
11
+ var delay = 300;
12
+
13
+ var _React$useState = React.useState(false),
14
+ _React$useState2 = _slicedToArray(_React$useState, 2),
15
+ isOpen = _React$useState2[0],
16
+ setIsOpen = _React$useState2[1];
17
+
18
+ var fadeOutTimeoutId = useRef();
19
+ var fadeInTimeoutId = useRef();
20
+ var initHideCard = useCallback(function () {
21
+ if (fadeInTimeoutId.current) {
22
+ clearTimeout(fadeInTimeoutId.current);
23
+ }
24
+
25
+ fadeOutTimeoutId.current = setTimeout(function () {
26
+ setIsOpen(false);
27
+ }, delay);
28
+ }, [delay]);
29
+ var initShowCard = useCallback(function () {
30
+ if (fadeOutTimeoutId.current) {
31
+ clearTimeout(fadeOutTimeoutId.current);
32
+ }
33
+
34
+ fadeInTimeoutId.current = setTimeout(function () {
35
+ setIsOpen(true);
36
+ }, delay);
37
+ }, [delay]);
38
+
39
+ var cardComponent = function cardComponent() {
40
+ return /*#__PURE__*/React.createElement("span", {
41
+ onMouseEnter: initShowCard,
42
+ onMouseLeave: initHideCard
43
+ }, /*#__PURE__*/React.createElement(Card, {
44
+ appearance: "block",
45
+ url: url,
46
+ ui: {
47
+ hideElevation: true,
48
+ size: SmartLinkSize.Large
49
+ }
50
+ }, /*#__PURE__*/React.createElement(TitleBlock, null), /*#__PURE__*/React.createElement(SnippetBlock, null), /*#__PURE__*/React.createElement(FooterBlock, null)));
51
+ };
52
+
53
+ var onClose = useCallback(function () {
54
+ return setIsOpen(false);
55
+ }, []);
56
+ return /*#__PURE__*/React.createElement(Popup, {
16
57
  testId: "hover-card",
17
- tag: "span"
18
- }, children);
58
+ isOpen: isOpen,
59
+ onClose: onClose,
60
+ placement: "bottom",
61
+ content: cardComponent,
62
+ trigger: function trigger(triggerProps) {
63
+ return /*#__PURE__*/React.createElement("span", _extends({}, triggerProps, {
64
+ onMouseEnter: initShowCard,
65
+ onMouseLeave: initHideCard
66
+ }), children);
67
+ }
68
+ });
19
69
  };
@@ -17,9 +17,9 @@ export var IconWrapper = styled.span(_templateObject || (_templateObject = _tagg
17
17
 
18
18
  export var EmojiWrapper = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: inline-block;\n margin-right: 2px;\n user-select: none;\n ", "\n ", "\n"])), IconOverrides, IconObjectOverrides); // The main 'wrapping' element, title of the content.
19
19
  // NB: `white-space` adds little whitespace before wrapping.
20
- // NB: `hyphens` enables hyphenation on word break.
20
+ // NB: `word-break` line breaks as soon as an overflow takes place.
21
21
 
22
- export var IconTitleWrapper = styled.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n hyphens: auto;\n white-space: pre-wrap;\n overflow-wrap: break-word;\n word-break: break-word;\n"]))); // TODO: Replace overrides with proper AtlasKit solution.
22
+ export var IconTitleWrapper = styled.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n white-space: pre-wrap;\n word-break: break-all;\n"]))); // TODO: Replace overrides with proper AtlasKit solution.
23
23
 
24
24
  export var LozengeWrapper = styled.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: inline-block;\n vertical-align: 1px;\n & > span {\n margin-left: 4px;\n padding: 2px 0 2px 0;\n }\n"]))); // TODO: Replace overrides with proper AtlasKit solution.
25
25
 
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
8
8
  var LINK_COLOR_DARK = '#4794FF'; // By default buttons will hide overflow and ellipsis content instead of wrapping.
9
9
  // This basically turns the button back into inline content
10
10
 
11
- export var IconStyledButton = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n text-align: initial !important;\n display: inline !important;\n\n &:hover {\n /* Remove the text-decoration to match other inline card hover states*/\n text-decoration: none !important;\n }\n\n > span {\n display: inline;\n > span {\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n }\n }\n"])));
11
+ export var IconStyledButton = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n text-align: initial !important;\n display: inline !important;\n\n &:hover {\n /* Remove the text-decoration to match other inline card hover states */\n text-decoration: none !important;\n }\n\n > span {\n display: inline;\n > span {\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n }\n }\n"])));
12
12
  export var NoLinkAppearance = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n"])), themed({
13
13
  light: N200,
14
14
  dark: LINK_COLOR_DARK
@@ -83,6 +83,9 @@ export declare enum ElementName {
83
83
  AuthorGroup = "AuthorGroup",
84
84
  CollaboratorGroup = "CollaboratorGroup",
85
85
  CommentCount = "CommentCount",
86
+ ViewCount = "ViewCount",
87
+ ReactCount = "ReactCount",
88
+ VoteCount = "VoteCount",
86
89
  CreatedBy = "CreatedBy",
87
90
  CreatedOn = "CreatedOn",
88
91
  LinkIcon = "LinkIcon",
@@ -153,6 +156,9 @@ export declare enum IconType {
153
156
  Error = "Default:Error",
154
157
  Forbidden = "Default:Forbidden",
155
158
  Comment = "Badge:Comment",
159
+ View = "Badge:View",
160
+ React = "Badge:React",
161
+ Vote = "Badge:Vote",
156
162
  PriorityBlocker = "Badge:PriorityBlocker",
157
163
  PriorityCritical = "Badge:PriorityCritical",
158
164
  PriorityHigh = "Badge:PriorityHigh",
@@ -34,7 +34,11 @@ export declare const TEST_DOCUMENT_WITH_ACTIONS: {
34
34
  'atlassian:updatedBy'?: string | JsonLd.Primitives.LinkModel | JsonLd.Primitives.Person<any> | undefined;
35
35
  'schema:commentCount'?: number | undefined;
36
36
  'atlassian:isDeleted'?: boolean | undefined;
37
+ 'atlassian:dateViewed'?: string | undefined;
38
+ 'atlassian:reactCount'?: number | undefined;
37
39
  'atlassian:state'?: string | undefined;
40
+ 'atlassian:viewCount'?: number | undefined;
41
+ 'atlassian:voteCount'?: number | undefined;
38
42
  '@context': JsonLd.Primitives.Context;
39
43
  'atlassian:downloadUrl'?: string | undefined;
40
44
  'atlassian:visitUrl'?: string | undefined;
@@ -96,7 +100,11 @@ export declare const TEST_DOCUMENT_WITH_PREVIEW: {
96
100
  'schema:commentCount'?: number | undefined;
97
101
  'atlassian:isDeleted'?: boolean | undefined;
98
102
  'schema:potentialAction'?: import("schema-dts").DeleteAction | import("schema-dts").ViewAction | import("schema-dts").DownloadAction | import("schema-dts").WatchAction | import("schema-dts").CommentAction | import("schema-dts").ShareAction | JsonLd.Data.DocumentAction[] | undefined;
103
+ 'atlassian:dateViewed'?: string | undefined;
104
+ 'atlassian:reactCount'?: number | undefined;
99
105
  'atlassian:state'?: string | undefined;
106
+ 'atlassian:viewCount'?: number | undefined;
107
+ 'atlassian:voteCount'?: number | undefined;
100
108
  '@context': JsonLd.Primitives.Context;
101
109
  'atlassian:downloadUrl'?: string | undefined;
102
110
  'atlassian:visitUrl'?: string | undefined;
@@ -1,5 +1,8 @@
1
1
  import { JsonLd } from 'json-ld-types';
2
2
  export declare const extractCommentCount: (data: JsonLd.Data.BaseData) => number | undefined;
3
+ export declare const extractViewCount: (data: JsonLd.Data.BaseData) => number | undefined;
4
+ export declare const extractReactCount: (data: JsonLd.Data.BaseData) => number | undefined;
5
+ export declare const extractVoteCount: (data: JsonLd.Data.BaseData) => number | undefined;
3
6
  export declare const extractCreatedBy: (data: JsonLd.Data.BaseData) => string | undefined;
4
7
  export declare const extractModifiedBy: (data: JsonLd.Data.BaseData) => string | undefined;
5
8
  export declare const extractProgrammingLanguage: (data: JsonLd.Data.BaseData) => string | undefined;
@@ -5,6 +5,9 @@ export declare type FlexibleUiDataContext = {
5
5
  authorGroup?: LinkPerson[];
6
6
  collaboratorGroup?: LinkPerson[];
7
7
  commentCount?: number;
8
+ viewCount?: number;
9
+ reactCount?: number;
10
+ voteCount?: number;
8
11
  createdBy?: string;
9
12
  createdOn?: string;
10
13
  linkIcon?: Icon;
@@ -10,6 +10,9 @@ import { MediaProps } from './media/types';
10
10
  export declare const AuthorGroup: import("react").FC<AvatarGroupProps>;
11
11
  export declare const CollaboratorGroup: import("react").FC<AvatarGroupProps>;
12
12
  export declare const CommentCount: import("react").FC<BadgeProps>;
13
+ export declare const ViewCount: import("react").FC<BadgeProps>;
14
+ export declare const ReactCount: import("react").FC<BadgeProps>;
15
+ export declare const VoteCount: import("react").FC<BadgeProps>;
13
16
  export declare const CreatedBy: import("react").FC<TextProps>;
14
17
  export declare const CreatedOn: import("react").FC<DateTimeProps>;
15
18
  export declare const LinkIcon: import("react").FC<IconProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.7.11",
3
+ "version": "18.0.1",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -36,12 +36,13 @@
36
36
  "@atlaskit/logo": "^13.5.0",
37
37
  "@atlaskit/lozenge": "^11.1.0",
38
38
  "@atlaskit/media-common": "^2.11.0",
39
- "@atlaskit/media-ui": "^20.1.0",
39
+ "@atlaskit/media-ui": "^21.0.0",
40
40
  "@atlaskit/modal-dialog": "^12.2.0",
41
41
  "@atlaskit/outbound-auth-flow-client": "^3.3.0",
42
+ "@atlaskit/popup": "^1.3.0",
42
43
  "@atlaskit/spinner": "^15.1.0",
43
44
  "@atlaskit/theme": "^12.1.0",
44
- "@atlaskit/tokens": "^0.7.0",
45
+ "@atlaskit/tokens": "^0.8.0",
45
46
  "@atlaskit/tooltip": "^17.5.2",
46
47
  "@atlaskit/ufo": "^0.1.0",
47
48
  "@babel/runtime": "^7.0.0",
@@ -51,7 +52,7 @@
51
52
  "async-retry": "^1.2.3",
52
53
  "dataloader": "^2.0.0",
53
54
  "facepaint": "^1.2.1",
54
- "json-ld-types": "2.4.0",
55
+ "json-ld-types": "2.4.1",
55
56
  "p-throttle": "^4.1.1",
56
57
  "react-error-boundary": "^3.1.3",
57
58
  "react-lazily-render": "^1.2.0",
@@ -76,7 +77,7 @@
76
77
  "@atlaskit/inline-message": "^11.2.0",
77
78
  "@atlaskit/lozenge": "^11.1.0",
78
79
  "@atlaskit/media-integration-test-helpers": "^2.5.0",
79
- "@atlaskit/media-test-helpers": "^29.2.0",
80
+ "@atlaskit/media-test-helpers": "^29.3.0",
80
81
  "@atlaskit/page": "^12.1.0",
81
82
  "@atlaskit/radio": "^5.3.0",
82
83
  "@atlaskit/range": "^6.0.0",