@atlaskit/link-picker 1.25.1 → 1.25.3

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 (90) hide show
  1. package/.eslintrc.js +18 -0
  2. package/CHANGELOG.md +12 -0
  3. package/compass.yml +43 -0
  4. package/dist/cjs/common/generic-error-svg/index.js +2 -3
  5. package/dist/cjs/controllers/use-fix-height/index.js +2 -3
  6. package/dist/cjs/ui/error-boundary/error-boundary-fallback/index.js +2 -2
  7. package/dist/cjs/ui/error-boundary/index.js +5 -6
  8. package/dist/cjs/ui/index.js +11 -8
  9. package/dist/cjs/ui/link-picker/announcer.js +4 -5
  10. package/dist/cjs/ui/link-picker/form-footer/index.js +4 -5
  11. package/dist/cjs/ui/link-picker/index.js +21 -22
  12. package/dist/cjs/ui/link-picker/link-search-error/index.js +4 -5
  13. package/dist/cjs/ui/link-picker/link-search-list/index.js +8 -13
  14. package/dist/cjs/ui/link-picker/link-search-list/link-search-no-results/index.js +4 -5
  15. package/dist/cjs/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.js +2 -3
  16. package/dist/cjs/ui/link-picker/list-item/index.js +44 -42
  17. package/dist/cjs/ui/link-picker/text-input/index.js +2 -3
  18. package/dist/cjs/ui/link-picker/track-mount/index.js +2 -4
  19. package/dist/cjs/ui/link-picker/track-tab-viewed/index.js +2 -4
  20. package/dist/cjs/ui/scrolling-tabs/index.js +2 -4
  21. package/dist/cjs/version.json +1 -1
  22. package/dist/es2019/common/generic-error-svg/index.js +2 -3
  23. package/dist/es2019/controllers/use-fix-height/index.js +2 -3
  24. package/dist/es2019/ui/error-boundary/error-boundary-fallback/index.js +1 -1
  25. package/dist/es2019/ui/error-boundary/index.js +7 -6
  26. package/dist/es2019/ui/index.js +7 -4
  27. package/dist/es2019/ui/link-picker/announcer.js +2 -3
  28. package/dist/es2019/ui/link-picker/form-footer/index.js +2 -3
  29. package/dist/es2019/ui/link-picker/index.js +13 -14
  30. package/dist/es2019/ui/link-picker/link-search-error/index.js +3 -4
  31. package/dist/es2019/ui/link-picker/link-search-list/index.js +7 -8
  32. package/dist/es2019/ui/link-picker/link-search-list/link-search-no-results/index.js +3 -4
  33. package/dist/es2019/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.js +2 -3
  34. package/dist/es2019/ui/link-picker/list-item/index.js +40 -39
  35. package/dist/es2019/ui/link-picker/text-input/index.js +2 -3
  36. package/dist/es2019/ui/link-picker/track-mount/index.js +2 -3
  37. package/dist/es2019/ui/link-picker/track-tab-viewed/index.js +2 -3
  38. package/dist/es2019/ui/scrolling-tabs/index.js +1 -2
  39. package/dist/es2019/version.json +1 -1
  40. package/dist/esm/common/generic-error-svg/index.js +2 -3
  41. package/dist/esm/controllers/use-fix-height/index.js +2 -3
  42. package/dist/esm/ui/error-boundary/error-boundary-fallback/index.js +1 -1
  43. package/dist/esm/ui/error-boundary/index.js +6 -6
  44. package/dist/esm/ui/index.js +10 -6
  45. package/dist/esm/ui/link-picker/announcer.js +2 -3
  46. package/dist/esm/ui/link-picker/form-footer/index.js +2 -3
  47. package/dist/esm/ui/link-picker/index.js +12 -13
  48. package/dist/esm/ui/link-picker/link-search-error/index.js +3 -4
  49. package/dist/esm/ui/link-picker/link-search-list/index.js +7 -9
  50. package/dist/esm/ui/link-picker/link-search-list/link-search-no-results/index.js +3 -4
  51. package/dist/esm/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.js +2 -3
  52. package/dist/esm/ui/link-picker/list-item/index.js +40 -39
  53. package/dist/esm/ui/link-picker/text-input/index.js +2 -3
  54. package/dist/esm/ui/link-picker/track-mount/index.js +2 -3
  55. package/dist/esm/ui/link-picker/track-tab-viewed/index.js +2 -3
  56. package/dist/esm/ui/scrolling-tabs/index.js +1 -2
  57. package/dist/esm/version.json +1 -1
  58. package/dist/types/common/generic-error-svg/index.d.ts +1 -2
  59. package/dist/types/controllers/use-fix-height/index.d.ts +1 -2
  60. package/dist/types/ui/error-boundary/index.d.ts +4 -5
  61. package/dist/types/ui/index.d.ts +0 -1
  62. package/dist/types/ui/link-picker/announcer.d.ts +2 -2
  63. package/dist/types/ui/link-picker/form-footer/index.d.ts +2 -2
  64. package/dist/types/ui/link-picker/index.d.ts +4 -3
  65. package/dist/types/ui/link-picker/link-search-error/index.d.ts +1 -2
  66. package/dist/types/ui/link-picker/link-search-list/index.d.ts +4 -3
  67. package/dist/types/ui/link-picker/link-search-list/link-search-no-results/index.d.ts +1 -2
  68. package/dist/types/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.d.ts +1 -2
  69. package/dist/types/ui/link-picker/list-item/index.d.ts +6 -3
  70. package/dist/types/ui/link-picker/text-input/index.d.ts +1 -2
  71. package/dist/types/ui/link-picker/track-mount/index.d.ts +1 -2
  72. package/dist/types/ui/link-picker/track-tab-viewed/index.d.ts +1 -2
  73. package/dist/types/ui/scrolling-tabs/index.d.ts +1 -1
  74. package/dist/types-ts4.5/common/generic-error-svg/index.d.ts +1 -2
  75. package/dist/types-ts4.5/controllers/use-fix-height/index.d.ts +1 -2
  76. package/dist/types-ts4.5/ui/error-boundary/index.d.ts +4 -5
  77. package/dist/types-ts4.5/ui/index.d.ts +0 -1
  78. package/dist/types-ts4.5/ui/link-picker/announcer.d.ts +2 -2
  79. package/dist/types-ts4.5/ui/link-picker/form-footer/index.d.ts +2 -2
  80. package/dist/types-ts4.5/ui/link-picker/index.d.ts +4 -3
  81. package/dist/types-ts4.5/ui/link-picker/link-search-error/index.d.ts +1 -2
  82. package/dist/types-ts4.5/ui/link-picker/link-search-list/index.d.ts +4 -3
  83. package/dist/types-ts4.5/ui/link-picker/link-search-list/link-search-no-results/index.d.ts +1 -2
  84. package/dist/types-ts4.5/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.d.ts +1 -2
  85. package/dist/types-ts4.5/ui/link-picker/list-item/index.d.ts +6 -3
  86. package/dist/types-ts4.5/ui/link-picker/text-input/index.d.ts +1 -2
  87. package/dist/types-ts4.5/ui/link-picker/track-mount/index.d.ts +1 -2
  88. package/dist/types-ts4.5/ui/link-picker/track-tab-viewed/index.d.ts +1 -2
  89. package/dist/types-ts4.5/ui/scrolling-tabs/index.d.ts +1 -1
  90. package/package.json +6 -6
@@ -3,15 +3,52 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.testIds = exports.LinkSearchListItem = void 0;
7
7
  var _react = require("react");
8
8
  var _react2 = require("@emotion/react");
9
+ var _reactIntlNext = require("react-intl-next");
9
10
  var _transformTimeStamp = require("../transformTimeStamp");
10
11
  var _styled = require("./styled");
11
- var _ = require("..");
12
- var _reactIntlNext = require("react-intl-next");
13
12
  /** @jsx jsx */
14
13
 
14
+ var testIds = {
15
+ searchResultItem: 'link-search-list-item',
16
+ searchResultIcon: 'link-search-list-item-icon'
17
+ };
18
+ exports.testIds = testIds;
19
+ var isSVG = function isSVG(icon) {
20
+ return icon.startsWith('<svg') && icon.endsWith('</svg>');
21
+ };
22
+ var base64SVG = function base64SVG(icon) {
23
+ return "data:image/svg+xml;base64,".concat(Buffer.from(icon).toString('base64'));
24
+ };
25
+ var ListItemIcon = function ListItemIcon(props) {
26
+ var item = props.item,
27
+ intl = props.intl;
28
+ var icon = item.icon,
29
+ iconAlt = item.iconAlt;
30
+ if (!icon) {
31
+ return null;
32
+ }
33
+ var alt = typeof iconAlt === 'string' ? iconAlt : intl.formatMessage(iconAlt);
34
+ if (typeof icon !== 'string') {
35
+ var Glyph = icon;
36
+ return (0, _react2.jsx)("span", {
37
+ css: _styled.itemIconStyles
38
+ }, (0, _react2.jsx)(Glyph, {
39
+ alt: alt,
40
+ "data-testid": testIds.searchResultIcon
41
+ }));
42
+ }
43
+ return (0, _react2.jsx)("span", {
44
+ css: _styled.itemIconStyles
45
+ }, (0, _react2.jsx)("img", {
46
+ "data-testid": testIds.searchResultIcon,
47
+ src: isSVG(icon) ? base64SVG(icon) : icon,
48
+ alt: alt,
49
+ css: _styled.imgStyles
50
+ }));
51
+ };
15
52
  var LinkSearchListItem = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
16
53
  var item = _ref.item,
17
54
  selected = _ref.selected,
@@ -33,7 +70,7 @@ var LinkSearchListItem = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
33
70
  role: role,
34
71
  id: id,
35
72
  "aria-selected": selected,
36
- "data-testid": _.testIds.searchResultItem,
73
+ "data-testid": testIds.searchResultItem,
37
74
  onKeyDown: onKeyDown,
38
75
  onClick: handleSelect,
39
76
  onFocus: onFocus,
@@ -45,10 +82,10 @@ var LinkSearchListItem = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
45
82
  }), (0, _react2.jsx)("div", {
46
83
  css: _styled.itemNameStyles
47
84
  }, (0, _react2.jsx)("div", {
48
- "data-testid": "".concat(_.testIds.searchResultItem, "-title"),
85
+ "data-testid": "".concat(testIds.searchResultItem, "-title"),
49
86
  css: _styled.listItemNameStyles
50
87
  }, item.name), (0, _react2.jsx)("div", {
51
- "data-testid": "".concat(_.testIds.searchResultItem, "-subtitle"),
88
+ "data-testid": "".concat(testIds.searchResultItem, "-subtitle"),
52
89
  css: _styled.listItemContextStyles
53
90
  }, container && (0, _react2.jsx)("div", {
54
91
  css: _styled.listItemContainerStyles
@@ -58,39 +95,4 @@ var LinkSearchListItem = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
58
95
  css: _styled.listItemContainerInnerStyles
59
96
  }, container && (0, _react2.jsx)(_react.Fragment, null, "\xA0 \u2022\xA0 "), (0, _react2.jsx)(_react.Fragment, null, date)))));
60
97
  });
61
- var _default = LinkSearchListItem;
62
- exports.default = _default;
63
- var isSVG = function isSVG(icon) {
64
- return icon.startsWith('<svg') && icon.endsWith('</svg>');
65
- };
66
- var base64SVG = function base64SVG(icon) {
67
- return "data:image/svg+xml;base64,".concat(Buffer.from(icon).toString('base64'));
68
- };
69
- var testId = 'link-search-list-item-icon';
70
- var ListItemIcon = function ListItemIcon(props) {
71
- var item = props.item,
72
- intl = props.intl;
73
- var icon = item.icon,
74
- iconAlt = item.iconAlt;
75
- if (!icon) {
76
- return null;
77
- }
78
- var alt = typeof iconAlt === 'string' ? iconAlt : intl.formatMessage(iconAlt);
79
- if (typeof icon !== 'string') {
80
- var Glyph = icon;
81
- return (0, _react2.jsx)("span", {
82
- css: _styled.itemIconStyles
83
- }, (0, _react2.jsx)(Glyph, {
84
- alt: alt,
85
- "data-testid": testId
86
- }));
87
- }
88
- return (0, _react2.jsx)("span", {
89
- css: _styled.itemIconStyles
90
- }, (0, _react2.jsx)("img", {
91
- "data-testid": testId,
92
- src: isSVG(icon) ? base64SVG(icon) : icon,
93
- alt: alt,
94
- css: _styled.imgStyles
95
- }));
96
- };
98
+ exports.LinkSearchListItem = LinkSearchListItem;
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.testIds = exports.default = void 0;
7
+ exports.testIds = exports.TextInput = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _react = require("react");
@@ -96,5 +96,4 @@ var TextInput = function TextInput(_ref) {
96
96
  }, error)));
97
97
  }));
98
98
  };
99
- var _default = TextInput;
100
- exports.default = _default;
99
+ exports.TextInput = TextInput;
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ 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");
@@ -32,6 +32,4 @@ function TrackMount() {
32
32
  };
33
33
  }, [createAnalyticsEvent]);
34
34
  return null;
35
- }
36
- var _default = TrackMount;
37
- exports.default = _default;
35
+ }
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports.TrackTabViewed = TrackTabViewed;
8
8
  var _react = require("react");
9
9
  var _analyticsNext = require("@atlaskit/analytics-next");
10
10
  var _analytics = _interopRequireDefault(require("../../../common/utils/analytics/analytics.codegen"));
@@ -21,6 +21,4 @@ function TrackTabViewed(_ref) {
21
21
  }
22
22
  }, [activePlugin, createAnalyticsEvent]);
23
23
  return null;
24
- }
25
- var _default = TrackTabViewed;
26
- exports.default = _default;
24
+ }
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = exports.ScrollingTabList = void 0;
8
+ exports.ScrollingTabList = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _react = _interopRequireWildcard(require("react"));
@@ -151,6 +151,4 @@ var ScrollingTabList = function ScrollingTabList(props) {
151
151
  }
152
152
  }))));
153
153
  };
154
- exports.ScrollingTabList = ScrollingTabList;
155
- var _default = ScrollingTabList;
156
- exports.default = _default;
154
+ exports.ScrollingTabList = ScrollingTabList;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.25.1",
3
+ "version": "1.25.3",
4
4
  "sideEffects": false
5
5
  }
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  /** @jsx jsx */
4
4
  import { jsx } from '@emotion/react';
5
5
  import { genericErrorStyles } from './styled';
6
- const GenericErrorSVG = props => {
6
+ export const GenericErrorSVG = props => {
7
7
  const id = 'link-picker-ui-generic-error-svg';
8
8
  return jsx("svg", _extends({
9
9
  height: "90",
@@ -48,5 +48,4 @@ const GenericErrorSVG = props => {
48
48
  stopColor: "#EBECF0",
49
49
  stopOpacity: ".6"
50
50
  }))));
51
- };
52
- export default GenericErrorSVG;
51
+ };
@@ -1,5 +1,5 @@
1
1
  import { useLayoutEffect, useRef } from 'react';
2
- const useFixHeight = shouldFixHeight => {
2
+ export const useFixHeight = shouldFixHeight => {
3
3
  const ref = useRef(null);
4
4
  const currentHeight = useRef(null);
5
5
  useLayoutEffect(() => {
@@ -13,5 +13,4 @@ const useFixHeight = shouldFixHeight => {
13
13
  minHeight: currentHeight.current || 'auto'
14
14
  } : undefined
15
15
  };
16
- };
17
- export default useFixHeight;
16
+ };
@@ -2,7 +2,7 @@
2
2
  import { jsx } from '@emotion/react';
3
3
  import EmptyState from '@atlaskit/empty-state';
4
4
  import { defineMessages, useIntl } from 'react-intl-next';
5
- import GenericErrorSVG from '../../../common/generic-error-svg';
5
+ import { GenericErrorSVG } from '../../../common/generic-error-svg';
6
6
  import { rootContainerStyles } from '../../link-picker/styled';
7
7
  const messages = defineMessages({
8
8
  heading: {
@@ -1,15 +1,17 @@
1
1
  import React, { useCallback } from 'react';
2
- import { withAnalyticsEvents } from '@atlaskit/analytics-next';
2
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
3
3
  import createEventPayload from '../../common/utils/analytics/analytics.codegen';
4
4
  import { ANALYTICS_CHANNEL } from '../../common/constants';
5
5
  import { failUfoExperience, ufoExperience } from '../../common/analytics/experiences';
6
6
  import { useLinkPickerSessionId } from '../../controllers/session-provider';
7
7
  import { ErrorBoundaryFallback } from './error-boundary-fallback';
8
8
  import { BaseErrorBoundary } from './error-boundary-base';
9
- function ErrorBoundary({
10
- children,
11
- createAnalyticsEvent
9
+ export function ErrorBoundary({
10
+ children
12
11
  }) {
12
+ const {
13
+ createAnalyticsEvent
14
+ } = useAnalyticsEvents();
13
15
  const linkPickerSessionId = useLinkPickerSessionId();
14
16
  const handleError = useCallback((error, info) => {
15
17
  var _window, _window$navigator, _info$componentStack;
@@ -27,5 +29,4 @@ function ErrorBoundary({
27
29
  onError: handleError,
28
30
  ErrorComponent: ErrorBoundaryFallback
29
31
  }, children);
30
- }
31
- export default withAnalyticsEvents()(ErrorBoundary);
32
+ }
@@ -4,7 +4,7 @@ import React, { memo } from 'react';
4
4
  import { LazySuspense, lazyForPaint } from 'react-loosely-lazy';
5
5
  import { COMPONENT_NAME } from '../common/constants';
6
6
  import { name as packageName, version as packageVersion } from '../version.json';
7
- import ErrorBoundary from './error-boundary';
7
+ import { ErrorBoundary } from './error-boundary';
8
8
  import { LoaderFallback } from './loader-fallback';
9
9
  import { LinkPickerSessionProvider } from '../controllers/session-provider';
10
10
  import { MessagesProvider } from './messages-provider';
@@ -18,7 +18,11 @@ export const PACKAGE_DATA = {
18
18
  source: COMPONENT_NAME
19
19
  };
20
20
  const LazyLinkPicker = lazyForPaint(() => import( /* webpackChunkName: "@atlaskit-internal_link-picker" */
21
- './link-picker'));
21
+ './link-picker').then(({
22
+ LinkPicker
23
+ }) => ({
24
+ default: LinkPicker
25
+ })));
22
26
  const DefaultRootComponent = ({
23
27
  children
24
28
  }) => {
@@ -40,5 +44,4 @@ export const ComposedLinkPicker = /*#__PURE__*/memo(props => {
40
44
  }, /*#__PURE__*/React.createElement(RootComponent, _extends({}, props, {
41
45
  "data-testid": testIds.linkPickerRoot
42
46
  }), /*#__PURE__*/React.createElement(LazyLinkPicker, props)))))));
43
- });
44
- export default ComposedLinkPicker;
47
+ });
@@ -12,7 +12,7 @@ import React, { forwardRef, memo, useState, useEffect } from 'react';
12
12
  // Note: Flag 'contentRendered' resolves bug with duplicates messages (NVDA + Firefox)
13
13
  // https://github.com/nvaccess/nvda/labels/bug%2Fdouble-speaking
14
14
  let timer;
15
- const Announcer = /*#__PURE__*/forwardRef(({
15
+ export const Announcer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
16
16
  ariaAtomic = 'true',
17
17
  ariaLive = 'polite',
18
18
  ariaRelevant = 'all',
@@ -37,5 +37,4 @@ const Announcer = /*#__PURE__*/forwardRef(({
37
37
  "aria-relevant": ariaRelevant,
38
38
  "aria-live": ariaLive
39
39
  }, contentRendered && /*#__PURE__*/React.createElement("span", null, text));
40
- });
41
- export default /*#__PURE__*/memo(Announcer);
40
+ }));
@@ -30,7 +30,7 @@ export const testIds = {
30
30
  cancelButton: 'link-picker-cancel-button',
31
31
  actionButton: 'link-picker-action-button'
32
32
  };
33
- const FormFooter = ({
33
+ export const FormFooter = /*#__PURE__*/memo(({
34
34
  isLoading,
35
35
  error,
36
36
  url,
@@ -69,5 +69,4 @@ const FormFooter = ({
69
69
  testId: testIds.insertButton,
70
70
  isDisabled: isSubmitDisabled
71
71
  }, intl.formatMessage(insertButtonMsg))));
72
- };
73
- export default /*#__PURE__*/memo(FormFooter);
72
+ });
@@ -7,6 +7,7 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
7
7
  import EditorSearchIcon from '@atlaskit/icon/glyph/editor/search';
8
8
  import Tabs, { Tab, TabList } from '@atlaskit/tabs';
9
9
  import VisuallyHidden from '@atlaskit/visually-hidden';
10
+ import Spinner from '@atlaskit/spinner/spinner';
10
11
  import createEventPayload from '../../common/utils/analytics/analytics.codegen';
11
12
  import { ANALYTICS_CHANNEL } from '../../common/constants';
12
13
  import { useLinkPickerAnalytics, withInputFieldTracking, withLinkPickerAnalyticsContext } from '../../common/analytics';
@@ -14,20 +15,19 @@ import { normalizeUrl, isSafeUrl } from '@atlaskit/linking-common/url';
14
15
  import { browser } from '@atlaskit/linking-common/user-agent';
15
16
  import { usePlugins } from '../../services/use-plugins';
16
17
  import { useSearchQuery } from '../../services/use-search-query';
17
- import useFixHeight from '../../controllers/use-fix-height';
18
+ import { useFixHeight } from '../../controllers/use-fix-height';
18
19
  import { searchMessages, linkMessages, formMessages, linkTextMessages } from './messages';
19
- import TextInput, { testIds as textFieldTestIds } from './text-input';
20
+ import { TextInput, testIds as textFieldTestIds } from './text-input';
20
21
  import { rootContainerStyles, searchIconStyles, tabsWrapperStyles, flexColumnStyles, formFooterMargin } from './styled';
21
- import Announcer from './announcer';
22
- import ScrollingTabList from '../scrolling-tabs';
23
- import LinkSearchList, { testIds as listTestIds } from './link-search-list';
24
- import LinkSearchError, { testIds as searchErrorTestIds } from './link-search-error';
25
- import FormFooter, { testIds as formFooterTestIds } from './form-footer';
22
+ 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
+ import { FormFooter, testIds as formFooterTestIds } from './form-footer';
26
27
  import { getDataSource, getScreenReaderText, handleNavKeyDown } from './utils';
27
- import TrackTabViewed from './track-tab-viewed';
28
- import TrackMount from './track-mount';
28
+ import { TrackTabViewed } from './track-tab-viewed';
29
+ import { TrackMount } from './track-mount';
29
30
  import { spinnerContainerStyles } from './link-search-list/styled';
30
- import Spinner from '@atlaskit/spinner/spinner';
31
31
  export const RECENT_SEARCH_LIST_SIZE = 5;
32
32
  export const testIds = {
33
33
  linkPickerRoot: 'link-picker-root',
@@ -81,7 +81,7 @@ const LinkInputField = withInputFieldTracking(TextInput, 'link', (event, attribu
81
81
  linkFieldContent: getLinkFieldContent(event.currentTarget.value)
82
82
  }));
83
83
  const DisplayTextInputField = withInputFieldTracking(TextInput, 'displayText');
84
- function LinkPicker({
84
+ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
85
85
  onSubmit,
86
86
  onCancel,
87
87
  onContentResize,
@@ -91,7 +91,7 @@ function LinkPicker({
91
91
  displayText: initDisplayText,
92
92
  hideDisplayText,
93
93
  featureFlags
94
- }) {
94
+ }) => {
95
95
  var _activePlugin$errorFa, _activePlugin$errorFa2;
96
96
  const {
97
97
  createAnalyticsEvent
@@ -383,5 +383,4 @@ function LinkPicker({
383
383
  action: pluginAction,
384
384
  css: !queryState || !(plugins !== null && plugins !== void 0 && plugins.length) ? formFooterMargin : undefined
385
385
  }));
386
- }
387
- export default withLinkPickerAnalyticsContext( /*#__PURE__*/memo(LinkPicker));
386
+ }));
@@ -4,7 +4,7 @@ import { jsx } from '@emotion/react';
4
4
  import { useIntl, FormattedMessage, defineMessages } from 'react-intl-next';
5
5
  import Button from '@atlaskit/button';
6
6
  import EmptyState from '@atlaskit/empty-state';
7
- import GenericErrorSVG from '../../../common/generic-error-svg';
7
+ import { GenericErrorSVG } from '../../../common/generic-error-svg';
8
8
  export const CONTACT_SUPPORT_LINK = 'https://support.atlassian.com/contact/';
9
9
  export const messages = defineMessages({
10
10
  searchErrorHeader: {
@@ -21,7 +21,7 @@ export const messages = defineMessages({
21
21
  export const testIds = {
22
22
  searchError: 'link-search-error'
23
23
  };
24
- const LinkSearchError = () => {
24
+ export const LinkSearchError = () => {
25
25
  const intl = useIntl();
26
26
  return jsx(EmptyState, {
27
27
  testId: testIds.searchError,
@@ -39,5 +39,4 @@ const LinkSearchError = () => {
39
39
  })),
40
40
  renderImage: () => jsx(GenericErrorSVG, null)
41
41
  });
42
- };
43
- export default LinkSearchError;
42
+ };
@@ -6,9 +6,9 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
6
  import { defineMessages, FormattedMessage } from 'react-intl-next';
7
7
  import Spinner from '@atlaskit/spinner';
8
8
  import VisuallyHidden from '@atlaskit/visually-hidden';
9
- import LinkSearchListItem from '../list-item';
9
+ import { LinkSearchListItem, testIds as searchResultItemTestIds } from '../list-item';
10
10
  import { listContainerStyles, spinnerContainerStyles, listStyles, listTitleStyles } from './styled';
11
- import LinkSearchNoResults, { testIds as noResultsTestIds } from './link-search-no-results';
11
+ import { NoResults, testIds as noResultsTestIds } from './link-search-no-results';
12
12
  import { useTrackResultsShown } from './use-track-results-shown';
13
13
  import { handleNavKeyDown } from '../utils';
14
14
  import { emptyStateNoResultsWrapper } from './link-search-no-results/styled';
@@ -31,13 +31,13 @@ export const messages = defineMessages({
31
31
  });
32
32
  export const testIds = {
33
33
  ...noResultsTestIds,
34
+ ...searchResultItemTestIds,
34
35
  resultListTitle: 'link-picker-list-title',
35
- searchResultItem: 'link-search-list-item',
36
36
  searchResultList: 'link-search-list',
37
37
  searchResultLoadingIndicator: 'link-picker.results-loading-indicator',
38
38
  tabsLoadingIndicator: 'link-picker.tabs-loading-indicator'
39
39
  };
40
- const LinkSearchList = /*#__PURE__*/forwardRef(({
40
+ export const LinkSearchList = /*#__PURE__*/forwardRef(({
41
41
  onChange,
42
42
  onSelect,
43
43
  onKeyDown,
@@ -101,14 +101,14 @@ const LinkSearchList = /*#__PURE__*/forwardRef(({
101
101
  if ((items === null || items === void 0 ? void 0 : items.length) === 0) {
102
102
  if (getBooleanFF('platform.linking-platform.link-picker.enable-empty-state')) {
103
103
  if (hasSearchTerm) {
104
- return jsx(LinkSearchNoResults, null);
104
+ return jsx(NoResults, null);
105
105
  } else {
106
106
  return jsx("div", {
107
107
  css: emptyStateNoResultsWrapper
108
108
  }, activePlugin !== null && activePlugin !== void 0 && activePlugin.emptyStateNoResults ? activePlugin.emptyStateNoResults() : null);
109
109
  }
110
110
  } else {
111
- return jsx(LinkSearchNoResults, null);
111
+ return jsx(NoResults, null);
112
112
  }
113
113
  }
114
114
  if (items && items.length > 0) {
@@ -157,5 +157,4 @@ const LinkSearchList = /*#__PURE__*/forwardRef(({
157
157
  ref: ref,
158
158
  css: listContainerStyles
159
159
  }, restProps), itemsContent, loadingContent);
160
- });
161
- export default LinkSearchList;
160
+ });
@@ -2,7 +2,7 @@
2
2
  import { jsx } from '@emotion/react';
3
3
  import EmptyState from '@atlaskit/empty-state';
4
4
  import { useIntl, defineMessages } from 'react-intl-next';
5
- import NoResultsSVG from './no-results-svg';
5
+ import { NoResultsSVG } from './no-results-svg';
6
6
  import { emptyStateWrapperStyles } from './styled';
7
7
  export const messages = defineMessages({
8
8
  noResults: {
@@ -19,7 +19,7 @@ export const messages = defineMessages({
19
19
  export const testIds = {
20
20
  emptyResultPage: 'link-search-no-results'
21
21
  };
22
- const NoResults = () => {
22
+ export const NoResults = () => {
23
23
  const intl = useIntl();
24
24
  return jsx("div", {
25
25
  css: emptyStateWrapperStyles
@@ -29,5 +29,4 @@ const NoResults = () => {
29
29
  description: intl.formatMessage(messages.noResultsDescription),
30
30
  renderImage: () => jsx(NoResultsSVG, null)
31
31
  }));
32
- };
33
- export default NoResults;
32
+ };
@@ -2,7 +2,7 @@
2
2
  /** @jsx jsx */
3
3
  import { jsx } from '@emotion/react';
4
4
  import { noResultsSVGStyles } from './styled';
5
- const NoResultsSVG = () => {
5
+ export const NoResultsSVG = () => {
6
6
  const id = 'link-picker-ui-no-results-svg';
7
7
  return jsx("svg", {
8
8
  css: noResultsSVGStyles,
@@ -53,5 +53,4 @@ const NoResultsSVG = () => {
53
53
  transform: "translate(0 .62)",
54
54
  d: "M0 0h207.16v189.87H0z"
55
55
  }))));
56
- };
57
- export default NoResultsSVG;
56
+ };
@@ -1,11 +1,47 @@
1
1
  /** @jsx jsx */
2
2
  import { forwardRef, Fragment } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
+ import { useIntl } from 'react-intl-next';
4
5
  import { transformTimeStamp } from '../transformTimeStamp';
5
6
  import { itemNameStyles, itemIconStyles, listItemContextStyles, listItemNameStyles, composeListItemStyles, imgStyles, listItemContainerStyles, listItemContainerInnerStyles } from './styled';
6
- import { testIds } from '..';
7
- import { useIntl } from 'react-intl-next';
8
- const LinkSearchListItem = /*#__PURE__*/forwardRef(({
7
+ export const testIds = {
8
+ searchResultItem: 'link-search-list-item',
9
+ searchResultIcon: 'link-search-list-item-icon'
10
+ };
11
+ const isSVG = icon => icon.startsWith('<svg') && icon.endsWith('</svg>');
12
+ const base64SVG = icon => `data:image/svg+xml;base64,${Buffer.from(icon).toString('base64')}`;
13
+ const ListItemIcon = props => {
14
+ const {
15
+ item,
16
+ intl
17
+ } = props;
18
+ const {
19
+ icon,
20
+ iconAlt
21
+ } = item;
22
+ if (!icon) {
23
+ return null;
24
+ }
25
+ const alt = typeof iconAlt === 'string' ? iconAlt : intl.formatMessage(iconAlt);
26
+ if (typeof icon !== 'string') {
27
+ const Glyph = icon;
28
+ return jsx("span", {
29
+ css: itemIconStyles
30
+ }, jsx(Glyph, {
31
+ alt: alt,
32
+ "data-testid": testIds.searchResultIcon
33
+ }));
34
+ }
35
+ return jsx("span", {
36
+ css: itemIconStyles
37
+ }, jsx("img", {
38
+ "data-testid": testIds.searchResultIcon,
39
+ src: isSVG(icon) ? base64SVG(icon) : icon,
40
+ alt: alt,
41
+ css: imgStyles
42
+ }));
43
+ };
44
+ export const LinkSearchListItem = /*#__PURE__*/forwardRef(({
9
45
  item,
10
46
  selected,
11
47
  active,
@@ -49,39 +85,4 @@ const LinkSearchListItem = /*#__PURE__*/forwardRef(({
49
85
  }, container)), date && jsx("div", {
50
86
  css: listItemContainerInnerStyles
51
87
  }, container && jsx(Fragment, null, "\xA0 \u2022\xA0 "), jsx(Fragment, null, date)))));
52
- });
53
- export default LinkSearchListItem;
54
- const isSVG = icon => icon.startsWith('<svg') && icon.endsWith('</svg>');
55
- const base64SVG = icon => `data:image/svg+xml;base64,${Buffer.from(icon).toString('base64')}`;
56
- const testId = 'link-search-list-item-icon';
57
- const ListItemIcon = props => {
58
- const {
59
- item,
60
- intl
61
- } = props;
62
- const {
63
- icon,
64
- iconAlt
65
- } = item;
66
- if (!icon) {
67
- return null;
68
- }
69
- const alt = typeof iconAlt === 'string' ? iconAlt : intl.formatMessage(iconAlt);
70
- if (typeof icon !== 'string') {
71
- const Glyph = icon;
72
- return jsx("span", {
73
- css: itemIconStyles
74
- }, jsx(Glyph, {
75
- alt: alt,
76
- "data-testid": testId
77
- }));
78
- }
79
- return jsx("span", {
80
- css: itemIconStyles
81
- }, jsx("img", {
82
- "data-testid": testId,
83
- src: isSVG(icon) ? base64SVG(icon) : icon,
84
- alt: alt,
85
- css: imgStyles
86
- }));
87
- };
88
+ });
@@ -13,7 +13,7 @@ export const testIds = {
13
13
  urlError: 'link-error',
14
14
  clearUrlButton: 'clear-text'
15
15
  };
16
- const TextInput = ({
16
+ export const TextInput = ({
17
17
  name,
18
18
  label,
19
19
  autoFocus,
@@ -87,5 +87,4 @@ const TextInput = ({
87
87
  testId: testIds.urlError
88
88
  }, error)));
89
89
  }));
90
- };
91
- export default TextInput;
90
+ };
@@ -9,7 +9,7 @@ import { useLinkPickerSessionId } from '../../../controllers/session-provider';
9
9
  /**
10
10
  * UFO + Analytics tracking for component mount (and unmount)
11
11
  */
12
- function TrackMount() {
12
+ export function TrackMount() {
13
13
  const {
14
14
  createAnalyticsEvent
15
15
  } = useAnalyticsEvents();
@@ -26,5 +26,4 @@ function TrackMount() {
26
26
  };
27
27
  }, [createAnalyticsEvent]);
28
28
  return null;
29
- }
30
- export default TrackMount;
29
+ }
@@ -3,7 +3,7 @@ import { useLayoutEffect } from 'react';
3
3
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
4
  import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
5
5
  import { ANALYTICS_CHANNEL } from '../../../common/constants';
6
- function TrackTabViewed({
6
+ export function TrackTabViewed({
7
7
  activePlugin
8
8
  }) {
9
9
  const {
@@ -15,5 +15,4 @@ function TrackTabViewed({
15
15
  }
16
16
  }, [activePlugin, createAnalyticsEvent]);
17
17
  return null;
18
- }
19
- export default TrackTabViewed;
18
+ }
@@ -113,5 +113,4 @@ export const ScrollingTabList = props => {
113
113
  }),
114
114
  onClick: () => scrollForward(ref)
115
115
  }))));
116
- };
117
- export default ScrollingTabList;
116
+ };