@atlaskit/smart-card 26.9.12 → 26.9.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.9.14
4
+
5
+ ### Patch Changes
6
+
7
+ - [`08c372c1547`](https://bitbucket.org/atlassian/atlassian-frontend/commits/08c372c1547) - [ux] Revert of functionality added in 26.9.8
8
+
9
+ ## 26.9.13
10
+
11
+ ### Patch Changes
12
+
13
+ - [`68956c0d353`](https://bitbucket.org/atlassian/atlassian-frontend/commits/68956c0d353) - Embed Modal: Fix icon alignment when triggered from flexible and block card component
14
+
3
15
  ## 26.9.12
4
16
 
5
17
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.9.12",
3
+ "version": "26.9.14",
4
4
  "sideEffects": false
5
5
  }
@@ -12,7 +12,10 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
12
12
  var containerStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n display: flex;\n gap: ", ";\n justify-content: space-between;\n // AK ModalBody has 2px padding top and bottom.\n // Using 14px here to create 16px gap between\n // link info and iframe\n padding: ", " ", " 14px\n ", ";\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-300, 24px)", "var(--ds-space-300, 24px)", "var(--ds-space-300, 24px)");
13
13
  exports.containerStyles = containerStyles;
14
14
  var iconSize = '24px';
15
- var iconCss = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n img,\n span,\n svg {\n height: ", ";\n min-height: ", ";\n max-height: ", ";\n width: ", ";\n min-width: ", ";\n max-width: ", ";\n }\n"])), iconSize, iconSize, iconSize, iconSize, iconSize, iconSize);
15
+ // EDM-7328: CSS Specificity
16
+ // An embed modal icon css for img, span, svg has specificity weight of 0-1-1.
17
+ // Specify flex ui icon selector to increase specificity weight to 0-2-1.
18
+ var iconCss = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n &,\n [data-smart-element-icon] img,\n [data-smart-element-icon] span,\n [data-smart-element-icon] svg,\n img,\n span,\n svg {\n height: ", ";\n min-height: ", ";\n max-height: ", ";\n width: ", ";\n min-width: ", ";\n max-width: ", ";\n }\n"])), iconSize, iconSize, iconSize, iconSize, iconSize, iconSize);
16
19
  exports.iconCss = iconCss;
17
20
  var height = '20px';
18
21
  var titleCss = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n flex: 1 1 auto;\n\n h3 {\n flex: 1 1 auto;\n font-size: 16px;\n font-weight: 400;\n line-height: ", ";\n\n display: -webkit-box;\n margin-bottom: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: break-word;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n // Fallback options\n @supports not (-webkit-line-clamp: 1) {\n max-height: ", ";\n }\n }\n"])), height, height);
@@ -8,13 +8,14 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.openPreviewModal = void 0;
9
9
  exports.previewFunction = previewFunction;
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
14
  var _react = _interopRequireDefault(require("react"));
15
15
  var _reactDom = _interopRequireDefault(require("react-dom"));
16
16
  var _reactIntlNext = require("react-intl-next");
17
17
  var _icon = _interopRequireDefault(require("../FlexibleCard/components/elements/icon"));
18
+ var _constants = require("../../constants");
18
19
  var _excluded = ["popupMountPointId", "onClose"];
19
20
  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); }
20
21
  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; }
@@ -30,7 +31,9 @@ var openPreviewModal = function openPreviewModal(_ref) {
30
31
  title = _ref.title,
31
32
  url = _ref.url;
32
33
  var EmbedIcon = {
33
- icon: /*#__PURE__*/_react.default.createElement(_icon.default, linkIcon),
34
+ icon: /*#__PURE__*/_react.default.createElement(_icon.default, (0, _extends2.default)({}, linkIcon, {
35
+ size: _constants.SmartLinkSize.Large
36
+ })),
34
37
  isFlexibleUi: true
35
38
  };
36
39
  return previewFunction({
@@ -185,7 +185,6 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
185
185
  var hoverCardContentProps = {
186
186
  onMouseEnter: initShowCard,
187
187
  onMouseLeave: initHideCard,
188
- onWheel: initHideCard,
189
188
  cardActions: filteredActions,
190
189
  cardState: linkState,
191
190
  onActionClick: onActionClick,
@@ -80,7 +80,6 @@ var HoverCardContent = function HoverCardContent(_ref) {
80
80
  url = _ref.url,
81
81
  onMouseEnter = _ref.onMouseEnter,
82
82
  onMouseLeave = _ref.onMouseLeave,
83
- onWheel = _ref.onWheel,
84
83
  showServerActions = _ref.showServerActions;
85
84
  var useLozengeAction = (0, _linkProvider.useFeatureFlag)('useLozengeAction');
86
85
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
@@ -94,7 +93,6 @@ var HoverCardContent = function HoverCardContent(_ref) {
94
93
  var linkStatus = (_linkState$status = linkState.status) !== null && _linkState$status !== void 0 ? _linkState$status : 'pending';
95
94
  var statusRef = (0, _react2.useRef)(linkStatus);
96
95
  var analyticsRef = (0, _react2.useRef)(analytics);
97
- var wrapperRef = (0, _react2.useRef)(null);
98
96
  (0, _react2.useEffect)(function () {
99
97
  /**
100
98
  * Must access current analytics object value via ref because its not stable
@@ -126,22 +124,6 @@ var HoverCardContent = function HoverCardContent(_ref) {
126
124
  });
127
125
  };
128
126
  }, []);
129
- (0, _react2.useEffect)(function () {
130
- var wrapperRefValue = null;
131
- if (wrapperRef.current && onWheel) {
132
- // Detect wheel even on hover card content to close hover card
133
- // Add event listener through ref because we want it to execute only once.
134
- wrapperRef.current.addEventListener('wheel', onWheel, {
135
- once: true
136
- });
137
- wrapperRefValue = wrapperRef.current;
138
- }
139
- return function () {
140
- if (wrapperRefValue && onWheel) {
141
- wrapperRefValue.removeEventListener('wheel', onWheel);
142
- }
143
- };
144
- }, [onWheel]);
145
127
  var onClick = (0, _react2.useCallback)(function (event) {
146
128
  var isModifierKeyPressed = (0, _utils.isSpecialEvent)(event);
147
129
  analytics.ui.cardClickedEvent({
@@ -217,13 +199,11 @@ var HoverCardContent = function HoverCardContent(_ref) {
217
199
  };
218
200
  var cardView = getCardView(cardState);
219
201
  return cardView ? (0, _react.jsx)("div", {
220
- "data-testid": "hover-card-content",
221
202
  onMouseEnter: onMouseEnter,
222
203
  onMouseLeave: onMouseLeave,
223
204
  onClick: onClickStopPropagation,
224
205
  className: hoverCardClassName,
225
- css: _styled.HoverCardContainer,
226
- ref: wrapperRef
206
+ css: _styled.HoverCardContainer
227
207
  }, cardView) : null;
228
208
  };
229
209
  var _default = HoverCardContent;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.9.12",
3
+ "version": "26.9.14",
4
4
  "sideEffects": false
5
5
  }
@@ -12,7 +12,14 @@ export const containerStyles = css`
12
12
  ${"var(--ds-space-300, 24px)"};
13
13
  `;
14
14
  const iconSize = '24px';
15
+ // EDM-7328: CSS Specificity
16
+ // An embed modal icon css for img, span, svg has specificity weight of 0-1-1.
17
+ // Specify flex ui icon selector to increase specificity weight to 0-2-1.
15
18
  export const iconCss = css`
19
+ &,
20
+ [data-smart-element-icon] img,
21
+ [data-smart-element-icon] span,
22
+ [data-smart-element-icon] svg,
16
23
  img,
17
24
  span,
18
25
  svg {
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import ReactDOM from 'react-dom';
4
4
  import { IntlProvider } from 'react-intl-next';
5
5
  import Icon from '../FlexibleCard/components/elements/icon';
6
+ import { SmartLinkSize } from '../../constants';
6
7
  export const openPreviewModal = ({
7
8
  analytics,
8
9
  downloadUrl: download,
@@ -15,7 +16,9 @@ export const openPreviewModal = ({
15
16
  url
16
17
  }) => {
17
18
  const EmbedIcon = {
18
- icon: /*#__PURE__*/React.createElement(Icon, linkIcon),
19
+ icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
20
+ size: SmartLinkSize.Large
21
+ })),
19
22
  isFlexibleUi: true
20
23
  };
21
24
  return previewFunction({
@@ -160,7 +160,6 @@ export const HoverCardComponent = ({
160
160
  const hoverCardContentProps = {
161
161
  onMouseEnter: initShowCard,
162
162
  onMouseLeave: initHideCard,
163
- onWheel: initHideCard,
164
163
  cardActions: filteredActions,
165
164
  cardState: linkState,
166
165
  onActionClick,
@@ -41,7 +41,6 @@ const HoverCardContent = ({
41
41
  url,
42
42
  onMouseEnter,
43
43
  onMouseLeave,
44
- onWheel,
45
44
  showServerActions
46
45
  }) => {
47
46
  var _linkState$status, _cardState$details;
@@ -56,7 +55,6 @@ const HoverCardContent = ({
56
55
  const linkStatus = (_linkState$status = linkState.status) !== null && _linkState$status !== void 0 ? _linkState$status : 'pending';
57
56
  const statusRef = useRef(linkStatus);
58
57
  const analyticsRef = useRef(analytics);
59
- const wrapperRef = useRef(null);
60
58
  useEffect(() => {
61
59
  /**
62
60
  * Must access current analytics object value via ref because its not stable
@@ -88,22 +86,6 @@ const HoverCardContent = ({
88
86
  });
89
87
  };
90
88
  }, []);
91
- useEffect(() => {
92
- let wrapperRefValue = null;
93
- if (wrapperRef.current && onWheel) {
94
- // Detect wheel even on hover card content to close hover card
95
- // Add event listener through ref because we want it to execute only once.
96
- wrapperRef.current.addEventListener('wheel', onWheel, {
97
- once: true
98
- });
99
- wrapperRefValue = wrapperRef.current;
100
- }
101
- return () => {
102
- if (wrapperRefValue && onWheel) {
103
- wrapperRefValue.removeEventListener('wheel', onWheel);
104
- }
105
- };
106
- }, [onWheel]);
107
89
  const onClick = useCallback(event => {
108
90
  const isModifierKeyPressed = isSpecialEvent(event);
109
91
  analytics.ui.cardClickedEvent({
@@ -176,13 +158,11 @@ const HoverCardContent = ({
176
158
  };
177
159
  const cardView = getCardView(cardState);
178
160
  return cardView ? jsx("div", {
179
- "data-testid": "hover-card-content",
180
161
  onMouseEnter: onMouseEnter,
181
162
  onMouseLeave: onMouseLeave,
182
163
  onClick: onClickStopPropagation,
183
164
  className: hoverCardClassName,
184
- css: HoverCardContainer,
185
- ref: wrapperRef
165
+ css: HoverCardContainer
186
166
  }, cardView) : null;
187
167
  };
188
168
  export default HoverCardContent;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.9.12",
3
+ "version": "26.9.14",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,10 @@ import { css } from '@emotion/react';
4
4
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
5
5
  export var containerStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n gap: ", ";\n justify-content: space-between;\n // AK ModalBody has 2px padding top and bottom.\n // Using 14px here to create 16px gap between\n // link info and iframe\n padding: ", " ", " 14px\n ", ";\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-300, 24px)", "var(--ds-space-300, 24px)", "var(--ds-space-300, 24px)");
6
6
  var iconSize = '24px';
7
- export var iconCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n img,\n span,\n svg {\n height: ", ";\n min-height: ", ";\n max-height: ", ";\n width: ", ";\n min-width: ", ";\n max-width: ", ";\n }\n"])), iconSize, iconSize, iconSize, iconSize, iconSize, iconSize);
7
+ // EDM-7328: CSS Specificity
8
+ // An embed modal icon css for img, span, svg has specificity weight of 0-1-1.
9
+ // Specify flex ui icon selector to increase specificity weight to 0-2-1.
10
+ export var iconCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &,\n [data-smart-element-icon] img,\n [data-smart-element-icon] span,\n [data-smart-element-icon] svg,\n img,\n span,\n svg {\n height: ", ";\n min-height: ", ";\n max-height: ", ";\n width: ", ";\n min-width: ", ";\n max-width: ", ";\n }\n"])), iconSize, iconSize, iconSize, iconSize, iconSize, iconSize);
8
11
  var height = '20px';
9
12
  export var titleCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n\n h3 {\n flex: 1 1 auto;\n font-size: 16px;\n font-weight: 400;\n line-height: ", ";\n\n display: -webkit-box;\n margin-bottom: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: break-word;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n // Fallback options\n @supports not (-webkit-line-clamp: 1) {\n max-height: ", ";\n }\n }\n"])), height, height);
10
13
  export var actionCss = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex: 0 0 auto;\n gap: ", ";\n line-height: ", ";\n span {\n line-height: ", ";\n }\n\n @media only screen and (max-width: 980px) {\n // Hide resize button if the screen is smaller than the min width\n // or too small to have enough impact to matter.\n .smart-link-resize-button {\n display: none;\n }\n }\n"])), "var(--ds-space-050, 4px)", height, height);
@@ -1,12 +1,13 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _extends from "@babel/runtime/helpers/extends";
4
4
  var _excluded = ["popupMountPointId", "onClose"];
5
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  import React from 'react';
7
7
  import ReactDOM from 'react-dom';
8
8
  import { IntlProvider } from 'react-intl-next';
9
9
  import Icon from '../FlexibleCard/components/elements/icon';
10
+ import { SmartLinkSize } from '../../constants';
10
11
  export var openPreviewModal = function openPreviewModal(_ref) {
11
12
  var analytics = _ref.analytics,
12
13
  download = _ref.downloadUrl,
@@ -19,7 +20,9 @@ export var openPreviewModal = function openPreviewModal(_ref) {
19
20
  title = _ref.title,
20
21
  url = _ref.url;
21
22
  var EmbedIcon = {
22
- icon: /*#__PURE__*/React.createElement(Icon, linkIcon),
23
+ icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
24
+ size: SmartLinkSize.Large
25
+ })),
23
26
  isFlexibleUi: true
24
27
  };
25
28
  return previewFunction({
@@ -174,7 +174,6 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
174
174
  var hoverCardContentProps = {
175
175
  onMouseEnter: initShowCard,
176
176
  onMouseLeave: initHideCard,
177
- onWheel: initHideCard,
178
177
  cardActions: filteredActions,
179
178
  cardState: linkState,
180
179
  onActionClick: onActionClick,
@@ -67,7 +67,6 @@ var HoverCardContent = function HoverCardContent(_ref) {
67
67
  url = _ref.url,
68
68
  onMouseEnter = _ref.onMouseEnter,
69
69
  onMouseLeave = _ref.onMouseLeave,
70
- onWheel = _ref.onWheel,
71
70
  showServerActions = _ref.showServerActions;
72
71
  var useLozengeAction = useFeatureFlag('useLozengeAction');
73
72
  var _useAnalyticsEvents = useAnalyticsEvents(),
@@ -81,7 +80,6 @@ var HoverCardContent = function HoverCardContent(_ref) {
81
80
  var linkStatus = (_linkState$status = linkState.status) !== null && _linkState$status !== void 0 ? _linkState$status : 'pending';
82
81
  var statusRef = useRef(linkStatus);
83
82
  var analyticsRef = useRef(analytics);
84
- var wrapperRef = useRef(null);
85
83
  useEffect(function () {
86
84
  /**
87
85
  * Must access current analytics object value via ref because its not stable
@@ -113,22 +111,6 @@ var HoverCardContent = function HoverCardContent(_ref) {
113
111
  });
114
112
  };
115
113
  }, []);
116
- useEffect(function () {
117
- var wrapperRefValue = null;
118
- if (wrapperRef.current && onWheel) {
119
- // Detect wheel even on hover card content to close hover card
120
- // Add event listener through ref because we want it to execute only once.
121
- wrapperRef.current.addEventListener('wheel', onWheel, {
122
- once: true
123
- });
124
- wrapperRefValue = wrapperRef.current;
125
- }
126
- return function () {
127
- if (wrapperRefValue && onWheel) {
128
- wrapperRefValue.removeEventListener('wheel', onWheel);
129
- }
130
- };
131
- }, [onWheel]);
132
114
  var onClick = useCallback(function (event) {
133
115
  var isModifierKeyPressed = isSpecialEvent(event);
134
116
  analytics.ui.cardClickedEvent({
@@ -204,13 +186,11 @@ var HoverCardContent = function HoverCardContent(_ref) {
204
186
  };
205
187
  var cardView = getCardView(cardState);
206
188
  return cardView ? jsx("div", {
207
- "data-testid": "hover-card-content",
208
189
  onMouseEnter: onMouseEnter,
209
190
  onMouseLeave: onMouseLeave,
210
191
  onClick: onClickStopPropagation,
211
192
  className: hoverCardClassName,
212
- css: HoverCardContainer,
213
- ref: wrapperRef
193
+ css: HoverCardContainer
214
194
  }, cardView) : null;
215
195
  };
216
196
  export default HoverCardContent;
@@ -80,7 +80,6 @@ export type HoverCardContentProps = {
80
80
  url: string;
81
81
  onMouseEnter?: MouseEventHandler;
82
82
  onMouseLeave?: MouseEventHandler;
83
- onWheel?: EventListenerOrEventListenerObject;
84
83
  showServerActions?: boolean;
85
84
  };
86
85
  export type SnippetOrPreviewProps = {
@@ -80,7 +80,6 @@ export type HoverCardContentProps = {
80
80
  url: string;
81
81
  onMouseEnter?: MouseEventHandler;
82
82
  onMouseLeave?: MouseEventHandler;
83
- onWheel?: EventListenerOrEventListenerObject;
84
83
  showServerActions?: boolean;
85
84
  };
86
85
  export type SnippetOrPreviewProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.9.12",
3
+ "version": "26.9.14",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -49,7 +49,7 @@
49
49
  "@atlaskit/popup": "^1.8.0",
50
50
  "@atlaskit/spinner": "^15.5.0",
51
51
  "@atlaskit/theme": "^12.5.0",
52
- "@atlaskit/tokens": "^1.12.0",
52
+ "@atlaskit/tokens": "^1.13.0",
53
53
  "@atlaskit/tooltip": "^17.8.0",
54
54
  "@atlaskit/ufo": "^0.2.0",
55
55
  "@babel/runtime": "^7.0.0",
@@ -75,7 +75,7 @@
75
75
  "@af/visual-regression": "*",
76
76
  "@atlaskit/avatar": "^21.3.0",
77
77
  "@atlaskit/css-reset": "^6.5.0",
78
- "@atlaskit/link-test-helpers": "^4.1.0",
78
+ "@atlaskit/link-test-helpers": "^4.2.0",
79
79
  "@atlaskit/lozenge": "^11.4.0",
80
80
  "@atlaskit/media-integration-test-helpers": "^3.0.0",
81
81
  "@atlaskit/media-test-helpers": "^33.0.0",