@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
@@ -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(_ref) {
5
+ import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
6
+ export function TrackTabViewed(_ref) {
7
7
  var activePlugin = _ref.activePlugin;
8
8
  var _useAnalyticsEvents = useAnalyticsEvents(),
9
9
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
@@ -13,5 +13,4 @@ function TrackTabViewed(_ref) {
13
13
  }
14
14
  }, [activePlugin, createAnalyticsEvent]);
15
15
  return null;
16
- }
17
- export default TrackTabViewed;
16
+ }
@@ -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
  var formatTime = function formatTime(timeStamp, intl) {
6
6
  var isAbsolute = isMoreThanOneWeekAgo(timeStamp);
7
7
  if (isAbsolute) {
@@ -1,24 +1,4 @@
1
- import { browser } from '@atlaskit/linking-common/user-agent';
2
1
  import { transformTimeStamp } from './transformTimeStamp';
3
- var KeyZCode = 90;
4
- var KeyYCode = 89;
5
- export var isUndoEvent = function isUndoEvent(e) {
6
- var _browser = browser(),
7
- mac = _browser.mac;
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 var isRedoEvent = function isRedoEvent(e) {
15
- var _browser2 = browser(),
16
- mac = _browser2.mac;
17
- return (
18
- // ctrl + y for non-mac
19
- !mac && e.ctrlKey && e.keyCode === KeyYCode || mac && e.metaKey && e.shiftKey && e.keyCode === KeyZCode || e.ctrlKey && e.shiftKey && e.keyCode === KeyZCode
20
- );
21
- };
22
2
 
23
3
  /**
24
4
  * Retrieve the data source for a link given the item and the plugin that resolved it
@@ -37,26 +17,4 @@ export function getScreenReaderText(items, selectedIndex, intl) {
37
17
  var date = transformTimeStamp(intl, lastViewedDate, lastUpdatedDate);
38
18
  return [name, container, date].filter(Boolean).join(', ');
39
19
  }
40
- }
41
- export var handleNavKeyDown = function handleNavKeyDown(event, itemsLength, activeIndex) {
42
- var updatedIndex = activeIndex;
43
- switch (event.key) {
44
- case 'ArrowDown':
45
- event.preventDefault();
46
- updatedIndex = (activeIndex + 1) % itemsLength;
47
- break;
48
- case 'ArrowUp':
49
- event.preventDefault();
50
- updatedIndex = activeIndex > 0 ? activeIndex - 1 : itemsLength - 1;
51
- break;
52
- case 'Home':
53
- event.preventDefault();
54
- updatedIndex = 0;
55
- break;
56
- case 'End':
57
- event.preventDefault();
58
- updatedIndex = itemsLength - 1;
59
- break;
60
- }
61
- return updatedIndex;
62
- };
20
+ }
@@ -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,16 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3;
3
+ import { css } from '@emotion/react';
4
+
5
+ // eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
6
+ import { rootContainerStyles } from '../link-picker/styled';
7
+
8
+ /** Link Picker loader / skeleton will be taller in height when displayText field is shown */
9
+ // See lazy-load-height example to verify these
10
+ var LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_DISPLAYTEXT = 142;
11
+ var LINK_PICKER_MIN_HEIGHT_IN_PX_WITH_DISPLAYTEXT = 220;
12
+ var rootContainerStylesForLoader = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n display: flex;\n align-items: center;\n justify-content: center;\n"])), rootContainerStyles);
13
+ export var rootContainerStylesForLoaderWithDisplaytext = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n min-height: ", "px;\n"])), rootContainerStylesForLoader, LINK_PICKER_MIN_HEIGHT_IN_PX_WITH_DISPLAYTEXT);
14
+
15
+ /** Link Picker loader / skeleton will be shorter in height when displayText field isn't shown */
16
+ export var rootContainerStylesForLoaderWithoutDisplaytext = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n min-height: ", "px;\n"])), rootContainerStylesForLoader, LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_DISPLAYTEXT);
@@ -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
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
+ import { LinkPickerProps } from '../../index';
2
3
  import { LinkPickerAnalyticsContextType } from '../utils/analytics/analytics.codegen';
3
- import { LinkPickerProps } from '../../';
4
4
  type AnalyticsContextAttributesType = LinkPickerAnalyticsContextType;
5
5
  export type TrackAttribute = <K extends keyof LinkPickerAnalyticsContextType>(attribute: K, value: AnalyticsContextAttributesType[K]) => void;
6
6
  interface AnalyticsContextType {
@@ -1,2 +1,3 @@
1
1
  export declare const ANALYTICS_CHANNEL = "media";
2
2
  export declare const COMPONENT_NAME = "linkPicker";
3
+ export declare const RECENT_SEARCH_LIST_SIZE = 5;
@@ -1,4 +1,3 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
- declare const GenericErrorSVG: (props: React.SVGProps<SVGSVGElement>) => jsx.JSX.Element;
4
- export default GenericErrorSVG;
3
+ export declare const GenericErrorSVG: (props: React.SVGProps<SVGSVGElement>) => jsx.JSX.Element;
@@ -61,3 +61,13 @@ export interface LinkPickerPluginAction {
61
61
  }
62
62
  export type LinkPickerPluginErrorFallback = (error: unknown, retry: () => void) => ReactNode;
63
63
  export type LinkPickerPluginEmptyStateNoResults = () => ReactNode;
64
+ export interface PickerState {
65
+ selectedIndex: number;
66
+ activeIndex: number;
67
+ url: string;
68
+ displayText: string;
69
+ invalidUrl: boolean;
70
+ activeTab: number;
71
+ /** When true, even if the selected index is -1, don't hide the recents. */
72
+ preventHidingRecents: boolean;
73
+ }
@@ -0,0 +1,2 @@
1
+ import { KeyboardEvent } from 'react';
2
+ export declare const handleNavKeyDown: (event: KeyboardEvent<HTMLElement>, itemsLength: number, activeIndex: number) => number;
@@ -1,8 +1,7 @@
1
1
  /// <reference types="react" />
2
- declare const useFixHeight: (shouldFixHeight: boolean) => {
2
+ export declare const useFixHeight: (shouldFixHeight: boolean) => {
3
3
  ref: import("react").RefObject<HTMLDivElement>;
4
4
  style: {
5
5
  minHeight: string | number;
6
6
  } | undefined;
7
7
  };
8
- export default useFixHeight;
@@ -1,4 +1,4 @@
1
1
  export { ComposedLinkPicker as LinkPicker } from './ui';
2
2
  export type { LinkPickerProps } from './ui/link-picker';
3
- export type { LinkInputType, LinkPickerPluginAction, LinkPickerPlugin, LinkPickerState, LinkSearchListItemData, LinkPickerPluginErrorFallback, LinkPickerPluginEmptyStateNoResults, } from './ui/types';
3
+ export type { LinkInputType, LinkPickerPluginAction, LinkPickerPlugin, LinkPickerState, LinkSearchListItemData, LinkPickerPluginErrorFallback, LinkPickerPluginEmptyStateNoResults, } from './common/types';
4
4
  export { UnauthenticatedError } from './common/utils/errors';
@@ -1,4 +1,4 @@
1
- import { LinkPickerPlugin, LinkPickerPluginAction, LinkPickerPluginErrorFallback, LinkPickerState, LinkSearchListItemData } from '../../ui/types';
1
+ import { LinkPickerPlugin, LinkPickerPluginAction, LinkPickerPluginErrorFallback, LinkPickerState, LinkSearchListItemData } from '../../common/types';
2
2
  export interface LinkPickerPluginsService {
3
3
  items: LinkSearchListItemData[] | null;
4
4
  isLoading: boolean;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { LinkSearchListItemData } from '../../ui/types';
2
+ import { LinkSearchListItemData } from '../../common/types';
3
3
  export interface PluginState {
4
4
  items: LinkSearchListItemData[] | null;
5
5
  error: unknown | null;
@@ -1,4 +1,4 @@
1
- import { LinkPickerPlugin, LinkPickerState, ResolveResult } from '../../ui/types';
1
+ import { LinkPickerPlugin, LinkPickerState, ResolveResult } from '../../common/types';
2
2
  export declare class CancellationError extends Error {
3
3
  }
4
4
  export declare const cancellable: <T extends unknown>(promise: Promise<T>) => {
@@ -1,3 +1,2 @@
1
- import { LinkPickerState } from '../../ui/types';
2
- import { PickerState } from '../../ui/link-picker';
1
+ import { LinkPickerState, PickerState } from '../../common/types';
3
2
  export declare function useSearchQuery(state: PickerState): LinkPickerState | null;
@@ -1,7 +1,6 @@
1
- import React, { ReactNode } from 'react';
2
- import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
- interface ErrorBoundaryProps extends WithAnalyticsEventsProps {
1
+ import { ReactNode } from 'react';
2
+ interface ErrorBoundaryProps {
4
3
  children: ReactNode;
5
4
  }
6
- declare const _default: React.ForwardRefExoticComponent<Omit<ErrorBoundaryProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
7
- export default _default;
5
+ export declare function ErrorBoundary({ children }: ErrorBoundaryProps): JSX.Element;
6
+ export {};
@@ -6,4 +6,3 @@ export declare const testIds: {
6
6
  };
7
7
  export declare const PACKAGE_DATA: PackageMetaDataType;
8
8
  export declare const ComposedLinkPicker: React.MemoExoticComponent<(props: LinkPickerProps) => JSX.Element>;
9
- export default ComposedLinkPicker;
@@ -18,5 +18,5 @@ type AnnouncerProps = {
18
18
  * It can be useful for cases when the parent component re-renders with the same announcer's text. */
19
19
  delay?: number;
20
20
  };
21
- declare const _default: React.NamedExoticComponent<AnnouncerProps>;
22
- export default _default;
21
+ export declare const Announcer: React.FC<AnnouncerProps>;
22
+ export {};
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
- /** @jsx jsx */
3
2
  import { jsx } from '@emotion/react';
4
- import { LinkPickerPluginAction, LinkPickerState, LinkSearchListItemData } from '../../types';
3
+ import { LinkPickerPluginAction, LinkPickerState, LinkSearchListItemData } from '../../../common/types';
5
4
  export declare const testIds: {
6
5
  readonly insertButton: "link-picker-insert-button";
7
6
  readonly cancelButton: "link-picker-cancel-button";
@@ -18,5 +17,5 @@ interface FormFooterProps extends React.HTMLAttributes<HTMLElement> {
18
17
  onCancel?: () => void;
19
18
  action?: LinkPickerPluginAction;
20
19
  }
21
- declare const _default: import("react").MemoExoticComponent<({ isLoading, error, url, queryState, items, isEditing, onCancel, action, ...restProps }: FormFooterProps) => jsx.JSX.Element | null>;
22
- export default _default;
20
+ export declare const FormFooter: import("react").MemoExoticComponent<({ isLoading, error, url, queryState, items, isEditing, onCancel, action, ...restProps }: FormFooterProps) => jsx.JSX.Element | null>;
21
+ export {};
@@ -1,2 +1,2 @@
1
- import { LinkPickerState, LinkSearchListItemData } from '../../types';
1
+ import { LinkPickerState, LinkSearchListItemData } from '../../../common/types';
2
2
  export declare const checkSubmitDisabled: (isLoading: boolean, error: unknown | null, url: string, queryState: LinkPickerState | null, items: LinkSearchListItemData[] | null) => boolean;
@@ -1,17 +1,17 @@
1
1
  /// <reference types="react" />
2
2
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import { LinkInputType, LinkPickerPlugin } from '../types';
4
- export declare const RECENT_SEARCH_LIST_SIZE = 5;
3
+ import { LinkInputType, LinkPickerPlugin } from '../../common/types';
5
4
  export declare const testIds: {
6
5
  readonly tabList: "link-picker-tabs";
7
6
  readonly tabItem: "link-picker-tab";
8
7
  readonly urlError: string;
9
8
  readonly clearUrlButton: string;
10
9
  readonly resultListTitle: string;
11
- readonly searchResultItem: string;
12
10
  readonly searchResultList: string;
13
11
  readonly searchResultLoadingIndicator: string;
14
12
  readonly tabsLoadingIndicator: string;
13
+ readonly searchResultItem: string;
14
+ readonly searchResultIcon: string;
15
15
  readonly emptyResultPage: string;
16
16
  readonly searchError: string;
17
17
  readonly insertButton: "link-picker-insert-button";
@@ -21,7 +21,6 @@ export declare const testIds: {
21
21
  readonly linkPicker: "link-picker";
22
22
  readonly urlInputField: "link-url";
23
23
  readonly textInputField: "link-text";
24
- readonly searchIcon: "link-picker-search-icon";
25
24
  };
26
25
  interface Meta {
27
26
  /** Indicates how the link was picked. */
@@ -69,15 +68,5 @@ export interface LinkPickerProps {
69
68
  hideDisplayText?: boolean;
70
69
  featureFlags?: Record<string, unknown>;
71
70
  }
72
- export interface PickerState {
73
- selectedIndex: number;
74
- activeIndex: number;
75
- url: string;
76
- displayText: string;
77
- invalidUrl: boolean;
78
- activeTab: number;
79
- /** When true, even if the selected index is -1, don't hide the recents. */
80
- preventHidingRecents: boolean;
81
- }
82
- declare const _default: import("react").ComponentType<LinkPickerProps>;
83
- export default _default;
71
+ export declare const LinkPicker: import("react").ComponentType<LinkPickerProps>;
72
+ export {};
@@ -16,5 +16,4 @@ export declare const messages: {
16
16
  export declare const testIds: {
17
17
  searchError: string;
18
18
  };
19
- declare const LinkSearchError: () => jsx.JSX.Element;
20
- export default LinkSearchError;
19
+ export declare const LinkSearchError: () => jsx.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { KeyboardEvent } from 'react';
3
- import { LinkPickerPlugin, LinkSearchListItemData } from '../../types';
3
+ import { LinkPickerPlugin, LinkSearchListItemData } from '../../../common/types';
4
4
  export declare const messages: {
5
5
  titleRecentlyViewed: {
6
6
  id: string;
@@ -20,10 +20,11 @@ export declare const messages: {
20
20
  };
21
21
  export declare const testIds: {
22
22
  resultListTitle: string;
23
- searchResultItem: string;
24
23
  searchResultList: string;
25
24
  searchResultLoadingIndicator: string;
26
25
  tabsLoadingIndicator: string;
26
+ searchResultItem: string;
27
+ searchResultIcon: string;
27
28
  emptyResultPage: string;
28
29
  };
29
30
  type LinkSearchListElement = HTMLElement;
@@ -42,5 +43,5 @@ export interface LinkSearchListProps extends Omit<React.HTMLAttributes<LinkSearc
42
43
  hasSearchTerm?: boolean;
43
44
  activePlugin?: LinkPickerPlugin;
44
45
  }
45
- declare const LinkSearchList: import("react").ForwardRefExoticComponent<LinkSearchListProps & import("react").RefAttributes<HTMLDivElement>>;
46
- export default LinkSearchList;
46
+ export declare const LinkSearchList: import("react").ForwardRefExoticComponent<LinkSearchListProps & import("react").RefAttributes<HTMLDivElement>>;
47
+ export {};
@@ -15,5 +15,4 @@ export declare const messages: {
15
15
  export declare const testIds: {
16
16
  emptyResultPage: string;
17
17
  };
18
- declare const NoResults: () => jsx.JSX.Element;
19
- export default NoResults;
18
+ export declare const NoResults: () => jsx.JSX.Element;
@@ -1,4 +1,3 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
- declare const NoResultsSVG: () => jsx.JSX.Element;
4
- export default NoResultsSVG;
3
+ export declare const NoResultsSVG: () => jsx.JSX.Element;
@@ -0,0 +1,19 @@
1
+ /** @jsx jsx */
2
+ import { KeyboardEvent } from 'react';
3
+ import { LinkSearchListItemData } from '../../../../common/types';
4
+ export declare const testIds: {
5
+ searchResultItem: string;
6
+ searchResultIcon: string;
7
+ };
8
+ export interface LinkSearchListItemProps {
9
+ item: LinkSearchListItemData;
10
+ selected: boolean;
11
+ active: boolean;
12
+ tabIndex?: number;
13
+ onSelect: (objectId: string) => void;
14
+ onKeyDown: (e: KeyboardEvent<HTMLDivElement>) => void;
15
+ onFocus: () => void;
16
+ id?: string;
17
+ role?: string;
18
+ }
19
+ export declare const LinkSearchListItem: import("react").ForwardRefExoticComponent<LinkSearchListItemProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,2 +1,2 @@
1
- import { LinkSearchListItemData } from '../../../types';
1
+ import { LinkSearchListItemData } from '../../../../common/types';
2
2
  export declare const useTrackResultsShown: (isLoading: boolean, items?: LinkSearchListItemData[] | null | undefined, hasSearchTerm?: boolean) => void;
@@ -4,4 +4,4 @@ interface ScrollingTabListProps {
4
4
  children: JSX.Element;
5
5
  }
6
6
  export declare const ScrollingTabList: (props: ScrollingTabListProps) => jsx.JSX.Element;
7
- export default ScrollingTabList;
7
+ export {};
@@ -2,11 +2,6 @@
2
2
  * Half padding on the top as the form field has a `gridSize()` margin top that cannot be overridden
3
3
  */
4
4
  export declare const rootContainerStyles: import("@emotion/react").SerializedStyles;
5
- /** Link Picker loader / skeleton will be taller in height when displayText field is shown */
6
- export declare const rootContainerStylesForLoaderWithDisplaytext: import("@emotion/react").SerializedStyles;
7
- /** Link Picker loader / skeleton will be shorter in height when displayText field isn't shown */
8
- export declare const rootContainerStylesForLoaderWithoutDisplaytext: import("@emotion/react").SerializedStyles;
9
- export declare const searchIconStyles: import("@emotion/react").SerializedStyles;
10
5
  export declare const tabsWrapperStyles: import("@emotion/react").SerializedStyles;
11
6
  export declare const flexColumnStyles: import("@emotion/react").SerializedStyles;
12
7
  export declare const formFooterMargin: import("@emotion/react").SerializedStyles;
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import type { FunctionComponent } from 'react';
1
+ import React, { FunctionComponent } from 'react';
3
2
  export interface ConditionalSpotlightTargetWrapperProps {
4
3
  spotlightTargetName?: string;
5
4
  children: React.ReactElement;
@@ -1,6 +1,6 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { TextFieldProps } from '@atlaskit/textfield';
3
- import { ConditionalSpotlightTargetWrapperProps } from '../conditional-spotlight-target-wrapper';
3
+ import { ConditionalSpotlightTargetWrapperProps } from './conditional-spotlight-target-wrapper';
4
4
  export type TextInputProps = Omit<TextFieldProps, 'name' | 'value'> & Pick<ConditionalSpotlightTargetWrapperProps, 'spotlightTargetName'> & {
5
5
  name: string;
6
6
  value: string;
@@ -15,5 +15,4 @@ export declare const testIds: {
15
15
  urlError: string;
16
16
  clearUrlButton: string;
17
17
  };
18
- declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, spotlightTargetName, ...restProps }: TextInputProps) => jsx.JSX.Element;
19
- export default TextInput;
18
+ export declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, spotlightTargetName, ...restProps }: TextInputProps) => jsx.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { KeyboardEvent } from 'react';
2
+ export declare const isUndoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
3
+ export declare const isRedoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
@@ -1,5 +1,4 @@
1
1
  /**
2
2
  * UFO + Analytics tracking for component mount (and unmount)
3
3
  */
4
- declare function TrackMount(): null;
5
- export default TrackMount;
4
+ export declare function TrackMount(): null;
@@ -1,5 +1,4 @@
1
1
  import { LinkPickerPlugin } from '../../../index';
2
- declare function TrackTabViewed({ activePlugin, }: {
2
+ export declare function TrackTabViewed({ activePlugin, }: {
3
3
  activePlugin: LinkPickerPlugin | undefined;
4
4
  }): null;
5
- export default TrackTabViewed;
@@ -1,11 +1,7 @@
1
- import { KeyboardEvent } from 'react';
2
1
  import { IntlShape } from 'react-intl-next';
3
- import { LinkPickerPlugin, LinkSearchListItemData } from '../types';
4
- export declare const isUndoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
5
- export declare const isRedoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
2
+ import { LinkPickerPlugin, LinkSearchListItemData } from '../../common/types';
6
3
  /**
7
4
  * Retrieve the data source for a link given the item and the plugin that resolved it
8
5
  */
9
6
  export declare const getDataSource: (item: LinkSearchListItemData, plugin?: LinkPickerPlugin) => string;
10
7
  export declare function getScreenReaderText(items: LinkSearchListItemData[], selectedIndex: number, intl: IntlShape): string | undefined;
11
- export declare const handleNavKeyDown: (event: KeyboardEvent<HTMLElement>, itemsLength: number, activeIndex: number) => number;
@@ -0,0 +1,3 @@
1
+ export declare const rootContainerStylesForLoaderWithDisplaytext: import("@emotion/react").SerializedStyles;
2
+ /** Link Picker loader / skeleton will be shorter in height when displayText field isn't shown */
3
+ export declare const rootContainerStylesForLoaderWithoutDisplaytext: import("@emotion/react").SerializedStyles;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
+ import { LinkPickerProps } from '../../index';
2
3
  import { LinkPickerAnalyticsContextType } from '../utils/analytics/analytics.codegen';
3
- import { LinkPickerProps } from '../../';
4
4
  type AnalyticsContextAttributesType = LinkPickerAnalyticsContextType;
5
5
  export type TrackAttribute = <K extends keyof LinkPickerAnalyticsContextType>(attribute: K, value: AnalyticsContextAttributesType[K]) => void;
6
6
  interface AnalyticsContextType {
@@ -1,2 +1,3 @@
1
1
  export declare const ANALYTICS_CHANNEL = "media";
2
2
  export declare const COMPONENT_NAME = "linkPicker";
3
+ export declare const RECENT_SEARCH_LIST_SIZE = 5;
@@ -1,4 +1,3 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
- declare const GenericErrorSVG: (props: React.SVGProps<SVGSVGElement>) => jsx.JSX.Element;
4
- export default GenericErrorSVG;
3
+ export declare const GenericErrorSVG: (props: React.SVGProps<SVGSVGElement>) => jsx.JSX.Element;
@@ -61,3 +61,13 @@ export interface LinkPickerPluginAction {
61
61
  }
62
62
  export type LinkPickerPluginErrorFallback = (error: unknown, retry: () => void) => ReactNode;
63
63
  export type LinkPickerPluginEmptyStateNoResults = () => ReactNode;
64
+ export interface PickerState {
65
+ selectedIndex: number;
66
+ activeIndex: number;
67
+ url: string;
68
+ displayText: string;
69
+ invalidUrl: boolean;
70
+ activeTab: number;
71
+ /** When true, even if the selected index is -1, don't hide the recents. */
72
+ preventHidingRecents: boolean;
73
+ }
@@ -0,0 +1,2 @@
1
+ import { KeyboardEvent } from 'react';
2
+ export declare const handleNavKeyDown: (event: KeyboardEvent<HTMLElement>, itemsLength: number, activeIndex: number) => number;
@@ -1,8 +1,7 @@
1
1
  /// <reference types="react" />
2
- declare const useFixHeight: (shouldFixHeight: boolean) => {
2
+ export declare const useFixHeight: (shouldFixHeight: boolean) => {
3
3
  ref: import("react").RefObject<HTMLDivElement>;
4
4
  style: {
5
5
  minHeight: string | number;
6
6
  } | undefined;
7
7
  };
8
- export default useFixHeight;
@@ -1,4 +1,4 @@
1
1
  export { ComposedLinkPicker as LinkPicker } from './ui';
2
2
  export type { LinkPickerProps } from './ui/link-picker';
3
- export type { LinkInputType, LinkPickerPluginAction, LinkPickerPlugin, LinkPickerState, LinkSearchListItemData, LinkPickerPluginErrorFallback, LinkPickerPluginEmptyStateNoResults, } from './ui/types';
3
+ export type { LinkInputType, LinkPickerPluginAction, LinkPickerPlugin, LinkPickerState, LinkSearchListItemData, LinkPickerPluginErrorFallback, LinkPickerPluginEmptyStateNoResults, } from './common/types';
4
4
  export { UnauthenticatedError } from './common/utils/errors';
@@ -1,4 +1,4 @@
1
- import { LinkPickerPlugin, LinkPickerPluginAction, LinkPickerPluginErrorFallback, LinkPickerState, LinkSearchListItemData } from '../../ui/types';
1
+ import { LinkPickerPlugin, LinkPickerPluginAction, LinkPickerPluginErrorFallback, LinkPickerState, LinkSearchListItemData } from '../../common/types';
2
2
  export interface LinkPickerPluginsService {
3
3
  items: LinkSearchListItemData[] | null;
4
4
  isLoading: boolean;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { LinkSearchListItemData } from '../../ui/types';
2
+ import { LinkSearchListItemData } from '../../common/types';
3
3
  export interface PluginState {
4
4
  items: LinkSearchListItemData[] | null;
5
5
  error: unknown | null;
@@ -1,4 +1,4 @@
1
- import { LinkPickerPlugin, LinkPickerState, ResolveResult } from '../../ui/types';
1
+ import { LinkPickerPlugin, LinkPickerState, ResolveResult } from '../../common/types';
2
2
  export declare class CancellationError extends Error {
3
3
  }
4
4
  export declare const cancellable: <T extends unknown>(promise: Promise<T>) => {
@@ -1,3 +1,2 @@
1
- import { LinkPickerState } from '../../ui/types';
2
- import { PickerState } from '../../ui/link-picker';
1
+ import { LinkPickerState, PickerState } from '../../common/types';
3
2
  export declare function useSearchQuery(state: PickerState): LinkPickerState | null;
@@ -1,7 +1,6 @@
1
- import React, { ReactNode } from 'react';
2
- import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
- interface ErrorBoundaryProps extends WithAnalyticsEventsProps {
1
+ import { ReactNode } from 'react';
2
+ interface ErrorBoundaryProps {
4
3
  children: ReactNode;
5
4
  }
6
- declare const _default: React.ForwardRefExoticComponent<Omit<ErrorBoundaryProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
7
- export default _default;
5
+ export declare function ErrorBoundary({ children }: ErrorBoundaryProps): JSX.Element;
6
+ export {};
@@ -6,4 +6,3 @@ export declare const testIds: {
6
6
  };
7
7
  export declare const PACKAGE_DATA: PackageMetaDataType;
8
8
  export declare const ComposedLinkPicker: React.MemoExoticComponent<(props: LinkPickerProps) => JSX.Element>;
9
- export default ComposedLinkPicker;
@@ -18,5 +18,5 @@ type AnnouncerProps = {
18
18
  * It can be useful for cases when the parent component re-renders with the same announcer's text. */
19
19
  delay?: number;
20
20
  };
21
- declare const _default: React.NamedExoticComponent<AnnouncerProps>;
22
- export default _default;
21
+ export declare const Announcer: React.FC<AnnouncerProps>;
22
+ export {};
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
- /** @jsx jsx */
3
2
  import { jsx } from '@emotion/react';
4
- import { LinkPickerPluginAction, LinkPickerState, LinkSearchListItemData } from '../../types';
3
+ import { LinkPickerPluginAction, LinkPickerState, LinkSearchListItemData } from '../../../common/types';
5
4
  export declare const testIds: {
6
5
  readonly insertButton: "link-picker-insert-button";
7
6
  readonly cancelButton: "link-picker-cancel-button";
@@ -18,5 +17,5 @@ interface FormFooterProps extends React.HTMLAttributes<HTMLElement> {
18
17
  onCancel?: () => void;
19
18
  action?: LinkPickerPluginAction;
20
19
  }
21
- declare const _default: import("react").MemoExoticComponent<({ isLoading, error, url, queryState, items, isEditing, onCancel, action, ...restProps }: FormFooterProps) => jsx.JSX.Element | null>;
22
- export default _default;
20
+ export declare const FormFooter: import("react").MemoExoticComponent<({ isLoading, error, url, queryState, items, isEditing, onCancel, action, ...restProps }: FormFooterProps) => jsx.JSX.Element | null>;
21
+ export {};
@@ -1,2 +1,2 @@
1
- import { LinkPickerState, LinkSearchListItemData } from '../../types';
1
+ import { LinkPickerState, LinkSearchListItemData } from '../../../common/types';
2
2
  export declare const checkSubmitDisabled: (isLoading: boolean, error: unknown | null, url: string, queryState: LinkPickerState | null, items: LinkSearchListItemData[] | null) => boolean;