@atlaskit/link-picker 1.25.2 → 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 (180) 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/analytics/context.js +1 -1
  5. package/dist/cjs/common/analytics/input-field-tracking.js +3 -3
  6. package/dist/cjs/common/constants.js +4 -2
  7. package/dist/cjs/common/generic-error-svg/index.js +2 -3
  8. package/dist/cjs/common/utils/handleNavKeyDown.js +29 -0
  9. package/dist/cjs/controllers/use-fix-height/index.js +2 -3
  10. package/dist/cjs/services/use-plugins/index.js +7 -8
  11. package/dist/cjs/ui/error-boundary/error-boundary-fallback/index.js +5 -3
  12. package/dist/cjs/ui/error-boundary/index.js +8 -9
  13. package/dist/cjs/ui/index.js +13 -10
  14. package/dist/cjs/ui/link-picker/announcer.js +4 -5
  15. package/dist/cjs/ui/link-picker/form-footer/index.js +13 -14
  16. package/dist/cjs/ui/link-picker/index.js +37 -49
  17. package/dist/cjs/ui/link-picker/link-search-error/index.js +4 -5
  18. package/dist/cjs/ui/link-picker/link-search-list/index.js +18 -23
  19. package/dist/cjs/ui/link-picker/link-search-list/link-search-no-results/index.js +5 -6
  20. package/dist/cjs/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.js +2 -3
  21. package/dist/cjs/ui/link-picker/{list-item → link-search-list/list-item}/index.js +47 -43
  22. package/dist/cjs/ui/link-picker/{list-item → link-search-list/list-item}/styled.js +5 -3
  23. package/dist/cjs/ui/{scrolling-tabs → link-picker/scrolling-tabs}/index.js +5 -4
  24. package/dist/cjs/ui/link-picker/styled.js +5 -23
  25. package/dist/cjs/ui/link-picker/text-input/index.js +6 -7
  26. package/dist/cjs/ui/link-picker/text-input/utils.js +28 -0
  27. package/dist/cjs/ui/link-picker/track-mount/index.js +3 -5
  28. package/dist/cjs/ui/link-picker/track-tab-viewed/index.js +3 -5
  29. package/dist/cjs/ui/link-picker/transformTimeStamp.js +2 -2
  30. package/dist/cjs/ui/link-picker/utils.js +1 -48
  31. package/dist/cjs/ui/loader-fallback/index.js +1 -1
  32. package/dist/cjs/ui/loader-fallback/styled.js +21 -0
  33. package/dist/cjs/version.json +1 -1
  34. package/dist/es2019/common/analytics/context.js +1 -1
  35. package/dist/es2019/common/analytics/input-field-tracking.js +2 -2
  36. package/dist/es2019/common/constants.js +2 -1
  37. package/dist/es2019/common/generic-error-svg/index.js +2 -3
  38. package/dist/es2019/common/utils/handleNavKeyDown.js +22 -0
  39. package/dist/es2019/controllers/use-fix-height/index.js +2 -3
  40. package/dist/es2019/services/use-plugins/index.js +5 -6
  41. package/dist/es2019/ui/error-boundary/error-boundary-fallback/index.js +3 -2
  42. package/dist/es2019/ui/error-boundary/index.js +10 -9
  43. package/dist/es2019/ui/index.js +10 -7
  44. package/dist/es2019/ui/link-picker/announcer.js +3 -4
  45. package/dist/es2019/ui/link-picker/form-footer/index.js +6 -7
  46. package/dist/es2019/ui/link-picker/index.js +23 -34
  47. package/dist/es2019/ui/link-picker/link-search-error/index.js +4 -5
  48. package/dist/es2019/ui/link-picker/link-search-list/index.js +11 -12
  49. package/dist/es2019/ui/link-picker/link-search-list/link-search-no-results/index.js +4 -5
  50. package/dist/es2019/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.js +2 -3
  51. package/dist/es2019/ui/link-picker/{list-item → link-search-list/list-item}/index.js +42 -40
  52. package/dist/es2019/ui/link-picker/{list-item → link-search-list/list-item}/styled.js +2 -2
  53. package/dist/es2019/ui/link-picker/link-search-list/styled.js +1 -0
  54. package/dist/es2019/ui/{scrolling-tabs → link-picker/scrolling-tabs}/index.js +7 -5
  55. package/dist/es2019/ui/link-picker/styled.js +0 -30
  56. package/dist/es2019/ui/link-picker/text-input/index.js +7 -8
  57. package/dist/es2019/ui/link-picker/text-input/utils.js +22 -0
  58. package/dist/es2019/ui/link-picker/track-mount/index.js +3 -4
  59. package/dist/es2019/ui/link-picker/track-tab-viewed/index.js +3 -4
  60. package/dist/es2019/ui/link-picker/transformTimeStamp.js +2 -2
  61. package/dist/es2019/ui/link-picker/utils.js +1 -45
  62. package/dist/es2019/ui/loader-fallback/index.js +1 -1
  63. package/dist/es2019/ui/loader-fallback/styled.js +25 -0
  64. package/dist/es2019/version.json +1 -1
  65. package/dist/esm/common/analytics/context.js +1 -1
  66. package/dist/esm/common/analytics/input-field-tracking.js +2 -2
  67. package/dist/esm/common/constants.js +2 -1
  68. package/dist/esm/common/generic-error-svg/index.js +2 -3
  69. package/dist/esm/common/utils/handleNavKeyDown.js +22 -0
  70. package/dist/esm/controllers/use-fix-height/index.js +2 -3
  71. package/dist/esm/services/use-plugins/index.js +5 -6
  72. package/dist/esm/ui/error-boundary/error-boundary-fallback/index.js +3 -2
  73. package/dist/esm/ui/error-boundary/index.js +9 -9
  74. package/dist/esm/ui/index.js +13 -9
  75. package/dist/esm/ui/link-picker/announcer.js +3 -4
  76. package/dist/esm/ui/link-picker/form-footer/index.js +6 -7
  77. package/dist/esm/ui/link-picker/index.js +23 -34
  78. package/dist/esm/ui/link-picker/link-search-error/index.js +4 -5
  79. package/dist/esm/ui/link-picker/link-search-list/index.js +11 -13
  80. package/dist/esm/ui/link-picker/link-search-list/link-search-no-results/index.js +4 -5
  81. package/dist/esm/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.js +2 -3
  82. package/dist/esm/ui/link-picker/{list-item → link-search-list/list-item}/index.js +42 -40
  83. package/dist/esm/ui/link-picker/{list-item → link-search-list/list-item}/styled.js +2 -2
  84. package/dist/esm/ui/link-picker/link-search-list/styled.js +1 -0
  85. package/dist/esm/ui/{scrolling-tabs → link-picker/scrolling-tabs}/index.js +7 -5
  86. package/dist/esm/ui/link-picker/styled.js +4 -19
  87. package/dist/esm/ui/link-picker/text-input/index.js +7 -8
  88. package/dist/esm/ui/link-picker/text-input/utils.js +20 -0
  89. package/dist/esm/ui/link-picker/track-mount/index.js +3 -4
  90. package/dist/esm/ui/link-picker/track-tab-viewed/index.js +3 -4
  91. package/dist/esm/ui/link-picker/transformTimeStamp.js +2 -2
  92. package/dist/esm/ui/link-picker/utils.js +1 -43
  93. package/dist/esm/ui/loader-fallback/index.js +1 -1
  94. package/dist/esm/ui/loader-fallback/styled.js +16 -0
  95. package/dist/esm/version.json +1 -1
  96. package/dist/types/common/analytics/context.d.ts +1 -1
  97. package/dist/types/common/constants.d.ts +1 -0
  98. package/dist/types/common/generic-error-svg/index.d.ts +1 -2
  99. package/dist/types/{ui → common}/types.d.ts +10 -0
  100. package/dist/types/common/utils/handleNavKeyDown.d.ts +2 -0
  101. package/dist/types/controllers/use-fix-height/index.d.ts +1 -2
  102. package/dist/types/index.d.ts +1 -1
  103. package/dist/types/services/use-plugins/index.d.ts +1 -1
  104. package/dist/types/services/use-plugins/reducer.d.ts +1 -1
  105. package/dist/types/services/use-plugins/utils.d.ts +1 -1
  106. package/dist/types/services/use-search-query/index.d.ts +1 -2
  107. package/dist/types/ui/error-boundary/index.d.ts +4 -5
  108. package/dist/types/ui/index.d.ts +0 -1
  109. package/dist/types/ui/link-picker/announcer.d.ts +2 -2
  110. package/dist/types/ui/link-picker/form-footer/index.d.ts +3 -4
  111. package/dist/types/ui/link-picker/form-footer/utils.d.ts +1 -1
  112. package/dist/types/ui/link-picker/index.d.ts +5 -16
  113. package/dist/types/ui/link-picker/link-search-error/index.d.ts +1 -2
  114. package/dist/types/ui/link-picker/link-search-list/index.d.ts +5 -4
  115. package/dist/types/ui/link-picker/link-search-list/link-search-no-results/index.d.ts +1 -2
  116. package/dist/types/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.d.ts +1 -2
  117. package/dist/types/ui/link-picker/link-search-list/list-item/index.d.ts +19 -0
  118. package/dist/types/ui/link-picker/link-search-list/use-track-results-shown/index.d.ts +1 -1
  119. package/dist/{types-ts4.5/ui → types/ui/link-picker}/scrolling-tabs/index.d.ts +1 -1
  120. package/dist/types/ui/link-picker/styled.d.ts +0 -5
  121. package/dist/types/ui/link-picker/{conditional-spotlight-target-wrapper → text-input/conditional-spotlight-target-wrapper}/index.d.ts +1 -2
  122. package/dist/types/ui/link-picker/text-input/index.d.ts +2 -3
  123. package/dist/types/ui/link-picker/text-input/utils.d.ts +3 -0
  124. package/dist/types/ui/link-picker/track-mount/index.d.ts +1 -2
  125. package/dist/types/ui/link-picker/track-tab-viewed/index.d.ts +1 -2
  126. package/dist/types/ui/link-picker/utils.d.ts +1 -5
  127. package/dist/types/ui/loader-fallback/styled.d.ts +3 -0
  128. package/dist/types-ts4.5/common/analytics/context.d.ts +1 -1
  129. package/dist/types-ts4.5/common/constants.d.ts +1 -0
  130. package/dist/types-ts4.5/common/generic-error-svg/index.d.ts +1 -2
  131. package/dist/types-ts4.5/{ui → common}/types.d.ts +10 -0
  132. package/dist/types-ts4.5/common/utils/handleNavKeyDown.d.ts +2 -0
  133. package/dist/types-ts4.5/controllers/use-fix-height/index.d.ts +1 -2
  134. package/dist/types-ts4.5/index.d.ts +1 -1
  135. package/dist/types-ts4.5/services/use-plugins/index.d.ts +1 -1
  136. package/dist/types-ts4.5/services/use-plugins/reducer.d.ts +1 -1
  137. package/dist/types-ts4.5/services/use-plugins/utils.d.ts +1 -1
  138. package/dist/types-ts4.5/services/use-search-query/index.d.ts +1 -2
  139. package/dist/types-ts4.5/ui/error-boundary/index.d.ts +4 -5
  140. package/dist/types-ts4.5/ui/index.d.ts +0 -1
  141. package/dist/types-ts4.5/ui/link-picker/announcer.d.ts +2 -2
  142. package/dist/types-ts4.5/ui/link-picker/form-footer/index.d.ts +3 -4
  143. package/dist/types-ts4.5/ui/link-picker/form-footer/utils.d.ts +1 -1
  144. package/dist/types-ts4.5/ui/link-picker/index.d.ts +5 -16
  145. package/dist/types-ts4.5/ui/link-picker/link-search-error/index.d.ts +1 -2
  146. package/dist/types-ts4.5/ui/link-picker/link-search-list/index.d.ts +5 -4
  147. package/dist/types-ts4.5/ui/link-picker/link-search-list/link-search-no-results/index.d.ts +1 -2
  148. package/dist/types-ts4.5/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.d.ts +1 -2
  149. package/dist/types-ts4.5/ui/link-picker/link-search-list/list-item/index.d.ts +19 -0
  150. package/dist/types-ts4.5/ui/link-picker/link-search-list/use-track-results-shown/index.d.ts +1 -1
  151. package/dist/{types/ui → types-ts4.5/ui/link-picker}/scrolling-tabs/index.d.ts +1 -1
  152. package/dist/types-ts4.5/ui/link-picker/styled.d.ts +0 -5
  153. package/dist/types-ts4.5/ui/link-picker/{conditional-spotlight-target-wrapper → text-input/conditional-spotlight-target-wrapper}/index.d.ts +1 -2
  154. package/dist/types-ts4.5/ui/link-picker/text-input/index.d.ts +2 -3
  155. package/dist/types-ts4.5/ui/link-picker/text-input/utils.d.ts +3 -0
  156. package/dist/types-ts4.5/ui/link-picker/track-mount/index.d.ts +1 -2
  157. package/dist/types-ts4.5/ui/link-picker/track-tab-viewed/index.d.ts +1 -2
  158. package/dist/types-ts4.5/ui/link-picker/utils.d.ts +1 -5
  159. package/dist/types-ts4.5/ui/loader-fallback/styled.d.ts +3 -0
  160. package/package.json +26 -6
  161. package/dist/types/ui/link-picker/list-item/index.d.ts +0 -16
  162. package/dist/types-ts4.5/ui/link-picker/list-item/index.d.ts +0 -16
  163. /package/dist/cjs/{ui → common}/types.js +0 -0
  164. /package/dist/cjs/ui/{scrolling-tabs → link-picker/scrolling-tabs}/scrolling-tabs.js +0 -0
  165. /package/dist/cjs/ui/{scrolling-tabs → link-picker/scrolling-tabs}/styles.js +0 -0
  166. /package/dist/cjs/ui/link-picker/{conditional-spotlight-target-wrapper → text-input/conditional-spotlight-target-wrapper}/index.js +0 -0
  167. /package/dist/es2019/{ui → common}/types.js +0 -0
  168. /package/dist/es2019/ui/{scrolling-tabs → link-picker/scrolling-tabs}/scrolling-tabs.js +0 -0
  169. /package/dist/es2019/ui/{scrolling-tabs → link-picker/scrolling-tabs}/styles.js +0 -0
  170. /package/dist/es2019/ui/link-picker/{conditional-spotlight-target-wrapper → text-input/conditional-spotlight-target-wrapper}/index.js +0 -0
  171. /package/dist/esm/{ui → common}/types.js +0 -0
  172. /package/dist/esm/ui/{scrolling-tabs → link-picker/scrolling-tabs}/scrolling-tabs.js +0 -0
  173. /package/dist/esm/ui/{scrolling-tabs → link-picker/scrolling-tabs}/styles.js +0 -0
  174. /package/dist/esm/ui/link-picker/{conditional-spotlight-target-wrapper → text-input/conditional-spotlight-target-wrapper}/index.js +0 -0
  175. /package/dist/types/ui/link-picker/{list-item → link-search-list/list-item}/styled.d.ts +0 -0
  176. /package/dist/types/ui/{scrolling-tabs → link-picker/scrolling-tabs}/scrolling-tabs.d.ts +0 -0
  177. /package/dist/types/ui/{scrolling-tabs → link-picker/scrolling-tabs}/styles.d.ts +0 -0
  178. /package/dist/types-ts4.5/ui/link-picker/{list-item → link-search-list/list-item}/styled.d.ts +0 -0
  179. /package/dist/types-ts4.5/ui/{scrolling-tabs → link-picker/scrolling-tabs}/scrolling-tabs.d.ts +0 -0
  180. /package/dist/types-ts4.5/ui/{scrolling-tabs → link-picker/scrolling-tabs}/styles.d.ts +0 -0
@@ -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 from '../list-item';
10
- import { listContainerStyles, spinnerContainerStyles, listStyles, listTitleStyles } from './styled';
11
- import LinkSearchNoResults, { testIds as noResultsTestIds } from './link-search-no-results';
12
- import { useTrackResultsShown } from './use-track-results-shown';
13
- import { handleNavKeyDown } from '../utils';
9
+ import { handleNavKeyDown } from '../../../common/utils/handleNavKeyDown';
10
+ import { NoResults, testIds as noResultsTestIds } from './link-search-no-results';
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',
@@ -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
+ });
@@ -1,8 +1,8 @@
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
- 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,48 @@
1
1
  /** @jsx jsx */
2
2
  import { forwardRef, Fragment } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { transformTimeStamp } from '../transformTimeStamp';
5
- import { itemNameStyles, itemIconStyles, listItemContextStyles, listItemNameStyles, composeListItemStyles, imgStyles, listItemContainerStyles, listItemContainerInnerStyles } from './styled';
6
- import { testIds } from '..';
7
4
  import { useIntl } from 'react-intl-next';
8
- const LinkSearchListItem = /*#__PURE__*/forwardRef(({
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';
8
+ export const testIds = {
9
+ searchResultItem: 'link-search-list-item',
10
+ searchResultIcon: 'link-search-list-item-icon'
11
+ };
12
+ const isSVG = icon => icon.startsWith('<svg') && icon.endsWith('</svg>');
13
+ const base64SVG = icon => `data:image/svg+xml;base64,${Buffer.from(icon).toString('base64')}`;
14
+ const ListItemIcon = props => {
15
+ const {
16
+ item,
17
+ intl
18
+ } = props;
19
+ const {
20
+ icon,
21
+ iconAlt
22
+ } = item;
23
+ if (!icon) {
24
+ return null;
25
+ }
26
+ const alt = typeof iconAlt === 'string' ? iconAlt : intl.formatMessage(iconAlt);
27
+ if (typeof icon !== 'string') {
28
+ const Glyph = icon;
29
+ return jsx("span", {
30
+ css: itemIconStyles
31
+ }, jsx(Glyph, {
32
+ alt: alt,
33
+ "data-testid": testIds.searchResultIcon
34
+ }));
35
+ }
36
+ return jsx("span", {
37
+ css: itemIconStyles
38
+ }, jsx("img", {
39
+ "data-testid": testIds.searchResultIcon,
40
+ src: isSVG(icon) ? base64SVG(icon) : icon,
41
+ alt: alt,
42
+ css: imgStyles
43
+ }));
44
+ };
45
+ export const LinkSearchListItem = /*#__PURE__*/forwardRef(({
9
46
  item,
10
47
  selected,
11
48
  active,
@@ -49,39 +86,4 @@ const LinkSearchListItem = /*#__PURE__*/forwardRef(({
49
86
  }, container)), date && jsx("div", {
50
87
  css: listItemContainerInnerStyles
51
88
  }, 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
- };
89
+ });
@@ -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) {
@@ -113,5 +116,4 @@ export const ScrollingTabList = props => {
113
116
  }),
114
117
  onClick: () => scrollForward(ref)
115
118
  }))));
116
- };
117
- export default ScrollingTabList;
119
+ };
@@ -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,19 +1,19 @@
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'
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
+ };
@@ -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,14 +2,14 @@
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
  /**
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
+ }
@@ -1,9 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import { useLayoutEffect } from 'react';
3
3
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
- import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
5
4
  import { ANALYTICS_CHANNEL } from '../../../common/constants';
6
- function TrackTabViewed({
5
+ import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
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
+ }
@@ -1,7 +1,7 @@
1
- import { timeMessages } from './messages';
1
+ import isYesterday from 'date-fns/isYesterday';
2
2
  import { isMoreThanOneWeekAgo } from '../../common/utils/date';
3
3
  import { selectUnit } from '../../common/utils/dateUtils';
4
- import isYesterday from 'date-fns/isYesterday';
4
+ import { timeMessages } from './messages';
5
5
  const formatTime = (timeStamp, intl) => {
6
6
  const isAbsolute = isMoreThanOneWeekAgo(timeStamp);
7
7
  if (isAbsolute) {
@@ -1,26 +1,4 @@
1
- import { browser } from '@atlaskit/linking-common/user-agent';
2
1
  import { transformTimeStamp } from './transformTimeStamp';
3
- const KeyZCode = 90;
4
- const KeyYCode = 89;
5
- export const isUndoEvent = e => {
6
- const {
7
- mac
8
- } = browser();
9
- return e.keyCode === KeyZCode && (
10
- // cmd + z for mac
11
- mac && e.metaKey && !e.shiftKey ||
12
- // ctrl + z for non-mac
13
- !mac && e.ctrlKey);
14
- };
15
- export const isRedoEvent = e => {
16
- const {
17
- mac
18
- } = browser();
19
- return (
20
- // ctrl + y for non-mac
21
- !mac && e.ctrlKey && e.keyCode === KeyYCode || mac && e.metaKey && e.shiftKey && e.keyCode === KeyZCode || e.ctrlKey && e.shiftKey && e.keyCode === KeyZCode
22
- );
23
- };
24
2
 
25
3
  /**
26
4
  * Retrieve the data source for a link given the item and the plugin that resolved it
@@ -40,26 +18,4 @@ export function getScreenReaderText(items, selectedIndex, intl) {
40
18
  const date = transformTimeStamp(intl, lastViewedDate, lastUpdatedDate);
41
19
  return [name, container, date].filter(Boolean).join(', ');
42
20
  }
43
- }
44
- export const handleNavKeyDown = (event, itemsLength, activeIndex) => {
45
- let updatedIndex = activeIndex;
46
- switch (event.key) {
47
- case 'ArrowDown':
48
- event.preventDefault();
49
- updatedIndex = (activeIndex + 1) % itemsLength;
50
- break;
51
- case 'ArrowUp':
52
- event.preventDefault();
53
- updatedIndex = activeIndex > 0 ? activeIndex - 1 : itemsLength - 1;
54
- break;
55
- case 'Home':
56
- event.preventDefault();
57
- updatedIndex = 0;
58
- break;
59
- case 'End':
60
- event.preventDefault();
61
- updatedIndex = itemsLength - 1;
62
- break;
63
- }
64
- return updatedIndex;
65
- };
21
+ }
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
3
  import Spinner from '@atlaskit/spinner';
4
- import { rootContainerStylesForLoaderWithDisplaytext, rootContainerStylesForLoaderWithoutDisplaytext } from '../link-picker/styled';
4
+ import { rootContainerStylesForLoaderWithDisplaytext, rootContainerStylesForLoaderWithoutDisplaytext } from './styled';
5
5
 
6
6
  /**
7
7
  * Loader / skeleton for the Link Picker. Takes displayText prop - when no displayText is given the height of the skeleton
@@ -0,0 +1,25 @@
1
+ import { css } from '@emotion/react';
2
+
3
+ // eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
4
+ import { rootContainerStyles } from '../link-picker/styled';
5
+
6
+ /** Link Picker loader / skeleton will be taller in height when displayText field is shown */
7
+ // See lazy-load-height example to verify these
8
+ const LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_DISPLAYTEXT = 142;
9
+ const LINK_PICKER_MIN_HEIGHT_IN_PX_WITH_DISPLAYTEXT = 220;
10
+ const rootContainerStylesForLoader = css`
11
+ ${rootContainerStyles}
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ `;
16
+ export const rootContainerStylesForLoaderWithDisplaytext = css`
17
+ ${rootContainerStylesForLoader}
18
+ min-height: ${LINK_PICKER_MIN_HEIGHT_IN_PX_WITH_DISPLAYTEXT}px;
19
+ `;
20
+
21
+ /** Link Picker loader / skeleton will be shorter in height when displayText field isn't shown */
22
+ export const rootContainerStylesForLoaderWithoutDisplaytext = css`
23
+ ${rootContainerStylesForLoader}
24
+ min-height: ${LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_DISPLAYTEXT}px;
25
+ `;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.25.2",
3
+ "version": "1.25.4",
4
4
  "sideEffects": false
5
5
  }
@@ -5,8 +5,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
  import React, { useCallback, useContext, useMemo, useRef, useState } from 'react';
7
7
  import { AnalyticsListener } from '@atlaskit/analytics-next';
8
- import { ANALYTICS_CHANNEL } from '../constants';
9
8
  import { normalizeUrl } from '@atlaskit/linking-common/url';
9
+ import { ANALYTICS_CHANNEL } from '../constants';
10
10
  var DEFAULT_CONTEXT_ATTRIBUTES = {
11
11
  linkState: 'newLink',
12
12
  linkFieldContent: null,
@@ -3,9 +3,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _typeof from "@babel/runtime/helpers/typeof";
4
4
  import React, { useCallback, useRef } from 'react';
5
5
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
- import { ANALYTICS_CHANNEL } from '../constants';
7
6
  import createEventPayload from '../../common/utils/analytics/analytics.codegen';
8
- import { useLinkPickerAnalytics } from '.';
7
+ import { ANALYTICS_CHANNEL } from '../constants';
8
+ import { useLinkPickerAnalytics } from './index';
9
9
  var isEventWithInputType = function isEventWithInputType(e) {
10
10
  return _typeof(e) === 'object' && e !== null && 'inputType' in e;
11
11
  };
@@ -1,2 +1,3 @@
1
1
  export var ANALYTICS_CHANNEL = 'media';
2
- export var COMPONENT_NAME = 'linkPicker';
2
+ export var COMPONENT_NAME = 'linkPicker';
3
+ export var RECENT_SEARCH_LIST_SIZE = 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
- var GenericErrorSVG = function GenericErrorSVG(props) {
6
+ export var GenericErrorSVG = function GenericErrorSVG(props) {
7
7
  var id = 'link-picker-ui-generic-error-svg';
8
8
  return jsx("svg", _extends({
9
9
  height: "90",
@@ -48,5 +48,4 @@ var GenericErrorSVG = function GenericErrorSVG(props) {
48
48
  stopColor: "#EBECF0",
49
49
  stopOpacity: ".6"
50
50
  }))));
51
- };
52
- export default GenericErrorSVG;
51
+ };
@@ -0,0 +1,22 @@
1
+ export var handleNavKeyDown = function handleNavKeyDown(event, itemsLength, activeIndex) {
2
+ var 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,5 +1,5 @@
1
1
  import { useLayoutEffect, useRef } from 'react';
2
- var useFixHeight = function useFixHeight(shouldFixHeight) {
2
+ export var useFixHeight = function useFixHeight(shouldFixHeight) {
3
3
  var ref = useRef(null);
4
4
  var currentHeight = useRef(null);
5
5
  useLayoutEffect(function () {
@@ -13,5 +13,4 @@ var useFixHeight = function useFixHeight(shouldFixHeight) {
13
13
  minHeight: currentHeight.current || 'auto'
14
14
  } : undefined
15
15
  };
16
- };
17
- export default useFixHeight;
16
+ };
@@ -1,15 +1,14 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import { useEffect, useMemo, useState, useCallback } from 'react';
5
- import { convertToError } from '@atlaskit/frontend-utilities/convert-to-error';
4
+ import { useCallback, useEffect, useMemo, useState } from 'react';
6
5
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
7
- import { RECENT_SEARCH_LIST_SIZE } from '../../ui/link-picker';
6
+ import { convertToError } from '@atlaskit/frontend-utilities/convert-to-error';
7
+ import { useLinkPickerAnalytics } from '../../common/analytics';
8
+ import { ANALYTICS_CHANNEL, RECENT_SEARCH_LIST_SIZE } from '../../common/constants';
8
9
  import createEventPayload from '../../common/utils/analytics/analytics.codegen';
9
- import { ANALYTICS_CHANNEL } from '../../common/constants';
10
- import { CancellationError, resolvePluginUpdates } from './utils';
11
10
  import { usePluginReducer } from './reducer';
12
- import { useLinkPickerAnalytics } from '../../common/analytics';
11
+ import { CancellationError, resolvePluginUpdates } from './utils';
13
12
  export function usePlugins(state, activeTab, plugins) {
14
13
  var _activePlugin$tabKey;
15
14
  var _useAnalyticsEvents = useAnalyticsEvents(),
@@ -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';
5
- import GenericErrorSVG from '../../../common/generic-error-svg';
4
+ import EmptyState from '@atlaskit/empty-state';
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
  var messages = defineMessages({
8
9
  heading: {