@atlaskit/smart-card 28.2.1 → 28.3.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 (62) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/utils/analytics/analytics.js +1 -1
  3. package/dist/cjs/view/CardWithUrl/component.js +4 -2
  4. package/dist/cjs/view/CardWithUrl/loader.js +4 -2
  5. package/dist/cjs/view/InlineCard/ErroredView/index.js +4 -2
  6. package/dist/cjs/view/InlineCard/ForbiddenView/index.js +4 -2
  7. package/dist/cjs/view/InlineCard/Frame/index.js +4 -2
  8. package/dist/cjs/view/InlineCard/Frame/styled.js +30 -3
  9. package/dist/cjs/view/InlineCard/ResolvedView/index.js +4 -2
  10. package/dist/cjs/view/InlineCard/ResolvingView/index.js +6 -3
  11. package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +4 -2
  12. package/dist/cjs/view/InlineCard/index.js +14 -7
  13. package/dist/cjs/view/LinkUrl/index.js +1 -1
  14. package/dist/es2019/utils/analytics/analytics.js +1 -1
  15. package/dist/es2019/view/CardWithUrl/component.js +4 -2
  16. package/dist/es2019/view/CardWithUrl/loader.js +4 -2
  17. package/dist/es2019/view/InlineCard/ErroredView/index.js +4 -2
  18. package/dist/es2019/view/InlineCard/ForbiddenView/index.js +4 -2
  19. package/dist/es2019/view/InlineCard/Frame/index.js +4 -2
  20. package/dist/es2019/view/InlineCard/Frame/styled.js +35 -3
  21. package/dist/es2019/view/InlineCard/ResolvedView/index.js +4 -2
  22. package/dist/es2019/view/InlineCard/ResolvingView/index.js +6 -3
  23. package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +4 -2
  24. package/dist/es2019/view/InlineCard/index.js +14 -7
  25. package/dist/es2019/view/LinkUrl/index.js +1 -1
  26. package/dist/esm/utils/analytics/analytics.js +1 -1
  27. package/dist/esm/view/CardWithUrl/component.js +4 -2
  28. package/dist/esm/view/CardWithUrl/loader.js +4 -2
  29. package/dist/esm/view/InlineCard/ErroredView/index.js +4 -2
  30. package/dist/esm/view/InlineCard/ForbiddenView/index.js +4 -2
  31. package/dist/esm/view/InlineCard/Frame/index.js +4 -2
  32. package/dist/esm/view/InlineCard/Frame/styled.js +30 -3
  33. package/dist/esm/view/InlineCard/ResolvedView/index.js +4 -2
  34. package/dist/esm/view/InlineCard/ResolvingView/index.js +6 -3
  35. package/dist/esm/view/InlineCard/UnauthorisedView/index.js +4 -2
  36. package/dist/esm/view/InlineCard/index.js +14 -7
  37. package/dist/esm/view/LinkUrl/index.js +1 -1
  38. package/dist/types/view/Card/index.d.ts +1 -1
  39. package/dist/types/view/Card/types.d.ts +2 -0
  40. package/dist/types/view/CardWithUrl/types.d.ts +1 -0
  41. package/dist/types/view/InlineCard/ErroredView/index.d.ts +2 -0
  42. package/dist/types/view/InlineCard/ForbiddenView/index.d.ts +2 -0
  43. package/dist/types/view/InlineCard/Frame/index.d.ts +2 -0
  44. package/dist/types/view/InlineCard/Frame/styled.d.ts +1 -0
  45. package/dist/types/view/InlineCard/ResolvedView/index.d.ts +2 -0
  46. package/dist/types/view/InlineCard/ResolvingView/index.d.ts +2 -0
  47. package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +2 -0
  48. package/dist/types/view/InlineCard/index.d.ts +1 -1
  49. package/dist/types/view/InlineCard/types.d.ts +1 -0
  50. package/dist/types-ts4.5/view/Card/index.d.ts +1 -1
  51. package/dist/types-ts4.5/view/Card/types.d.ts +2 -0
  52. package/dist/types-ts4.5/view/CardWithUrl/types.d.ts +1 -0
  53. package/dist/types-ts4.5/view/InlineCard/ErroredView/index.d.ts +2 -0
  54. package/dist/types-ts4.5/view/InlineCard/ForbiddenView/index.d.ts +2 -0
  55. package/dist/types-ts4.5/view/InlineCard/Frame/index.d.ts +2 -0
  56. package/dist/types-ts4.5/view/InlineCard/Frame/styled.d.ts +1 -0
  57. package/dist/types-ts4.5/view/InlineCard/ResolvedView/index.d.ts +2 -0
  58. package/dist/types-ts4.5/view/InlineCard/ResolvingView/index.d.ts +2 -0
  59. package/dist/types-ts4.5/view/InlineCard/UnauthorisedView/index.d.ts +2 -0
  60. package/dist/types-ts4.5/view/InlineCard/index.d.ts +1 -1
  61. package/dist/types-ts4.5/view/InlineCard/types.d.ts +1 -0
  62. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 28.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 28.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#129695](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/129695)
14
+ [`0b33b1a47217a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0b33b1a47217a) -
15
+ [ux] Added truncateInline prop to allow for limiting inline cards to one line with truncation.
16
+
3
17
  ## 28.2.1
4
18
 
5
19
  ### Patch Changes
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
22
22
  var context = exports.context = {
23
23
  componentName: 'smart-cards',
24
24
  packageName: "@atlaskit/smart-card",
25
- packageVersion: "28.2.1"
25
+ packageVersion: "28.3.1"
26
26
  };
27
27
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
28
28
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -51,7 +51,8 @@ function Component(_ref) {
51
51
  analyticsEvents = _ref.analyticsEvents,
52
52
  useLegacyBlockCard = _ref.useLegacyBlockCard,
53
53
  removeTextHighlightingFromTitle = _ref.removeTextHighlightingFromTitle,
54
- resolvingPlaceholder = _ref.resolvingPlaceholder;
54
+ resolvingPlaceholder = _ref.resolvingPlaceholder,
55
+ truncateInline = _ref.truncateInline;
55
56
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
56
57
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
57
58
 
@@ -236,7 +237,8 @@ function Component(_ref) {
236
237
  showAuthTooltip: showAuthTooltip,
237
238
  actionOptions: actionOptions,
238
239
  removeTextHighlightingFromTitle: removeTextHighlightingFromTitle,
239
- resolvingPlaceholder: resolvingPlaceholder
240
+ resolvingPlaceholder: resolvingPlaceholder,
241
+ truncateInline: truncateInline
240
242
  });
241
243
  case 'block':
242
244
  return /*#__PURE__*/_react.default.createElement(_BlockCard.BlockCard, {
@@ -66,7 +66,8 @@ function CardWithURLRenderer(props) {
66
66
  fallbackComponent = props.fallbackComponent,
67
67
  useLegacyBlockCard = props.useLegacyBlockCard,
68
68
  removeTextHighlightingFromTitle = props.removeTextHighlightingFromTitle,
69
- resolvingPlaceholder = props.resolvingPlaceholder;
69
+ resolvingPlaceholder = props.resolvingPlaceholder,
70
+ truncateInline = props.truncateInline;
70
71
  var analytics = (0, _analytics.useSmartLinkAnalytics)(url !== null && url !== void 0 ? url : '', undefined, id);
71
72
  var isFlexibleUi = (0, _flexible.isFlexibleUiCard)(children);
72
73
  var errorHandler = (0, _react.useCallback)(function (error, info) {
@@ -136,7 +137,8 @@ function CardWithURLRenderer(props) {
136
137
  placeholder: placeholder,
137
138
  useLegacyBlockCard: useLegacyBlockCard,
138
139
  removeTextHighlightingFromTitle: removeTextHighlightingFromTitle,
139
- resolvingPlaceholder: resolvingPlaceholder
140
+ resolvingPlaceholder: resolvingPlaceholder,
141
+ truncateInline: truncateInline
140
142
  };
141
143
  return /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
142
144
  FallbackComponent: ErrorFallback,
@@ -67,11 +67,13 @@ var InlineCardErroredView = exports.InlineCardErroredView = /*#__PURE__*/functio
67
67
  _this$props$testId = _this$props.testId,
68
68
  testId = _this$props$testId === void 0 ? 'inline-card-errored-view' : _this$props$testId,
69
69
  icon = _this$props.icon,
70
- message = _this$props.message;
70
+ message = _this$props.message,
71
+ truncateInline = _this$props.truncateInline;
71
72
  var content = /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
72
73
  testId: testId,
73
74
  isSelected: isSelected,
74
- ref: this.frameRef
75
+ ref: this.frameRef,
76
+ truncateInline: truncateInline
75
77
  }, /*#__PURE__*/_react.default.createElement(_IconAndTitleLayout.IconAndTitleLayout, {
76
78
  icon: icon || /*#__PURE__*/_react.default.createElement(_Icon.AKIconWrapper, null, /*#__PURE__*/_react.default.createElement(_error.default, {
77
79
  label: "error",
@@ -114,11 +114,13 @@ var InlineCardForbiddenView = exports.InlineCardForbiddenView = /*#__PURE__*/fun
114
114
  onClick = _this$props4.onClick,
115
115
  isSelected = _this$props4.isSelected,
116
116
  _this$props4$testId = _this$props4.testId,
117
- testId = _this$props4$testId === void 0 ? 'inline-card-forbidden-view' : _this$props4$testId;
117
+ testId = _this$props4$testId === void 0 ? 'inline-card-forbidden-view' : _this$props4$testId,
118
+ truncateInline = _this$props4.truncateInline;
118
119
  var content = /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
119
120
  testId: testId,
120
121
  isSelected: isSelected,
121
- ref: this.frameRef
122
+ ref: this.frameRef,
123
+ truncateInline: truncateInline
122
124
  }, /*#__PURE__*/_react.default.createElement(_IconAndTitleLayout.IconAndTitleLayout, {
123
125
  icon: icon ? icon : FallbackForbiddenIcon,
124
126
  link: url,
@@ -18,7 +18,8 @@ var Frame = exports.Frame = /*#__PURE__*/(0, _react.forwardRef)(function (props,
18
18
  withoutBackground = props.withoutBackground,
19
19
  testId = props.testId,
20
20
  className = props.className,
21
- isHovered = props.isHovered;
21
+ isHovered = props.isHovered,
22
+ truncateInline = props.truncateInline;
22
23
  var handleClick = (0, _react.useCallback)(function (event) {
23
24
  if (onClick) {
24
25
  event.preventDefault();
@@ -56,6 +57,7 @@ var Frame = exports.Frame = /*#__PURE__*/(0, _react.forwardRef)(function (props,
56
57
  ,
57
58
  className: className,
58
59
  ref: ref,
59
- isHovered: isHovered
60
+ isHovered: isHovered,
61
+ truncateInline: truncateInline
60
62
  }, children);
61
63
  });
@@ -10,6 +10,7 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
10
10
  var _colors = require("@atlaskit/theme/colors");
11
11
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
12
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
13
+ var lineHeight = 22;
13
14
  var selectedStyles = {
14
15
  cursor: 'pointer',
15
16
  boxShadow: "0 0 0 2px ".concat("var(--ds-border-selected, ".concat(_colors.B100, ")")),
@@ -73,7 +74,7 @@ var hoveredWihBorderStyles = function hoveredWihBorderStyles(props) {
73
74
  // NB: `box-decoration-break` required for retaining properties (border-radius) on wrap.
74
75
  var baseWrapperStyles = function baseWrapperStyles(props) {
75
76
  return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
76
- lineHeight: '22px',
77
+ lineHeight: "".concat(lineHeight, "px"),
77
78
  padding: "var(--ds-space-025, 2px)".concat(" 0px")
78
79
  }, props.withoutBackground ? {
79
80
  paddingLeft: 0,
@@ -94,15 +95,41 @@ var baseWrapperStyles = function baseWrapperStyles(props) {
94
95
  MozUserSelect: 'none'
95
96
  }, props.isHovered ? hoveredWihBorderStyles(props) : undefined);
96
97
  };
98
+ var truncateStyles = {
99
+ overflow: 'hidden',
100
+ textOverflow: 'ellipsis',
101
+ wordBreak: 'break-all',
102
+ // The height of a truncated card is 1px higher than that of a non-truncated card, so we subtract 1px from the line height.
103
+ lineHeight: "".concat(lineHeight - 1, "px"),
104
+ display: '-webkit-inline-box',
105
+ WebkitLineClamp: 1,
106
+ WebkitBoxOrient: 'vertical',
107
+ // We need to remove the padding because display: -webkit-inline-box will cause any padding to be
108
+ // added to the total height, causing truncated cards to have greater height than non-truncated cards which use display: inline.
109
+ padding: 0,
110
+ '@supports not (-webkit-line-clamp: 1)': {
111
+ display: 'inline-block',
112
+ maxHeight: "".concat(lineHeight, "px"),
113
+ // If the browser does not support webkit, we don't need to remove the padding
114
+ padding: "var(--ds-space-025, 2px)".concat(" 0px")
115
+ }
116
+ };
117
+ var isTruncated = function isTruncated(_ref3) {
118
+ var truncateInline = _ref3.truncateInline;
119
+ if (truncateInline) {
120
+ return truncateStyles;
121
+ }
122
+ return undefined;
123
+ };
97
124
 
98
125
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-dynamic-styles -- Ignored via go/DSP-18766
99
126
  var WrapperAnchor = exports.WrapperAnchor = _styled.default.a(function (props) {
100
- return _objectSpread(_objectSpread({}, baseWrapperStyles(props)), isInteractive(props));
127
+ return _objectSpread(_objectSpread(_objectSpread({}, baseWrapperStyles(props)), isInteractive(props)), isTruncated(props));
101
128
  });
102
129
  WrapperAnchor.displayName = 'WrapperAnchor';
103
130
 
104
131
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-dynamic-styles -- Ignored via go/DSP-18766
105
132
  var WrapperSpan = exports.WrapperSpan = _styled.default.span(function (props) {
106
- return _objectSpread({}, baseWrapperStyles(props));
133
+ return _objectSpread(_objectSpread({}, baseWrapperStyles(props)), isTruncated(props));
107
134
  });
108
135
  WrapperSpan.displayName = 'WrapperSpan';
@@ -61,13 +61,15 @@ var InlineCardResolvedView = exports.InlineCardResolvedView = /*#__PURE__*/funct
61
61
  _this$props$showHover = _this$props.showHoverPreview,
62
62
  showHoverPreview = _this$props$showHover === void 0 ? false : _this$props$showHover,
63
63
  hoverPreviewOptions = _this$props.hoverPreviewOptions,
64
- actionOptions = _this$props.actionOptions;
64
+ actionOptions = _this$props.actionOptions,
65
+ truncateInline = _this$props.truncateInline;
65
66
  var inlineCardResolvedView = /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
66
67
  testId: testId,
67
68
  link: link,
68
69
  isSelected: isSelected,
69
70
  isHovered: isHovered,
70
- onClick: onClick
71
+ onClick: onClick,
72
+ truncateInline: truncateInline
71
73
  }, /*#__PURE__*/_react.default.createElement(_IconAndTitleLayout.IconAndTitleLayout, {
72
74
  emoji: titlePrefix,
73
75
  icon: icon,
@@ -36,13 +36,15 @@ var InlineCardResolvingView = exports.InlineCardResolvingView = /*#__PURE__*/fun
36
36
  _this$props$testId = _this$props.testId,
37
37
  testId = _this$props$testId === void 0 ? 'inline-card-resolving-view' : _this$props$testId,
38
38
  titleTextColor = _this$props.titleTextColor,
39
- resolvingPlaceholder = _this$props.resolvingPlaceholder;
39
+ resolvingPlaceholder = _this$props.resolvingPlaceholder,
40
+ truncateInline = _this$props.truncateInline;
40
41
  if (inlinePreloaderStyle === 'on-right-without-skeleton') {
41
42
  return /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
42
43
  withoutBackground: true,
43
44
  testId: testId,
44
45
  onClick: onClick,
45
- isSelected: isSelected
46
+ isSelected: isSelected,
47
+ truncateInline: truncateInline
46
48
  }, /*#__PURE__*/_react.default.createElement(_styled2.IconTitleWrapper, null, url, /*#__PURE__*/_react.default.createElement(_styled2.RightIconPositionWrapper, null, /*#__PURE__*/_react.default.createElement(_styled.SpinnerWrapper, {
47
49
  className: "inline-resolving-spinner"
48
50
  }, /*#__PURE__*/_react.default.createElement(_spinner.default, {
@@ -53,7 +55,8 @@ var InlineCardResolvingView = exports.InlineCardResolvingView = /*#__PURE__*/fun
53
55
  testId: testId,
54
56
  onClick: onClick,
55
57
  isSelected: isSelected,
56
- link: url
58
+ link: url,
59
+ truncateInline: truncateInline
57
60
  }, /*#__PURE__*/_react.default.createElement(_IconAndTitleLayout.IconAndTitleLayout, {
58
61
  title: resolvingPlaceholder !== null && resolvingPlaceholder !== void 0 ? resolvingPlaceholder : url,
59
62
  titleTextColor: titleTextColor
@@ -87,11 +87,13 @@ var InlineCardUnauthorizedView = exports.InlineCardUnauthorizedView = /*#__PURE_
87
87
  _this$props3$testId = _this$props3.testId,
88
88
  testId = _this$props3$testId === void 0 ? 'inline-card-unauthorized-view' : _this$props3$testId,
89
89
  _this$props3$showAuth = _this$props3.showAuthTooltip,
90
- showAuthTooltip = _this$props3$showAuth === void 0 ? false : _this$props3$showAuth;
90
+ showAuthTooltip = _this$props3$showAuth === void 0 ? false : _this$props3$showAuth,
91
+ truncateInline = _this$props3.truncateInline;
91
92
  var inlineCardUnauthenticatedView = /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
92
93
  testId: testId,
93
94
  isSelected: isSelected,
94
- ref: this.frameRef
95
+ ref: this.frameRef,
96
+ truncateInline: truncateInline
95
97
  }, /*#__PURE__*/_react.default.createElement(_IconAndTitleLayout.IconAndTitleLayout, {
96
98
  icon: icon ? icon : FallbackUnauthorizedIcon,
97
99
  title: url,
@@ -74,7 +74,8 @@ var InlineCard = exports.InlineCard = function InlineCard(_ref) {
74
74
  showAuthTooltip = _ref.showAuthTooltip,
75
75
  actionOptions = _ref.actionOptions,
76
76
  removeTextHighlightingFromTitle = _ref.removeTextHighlightingFromTitle,
77
- resolvingPlaceholder = _ref.resolvingPlaceholder;
77
+ resolvingPlaceholder = _ref.resolvingPlaceholder,
78
+ truncateInline = _ref.truncateInline;
78
79
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
79
80
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
80
81
  var status = cardState.status,
@@ -118,7 +119,8 @@ var InlineCard = exports.InlineCard = function InlineCard(_ref) {
118
119
  onClick: handleFrameClick,
119
120
  testId: testIdWithStatus,
120
121
  inlinePreloaderStyle: inlinePreloaderStyle,
121
- resolvingPlaceholder: resolvingPlaceholder
122
+ resolvingPlaceholder: resolvingPlaceholder,
123
+ truncateInline: truncateInline
122
124
  });
123
125
  case 'resolved':
124
126
  return /*#__PURE__*/_react.default.createElement(_ResolvedView.InlineCardResolvedView, (0, _extends2.default)({}, resolvedProps, {
@@ -130,7 +132,8 @@ var InlineCard = exports.InlineCard = function InlineCard(_ref) {
130
132
  isSelected: isSelected,
131
133
  isHovered: isHovered,
132
134
  onClick: handleFrameClick,
133
- testId: testIdWithStatus
135
+ testId: testIdWithStatus,
136
+ truncateInline: truncateInline
134
137
  }));
135
138
  case 'unauthorized':
136
139
  var provider = (0, _linkExtractors.extractProvider)(cardDetails);
@@ -145,7 +148,8 @@ var InlineCard = exports.InlineCard = function InlineCard(_ref) {
145
148
  showAuthTooltip: showAuthTooltip,
146
149
  id: id,
147
150
  analytics: analytics,
148
- extensionKey: extensionKey
151
+ extensionKey: extensionKey,
152
+ truncateInline: truncateInline
149
153
  });
150
154
  case 'forbidden':
151
155
  var providerForbidden = (0, _linkExtractors.extractProvider)(cardDetails);
@@ -165,7 +169,8 @@ var InlineCard = exports.InlineCard = function InlineCard(_ref) {
165
169
  onAuthorise: handleAuthorize,
166
170
  testId: testIdWithStatus,
167
171
  requestAccessContext: requestAccessContext,
168
- showHoverPreview: showHoverPreview
172
+ showHoverPreview: showHoverPreview,
173
+ truncateInline: truncateInline
169
174
  });
170
175
  case 'not_found':
171
176
  var providerNotFound = (0, _linkExtractors.extractProvider)(cardDetails);
@@ -176,7 +181,8 @@ var InlineCard = exports.InlineCard = function InlineCard(_ref) {
176
181
  message: "Can't find link",
177
182
  onClick: handleFrameClick,
178
183
  testId: testIdWithStatus || 'inline-card-not-found-view',
179
- showHoverPreview: showHoverPreview
184
+ showHoverPreview: showHoverPreview,
185
+ truncateInline: truncateInline
180
186
  });
181
187
  case 'fallback':
182
188
  case 'errored':
@@ -185,7 +191,8 @@ var InlineCard = exports.InlineCard = function InlineCard(_ref) {
185
191
  link: url,
186
192
  isSelected: isSelected,
187
193
  onClick: handleFrameClick,
188
- testId: testIdWithStatus || 'inline-card-errored-view'
194
+ testId: testIdWithStatus || 'inline-card-errored-view',
195
+ truncateInline: truncateInline
189
196
  });
190
197
  }
191
198
  };
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
17
17
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
18
18
  var PACKAGE_DATA = {
19
19
  packageName: "@atlaskit/smart-card",
20
- packageVersion: "28.2.1",
20
+ packageVersion: "28.3.1",
21
21
  componentName: 'linkUrl'
22
22
  };
23
23
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
4
4
  export const context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "28.2.1"
7
+ packageVersion: "28.3.1"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -41,7 +41,8 @@ function Component({
41
41
  analyticsEvents,
42
42
  useLegacyBlockCard,
43
43
  removeTextHighlightingFromTitle,
44
- resolvingPlaceholder
44
+ resolvingPlaceholder,
45
+ truncateInline
45
46
  }) {
46
47
  const {
47
48
  createAnalyticsEvent
@@ -223,7 +224,8 @@ function Component({
223
224
  showAuthTooltip: showAuthTooltip,
224
225
  actionOptions: actionOptions,
225
226
  removeTextHighlightingFromTitle: removeTextHighlightingFromTitle,
226
- resolvingPlaceholder: resolvingPlaceholder
227
+ resolvingPlaceholder: resolvingPlaceholder,
228
+ truncateInline: truncateInline
227
229
  });
228
230
  case 'block':
229
231
  return /*#__PURE__*/React.createElement(BlockCard, {
@@ -45,7 +45,8 @@ export function CardWithURLRenderer(props) {
45
45
  fallbackComponent,
46
46
  useLegacyBlockCard,
47
47
  removeTextHighlightingFromTitle,
48
- resolvingPlaceholder
48
+ resolvingPlaceholder,
49
+ truncateInline
49
50
  } = props;
50
51
  const analytics = useSmartLinkAnalytics(url !== null && url !== void 0 ? url : '', undefined, id);
51
52
  const isFlexibleUi = isFlexibleUiCard(children);
@@ -114,7 +115,8 @@ export function CardWithURLRenderer(props) {
114
115
  placeholder,
115
116
  useLegacyBlockCard,
116
117
  removeTextHighlightingFromTitle,
117
- resolvingPlaceholder
118
+ resolvingPlaceholder,
119
+ truncateInline
118
120
  };
119
121
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
120
122
  FallbackComponent: ErrorFallback,
@@ -45,12 +45,14 @@ export class InlineCardErroredView extends React.Component {
45
45
  isSelected,
46
46
  testId = 'inline-card-errored-view',
47
47
  icon,
48
- message
48
+ message,
49
+ truncateInline
49
50
  } = this.props;
50
51
  const content = /*#__PURE__*/React.createElement(Frame, {
51
52
  testId: testId,
52
53
  isSelected: isSelected,
53
- ref: this.frameRef
54
+ ref: this.frameRef,
55
+ truncateInline: truncateInline
54
56
  }, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
55
57
  icon: icon || /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(ErrorIcon, {
56
58
  label: "error",
@@ -94,12 +94,14 @@ export class InlineCardForbiddenView extends React.Component {
94
94
  icon,
95
95
  onClick,
96
96
  isSelected,
97
- testId = 'inline-card-forbidden-view'
97
+ testId = 'inline-card-forbidden-view',
98
+ truncateInline
98
99
  } = this.props;
99
100
  const content = /*#__PURE__*/React.createElement(Frame, {
100
101
  testId: testId,
101
102
  isSelected: isSelected,
102
- ref: this.frameRef
103
+ ref: this.frameRef,
104
+ truncateInline: truncateInline
103
105
  }, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
104
106
  icon: icon ? icon : FallbackForbiddenIcon,
105
107
  link: url,
@@ -10,7 +10,8 @@ export const Frame = /*#__PURE__*/forwardRef((props, ref) => {
10
10
  withoutBackground,
11
11
  testId,
12
12
  className,
13
- isHovered
13
+ isHovered,
14
+ truncateInline
14
15
  } = props;
15
16
  const handleClick = useCallback(event => {
16
17
  if (onClick) {
@@ -49,6 +50,7 @@ export const Frame = /*#__PURE__*/forwardRef((props, ref) => {
49
50
  ,
50
51
  className: className,
51
52
  ref: ref,
52
- isHovered: isHovered
53
+ isHovered: isHovered,
54
+ truncateInline: truncateInline
53
55
  }, children);
54
56
  });
@@ -1,6 +1,7 @@
1
1
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
2
2
  import styled from '@emotion/styled';
3
3
  import { B50, B100, B200, B400, N40 } from '@atlaskit/theme/colors';
4
+ const lineHeight = 22;
4
5
  const selectedStyles = {
5
6
  cursor: 'pointer',
6
7
  boxShadow: `0 0 0 2px ${`var(--ds-border-selected, ${B100})`}`,
@@ -66,7 +67,7 @@ const hoveredWihBorderStyles = props => ({
66
67
  // NB: `display: inline` required for `box-decoration-break` to work.
67
68
  // NB: `box-decoration-break` required for retaining properties (border-radius) on wrap.
68
69
  const baseWrapperStyles = props => ({
69
- lineHeight: '22px',
70
+ lineHeight: `${lineHeight}px`,
70
71
  padding: `${"var(--ds-space-025, 2px)"} 0px`,
71
72
  ...(props.withoutBackground ? {
72
73
  paddingLeft: 0,
@@ -91,19 +92,50 @@ const baseWrapperStyles = props => ({
91
92
 
92
93
  ...(props.isHovered ? hoveredWihBorderStyles(props) : undefined)
93
94
  });
95
+ const truncateStyles = {
96
+ overflow: 'hidden',
97
+ textOverflow: 'ellipsis',
98
+ wordBreak: 'break-all',
99
+ // The height of a truncated card is 1px higher than that of a non-truncated card, so we subtract 1px from the line height.
100
+ lineHeight: `${lineHeight - 1}px`,
101
+ display: '-webkit-inline-box',
102
+ WebkitLineClamp: 1,
103
+ WebkitBoxOrient: 'vertical',
104
+ // We need to remove the padding because display: -webkit-inline-box will cause any padding to be
105
+ // added to the total height, causing truncated cards to have greater height than non-truncated cards which use display: inline.
106
+ padding: 0,
107
+ '@supports not (-webkit-line-clamp: 1)': {
108
+ display: 'inline-block',
109
+ maxHeight: `${lineHeight}px`,
110
+ // If the browser does not support webkit, we don't need to remove the padding
111
+ padding: `${"var(--ds-space-025, 2px)"} 0px`
112
+ }
113
+ };
114
+ const isTruncated = ({
115
+ truncateInline
116
+ }) => {
117
+ if (truncateInline) {
118
+ return truncateStyles;
119
+ }
120
+ return undefined;
121
+ };
94
122
 
95
123
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-dynamic-styles -- Ignored via go/DSP-18766
96
124
  export const WrapperAnchor = styled.a(props => ({
97
125
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
98
126
  ...baseWrapperStyles(props),
99
127
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
100
- ...isInteractive(props)
128
+ ...isInteractive(props),
129
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
130
+ ...isTruncated(props)
101
131
  }));
102
132
  WrapperAnchor.displayName = 'WrapperAnchor';
103
133
 
104
134
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-dynamic-styles -- Ignored via go/DSP-18766
105
135
  export const WrapperSpan = styled.span(props => ({
106
136
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
107
- ...baseWrapperStyles(props)
137
+ ...baseWrapperStyles(props),
138
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
139
+ ...isTruncated(props)
108
140
  }));
109
141
  WrapperSpan.displayName = 'WrapperSpan';
@@ -36,14 +36,16 @@ export class InlineCardResolvedView extends React.Component {
36
36
  titlePrefix,
37
37
  showHoverPreview = false,
38
38
  hoverPreviewOptions,
39
- actionOptions
39
+ actionOptions,
40
+ truncateInline
40
41
  } = this.props;
41
42
  const inlineCardResolvedView = /*#__PURE__*/React.createElement(Frame, {
42
43
  testId: testId,
43
44
  link: link,
44
45
  isSelected: isSelected,
45
46
  isHovered: isHovered,
46
- onClick: onClick
47
+ onClick: onClick,
48
+ truncateInline: truncateInline
47
49
  }, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
48
50
  emoji: titlePrefix,
49
51
  icon: icon,
@@ -13,14 +13,16 @@ export class InlineCardResolvingView extends React.Component {
13
13
  inlinePreloaderStyle,
14
14
  testId = 'inline-card-resolving-view',
15
15
  titleTextColor,
16
- resolvingPlaceholder
16
+ resolvingPlaceholder,
17
+ truncateInline
17
18
  } = this.props;
18
19
  if (inlinePreloaderStyle === 'on-right-without-skeleton') {
19
20
  return /*#__PURE__*/React.createElement(Frame, {
20
21
  withoutBackground: true,
21
22
  testId: testId,
22
23
  onClick: onClick,
23
- isSelected: isSelected
24
+ isSelected: isSelected,
25
+ truncateInline: truncateInline
24
26
  }, /*#__PURE__*/React.createElement(IconTitleWrapper, null, url, /*#__PURE__*/React.createElement(RightIconPositionWrapper, null, /*#__PURE__*/React.createElement(SpinnerWrapper, {
25
27
  className: "inline-resolving-spinner"
26
28
  }, /*#__PURE__*/React.createElement(Spinner, {
@@ -31,7 +33,8 @@ export class InlineCardResolvingView extends React.Component {
31
33
  testId: testId,
32
34
  onClick: onClick,
33
35
  isSelected: isSelected,
34
- link: url
36
+ link: url,
37
+ truncateInline: truncateInline
35
38
  }, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
36
39
  title: resolvingPlaceholder !== null && resolvingPlaceholder !== void 0 ? resolvingPlaceholder : url,
37
40
  titleTextColor: titleTextColor
@@ -62,12 +62,14 @@ export class InlineCardUnauthorizedView extends React.Component {
62
62
  onClick,
63
63
  isSelected,
64
64
  testId = 'inline-card-unauthorized-view',
65
- showAuthTooltip = false
65
+ showAuthTooltip = false,
66
+ truncateInline
66
67
  } = this.props;
67
68
  const inlineCardUnauthenticatedView = /*#__PURE__*/React.createElement(Frame, {
68
69
  testId: testId,
69
70
  isSelected: isSelected,
70
- ref: this.frameRef
71
+ ref: this.frameRef,
72
+ truncateInline: truncateInline
71
73
  }, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
72
74
  icon: icon ? icon : FallbackUnauthorizedIcon,
73
75
  title: url,
@@ -34,7 +34,8 @@ export const InlineCard = ({
34
34
  showAuthTooltip,
35
35
  actionOptions,
36
36
  removeTextHighlightingFromTitle,
37
- resolvingPlaceholder
37
+ resolvingPlaceholder,
38
+ truncateInline
38
39
  }) => {
39
40
  var _details$meta, _providerForbidden$te;
40
41
  const {
@@ -83,7 +84,8 @@ export const InlineCard = ({
83
84
  onClick: handleFrameClick,
84
85
  testId: testIdWithStatus,
85
86
  inlinePreloaderStyle: inlinePreloaderStyle,
86
- resolvingPlaceholder: resolvingPlaceholder
87
+ resolvingPlaceholder: resolvingPlaceholder,
88
+ truncateInline: truncateInline
87
89
  });
88
90
  case 'resolved':
89
91
  return /*#__PURE__*/React.createElement(InlineCardResolvedView, _extends({}, resolvedProps, {
@@ -95,7 +97,8 @@ export const InlineCard = ({
95
97
  isSelected: isSelected,
96
98
  isHovered: isHovered,
97
99
  onClick: handleFrameClick,
98
- testId: testIdWithStatus
100
+ testId: testIdWithStatus,
101
+ truncateInline: truncateInline
99
102
  }));
100
103
  case 'unauthorized':
101
104
  const provider = extractProvider(cardDetails);
@@ -110,7 +113,8 @@ export const InlineCard = ({
110
113
  showAuthTooltip: showAuthTooltip,
111
114
  id: id,
112
115
  analytics: analytics,
113
- extensionKey: extensionKey
116
+ extensionKey: extensionKey,
117
+ truncateInline: truncateInline
114
118
  });
115
119
  case 'forbidden':
116
120
  const providerForbidden = extractProvider(cardDetails);
@@ -130,7 +134,8 @@ export const InlineCard = ({
130
134
  onAuthorise: handleAuthorize,
131
135
  testId: testIdWithStatus,
132
136
  requestAccessContext: requestAccessContext,
133
- showHoverPreview: showHoverPreview
137
+ showHoverPreview: showHoverPreview,
138
+ truncateInline: truncateInline
134
139
  });
135
140
  case 'not_found':
136
141
  const providerNotFound = extractProvider(cardDetails);
@@ -141,7 +146,8 @@ export const InlineCard = ({
141
146
  message: "Can't find link",
142
147
  onClick: handleFrameClick,
143
148
  testId: testIdWithStatus || 'inline-card-not-found-view',
144
- showHoverPreview: showHoverPreview
149
+ showHoverPreview: showHoverPreview,
150
+ truncateInline: truncateInline
145
151
  });
146
152
  case 'fallback':
147
153
  case 'errored':
@@ -150,7 +156,8 @@ export const InlineCard = ({
150
156
  link: url,
151
157
  isSelected: isSelected,
152
158
  onClick: handleFrameClick,
153
- testId: testIdWithStatus || 'inline-card-errored-view'
159
+ testId: testIdWithStatus || 'inline-card-errored-view',
160
+ truncateInline: truncateInline
154
161
  });
155
162
  }
156
163
  };
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
7
7
  import LinkWarningModal from './LinkWarningModal';
8
8
  const PACKAGE_DATA = {
9
9
  packageName: "@atlaskit/smart-card",
10
- packageVersion: "28.2.1",
10
+ packageVersion: "28.3.1",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');