@atlaskit/link-picker 1.25.3 → 1.25.4

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 (145) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/common/analytics/context.js +1 -1
  3. package/dist/cjs/common/analytics/input-field-tracking.js +3 -3
  4. package/dist/cjs/common/constants.js +4 -2
  5. package/dist/cjs/common/utils/handleNavKeyDown.js +29 -0
  6. package/dist/cjs/services/use-plugins/index.js +7 -8
  7. package/dist/cjs/ui/error-boundary/error-boundary-fallback/index.js +3 -1
  8. package/dist/cjs/ui/error-boundary/index.js +3 -3
  9. package/dist/cjs/ui/index.js +2 -2
  10. package/dist/cjs/ui/link-picker/form-footer/index.js +10 -10
  11. package/dist/cjs/ui/link-picker/index.js +29 -40
  12. package/dist/cjs/ui/link-picker/link-search-list/index.js +11 -11
  13. package/dist/cjs/ui/link-picker/link-search-list/link-search-no-results/index.js +1 -1
  14. package/dist/cjs/ui/link-picker/{list-item → link-search-list/list-item}/index.js +3 -1
  15. package/dist/cjs/ui/link-picker/{list-item → link-search-list/list-item}/styled.js +5 -3
  16. package/dist/cjs/ui/{scrolling-tabs → link-picker/scrolling-tabs}/index.js +3 -0
  17. package/dist/cjs/ui/link-picker/styled.js +5 -23
  18. package/dist/cjs/ui/link-picker/text-input/index.js +4 -4
  19. package/dist/cjs/ui/link-picker/text-input/utils.js +28 -0
  20. package/dist/cjs/ui/link-picker/track-mount/index.js +1 -1
  21. package/dist/cjs/ui/link-picker/track-tab-viewed/index.js +1 -1
  22. package/dist/cjs/ui/link-picker/transformTimeStamp.js +2 -2
  23. package/dist/cjs/ui/link-picker/utils.js +1 -48
  24. package/dist/cjs/ui/loader-fallback/index.js +1 -1
  25. package/dist/cjs/ui/loader-fallback/styled.js +21 -0
  26. package/dist/cjs/version.json +1 -1
  27. package/dist/es2019/common/analytics/context.js +1 -1
  28. package/dist/es2019/common/analytics/input-field-tracking.js +2 -2
  29. package/dist/es2019/common/constants.js +2 -1
  30. package/dist/es2019/common/utils/handleNavKeyDown.js +22 -0
  31. package/dist/es2019/services/use-plugins/index.js +5 -6
  32. package/dist/es2019/ui/error-boundary/error-boundary-fallback/index.js +2 -1
  33. package/dist/es2019/ui/error-boundary/index.js +3 -3
  34. package/dist/es2019/ui/index.js +3 -3
  35. package/dist/es2019/ui/link-picker/announcer.js +1 -1
  36. package/dist/es2019/ui/link-picker/form-footer/index.js +4 -4
  37. package/dist/es2019/ui/link-picker/index.js +18 -28
  38. package/dist/es2019/ui/link-picker/link-search-error/index.js +1 -1
  39. package/dist/es2019/ui/link-picker/link-search-list/index.js +5 -5
  40. package/dist/es2019/ui/link-picker/link-search-list/link-search-no-results/index.js +1 -1
  41. package/dist/es2019/ui/link-picker/{list-item → link-search-list/list-item}/index.js +3 -2
  42. package/dist/es2019/ui/link-picker/{list-item → link-search-list/list-item}/styled.js +2 -2
  43. package/dist/es2019/ui/link-picker/link-search-list/styled.js +1 -0
  44. package/dist/es2019/ui/{scrolling-tabs → link-picker/scrolling-tabs}/index.js +6 -3
  45. package/dist/es2019/ui/link-picker/styled.js +0 -30
  46. package/dist/es2019/ui/link-picker/text-input/index.js +5 -5
  47. package/dist/es2019/ui/link-picker/text-input/utils.js +22 -0
  48. package/dist/es2019/ui/link-picker/track-mount/index.js +1 -1
  49. package/dist/es2019/ui/link-picker/track-tab-viewed/index.js +1 -1
  50. package/dist/es2019/ui/link-picker/transformTimeStamp.js +2 -2
  51. package/dist/es2019/ui/link-picker/utils.js +1 -45
  52. package/dist/es2019/ui/loader-fallback/index.js +1 -1
  53. package/dist/es2019/ui/loader-fallback/styled.js +25 -0
  54. package/dist/es2019/version.json +1 -1
  55. package/dist/esm/common/analytics/context.js +1 -1
  56. package/dist/esm/common/analytics/input-field-tracking.js +2 -2
  57. package/dist/esm/common/constants.js +2 -1
  58. package/dist/esm/common/utils/handleNavKeyDown.js +22 -0
  59. package/dist/esm/services/use-plugins/index.js +5 -6
  60. package/dist/esm/ui/error-boundary/error-boundary-fallback/index.js +2 -1
  61. package/dist/esm/ui/error-boundary/index.js +3 -3
  62. package/dist/esm/ui/index.js +3 -3
  63. package/dist/esm/ui/link-picker/announcer.js +1 -1
  64. package/dist/esm/ui/link-picker/form-footer/index.js +4 -4
  65. package/dist/esm/ui/link-picker/index.js +19 -29
  66. package/dist/esm/ui/link-picker/link-search-error/index.js +1 -1
  67. package/dist/esm/ui/link-picker/link-search-list/index.js +5 -5
  68. package/dist/esm/ui/link-picker/link-search-list/link-search-no-results/index.js +1 -1
  69. package/dist/esm/ui/link-picker/{list-item → link-search-list/list-item}/index.js +3 -2
  70. package/dist/esm/ui/link-picker/{list-item → link-search-list/list-item}/styled.js +2 -2
  71. package/dist/esm/ui/link-picker/link-search-list/styled.js +1 -0
  72. package/dist/esm/ui/{scrolling-tabs → link-picker/scrolling-tabs}/index.js +6 -3
  73. package/dist/esm/ui/link-picker/styled.js +4 -19
  74. package/dist/esm/ui/link-picker/text-input/index.js +5 -5
  75. package/dist/esm/ui/link-picker/text-input/utils.js +20 -0
  76. package/dist/esm/ui/link-picker/track-mount/index.js +1 -1
  77. package/dist/esm/ui/link-picker/track-tab-viewed/index.js +1 -1
  78. package/dist/esm/ui/link-picker/transformTimeStamp.js +2 -2
  79. package/dist/esm/ui/link-picker/utils.js +1 -43
  80. package/dist/esm/ui/loader-fallback/index.js +1 -1
  81. package/dist/esm/ui/loader-fallback/styled.js +16 -0
  82. package/dist/esm/version.json +1 -1
  83. package/dist/types/common/analytics/context.d.ts +1 -1
  84. package/dist/types/common/constants.d.ts +1 -0
  85. package/dist/types/{ui → common}/types.d.ts +10 -0
  86. package/dist/types/common/utils/handleNavKeyDown.d.ts +2 -0
  87. package/dist/types/index.d.ts +1 -1
  88. package/dist/types/services/use-plugins/index.d.ts +1 -1
  89. package/dist/types/services/use-plugins/reducer.d.ts +1 -1
  90. package/dist/types/services/use-plugins/utils.d.ts +1 -1
  91. package/dist/types/services/use-search-query/index.d.ts +1 -2
  92. package/dist/types/ui/link-picker/form-footer/index.d.ts +1 -2
  93. package/dist/types/ui/link-picker/form-footer/utils.d.ts +1 -1
  94. package/dist/types/ui/link-picker/index.d.ts +1 -13
  95. package/dist/types/ui/link-picker/link-search-list/index.d.ts +1 -1
  96. package/dist/types/ui/link-picker/{list-item → link-search-list/list-item}/index.d.ts +1 -1
  97. package/dist/types/ui/link-picker/link-search-list/use-track-results-shown/index.d.ts +1 -1
  98. package/dist/types/ui/link-picker/styled.d.ts +0 -5
  99. package/dist/types/ui/link-picker/{conditional-spotlight-target-wrapper → text-input/conditional-spotlight-target-wrapper}/index.d.ts +1 -2
  100. package/dist/types/ui/link-picker/text-input/index.d.ts +1 -1
  101. package/dist/types/ui/link-picker/text-input/utils.d.ts +3 -0
  102. package/dist/types/ui/link-picker/utils.d.ts +1 -5
  103. package/dist/types/ui/loader-fallback/styled.d.ts +3 -0
  104. package/dist/types-ts4.5/common/analytics/context.d.ts +1 -1
  105. package/dist/types-ts4.5/common/constants.d.ts +1 -0
  106. package/dist/types-ts4.5/{ui → common}/types.d.ts +10 -0
  107. package/dist/types-ts4.5/common/utils/handleNavKeyDown.d.ts +2 -0
  108. package/dist/types-ts4.5/index.d.ts +1 -1
  109. package/dist/types-ts4.5/services/use-plugins/index.d.ts +1 -1
  110. package/dist/types-ts4.5/services/use-plugins/reducer.d.ts +1 -1
  111. package/dist/types-ts4.5/services/use-plugins/utils.d.ts +1 -1
  112. package/dist/types-ts4.5/services/use-search-query/index.d.ts +1 -2
  113. package/dist/types-ts4.5/ui/link-picker/form-footer/index.d.ts +1 -2
  114. package/dist/types-ts4.5/ui/link-picker/form-footer/utils.d.ts +1 -1
  115. package/dist/types-ts4.5/ui/link-picker/index.d.ts +1 -13
  116. package/dist/types-ts4.5/ui/link-picker/link-search-list/index.d.ts +1 -1
  117. package/dist/types-ts4.5/ui/link-picker/{list-item → link-search-list/list-item}/index.d.ts +1 -1
  118. package/dist/types-ts4.5/ui/link-picker/link-search-list/use-track-results-shown/index.d.ts +1 -1
  119. package/dist/types-ts4.5/ui/link-picker/styled.d.ts +0 -5
  120. package/dist/types-ts4.5/ui/link-picker/{conditional-spotlight-target-wrapper → text-input/conditional-spotlight-target-wrapper}/index.d.ts +1 -2
  121. package/dist/types-ts4.5/ui/link-picker/text-input/index.d.ts +1 -1
  122. package/dist/types-ts4.5/ui/link-picker/text-input/utils.d.ts +3 -0
  123. package/dist/types-ts4.5/ui/link-picker/utils.d.ts +1 -5
  124. package/dist/types-ts4.5/ui/loader-fallback/styled.d.ts +3 -0
  125. package/package.json +25 -5
  126. /package/dist/cjs/{ui → common}/types.js +0 -0
  127. /package/dist/cjs/ui/{scrolling-tabs → link-picker/scrolling-tabs}/scrolling-tabs.js +0 -0
  128. /package/dist/cjs/ui/{scrolling-tabs → link-picker/scrolling-tabs}/styles.js +0 -0
  129. /package/dist/cjs/ui/link-picker/{conditional-spotlight-target-wrapper → text-input/conditional-spotlight-target-wrapper}/index.js +0 -0
  130. /package/dist/es2019/{ui → common}/types.js +0 -0
  131. /package/dist/es2019/ui/{scrolling-tabs → link-picker/scrolling-tabs}/scrolling-tabs.js +0 -0
  132. /package/dist/es2019/ui/{scrolling-tabs → link-picker/scrolling-tabs}/styles.js +0 -0
  133. /package/dist/es2019/ui/link-picker/{conditional-spotlight-target-wrapper → text-input/conditional-spotlight-target-wrapper}/index.js +0 -0
  134. /package/dist/esm/{ui → common}/types.js +0 -0
  135. /package/dist/esm/ui/{scrolling-tabs → link-picker/scrolling-tabs}/scrolling-tabs.js +0 -0
  136. /package/dist/esm/ui/{scrolling-tabs → link-picker/scrolling-tabs}/styles.js +0 -0
  137. /package/dist/esm/ui/link-picker/{conditional-spotlight-target-wrapper → text-input/conditional-spotlight-target-wrapper}/index.js +0 -0
  138. /package/dist/types/ui/link-picker/{list-item → link-search-list/list-item}/styled.d.ts +0 -0
  139. /package/dist/types/ui/{scrolling-tabs → link-picker/scrolling-tabs}/index.d.ts +0 -0
  140. /package/dist/types/ui/{scrolling-tabs → link-picker/scrolling-tabs}/scrolling-tabs.d.ts +0 -0
  141. /package/dist/types/ui/{scrolling-tabs → link-picker/scrolling-tabs}/styles.d.ts +0 -0
  142. /package/dist/types-ts4.5/ui/link-picker/{list-item → link-search-list/list-item}/styled.d.ts +0 -0
  143. /package/dist/types-ts4.5/ui/{scrolling-tabs → link-picker/scrolling-tabs}/index.d.ts +0 -0
  144. /package/dist/types-ts4.5/ui/{scrolling-tabs → link-picker/scrolling-tabs}/scrolling-tabs.d.ts +0 -0
  145. /package/dist/types-ts4.5/ui/{scrolling-tabs → link-picker/scrolling-tabs}/styles.d.ts +0 -0
@@ -10,12 +10,12 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
10
10
  var _react = require("react");
11
11
  var _react2 = require("@emotion/react");
12
12
  var _form = require("@atlaskit/form");
13
- var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
14
- var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
15
13
  var _selectClear = _interopRequireDefault(require("@atlaskit/icon/glyph/select-clear"));
16
- var _conditionalSpotlightTargetWrapper = require("../conditional-spotlight-target-wrapper");
17
- var _utils = require("../utils");
14
+ var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
15
+ var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
16
+ var _conditionalSpotlightTargetWrapper = require("./conditional-spotlight-target-wrapper");
18
17
  var _styled = require("./styled");
18
+ var _utils = require("./utils");
19
19
  var _excluded = ["name", "label", "autoFocus", "onRedo", "onUndo", "onKeyDown", "onClear", "clearLabel", "error", "spotlightTargetName"];
20
20
  /** @jsx jsx */
21
21
  var testIds = {
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isUndoEvent = exports.isRedoEvent = void 0;
7
+ var _userAgent = require("@atlaskit/linking-common/user-agent");
8
+ var KeyZCode = 90;
9
+ var KeyYCode = 89;
10
+ var isUndoEvent = function isUndoEvent(e) {
11
+ var _browser = (0, _userAgent.browser)(),
12
+ mac = _browser.mac;
13
+ return e.keyCode === KeyZCode && (
14
+ // cmd + z for mac
15
+ mac && e.metaKey && !e.shiftKey ||
16
+ // ctrl + z for non-mac
17
+ !mac && e.ctrlKey);
18
+ };
19
+ exports.isUndoEvent = isUndoEvent;
20
+ var isRedoEvent = function isRedoEvent(e) {
21
+ var _browser2 = (0, _userAgent.browser)(),
22
+ mac = _browser2.mac;
23
+ return (
24
+ // ctrl + y for non-mac
25
+ !mac && e.ctrlKey && e.keyCode === KeyYCode || mac && e.metaKey && e.shiftKey && e.keyCode === KeyZCode || e.ctrlKey && e.shiftKey && e.keyCode === KeyZCode
26
+ );
27
+ };
28
+ exports.isRedoEvent = isRedoEvent;
@@ -8,8 +8,8 @@ exports.TrackMount = TrackMount;
8
8
  var _react = require("react");
9
9
  var _analyticsNext = require("@atlaskit/analytics-next");
10
10
  var _experiences = require("../../../common/analytics/experiences");
11
- var _analytics = _interopRequireDefault(require("../../../common/utils/analytics/analytics.codegen"));
12
11
  var _constants = require("../../../common/constants");
12
+ var _analytics = _interopRequireDefault(require("../../../common/utils/analytics/analytics.codegen"));
13
13
  var _sessionProvider = require("../../../controllers/session-provider");
14
14
  /** @jsx jsx */
15
15
 
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.TrackTabViewed = TrackTabViewed;
8
8
  var _react = require("react");
9
9
  var _analyticsNext = require("@atlaskit/analytics-next");
10
- var _analytics = _interopRequireDefault(require("../../../common/utils/analytics/analytics.codegen"));
11
10
  var _constants = require("../../../common/constants");
11
+ var _analytics = _interopRequireDefault(require("../../../common/utils/analytics/analytics.codegen"));
12
12
  /** @jsx jsx */
13
13
 
14
14
  function TrackTabViewed(_ref) {
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.transformTimeStamp = void 0;
8
- var _messages = require("./messages");
8
+ var _isYesterday = _interopRequireDefault(require("date-fns/isYesterday"));
9
9
  var _date = require("../../common/utils/date");
10
10
  var _dateUtils = require("../../common/utils/dateUtils");
11
- var _isYesterday = _interopRequireDefault(require("date-fns/isYesterday"));
11
+ var _messages = require("./messages");
12
12
  var formatTime = function formatTime(timeStamp, intl) {
13
13
  var isAbsolute = (0, _date.isMoreThanOneWeekAgo)(timeStamp);
14
14
  if (isAbsolute) {
@@ -5,34 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getDataSource = void 0;
7
7
  exports.getScreenReaderText = getScreenReaderText;
8
- exports.isUndoEvent = exports.isRedoEvent = exports.handleNavKeyDown = void 0;
9
- var _userAgent = require("@atlaskit/linking-common/user-agent");
10
8
  var _transformTimeStamp = require("./transformTimeStamp");
11
- var KeyZCode = 90;
12
- var KeyYCode = 89;
13
- var isUndoEvent = function isUndoEvent(e) {
14
- var _browser = (0, _userAgent.browser)(),
15
- mac = _browser.mac;
16
- return e.keyCode === KeyZCode && (
17
- // cmd + z for mac
18
- mac && e.metaKey && !e.shiftKey ||
19
- // ctrl + z for non-mac
20
- !mac && e.ctrlKey);
21
- };
22
- exports.isUndoEvent = isUndoEvent;
23
- var isRedoEvent = function isRedoEvent(e) {
24
- var _browser2 = (0, _userAgent.browser)(),
25
- mac = _browser2.mac;
26
- return (
27
- // ctrl + y for non-mac
28
- !mac && e.ctrlKey && e.keyCode === KeyYCode || mac && e.metaKey && e.shiftKey && e.keyCode === KeyZCode || e.ctrlKey && e.shiftKey && e.keyCode === KeyZCode
29
- );
30
- };
31
-
32
9
  /**
33
10
  * Retrieve the data source for a link given the item and the plugin that resolved it
34
11
  */
35
- exports.isRedoEvent = isRedoEvent;
36
12
  var getDataSource = function getDataSource(item, plugin) {
37
13
  var _ref, _item$meta$source, _item$meta, _plugin$meta;
38
14
  return (_ref = (_item$meta$source = (_item$meta = item.meta) === null || _item$meta === void 0 ? void 0 : _item$meta.source) !== null && _item$meta$source !== void 0 ? _item$meta$source : plugin === null || plugin === void 0 ? void 0 : (_plugin$meta = plugin.meta) === null || _plugin$meta === void 0 ? void 0 : _plugin$meta.source) !== null && _ref !== void 0 ? _ref : 'unknown';
@@ -48,27 +24,4 @@ function getScreenReaderText(items, selectedIndex, intl) {
48
24
  var date = (0, _transformTimeStamp.transformTimeStamp)(intl, lastViewedDate, lastUpdatedDate);
49
25
  return [name, container, date].filter(Boolean).join(', ');
50
26
  }
51
- }
52
- var handleNavKeyDown = function handleNavKeyDown(event, itemsLength, activeIndex) {
53
- var updatedIndex = activeIndex;
54
- switch (event.key) {
55
- case 'ArrowDown':
56
- event.preventDefault();
57
- updatedIndex = (activeIndex + 1) % itemsLength;
58
- break;
59
- case 'ArrowUp':
60
- event.preventDefault();
61
- updatedIndex = activeIndex > 0 ? activeIndex - 1 : itemsLength - 1;
62
- break;
63
- case 'Home':
64
- event.preventDefault();
65
- updatedIndex = 0;
66
- break;
67
- case 'End':
68
- event.preventDefault();
69
- updatedIndex = itemsLength - 1;
70
- break;
71
- }
72
- return updatedIndex;
73
- };
74
- exports.handleNavKeyDown = handleNavKeyDown;
27
+ }
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.LoaderFallback = void 0;
8
8
  var _react = require("@emotion/react");
9
9
  var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
10
- var _styled = require("../link-picker/styled");
10
+ var _styled = require("./styled");
11
11
  /** @jsx jsx */
12
12
 
13
13
  /**
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.rootContainerStylesForLoaderWithoutDisplaytext = exports.rootContainerStylesForLoaderWithDisplaytext = void 0;
8
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
+ var _react = require("@emotion/react");
10
+ var _styled = require("../link-picker/styled");
11
+ var _templateObject, _templateObject2, _templateObject3; // eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
12
+ /** Link Picker loader / skeleton will be taller in height when displayText field is shown */ // See lazy-load-height example to verify these
13
+ var LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_DISPLAYTEXT = 142;
14
+ var LINK_PICKER_MIN_HEIGHT_IN_PX_WITH_DISPLAYTEXT = 220;
15
+ var rootContainerStylesForLoader = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", "\n display: flex;\n align-items: center;\n justify-content: center;\n"])), _styled.rootContainerStyles);
16
+ var rootContainerStylesForLoaderWithDisplaytext = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n min-height: ", "px;\n"])), rootContainerStylesForLoader, LINK_PICKER_MIN_HEIGHT_IN_PX_WITH_DISPLAYTEXT);
17
+
18
+ /** Link Picker loader / skeleton will be shorter in height when displayText field isn't shown */
19
+ exports.rootContainerStylesForLoaderWithDisplaytext = rootContainerStylesForLoaderWithDisplaytext;
20
+ var rootContainerStylesForLoaderWithoutDisplaytext = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n min-height: ", "px;\n"])), rootContainerStylesForLoader, LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_DISPLAYTEXT);
21
+ exports.rootContainerStylesForLoaderWithoutDisplaytext = rootContainerStylesForLoaderWithoutDisplaytext;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.25.3",
3
+ "version": "1.25.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,8 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useContext, useMemo, useRef, useState } from 'react';
3
3
  import { AnalyticsListener } from '@atlaskit/analytics-next';
4
- import { ANALYTICS_CHANNEL } from '../constants';
5
4
  import { normalizeUrl } from '@atlaskit/linking-common/url';
5
+ import { ANALYTICS_CHANNEL } from '../constants';
6
6
  const DEFAULT_CONTEXT_ATTRIBUTES = {
7
7
  linkState: 'newLink',
8
8
  linkFieldContent: null,
@@ -1,9 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useRef } from 'react';
3
3
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
- import { ANALYTICS_CHANNEL } from '../constants';
5
4
  import createEventPayload from '../../common/utils/analytics/analytics.codegen';
6
- import { useLinkPickerAnalytics } from '.';
5
+ import { ANALYTICS_CHANNEL } from '../constants';
6
+ import { useLinkPickerAnalytics } from './index';
7
7
  const isEventWithInputType = e => {
8
8
  return typeof e === 'object' && e !== null && 'inputType' in e;
9
9
  };
@@ -1,2 +1,3 @@
1
1
  export const ANALYTICS_CHANNEL = 'media';
2
- export const COMPONENT_NAME = 'linkPicker';
2
+ export const COMPONENT_NAME = 'linkPicker';
3
+ export const RECENT_SEARCH_LIST_SIZE = 5;
@@ -0,0 +1,22 @@
1
+ export const handleNavKeyDown = (event, itemsLength, activeIndex) => {
2
+ let updatedIndex = activeIndex;
3
+ switch (event.key) {
4
+ case 'ArrowDown':
5
+ event.preventDefault();
6
+ updatedIndex = (activeIndex + 1) % itemsLength;
7
+ break;
8
+ case 'ArrowUp':
9
+ event.preventDefault();
10
+ updatedIndex = activeIndex > 0 ? activeIndex - 1 : itemsLength - 1;
11
+ break;
12
+ case 'Home':
13
+ event.preventDefault();
14
+ updatedIndex = 0;
15
+ break;
16
+ case 'End':
17
+ event.preventDefault();
18
+ updatedIndex = itemsLength - 1;
19
+ break;
20
+ }
21
+ return updatedIndex;
22
+ };
@@ -1,12 +1,11 @@
1
- import { useEffect, useMemo, useState, useCallback } from 'react';
2
- import { convertToError } from '@atlaskit/frontend-utilities/convert-to-error';
1
+ import { useCallback, useEffect, useMemo, useState } from 'react';
3
2
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
- import { RECENT_SEARCH_LIST_SIZE } from '../../ui/link-picker';
3
+ import { convertToError } from '@atlaskit/frontend-utilities/convert-to-error';
4
+ import { useLinkPickerAnalytics } from '../../common/analytics';
5
+ import { ANALYTICS_CHANNEL, RECENT_SEARCH_LIST_SIZE } from '../../common/constants';
5
6
  import createEventPayload from '../../common/utils/analytics/analytics.codegen';
6
- import { ANALYTICS_CHANNEL } from '../../common/constants';
7
- import { CancellationError, resolvePluginUpdates } from './utils';
8
7
  import { usePluginReducer } from './reducer';
9
- import { useLinkPickerAnalytics } from '../../common/analytics';
8
+ import { CancellationError, resolvePluginUpdates } from './utils';
10
9
  export function usePlugins(state, activeTab, plugins) {
11
10
  var _activePlugin$tabKey;
12
11
  const {
@@ -1,8 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
- import EmptyState from '@atlaskit/empty-state';
4
3
  import { defineMessages, useIntl } from 'react-intl-next';
4
+ import EmptyState from '@atlaskit/empty-state';
5
5
  import { GenericErrorSVG } from '../../../common/generic-error-svg';
6
+ // eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
6
7
  import { rootContainerStyles } from '../../link-picker/styled';
7
8
  const messages = defineMessages({
8
9
  heading: {
@@ -1,11 +1,11 @@
1
1
  import React, { useCallback } from 'react';
2
2
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
3
- import createEventPayload from '../../common/utils/analytics/analytics.codegen';
4
- import { ANALYTICS_CHANNEL } from '../../common/constants';
5
3
  import { failUfoExperience, ufoExperience } from '../../common/analytics/experiences';
4
+ import { ANALYTICS_CHANNEL } from '../../common/constants';
5
+ import createEventPayload from '../../common/utils/analytics/analytics.codegen';
6
6
  import { useLinkPickerSessionId } from '../../controllers/session-provider';
7
- import { ErrorBoundaryFallback } from './error-boundary-fallback';
8
7
  import { BaseErrorBoundary } from './error-boundary-base';
8
+ import { ErrorBoundaryFallback } from './error-boundary-fallback';
9
9
  export function ErrorBoundary({
10
10
  children
11
11
  }) {
@@ -1,12 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import { AnalyticsContext } from '@atlaskit/analytics-next';
3
2
  import React, { memo } from 'react';
4
- import { LazySuspense, lazyForPaint } from 'react-loosely-lazy';
3
+ import { lazyForPaint, LazySuspense } from 'react-loosely-lazy';
4
+ import { AnalyticsContext } from '@atlaskit/analytics-next';
5
5
  import { COMPONENT_NAME } from '../common/constants';
6
+ import { LinkPickerSessionProvider } from '../controllers/session-provider';
6
7
  import { name as packageName, version as packageVersion } from '../version.json';
7
8
  import { ErrorBoundary } from './error-boundary';
8
9
  import { LoaderFallback } from './loader-fallback';
9
- import { LinkPickerSessionProvider } from '../controllers/session-provider';
10
10
  import { MessagesProvider } from './messages-provider';
11
11
  export const testIds = {
12
12
  linkPickerRoot: 'link-picker-root'
@@ -1,4 +1,4 @@
1
- import React, { forwardRef, memo, useState, useEffect } from 'react';
1
+ import React, { forwardRef, memo, useEffect, useState } from 'react';
2
2
 
3
3
  // How to use:
4
4
  // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions#Preferring_specialized_live_region_roles
@@ -1,13 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
- import { jsx } from '@emotion/react';
4
3
  import { memo } from 'react';
5
- import { useIntl, defineMessages } from 'react-intl-next';
4
+ import { jsx } from '@emotion/react';
5
+ import { defineMessages, useIntl } from 'react-intl-next';
6
6
  import Button, { ButtonGroup } from '@atlaskit/button';
7
7
  import EditorAddIcon from '@atlaskit/icon/glyph/editor/add';
8
- import { formFooterStyles, formFooterActionStyles } from './styled';
9
- import { checkSubmitDisabled } from './utils';
10
8
  import { UnauthenticatedError } from '../../../common/utils/errors';
9
+ import { formFooterActionStyles, formFooterStyles } from './styled';
10
+ import { checkSubmitDisabled } from './utils';
11
11
  const messages = defineMessages({
12
12
  cancelButton: {
13
13
  id: 'fabric.linkPicker.button.cancel',
@@ -1,40 +1,38 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
- import { Fragment, useCallback, useLayoutEffect, useReducer, memo } from 'react';
3
+ import { Fragment, memo, useCallback, useLayoutEffect, useReducer } from 'react';
4
4
  import { jsx } from '@emotion/react';
5
- import { useIntl, FormattedMessage } from 'react-intl-next';
5
+ import { FormattedMessage, useIntl } from 'react-intl-next';
6
6
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
7
- import EditorSearchIcon from '@atlaskit/icon/glyph/editor/search';
7
+ import { isSafeUrl, normalizeUrl } from '@atlaskit/linking-common/url';
8
+ import { browser } from '@atlaskit/linking-common/user-agent';
9
+ import Spinner from '@atlaskit/spinner/spinner';
8
10
  import Tabs, { Tab, TabList } from '@atlaskit/tabs';
9
11
  import VisuallyHidden from '@atlaskit/visually-hidden';
10
- import Spinner from '@atlaskit/spinner/spinner';
11
- import createEventPayload from '../../common/utils/analytics/analytics.codegen';
12
- import { ANALYTICS_CHANNEL } from '../../common/constants';
13
12
  import { useLinkPickerAnalytics, withInputFieldTracking, withLinkPickerAnalyticsContext } from '../../common/analytics';
14
- import { normalizeUrl, isSafeUrl } from '@atlaskit/linking-common/url';
15
- import { browser } from '@atlaskit/linking-common/user-agent';
13
+ import { ANALYTICS_CHANNEL } from '../../common/constants';
14
+ import createEventPayload from '../../common/utils/analytics/analytics.codegen';
15
+ import { handleNavKeyDown } from '../../common/utils/handleNavKeyDown';
16
+ import { useFixHeight } from '../../controllers/use-fix-height';
16
17
  import { usePlugins } from '../../services/use-plugins';
17
18
  import { useSearchQuery } from '../../services/use-search-query';
18
- import { useFixHeight } from '../../controllers/use-fix-height';
19
- import { searchMessages, linkMessages, formMessages, linkTextMessages } from './messages';
20
- import { TextInput, testIds as textFieldTestIds } from './text-input';
21
- import { rootContainerStyles, searchIconStyles, tabsWrapperStyles, flexColumnStyles, formFooterMargin } from './styled';
22
19
  import { Announcer } from './announcer';
23
- import { ScrollingTabList } from '../scrolling-tabs';
24
- import { LinkSearchList, testIds as listTestIds } from './link-search-list';
25
- import { LinkSearchError, testIds as searchErrorTestIds } from './link-search-error';
26
20
  import { FormFooter, testIds as formFooterTestIds } from './form-footer';
27
- import { getDataSource, getScreenReaderText, handleNavKeyDown } from './utils';
28
- import { TrackTabViewed } from './track-tab-viewed';
29
- import { TrackMount } from './track-mount';
21
+ import { LinkSearchError, testIds as searchErrorTestIds } from './link-search-error';
22
+ import { LinkSearchList, testIds as listTestIds } from './link-search-list';
30
23
  import { spinnerContainerStyles } from './link-search-list/styled';
31
- export const RECENT_SEARCH_LIST_SIZE = 5;
24
+ import { formMessages, linkMessages, linkTextMessages, searchMessages } from './messages';
25
+ import { ScrollingTabList } from './scrolling-tabs';
26
+ import { flexColumnStyles, formFooterMargin, rootContainerStyles, tabsWrapperStyles } from './styled';
27
+ import { testIds as textFieldTestIds, TextInput } from './text-input';
28
+ import { TrackMount } from './track-mount';
29
+ import { TrackTabViewed } from './track-tab-viewed';
30
+ import { getDataSource, getScreenReaderText } from './utils';
32
31
  export const testIds = {
33
32
  linkPickerRoot: 'link-picker-root',
34
33
  linkPicker: 'link-picker',
35
34
  urlInputField: 'link-url',
36
35
  textInputField: 'link-text',
37
- searchIcon: 'link-picker-search-icon',
38
36
  ...formFooterTestIds,
39
37
  ...searchErrorTestIds,
40
38
  ...listTestIds,
@@ -289,13 +287,6 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
289
287
  // as the Aria design pattern for combobox does not work in this case
290
288
  // for details: https://a11y-internal.atlassian.net/browse/AK-740
291
289
  const screenReaderText = browser().safari && getScreenReaderText(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
292
- const searchIcon = isActivePlugin && jsx("span", {
293
- css: searchIconStyles,
294
- "data-testid": testIds.searchIcon
295
- }, jsx(EditorSearchIcon, {
296
- size: "medium",
297
- label: ''
298
- }));
299
290
  const tabList = jsx(TabList, null, tabs.map(tab => jsx(Tab, {
300
291
  key: tab.tabTitle,
301
292
  testId: testIds.tabItem
@@ -320,7 +311,6 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
320
311
  placeholder: intl.formatMessage(messages.linkPlaceholder),
321
312
  value: url,
322
313
  autoFocus: true,
323
- elemBeforeInput: searchIcon,
324
314
  clearLabel: intl.formatMessage(formMessages.clearLink),
325
315
  "aria-expanded": true,
326
316
  "aria-autocomplete": "list",
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
3
  import { jsx } from '@emotion/react';
4
- import { useIntl, FormattedMessage, defineMessages } from 'react-intl-next';
4
+ import { defineMessages, FormattedMessage, useIntl } from 'react-intl-next';
5
5
  import Button from '@atlaskit/button';
6
6
  import EmptyState from '@atlaskit/empty-state';
7
7
  import { GenericErrorSVG } from '../../../common/generic-error-svg';
@@ -2,16 +2,16 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
3
  import { forwardRef, Fragment, useCallback, useRef } from 'react';
4
4
  import { jsx } from '@emotion/react';
5
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
5
  import { defineMessages, FormattedMessage } from 'react-intl-next';
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
7
  import Spinner from '@atlaskit/spinner';
8
8
  import VisuallyHidden from '@atlaskit/visually-hidden';
9
- import { LinkSearchListItem, testIds as searchResultItemTestIds } from '../list-item';
10
- import { listContainerStyles, spinnerContainerStyles, listStyles, listTitleStyles } from './styled';
9
+ import { handleNavKeyDown } from '../../../common/utils/handleNavKeyDown';
11
10
  import { NoResults, testIds as noResultsTestIds } from './link-search-no-results';
12
- import { useTrackResultsShown } from './use-track-results-shown';
13
- import { handleNavKeyDown } from '../utils';
14
11
  import { emptyStateNoResultsWrapper } from './link-search-no-results/styled';
12
+ import { LinkSearchListItem, testIds as searchResultItemTestIds } from './list-item';
13
+ import { listContainerStyles, listStyles, listTitleStyles, spinnerContainerStyles } from './styled';
14
+ import { useTrackResultsShown } from './use-track-results-shown';
15
15
  export const messages = defineMessages({
16
16
  titleRecentlyViewed: {
17
17
  id: 'fabric.linkPicker.listTitle.recentlyViewed',
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
+ import { defineMessages, useIntl } from 'react-intl-next';
3
4
  import EmptyState from '@atlaskit/empty-state';
4
- import { useIntl, defineMessages } from 'react-intl-next';
5
5
  import { NoResultsSVG } from './no-results-svg';
6
6
  import { emptyStateWrapperStyles } from './styled';
7
7
  export const messages = defineMessages({
@@ -2,8 +2,9 @@
2
2
  import { forwardRef, Fragment } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  import { useIntl } from 'react-intl-next';
5
- import { transformTimeStamp } from '../transformTimeStamp';
6
- import { itemNameStyles, itemIconStyles, listItemContextStyles, listItemNameStyles, composeListItemStyles, imgStyles, listItemContainerStyles, listItemContainerInnerStyles } from './styled';
5
+ /* eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports */
6
+ import { transformTimeStamp } from '../../transformTimeStamp';
7
+ import { composeListItemStyles, imgStyles, itemIconStyles, itemNameStyles, listItemContainerInnerStyles, listItemContainerStyles, listItemContextStyles, listItemNameStyles } from './styled';
7
8
  export const testIds = {
8
9
  searchResultItem: 'link-search-list-item',
9
10
  searchResultIcon: 'link-search-list-item-icon'
@@ -1,8 +1,8 @@
1
1
  import { css } from '@emotion/react';
2
- import { B50, N300, N800, N20, N200, B400, B100 } from '@atlaskit/theme/colors';
2
+ import { B100, B400, B50, N20, N200, N300, N800 } from '@atlaskit/theme/colors';
3
+ import { fontSize, fontSizeSmall } from '@atlaskit/theme/constants';
3
4
  // AFP-2532 TODO: Fix automatic suppressions below
4
5
  // eslint-disable-next-line @atlassian/tangerine/import/entry-points
5
- import { fontSizeSmall, fontSize } from '@atlaskit/theme';
6
6
  export const relativeFontSizeToBase16 = px => {
7
7
  if (typeof px === 'string') {
8
8
  px = parseInt(px);
@@ -1,4 +1,5 @@
1
1
  import { css } from '@emotion/react';
2
+
2
3
  // AFP-2532 TODO: Fix automatic suppressions below
3
4
  // eslint-disable-next-line @atlassian/tangerine/import/entry-points
4
5
  import { typography } from '@atlaskit/theme';
@@ -1,12 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
- import React, { useRef, useMemo, useState, useCallback } from 'react';
3
+ import React, { useCallback, useMemo, useRef, useState } from 'react';
4
4
  import { jsx } from '@emotion/react';
5
5
  import Button from '@atlaskit/button';
6
6
  import ChevronLeftIcon from '@atlaskit/icon/glyph/chevron-left';
7
7
  import ChevronRightIcon from '@atlaskit/icon/glyph/chevron-right';
8
- import { scrollBack, scrollForward, calculateConditionalButtons, getTabList, createGhost } from './scrolling-tabs';
9
- import { containerStyles, scrollingContainerStyles, nextButtonStyles, backButtonStyles } from './styles';
8
+ import { calculateConditionalButtons, createGhost, getTabList, scrollBack, scrollForward } from './scrolling-tabs';
9
+ import { backButtonStyles, containerStyles, nextButtonStyles, scrollingContainerStyles } from './styles';
10
10
  function isTouchDevice() {
11
11
  return 'ontouchstart' in window ||
12
12
  // eslint-disable-next-line compat/compat
@@ -16,6 +16,8 @@ const initialConditionalButtonsState = {
16
16
  back: false,
17
17
  forward: false
18
18
  };
19
+
20
+ /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
19
21
  export const ScrollingTabList = props => {
20
22
  const ref = useRef(null);
21
23
  const [conditionalButtons, setConditionalButtons] = useState(initialConditionalButtonsState);
@@ -75,6 +77,7 @@ export const ScrollingTabList = props => {
75
77
  }
76
78
  return () => {
77
79
  if (scrollingContainer) {
80
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
78
81
  scrollingContainer.removeEventListener('scroll', handleConditionalButtonsChange);
79
82
  }
80
83
  if (tabs.length) {
@@ -1,11 +1,6 @@
1
1
  import { css } from '@emotion/react';
2
- import { N500 } from '@atlaskit/theme/colors';
3
2
  const LINK_PICKER_WIDTH_IN_PX = 342;
4
3
 
5
- // See lazy-load-height example to verify these
6
- const LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_DISPLAYTEXT = 142;
7
- const LINK_PICKER_MIN_HEIGHT_IN_PX_WITH_DISPLAYTEXT = 220;
8
-
9
4
  /**
10
5
  * Half padding on the top as the form field has a `gridSize()` margin top that cannot be overridden
11
6
  */
@@ -16,31 +11,6 @@ export const rootContainerStyles = css`
16
11
  box-sizing: border-box;
17
12
  line-height: initial;
18
13
  `;
19
-
20
- /** Styles for skeleton element when Link Picker loading */
21
- const rootContainerStylesForLoader = css`
22
- ${rootContainerStyles}
23
- display: flex;
24
- align-items: center;
25
- justify-content: center;
26
- `;
27
-
28
- /** Link Picker loader / skeleton will be taller in height when displayText field is shown */
29
- export const rootContainerStylesForLoaderWithDisplaytext = css`
30
- ${rootContainerStylesForLoader}
31
- min-height: ${LINK_PICKER_MIN_HEIGHT_IN_PX_WITH_DISPLAYTEXT}px;
32
- `;
33
-
34
- /** Link Picker loader / skeleton will be shorter in height when displayText field isn't shown */
35
- export const rootContainerStylesForLoaderWithoutDisplaytext = css`
36
- ${rootContainerStylesForLoader}
37
- min-height: ${LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_DISPLAYTEXT}px;
38
- `;
39
- export const searchIconStyles = css`
40
- margin-left: ${"var(--ds-space-050, 4px)"};
41
- color: ${`var(--ds-icon, ${N500})`};
42
- cursor: default;
43
- `;
44
14
  export const tabsWrapperStyles = css`
45
15
  margin-top: ${"var(--ds-space-150, 12px)"};
46
16
  margin-left: calc(-1 * ${"var(--ds-space-100, 8px)"});
@@ -1,14 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
- import { useCallback, useRef, Fragment } from 'react';
3
+ import { Fragment, useCallback, useRef } from 'react';
4
4
  import { jsx } from '@emotion/react';
5
5
  import { ErrorMessage, Field } from '@atlaskit/form';
6
- import Tooltip from '@atlaskit/tooltip';
7
- import Textfield from '@atlaskit/textfield';
8
6
  import Selectclear from '@atlaskit/icon/glyph/select-clear';
9
- import { ConditionalSpotlightTargetWrapper } from '../conditional-spotlight-target-wrapper';
10
- import { isRedoEvent, isUndoEvent } from '../utils';
7
+ import Textfield from '@atlaskit/textfield';
8
+ import Tooltip from '@atlaskit/tooltip';
9
+ import { ConditionalSpotlightTargetWrapper } from './conditional-spotlight-target-wrapper';
11
10
  import { clearTextButtonStyles, fieldStyles } from './styled';
11
+ import { isRedoEvent, isUndoEvent } from './utils';
12
12
  export const testIds = {
13
13
  urlError: 'link-error',
14
14
  clearUrlButton: 'clear-text'
@@ -0,0 +1,22 @@
1
+ import { browser } from '@atlaskit/linking-common/user-agent';
2
+ const KeyZCode = 90;
3
+ const KeyYCode = 89;
4
+ export const isUndoEvent = e => {
5
+ const {
6
+ mac
7
+ } = browser();
8
+ return e.keyCode === KeyZCode && (
9
+ // cmd + z for mac
10
+ mac && e.metaKey && !e.shiftKey ||
11
+ // ctrl + z for non-mac
12
+ !mac && e.ctrlKey);
13
+ };
14
+ export const isRedoEvent = e => {
15
+ const {
16
+ mac
17
+ } = browser();
18
+ return (
19
+ // ctrl + y for non-mac
20
+ !mac && e.ctrlKey && e.keyCode === KeyYCode || mac && e.metaKey && e.shiftKey && e.keyCode === KeyZCode || e.ctrlKey && e.shiftKey && e.keyCode === KeyZCode
21
+ );
22
+ };
@@ -2,8 +2,8 @@
2
2
  import { useLayoutEffect } from 'react';
3
3
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
4
  import { succeedUfoExperience, ufoExperience } from '../../../common/analytics/experiences';
5
- import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
6
5
  import { ANALYTICS_CHANNEL } from '../../../common/constants';
6
+ import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
7
7
  import { useLinkPickerSessionId } from '../../../controllers/session-provider';
8
8
 
9
9
  /**