@atlaskit/smart-card 43.26.12 → 43.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 43.27.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`171234137629d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/171234137629d) -
8
+ Open smart hover card on focus
9
+
10
+ ## 43.26.13
11
+
12
+ ### Patch Changes
13
+
14
+ - [`6f1aadb138410`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6f1aadb138410) -
15
+ Migrate to new FG: jpx-1074-smart-links-iframe
16
+ - Updated dependencies
17
+
3
18
  ## 43.26.12
4
19
 
5
20
  ### Patch Changes
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
11
11
  var context = exports.context = {
12
12
  componentName: 'smart-cards',
13
13
  packageName: "@atlaskit/smart-card",
14
- packageVersion: "43.26.11"
14
+ packageVersion: "43.26.13"
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -87,7 +87,7 @@ var Frame = exports.Frame = /*#__PURE__*/_react.default.forwardRef(function (_re
87
87
  (0, _react.useEffect)(function () {
88
88
  var onBlur = function onBlur() {
89
89
  setWindowFocused(false);
90
- if ((0, _platformFeatureFlags.fg)('jpx-833-smart-links-graphql-provider')) {
90
+ if ((0, _platformFeatureFlags.fg)('jpx-1074-smart-links-iframe')) {
91
91
  if ((doc === null || doc === void 0 ? void 0 : doc.activeElement) === ref.current) {
92
92
  onIframeFocus && onIframeFocus();
93
93
  }
@@ -172,7 +172,7 @@ var FrameUpdated = exports.FrameUpdated = /*#__PURE__*/_react.default.forwardRef
172
172
  var _useState13 = (0, _react.useState)(
173
173
  // The below will be removed as part of FG cleanup
174
174
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
175
- (0, _platformFeatureFlags.fg)('jpx-833-smart-links-graphql-provider') ? (_doc$hasFocus = doc === null || doc === void 0 ? void 0 : doc.hasFocus()) !== null && _doc$hasFocus !== void 0 ? _doc$hasFocus : false : document.hasFocus()),
175
+ (0, _platformFeatureFlags.fg)('jpx-1074-smart-links-iframe') ? (_doc$hasFocus = doc === null || doc === void 0 ? void 0 : doc.hasFocus()) !== null && _doc$hasFocus !== void 0 ? _doc$hasFocus : false : document.hasFocus()),
176
176
  _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
177
177
  isWindowFocused = _useState14[0],
178
178
  setWindowFocused = _useState14[1];
@@ -215,10 +215,10 @@ var FrameUpdated = exports.FrameUpdated = /*#__PURE__*/_react.default.forwardRef
215
215
  // Initialize with current focus state
216
216
  // The below will be removed as part of FG cleanup
217
217
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
218
- setWindowFocused((0, _platformFeatureFlags.fg)('jpx-833-smart-links-graphql-provider') ? (_doc$hasFocus2 = doc === null || doc === void 0 ? void 0 : doc.hasFocus()) !== null && _doc$hasFocus2 !== void 0 ? _doc$hasFocus2 : false : document.hasFocus());
218
+ setWindowFocused((0, _platformFeatureFlags.fg)('jpx-1074-smart-links-iframe') ? (_doc$hasFocus2 = doc === null || doc === void 0 ? void 0 : doc.hasFocus()) !== null && _doc$hasFocus2 !== void 0 ? _doc$hasFocus2 : false : document.hasFocus());
219
219
  var onBlur = function onBlur() {
220
220
  setWindowFocused(false);
221
- if ((0, _platformFeatureFlags.fg)('jpx-833-smart-links-graphql-provider')) {
221
+ if ((0, _platformFeatureFlags.fg)('jpx-1074-smart-links-iframe')) {
222
222
  if ((doc === null || doc === void 0 ? void 0 : doc.activeElement) === ref.current) {
223
223
  onIframeFocus && onIframeFocus();
224
224
  }
@@ -233,6 +233,12 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
233
233
  source: HOVER_CARD_SOURCE
234
234
  }, /*#__PURE__*/_react.default.createElement(_HoverCardContent.default, hoverCardContentProps));
235
235
  }, [initShowCard, initHideCard, linkState, onActionClick, renderers, actionOptions, url, id, hoverPreviewOptions]);
236
+ var handleKeyDown = (0, _react.useCallback)(function (e) {
237
+ if (e.key === ' ') {
238
+ e.preventDefault();
239
+ initShowCard(e);
240
+ }
241
+ }, [initShowCard]);
236
242
  var trigger = (0, _react.useCallback)(function (_ref3) {
237
243
  var _ariaHasPopup = _ref3['aria-haspopup'],
238
244
  _ariaExpanded = _ref3['aria-expanded'],
@@ -246,13 +252,14 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
246
252
  ,
247
253
  onMouseLeave: initHideCard,
248
254
  onMouseMove: setMousePosition,
255
+ onKeyDown: (0, _platformFeatureFlags.fg)('fix_hover_card_on_focus_a11y') ? handleKeyDown : undefined,
249
256
  onClick: onChildClick,
250
257
  onContextMenu: onContextMenuClick,
251
258
  "data-testid": HOVER_CARD_TRIGGER_WRAPPER
252
259
  }, (0, _experiments.editorExperiment)('platform_editor_preview_panel_linking_exp', true) ? {
253
260
  className: HOVER_CARD_TRIGGER_WRAPPER
254
261
  } : {}), children));
255
- }, [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition]);
262
+ }, [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition, handleKeyDown]);
256
263
  var popupComponent = (0, _react.useMemo)(
257
264
  // Within the Popup component, if shouldRenderToParent, the zIndex prop is ignored
258
265
  // as it is assumed that the custom popup container has the desired styles
@@ -262,7 +269,7 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
262
269
  return /*#__PURE__*/_react.default.createElement(_popup.default, {
263
270
  testId: "hover-card",
264
271
  isOpen: isOpen && canOpen,
265
- onClose: hideCard,
272
+ onClose: (0, _platformFeatureFlags.fg)('fix_hover_card_on_focus_a11y') ? initHideCard : hideCard,
266
273
  placement: "bottom-start",
267
274
  offset: popupOffset.current,
268
275
  autoFocus: false,
@@ -22,7 +22,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
22
22
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
23
23
  var PACKAGE_DATA = {
24
24
  packageName: "@atlaskit/smart-card",
25
- packageVersion: "43.26.11",
25
+ packageVersion: "43.26.13",
26
26
  componentName: 'linkUrl'
27
27
  };
28
28
  var Anchor = (0, _click.withLinkClickedEvent)('a');
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
2
2
  export const context = {
3
3
  componentName: 'smart-cards',
4
4
  packageName: "@atlaskit/smart-card",
5
- packageVersion: "43.26.11"
5
+ packageVersion: "43.26.13"
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -65,7 +65,7 @@ export const Frame = /*#__PURE__*/React.forwardRef(({
65
65
  useEffect(() => {
66
66
  const onBlur = () => {
67
67
  setWindowFocused(false);
68
- if (fg('jpx-833-smart-links-graphql-provider')) {
68
+ if (fg('jpx-1074-smart-links-iframe')) {
69
69
  if ((doc === null || doc === void 0 ? void 0 : doc.activeElement) === ref.current) {
70
70
  onIframeFocus && onIframeFocus();
71
71
  }
@@ -144,7 +144,7 @@ export const FrameUpdated = /*#__PURE__*/React.forwardRef(({
144
144
  const [isWindowFocused, setWindowFocused] = useState(
145
145
  // The below will be removed as part of FG cleanup
146
146
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
147
- fg('jpx-833-smart-links-graphql-provider') ? (_doc$hasFocus = doc === null || doc === void 0 ? void 0 : doc.hasFocus()) !== null && _doc$hasFocus !== void 0 ? _doc$hasFocus : false : document.hasFocus());
147
+ fg('jpx-1074-smart-links-iframe') ? (_doc$hasFocus = doc === null || doc === void 0 ? void 0 : doc.hasFocus()) !== null && _doc$hasFocus !== void 0 ? _doc$hasFocus : false : document.hasFocus());
148
148
 
149
149
  // Use prop if provided (from wrapper), otherwise use local state (for backward compatibility)
150
150
  const effectiveMouseOver = isMouseOverProp !== undefined ? isMouseOverProp : isMouseOver;
@@ -179,10 +179,10 @@ export const FrameUpdated = /*#__PURE__*/React.forwardRef(({
179
179
  // Initialize with current focus state
180
180
  // The below will be removed as part of FG cleanup
181
181
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
182
- setWindowFocused(fg('jpx-833-smart-links-graphql-provider') ? (_doc$hasFocus2 = doc === null || doc === void 0 ? void 0 : doc.hasFocus()) !== null && _doc$hasFocus2 !== void 0 ? _doc$hasFocus2 : false : document.hasFocus());
182
+ setWindowFocused(fg('jpx-1074-smart-links-iframe') ? (_doc$hasFocus2 = doc === null || doc === void 0 ? void 0 : doc.hasFocus()) !== null && _doc$hasFocus2 !== void 0 ? _doc$hasFocus2 : false : document.hasFocus());
183
183
  const onBlur = () => {
184
184
  setWindowFocused(false);
185
- if (fg('jpx-833-smart-links-graphql-provider')) {
185
+ if (fg('jpx-1074-smart-links-iframe')) {
186
186
  if ((doc === null || doc === void 0 ? void 0 : doc.activeElement) === ref.current) {
187
187
  onIframeFocus && onIframeFocus();
188
188
  }
@@ -207,6 +207,12 @@ export const HoverCardComponent = ({
207
207
  source: HOVER_CARD_SOURCE
208
208
  }, /*#__PURE__*/React.createElement(HoverCardContent, hoverCardContentProps));
209
209
  }, [initShowCard, initHideCard, linkState, onActionClick, renderers, actionOptions, url, id, hoverPreviewOptions]);
210
+ const handleKeyDown = useCallback(e => {
211
+ if (e.key === ' ') {
212
+ e.preventDefault();
213
+ initShowCard(e);
214
+ }
215
+ }, [initShowCard]);
210
216
  const trigger = useCallback(({
211
217
  'aria-haspopup': _ariaHasPopup,
212
218
  'aria-expanded': _ariaExpanded,
@@ -220,12 +226,13 @@ export const HoverCardComponent = ({
220
226
  ,
221
227
  onMouseLeave: initHideCard,
222
228
  onMouseMove: setMousePosition,
229
+ onKeyDown: fg('fix_hover_card_on_focus_a11y') ? handleKeyDown : undefined,
223
230
  onClick: onChildClick,
224
231
  onContextMenu: onContextMenuClick,
225
232
  "data-testid": HOVER_CARD_TRIGGER_WRAPPER
226
233
  }, editorExperiment('platform_editor_preview_panel_linking_exp', true) ? {
227
234
  className: HOVER_CARD_TRIGGER_WRAPPER
228
- } : {}), children)), [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition]);
235
+ } : {}), children)), [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition, handleKeyDown]);
229
236
  const popupComponent = useMemo(
230
237
  // Within the Popup component, if shouldRenderToParent, the zIndex prop is ignored
231
238
  // as it is assumed that the custom popup container has the desired styles
@@ -233,7 +240,7 @@ export const HoverCardComponent = ({
233
240
  return /*#__PURE__*/React.createElement(Popup, {
234
241
  testId: "hover-card",
235
242
  isOpen: isOpen && canOpen,
236
- onClose: hideCard,
243
+ onClose: fg('fix_hover_card_on_focus_a11y') ? initHideCard : hideCard,
237
244
  placement: "bottom-start",
238
245
  offset: popupOffset.current,
239
246
  autoFocus: false,
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
12
12
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
13
13
  const PACKAGE_DATA = {
14
14
  packageName: "@atlaskit/smart-card",
15
- packageVersion: "43.26.11",
15
+ packageVersion: "43.26.13",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  const Anchor = withLinkClickedEvent('a');
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
4
4
  export var context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "43.26.11"
7
+ packageVersion: "43.26.13"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -80,7 +80,7 @@ export var Frame = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef) {
80
80
  useEffect(function () {
81
81
  var onBlur = function onBlur() {
82
82
  setWindowFocused(false);
83
- if (fg('jpx-833-smart-links-graphql-provider')) {
83
+ if (fg('jpx-1074-smart-links-iframe')) {
84
84
  if ((doc === null || doc === void 0 ? void 0 : doc.activeElement) === ref.current) {
85
85
  onIframeFocus && onIframeFocus();
86
86
  }
@@ -165,7 +165,7 @@ export var FrameUpdated = /*#__PURE__*/React.forwardRef(function (_ref2, iframeR
165
165
  var _useState13 = useState(
166
166
  // The below will be removed as part of FG cleanup
167
167
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
168
- fg('jpx-833-smart-links-graphql-provider') ? (_doc$hasFocus = doc === null || doc === void 0 ? void 0 : doc.hasFocus()) !== null && _doc$hasFocus !== void 0 ? _doc$hasFocus : false : document.hasFocus()),
168
+ fg('jpx-1074-smart-links-iframe') ? (_doc$hasFocus = doc === null || doc === void 0 ? void 0 : doc.hasFocus()) !== null && _doc$hasFocus !== void 0 ? _doc$hasFocus : false : document.hasFocus()),
169
169
  _useState14 = _slicedToArray(_useState13, 2),
170
170
  isWindowFocused = _useState14[0],
171
171
  setWindowFocused = _useState14[1];
@@ -208,10 +208,10 @@ export var FrameUpdated = /*#__PURE__*/React.forwardRef(function (_ref2, iframeR
208
208
  // Initialize with current focus state
209
209
  // The below will be removed as part of FG cleanup
210
210
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
211
- setWindowFocused(fg('jpx-833-smart-links-graphql-provider') ? (_doc$hasFocus2 = doc === null || doc === void 0 ? void 0 : doc.hasFocus()) !== null && _doc$hasFocus2 !== void 0 ? _doc$hasFocus2 : false : document.hasFocus());
211
+ setWindowFocused(fg('jpx-1074-smart-links-iframe') ? (_doc$hasFocus2 = doc === null || doc === void 0 ? void 0 : doc.hasFocus()) !== null && _doc$hasFocus2 !== void 0 ? _doc$hasFocus2 : false : document.hasFocus());
212
212
  var onBlur = function onBlur() {
213
213
  setWindowFocused(false);
214
- if (fg('jpx-833-smart-links-graphql-provider')) {
214
+ if (fg('jpx-1074-smart-links-iframe')) {
215
215
  if ((doc === null || doc === void 0 ? void 0 : doc.activeElement) === ref.current) {
216
216
  onIframeFocus && onIframeFocus();
217
217
  }
@@ -224,6 +224,12 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
224
224
  source: HOVER_CARD_SOURCE
225
225
  }, /*#__PURE__*/React.createElement(HoverCardContent, hoverCardContentProps));
226
226
  }, [initShowCard, initHideCard, linkState, onActionClick, renderers, actionOptions, url, id, hoverPreviewOptions]);
227
+ var handleKeyDown = useCallback(function (e) {
228
+ if (e.key === ' ') {
229
+ e.preventDefault();
230
+ initShowCard(e);
231
+ }
232
+ }, [initShowCard]);
227
233
  var trigger = useCallback(function (_ref3) {
228
234
  var _ariaHasPopup = _ref3['aria-haspopup'],
229
235
  _ariaExpanded = _ref3['aria-expanded'],
@@ -237,13 +243,14 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
237
243
  ,
238
244
  onMouseLeave: initHideCard,
239
245
  onMouseMove: setMousePosition,
246
+ onKeyDown: fg('fix_hover_card_on_focus_a11y') ? handleKeyDown : undefined,
240
247
  onClick: onChildClick,
241
248
  onContextMenu: onContextMenuClick,
242
249
  "data-testid": HOVER_CARD_TRIGGER_WRAPPER
243
250
  }, editorExperiment('platform_editor_preview_panel_linking_exp', true) ? {
244
251
  className: HOVER_CARD_TRIGGER_WRAPPER
245
252
  } : {}), children));
246
- }, [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition]);
253
+ }, [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition, handleKeyDown]);
247
254
  var popupComponent = useMemo(
248
255
  // Within the Popup component, if shouldRenderToParent, the zIndex prop is ignored
249
256
  // as it is assumed that the custom popup container has the desired styles
@@ -253,7 +260,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
253
260
  return /*#__PURE__*/React.createElement(Popup, {
254
261
  testId: "hover-card",
255
262
  isOpen: isOpen && canOpen,
256
- onClose: hideCard,
263
+ onClose: fg('fix_hover_card_on_focus_a11y') ? initHideCard : hideCard,
257
264
  placement: "bottom-start",
258
265
  offset: popupOffset.current,
259
266
  autoFocus: false,
@@ -15,7 +15,7 @@ import LinkWarningModal from './LinkWarningModal';
15
15
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
16
16
  var PACKAGE_DATA = {
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "43.26.11",
18
+ packageVersion: "43.26.13",
19
19
  componentName: 'linkUrl'
20
20
  };
21
21
  var Anchor = withLinkClickedEvent('a');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "43.26.12",
3
+ "version": "43.27.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -63,7 +63,7 @@
63
63
  "@atlaskit/outbound-auth-flow-client": "^3.4.0",
64
64
  "@atlaskit/platform-feature-flags": "^1.1.0",
65
65
  "@atlaskit/platform-feature-flags-react": "^0.4.0",
66
- "@atlaskit/popup": "^4.13.0",
66
+ "@atlaskit/popup": "^4.14.0",
67
67
  "@atlaskit/primitives": "^18.0.0",
68
68
  "@atlaskit/react-ufo": "^5.4.0",
69
69
  "@atlaskit/rovo-triggers": "^5.30.0",
@@ -74,7 +74,7 @@
74
74
  "@atlaskit/textfield": "^8.2.0",
75
75
  "@atlaskit/theme": "^22.0.0",
76
76
  "@atlaskit/tile": "^1.0.0",
77
- "@atlaskit/tmp-editor-statsig": "^42.0.0",
77
+ "@atlaskit/tmp-editor-statsig": "^43.0.0",
78
78
  "@atlaskit/tokens": "^11.1.0",
79
79
  "@atlaskit/tooltip": "^21.0.0",
80
80
  "@atlaskit/ufo": "^0.4.0",
@@ -102,7 +102,7 @@
102
102
  "@af/integration-testing": "workspace:^",
103
103
  "@af/visual-regression": "workspace:^",
104
104
  "@atlaskit/analytics-listeners": "^10.0.0",
105
- "@atlaskit/css-reset": "^7.3.0",
105
+ "@atlaskit/css-reset": "^7.4.0",
106
106
  "@atlaskit/media-test-helpers": "^40.0.0",
107
107
  "@atlaskit/ssr": "workspace:^",
108
108
  "@atlassian/a11y-jest-testing": "^0.10.0",
@@ -227,7 +227,10 @@
227
227
  "platform_sl_3p_auth_rovo_action_kill_switch": {
228
228
  "type": "boolean"
229
229
  },
230
- "jpx-833-smart-links-graphql-provider": {
230
+ "jpx-1074-smart-links-iframe": {
231
+ "type": "boolean"
232
+ },
233
+ "fix_hover_card_on_focus_a11y": {
231
234
  "type": "boolean"
232
235
  }
233
236
  },