@atlaskit/link-picker 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/common/generic-error-svg/index.js +2 -10
  3. package/dist/cjs/common/ui/empty-state/index.js +2 -10
  4. package/dist/cjs/common/ui/min-height-container/index.js +2 -14
  5. package/dist/cjs/ui/error-boundary/error-boundary-fallback/index.js +2 -9
  6. package/dist/cjs/ui/link-picker/form-footer/index.js +3 -11
  7. package/dist/cjs/ui/link-picker/index.js +3 -10
  8. package/dist/cjs/ui/link-picker/search-results/index.js +2 -10
  9. package/dist/cjs/ui/link-picker/search-results/link-search-list/index.js +2 -13
  10. package/dist/cjs/ui/link-picker/search-results/link-search-list/link-search-no-results/no-results-svg/index.js +2 -10
  11. package/dist/cjs/ui/link-picker/search-results/link-search-list/list-item/index.js +2 -15
  12. package/dist/cjs/ui/link-picker/search-results/scrolling-tabs/index.js +2 -10
  13. package/dist/cjs/ui/link-picker/search-results/search-results-container/index.js +2 -10
  14. package/dist/cjs/ui/link-picker/text-input/index.js +2 -9
  15. package/dist/cjs/ui/loader-fallback/index.js +2 -10
  16. package/dist/cjs/ui/main.js +3 -11
  17. package/dist/es2019/common/generic-error-svg/index.js +1 -9
  18. package/dist/es2019/common/ui/empty-state/index.js +1 -9
  19. package/dist/es2019/common/ui/min-height-container/index.js +1 -13
  20. package/dist/es2019/ui/error-boundary/error-boundary-fallback/index.js +1 -8
  21. package/dist/es2019/ui/link-picker/form-footer/index.js +2 -10
  22. package/dist/es2019/ui/link-picker/index.js +2 -9
  23. package/dist/es2019/ui/link-picker/search-results/index.js +1 -9
  24. package/dist/es2019/ui/link-picker/search-results/link-search-list/index.js +1 -12
  25. package/dist/es2019/ui/link-picker/search-results/link-search-list/link-search-no-results/no-results-svg/index.js +1 -9
  26. package/dist/es2019/ui/link-picker/search-results/link-search-list/list-item/index.js +1 -14
  27. package/dist/es2019/ui/link-picker/search-results/scrolling-tabs/index.js +1 -9
  28. package/dist/es2019/ui/link-picker/search-results/search-results-container/index.js +1 -9
  29. package/dist/es2019/ui/link-picker/text-input/index.js +1 -8
  30. package/dist/es2019/ui/loader-fallback/index.js +1 -9
  31. package/dist/es2019/ui/main.js +2 -10
  32. package/dist/esm/common/generic-error-svg/index.js +1 -9
  33. package/dist/esm/common/ui/empty-state/index.js +1 -9
  34. package/dist/esm/common/ui/min-height-container/index.js +1 -13
  35. package/dist/esm/ui/error-boundary/error-boundary-fallback/index.js +1 -8
  36. package/dist/esm/ui/link-picker/form-footer/index.js +2 -10
  37. package/dist/esm/ui/link-picker/index.js +2 -9
  38. package/dist/esm/ui/link-picker/search-results/index.js +1 -9
  39. package/dist/esm/ui/link-picker/search-results/link-search-list/index.js +1 -12
  40. package/dist/esm/ui/link-picker/search-results/link-search-list/link-search-no-results/no-results-svg/index.js +1 -9
  41. package/dist/esm/ui/link-picker/search-results/link-search-list/list-item/index.js +1 -14
  42. package/dist/esm/ui/link-picker/search-results/scrolling-tabs/index.js +1 -9
  43. package/dist/esm/ui/link-picker/search-results/search-results-container/index.js +1 -9
  44. package/dist/esm/ui/link-picker/text-input/index.js +1 -8
  45. package/dist/esm/ui/loader-fallback/index.js +1 -9
  46. package/dist/esm/ui/main.js +2 -10
  47. package/dist/types/common/generic-error-svg/index.d.ts +0 -1
  48. package/dist/types/common/ui/empty-state/index.d.ts +1 -2
  49. package/dist/types/common/ui/min-height-container/index.d.ts +0 -3
  50. package/dist/types/ui/error-boundary/error-boundary-fallback/index.d.ts +0 -1
  51. package/dist/types/ui/index.d.ts +2 -2
  52. package/dist/types/ui/lazy.d.ts +1 -1
  53. package/dist/types/ui/link-picker/form-footer/index.d.ts +1 -2
  54. package/dist/types/ui/link-picker/index.d.ts +1 -2
  55. package/dist/types/ui/link-picker/search-results/index.d.ts +1 -2
  56. package/dist/types/ui/link-picker/search-results/link-search-list/index.d.ts +0 -1
  57. package/dist/types/ui/link-picker/search-results/link-search-list/link-search-no-results/no-results-svg/index.d.ts +1 -2
  58. package/dist/types/ui/link-picker/search-results/link-search-list/list-item/index.d.ts +0 -1
  59. package/dist/types/ui/link-picker/search-results/scrolling-tabs/index.d.ts +0 -1
  60. package/dist/types/ui/link-picker/search-results/search-results-container/index.d.ts +1 -2
  61. package/dist/types/ui/link-picker/text-input/index.d.ts +1 -2
  62. package/dist/types/ui/loader-fallback/index.d.ts +0 -1
  63. package/dist/types/ui/main.d.ts +1 -2
  64. package/dist/types-ts4.5/common/generic-error-svg/index.d.ts +0 -1
  65. package/dist/types-ts4.5/common/ui/empty-state/index.d.ts +1 -2
  66. package/dist/types-ts4.5/common/ui/min-height-container/index.d.ts +0 -3
  67. package/dist/types-ts4.5/ui/error-boundary/error-boundary-fallback/index.d.ts +0 -1
  68. package/dist/types-ts4.5/ui/index.d.ts +2 -2
  69. package/dist/types-ts4.5/ui/lazy.d.ts +1 -1
  70. package/dist/types-ts4.5/ui/link-picker/form-footer/index.d.ts +1 -2
  71. package/dist/types-ts4.5/ui/link-picker/index.d.ts +1 -2
  72. package/dist/types-ts4.5/ui/link-picker/search-results/index.d.ts +1 -2
  73. package/dist/types-ts4.5/ui/link-picker/search-results/link-search-list/index.d.ts +0 -1
  74. package/dist/types-ts4.5/ui/link-picker/search-results/link-search-list/link-search-no-results/no-results-svg/index.d.ts +1 -2
  75. package/dist/types-ts4.5/ui/link-picker/search-results/link-search-list/list-item/index.d.ts +0 -1
  76. package/dist/types-ts4.5/ui/link-picker/search-results/scrolling-tabs/index.d.ts +0 -1
  77. package/dist/types-ts4.5/ui/link-picker/search-results/search-results-container/index.d.ts +1 -2
  78. package/dist/types-ts4.5/ui/link-picker/text-input/index.d.ts +1 -2
  79. package/dist/types-ts4.5/ui/loader-fallback/index.d.ts +0 -1
  80. package/dist/types-ts4.5/ui/main.d.ts +1 -2
  81. package/package.json +1 -5
  82. package/report.api.md +1 -1
  83. package/dist/cjs/common/generic-error-svg/old/index.js +0 -66
  84. package/dist/cjs/common/ui/empty-state/old/index.js +0 -38
  85. package/dist/cjs/common/ui/min-height-container/old/index.js +0 -34
  86. package/dist/cjs/common/ui/min-height-container/old/styled.js +0 -16
  87. package/dist/cjs/ui/error-boundary/error-boundary-fallback/old/index.js +0 -50
  88. package/dist/cjs/ui/link-picker/form-footer/old/index.js +0 -116
  89. package/dist/cjs/ui/link-picker/old/index.js +0 -435
  90. package/dist/cjs/ui/link-picker/search-results/link-search-list/link-search-no-results/no-results-svg/old/index.js +0 -70
  91. package/dist/cjs/ui/link-picker/search-results/link-search-list/list-item/old/index.js +0 -145
  92. package/dist/cjs/ui/link-picker/search-results/link-search-list/list-item/old/styled.js +0 -91
  93. package/dist/cjs/ui/link-picker/search-results/link-search-list/old/index.js +0 -188
  94. package/dist/cjs/ui/link-picker/search-results/link-search-list/old/styled.js +0 -45
  95. package/dist/cjs/ui/link-picker/search-results/old/index.js +0 -105
  96. package/dist/cjs/ui/link-picker/search-results/scrolling-tabs/old/index.js +0 -163
  97. package/dist/cjs/ui/link-picker/search-results/scrolling-tabs/old/styles.js +0 -74
  98. package/dist/cjs/ui/link-picker/search-results/search-results-container/old/index.js +0 -43
  99. package/dist/cjs/ui/link-picker/text-input/old/index.js +0 -125
  100. package/dist/cjs/ui/loader-fallback/old/index.js +0 -67
  101. package/dist/cjs/ui/old/main.js +0 -75
  102. package/dist/es2019/common/generic-error-svg/old/index.js +0 -58
  103. package/dist/es2019/common/ui/empty-state/old/index.js +0 -32
  104. package/dist/es2019/common/ui/min-height-container/old/index.js +0 -25
  105. package/dist/es2019/common/ui/min-height-container/old/styled.js +0 -10
  106. package/dist/es2019/ui/error-boundary/error-boundary-fallback/old/index.js +0 -41
  107. package/dist/es2019/ui/link-picker/form-footer/old/index.js +0 -104
  108. package/dist/es2019/ui/link-picker/old/index.js +0 -436
  109. package/dist/es2019/ui/link-picker/search-results/link-search-list/link-search-no-results/no-results-svg/old/index.js +0 -63
  110. package/dist/es2019/ui/link-picker/search-results/link-search-list/list-item/old/index.js +0 -132
  111. package/dist/es2019/ui/link-picker/search-results/link-search-list/list-item/old/styled.js +0 -83
  112. package/dist/es2019/ui/link-picker/search-results/link-search-list/old/index.js +0 -178
  113. package/dist/es2019/ui/link-picker/search-results/link-search-list/old/styled.js +0 -38
  114. package/dist/es2019/ui/link-picker/search-results/old/index.js +0 -98
  115. package/dist/es2019/ui/link-picker/search-results/scrolling-tabs/old/index.js +0 -130
  116. package/dist/es2019/ui/link-picker/search-results/scrolling-tabs/old/styles.js +0 -67
  117. package/dist/es2019/ui/link-picker/search-results/search-results-container/old/index.js +0 -37
  118. package/dist/es2019/ui/link-picker/text-input/old/index.js +0 -121
  119. package/dist/es2019/ui/loader-fallback/old/index.js +0 -60
  120. package/dist/es2019/ui/old/main.js +0 -73
  121. package/dist/esm/common/generic-error-svg/old/index.js +0 -58
  122. package/dist/esm/common/ui/empty-state/old/index.js +0 -31
  123. package/dist/esm/common/ui/min-height-container/old/index.js +0 -25
  124. package/dist/esm/common/ui/min-height-container/old/styled.js +0 -10
  125. package/dist/esm/ui/error-boundary/error-boundary-fallback/old/index.js +0 -43
  126. package/dist/esm/ui/link-picker/form-footer/old/index.js +0 -108
  127. package/dist/esm/ui/link-picker/old/index.js +0 -432
  128. package/dist/esm/ui/link-picker/search-results/link-search-list/link-search-no-results/no-results-svg/old/index.js +0 -63
  129. package/dist/esm/ui/link-picker/search-results/link-search-list/list-item/old/index.js +0 -136
  130. package/dist/esm/ui/link-picker/search-results/link-search-list/list-item/old/styled.js +0 -84
  131. package/dist/esm/ui/link-picker/search-results/link-search-list/old/index.js +0 -186
  132. package/dist/esm/ui/link-picker/search-results/link-search-list/old/styled.js +0 -38
  133. package/dist/esm/ui/link-picker/search-results/old/index.js +0 -100
  134. package/dist/esm/ui/link-picker/search-results/scrolling-tabs/old/index.js +0 -158
  135. package/dist/esm/ui/link-picker/search-results/scrolling-tabs/old/styles.js +0 -67
  136. package/dist/esm/ui/link-picker/search-results/search-results-container/old/index.js +0 -36
  137. package/dist/esm/ui/link-picker/text-input/old/index.js +0 -121
  138. package/dist/esm/ui/loader-fallback/old/index.js +0 -59
  139. package/dist/esm/ui/old/main.js +0 -64
  140. package/dist/types/common/generic-error-svg/old/index.d.ts +0 -6
  141. package/dist/types/common/ui/empty-state/old/index.d.ts +0 -9
  142. package/dist/types/common/ui/min-height-container/old/index.d.ts +0 -8
  143. package/dist/types/common/ui/min-height-container/old/styled.d.ts +0 -1
  144. package/dist/types/ui/error-boundary/error-boundary-fallback/old/index.d.ts +0 -6
  145. package/dist/types/ui/link-picker/form-footer/old/index.d.ts +0 -42
  146. package/dist/types/ui/link-picker/old/index.d.ts +0 -25
  147. package/dist/types/ui/link-picker/search-results/link-search-list/link-search-no-results/no-results-svg/old/index.d.ts +0 -6
  148. package/dist/types/ui/link-picker/search-results/link-search-list/list-item/old/index.d.ts +0 -23
  149. package/dist/types/ui/link-picker/search-results/link-search-list/list-item/old/styled.d.ts +0 -7
  150. package/dist/types/ui/link-picker/search-results/link-search-list/old/index.d.ts +0 -52
  151. package/dist/types/ui/link-picker/search-results/link-search-list/old/styled.d.ts +0 -4
  152. package/dist/types/ui/link-picker/search-results/old/index.d.ts +0 -45
  153. package/dist/types/ui/link-picker/search-results/scrolling-tabs/old/index.d.ts +0 -7
  154. package/dist/types/ui/link-picker/search-results/scrolling-tabs/old/styles.d.ts +0 -6
  155. package/dist/types/ui/link-picker/search-results/search-results-container/old/index.d.ts +0 -10
  156. package/dist/types/ui/link-picker/text-input/old/index.d.ts +0 -18
  157. package/dist/types/ui/loader-fallback/old/index.d.ts +0 -17
  158. package/dist/types/ui/old/main.d.ts +0 -13
  159. package/dist/types-ts4.5/common/generic-error-svg/old/index.d.ts +0 -6
  160. package/dist/types-ts4.5/common/ui/empty-state/old/index.d.ts +0 -9
  161. package/dist/types-ts4.5/common/ui/min-height-container/old/index.d.ts +0 -8
  162. package/dist/types-ts4.5/common/ui/min-height-container/old/styled.d.ts +0 -1
  163. package/dist/types-ts4.5/ui/error-boundary/error-boundary-fallback/old/index.d.ts +0 -6
  164. package/dist/types-ts4.5/ui/link-picker/form-footer/old/index.d.ts +0 -42
  165. package/dist/types-ts4.5/ui/link-picker/old/index.d.ts +0 -25
  166. package/dist/types-ts4.5/ui/link-picker/search-results/link-search-list/link-search-no-results/no-results-svg/old/index.d.ts +0 -6
  167. package/dist/types-ts4.5/ui/link-picker/search-results/link-search-list/list-item/old/index.d.ts +0 -23
  168. package/dist/types-ts4.5/ui/link-picker/search-results/link-search-list/list-item/old/styled.d.ts +0 -7
  169. package/dist/types-ts4.5/ui/link-picker/search-results/link-search-list/old/index.d.ts +0 -52
  170. package/dist/types-ts4.5/ui/link-picker/search-results/link-search-list/old/styled.d.ts +0 -4
  171. package/dist/types-ts4.5/ui/link-picker/search-results/old/index.d.ts +0 -45
  172. package/dist/types-ts4.5/ui/link-picker/search-results/scrolling-tabs/old/index.d.ts +0 -7
  173. package/dist/types-ts4.5/ui/link-picker/search-results/scrolling-tabs/old/styles.d.ts +0 -6
  174. package/dist/types-ts4.5/ui/link-picker/search-results/search-results-container/old/index.d.ts +0 -10
  175. package/dist/types-ts4.5/ui/link-picker/text-input/old/index.d.ts +0 -18
  176. package/dist/types-ts4.5/ui/loader-fallback/old/index.d.ts +0 -17
  177. package/dist/types-ts4.5/ui/old/main.d.ts +0 -13
@@ -1,432 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- /* eslint-disable @atlassian/tangerine/import/no-parent-imports */
7
- /**
8
- * @jsxRuntime classic
9
- * @jsx jsx
10
- */
11
- import { Fragment, memo, useCallback, useLayoutEffect, useMemo, useReducer } from 'react';
12
-
13
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
14
- import { css, jsx } from '@emotion/react';
15
- import { FormattedMessage, useIntl } from 'react-intl-next';
16
- import uuid from 'uuid';
17
- import { useAnalyticsEvents } from '@atlaskit/analytics-next';
18
- import { isSafeUrl, normalizeUrl } from '@atlaskit/linking-common/url';
19
- import { browser } from '@atlaskit/linking-common/user-agent';
20
- import { Box, xcss } from '@atlaskit/primitives';
21
- import VisuallyHidden from '@atlaskit/visually-hidden';
22
- import { useLinkPickerAnalytics, withInputFieldTracking, withLinkPickerAnalyticsContext } from '../../../common/analytics';
23
- import { ANALYTICS_CHANNEL } from '../../../common/constants';
24
- import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
25
- import { handleNavKeyDown } from '../../../common/utils/handleNavKeyDown';
26
- import { usePlugins } from '../../../services/use-plugins';
27
- import { useSearchQuery } from '../../../services/use-search-query';
28
- import { Announcer } from '../announcer';
29
- import { FormFooter, testIds as formFooterTestIds } from '../form-footer';
30
- import { LinkPickerSubmitButton } from '../form-footer/link-picker-submit-button';
31
- import { formMessages, linkMessages, linkTextMessages, searchMessages } from '../messages';
32
- import { SearchResults, testIds as searchTestIds } from '../search-results';
33
- import { testIds as textFieldTestIds, TextInput } from '../text-input';
34
- import { TrackMount } from '../track-mount';
35
- import { getDataSource, getScreenReaderText } from '../utils';
36
- var rootContainerStyles = css({
37
- paddingLeft: 'var(--link-picker-padding-left)',
38
- paddingRight: 'var(--link-picker-padding-right)',
39
- paddingTop: 'var(--link-picker-padding-top)',
40
- paddingBottom: 'var(--link-picker-padding-bottom)',
41
- boxSizing: 'border-box',
42
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
43
- lineHeight: 'initial',
44
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
45
- display: 'block !important'
46
- });
47
- var formFooterMargin = css({
48
- marginTop: "var(--ds-space-200, 16px)"
49
- });
50
- export var testIds = _objectSpread(_objectSpread(_objectSpread({
51
- linkPickerRoot: 'link-picker-root',
52
- linkPicker: 'link-picker',
53
- urlInputField: 'link-url',
54
- textInputField: 'link-text'
55
- }, searchTestIds), formFooterTestIds), textFieldTestIds);
56
- var initState = {
57
- url: '',
58
- displayText: '',
59
- activeIndex: -1,
60
- selectedIndex: -1,
61
- invalidUrl: false,
62
- activeTab: 0,
63
- preventHidingRecents: false
64
- };
65
- var FullWidthSubmitButtonStyles = xcss({
66
- marginTop: 'space.200',
67
- display: 'flex',
68
- flexDirection: 'column'
69
- });
70
- function reducer(state, payload) {
71
- if (payload.url && state.url !== payload.url) {
72
- return _objectSpread(_objectSpread({}, state), {}, {
73
- invalidUrl: false,
74
- selectedIndex: isSafeUrl(payload.url) && payload.url.length ? -1 : state.selectedIndex
75
- }, payload);
76
- }
77
- return _objectSpread(_objectSpread({}, state), payload);
78
- }
79
-
80
- /**
81
- * Bind input fields to analytics tracking
82
- */
83
-
84
- var getLinkFieldContent = function getLinkFieldContent(value) {
85
- if (!Boolean(value)) {
86
- return null;
87
- }
88
- return isSafeUrl(value) ? 'url' : 'text_string';
89
- };
90
- var LinkInputField = withInputFieldTracking(TextInput, 'link', function (event, attributes) {
91
- return _objectSpread(_objectSpread({}, attributes), {}, {
92
- linkFieldContent: getLinkFieldContent(event.currentTarget.value)
93
- });
94
- });
95
- var DisplayTextInputField = withInputFieldTracking(TextInput, 'displayText');
96
- export var LinkPickerOld = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(function (_ref) {
97
- var onSubmit = _ref.onSubmit,
98
- onCancel = _ref.onCancel,
99
- onContentResize = _ref.onContentResize,
100
- plugins = _ref.plugins,
101
- isLoadingPlugins = _ref.isLoadingPlugins,
102
- initUrl = _ref.url,
103
- initDisplayText = _ref.displayText,
104
- hideDisplayText = _ref.hideDisplayText,
105
- featureFlags = _ref.featureFlags,
106
- customMessages = _ref.customMessages,
107
- _ref$isSubmitting = _ref.isSubmitting,
108
- isSubmitting = _ref$isSubmitting === void 0 ? false : _ref$isSubmitting,
109
- _ref$adaptiveHeight = _ref.adaptiveHeight,
110
- adaptiveHeight = _ref$adaptiveHeight === void 0 ? false : _ref$adaptiveHeight,
111
- _ref$moveSubmitButton = _ref.moveSubmitButton,
112
- moveSubmitButton = _ref$moveSubmitButton === void 0 ? false : _ref$moveSubmitButton;
113
- var _useAnalyticsEvents = useAnalyticsEvents(),
114
- createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
115
- var _useReducer = useReducer(reducer, _objectSpread(_objectSpread({}, initState), {}, {
116
- url: normalizeUrl(initUrl) || '',
117
- displayText: initDisplayText || ''
118
- })),
119
- _useReducer2 = _slicedToArray(_useReducer, 2),
120
- state = _useReducer2[0],
121
- dispatch = _useReducer2[1];
122
- var activeIndex = state.activeIndex,
123
- selectedIndex = state.selectedIndex,
124
- url = state.url,
125
- displayText = state.displayText,
126
- invalidUrl = state.invalidUrl,
127
- activeTab = state.activeTab;
128
- var intl = useIntl();
129
- var queryState = useSearchQuery(state);
130
- var _usePlugins = usePlugins(queryState, activeTab, plugins),
131
- items = _usePlugins.items,
132
- isLoadingResults = _usePlugins.isLoading,
133
- isActivePlugin = _usePlugins.isActivePlugin,
134
- activePlugin = _usePlugins.activePlugin,
135
- tabs = _usePlugins.tabs,
136
- error = _usePlugins.error,
137
- retry = _usePlugins.retry,
138
- pluginAction = _usePlugins.pluginAction;
139
- var isEditing = !!initUrl;
140
- var selectedItem = items === null || items === void 0 ? void 0 : items[selectedIndex];
141
- var isSelectedItem = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.url) === url;
142
- var _useLinkPickerAnalyti = useLinkPickerAnalytics(),
143
- trackAttribute = _useLinkPickerAnalyti.trackAttribute,
144
- getAttributes = _useLinkPickerAnalyti.getAttributes;
145
- var submitMessageId = useMemo(function () {
146
- return uuid();
147
- }, []);
148
- useLayoutEffect(function () {
149
- if (onContentResize) {
150
- onContentResize();
151
- }
152
- }, [onContentResize, items, isLoadingResults, isActivePlugin, tabs]);
153
- var handleChangeUrl = useCallback(function (e) {
154
- if (isSubmitting) {
155
- // Prevent changing url while submitting
156
- return;
157
- }
158
-
159
- /** Any on change event is triggered by manual input or paste, so source is null */
160
- trackAttribute('linkFieldContentInputSource', null);
161
- dispatch({
162
- url: e.currentTarget.value,
163
- // If the last action was changing tabs, make sure we're now allowing recents to be hidden
164
- preventHidingRecents: false
165
- });
166
- }, [dispatch, trackAttribute, isSubmitting]);
167
- var handleChangeText = useCallback(function (e) {
168
- dispatch({
169
- displayText: e.currentTarget.value
170
- });
171
- }, [dispatch]);
172
- var handleClear = useCallback(function (field) {
173
- dispatch(_defineProperty({
174
- activeIndex: -1,
175
- selectedIndex: -1
176
- }, field, ''));
177
- }, [dispatch]);
178
- var handleUrlClear = useCallback(function () {
179
- if (isSubmitting) {
180
- // Prevent clearing url while submitting
181
- return;
182
- }
183
- trackAttribute('linkFieldContentInputSource', null);
184
- handleClear('url');
185
- }, [trackAttribute, handleClear, isSubmitting]);
186
- var handleInsert = useCallback(function (url, title, inputType, data) {
187
- var event = createAnalyticsEvent(createEventPayload('ui.form.submitted.linkPicker', {}));
188
-
189
- // Clone the event so that it can be emitted for consumer usage
190
- // This must happen BEFORE the original event is fired!
191
- var consumerEvent = event.clone();
192
- // Cloned event doesnt have the attributes that are added by
193
- // the analytics listener in the LinkPickerAnalyticsContext, add them here
194
- consumerEvent === null || consumerEvent === void 0 || consumerEvent.update({
195
- attributes: getAttributes()
196
- });
197
- // Dispatch the original event to our channel
198
- event.fire(ANALYTICS_CHANNEL);
199
- onSubmit(_objectSpread({
200
- url: url,
201
- displayText: displayText || null,
202
- title: title || null,
203
- meta: {
204
- inputMethod: inputType
205
- },
206
- data: data
207
- }, inputType === 'manual' ? {
208
- rawUrl: state.url
209
- } : {}), consumerEvent);
210
- }, [displayText, onSubmit, state.url, createAnalyticsEvent, getAttributes]);
211
- var handleSelected = useCallback(function (objectId) {
212
- if (isSubmitting) {
213
- // Prevent changing selection while submitting
214
- return;
215
- }
216
- var selectedItem = items === null || items === void 0 ? void 0 : items.find(function (item) {
217
- return item.objectId === objectId;
218
- });
219
- if (selectedItem) {
220
- var _url = selectedItem.url,
221
- name = selectedItem.name;
222
- /**
223
- * Manually track that the url has been updated using searchResult method
224
- */
225
- dispatchEvent(new Event('submit'));
226
- trackAttribute('linkFieldContent', getLinkFieldContent(_url));
227
- trackAttribute('linkFieldContentInputMethod', 'searchResult');
228
- trackAttribute('linkFieldContentInputSource', getDataSource(selectedItem, activePlugin));
229
- handleInsert(_url, name, 'typeAhead', _objectSpread({}, selectedItem));
230
- }
231
- }, [handleInsert, trackAttribute, items, activePlugin, isSubmitting]);
232
- var handleSubmit = useCallback(function (event) {
233
- event === null || event === void 0 || event.preventDefault();
234
- if (isSubmitting) {
235
- // Prevent submit while submitting
236
- return;
237
- }
238
- if (isSelectedItem && selectedItem) {
239
- return handleInsert(selectedItem.url, selectedItem.name, 'typeAhead');
240
- }
241
- var normalized = normalizeUrl(url);
242
- if (normalized) {
243
- return handleInsert(normalized, null, 'manual');
244
- }
245
- return dispatch({
246
- invalidUrl: true
247
- });
248
- }, [dispatch, handleInsert, isSelectedItem, selectedItem, url, isSubmitting]);
249
- var handleTabChange = useCallback(function (activeTab) {
250
- var _plugins$activeTab$ta, _plugins$activeTab;
251
- dispatch({
252
- // We don't want any selection to exist after changing tab, as the selection
253
- // wouldn't mean anything.
254
- activeIndex: -1,
255
- selectedIndex: -1,
256
- // We don't want recents to be hidden, even though we don't have a selection
257
- preventHidingRecents: true,
258
- invalidUrl: false,
259
- activeTab: activeTab
260
- });
261
- trackAttribute('tab', (_plugins$activeTab$ta = plugins === null || plugins === void 0 || (_plugins$activeTab = plugins[activeTab]) === null || _plugins$activeTab === void 0 ? void 0 : _plugins$activeTab.tabKey) !== null && _plugins$activeTab$ta !== void 0 ? _plugins$activeTab$ta : null);
262
- }, [dispatch, plugins, trackAttribute]);
263
- var handleSearchListOnChange = function handleSearchListOnChange(id) {
264
- if (isSubmitting) {
265
- // Prevent changing item while submitting
266
- return;
267
- }
268
- var index = items === null || items === void 0 ? void 0 : items.findIndex(function (item) {
269
- return item.objectId === id;
270
- });
271
- if (typeof index === 'number') {
272
- var item = items === null || items === void 0 ? void 0 : items[index];
273
- if (item) {
274
- /**
275
- * Manually track that the url has been updated using searchResult method
276
- */
277
- trackAttribute('linkFieldContent', getLinkFieldContent(item.url));
278
- trackAttribute('linkFieldContentInputMethod', 'searchResult');
279
- trackAttribute('linkFieldContentInputSource', getDataSource(item, activePlugin));
280
- dispatch({
281
- activeIndex: index,
282
- selectedIndex: index,
283
- url: item.url,
284
- invalidUrl: false
285
- });
286
- }
287
- }
288
- };
289
- var handleKeyDown = useCallback(function (event) {
290
- if (!(items !== null && items !== void 0 && items.length)) {
291
- return;
292
- }
293
- var updatedIndex = activeIndex;
294
- if (event.key === 'Enter') {
295
- event.preventDefault();
296
- if (selectedItem) {
297
- handleSelected(selectedItem.objectId);
298
- } else {
299
- // triggers validation error message
300
- handleSubmit();
301
- }
302
- } else {
303
- updatedIndex = handleNavKeyDown(event, items.length, activeIndex);
304
- }
305
- var item = items[updatedIndex];
306
- if (['Enter', 'ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key) && item) {
307
- /**
308
- * Manually track that the url has been updated using searchResult method
309
- */
310
- trackAttribute('linkFieldContent', getLinkFieldContent(item.url));
311
- trackAttribute('linkFieldContentInputMethod', 'searchResult');
312
- trackAttribute('linkFieldContentInputSource', getDataSource(item, activePlugin));
313
- dispatch({
314
- activeIndex: updatedIndex,
315
- selectedIndex: updatedIndex,
316
- url: item.url,
317
- invalidUrl: false
318
- });
319
- }
320
- }, [items, activeIndex, selectedItem, handleSelected, handleSubmit, trackAttribute, activePlugin]);
321
- var messages = isActivePlugin ? searchMessages : linkMessages;
322
- var screenReaderDescriptionId = 'search-recent-links-field-description';
323
- var linkSearchListId = 'link-picker-search-list';
324
- var ariaActiveDescendant = selectedIndex > -1 ? "link-search-list-item-".concat(selectedIndex) : '';
325
- var a11yList = isActivePlugin || isLoadingPlugins ? {
326
- role: 'combobox',
327
- // When a combobox popup is not visible, the element with role combobox has aria-expanded set to false
328
- // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded#combobox
329
- 'aria-expanded': !!(items !== null && items !== void 0 && items.length),
330
- 'aria-autocomplete': 'list',
331
- 'aria-controls': linkSearchListId,
332
- 'aria-activedescendant': ariaActiveDescendant,
333
- 'aria-describedby': screenReaderDescriptionId
334
- } : undefined;
335
-
336
- // Added workaround with a screen reader Announcer specifically for VoiceOver + Safari
337
- // as the Aria design pattern for combobox does not work in this case
338
- // for details: https://a11y-internal.atlassian.net/browse/AK-740
339
- var screenReaderText = browser().safari && getScreenReaderText(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
340
- var customSubmitButtonLabel = customMessages !== null && customMessages !== void 0 && customMessages.submitButtonLabel ? customMessages.submitButtonLabel : undefined;
341
- return jsx("form", {
342
- "data-testid": testIds.linkPicker,
343
- css: rootContainerStyles
344
- // Use onSubmitCapture instead of onSubmit so that any possible parent form isn't submitted
345
- ,
346
- onSubmitCapture: handleSubmit
347
- }, jsx(TrackMount, null), isActivePlugin && jsx(Fragment, null, screenReaderText && jsx(Announcer, {
348
- ariaLive: "assertive",
349
- text: screenReaderText,
350
- ariaRelevant: "additions",
351
- delay: 250
352
- }), jsx(VisuallyHidden, {
353
- id: screenReaderDescriptionId
354
- }, customMessages !== null && customMessages !== void 0 && customMessages.linkAriaLabel ? jsx(FormattedMessage, customMessages.linkAriaLabel) : jsx(FormattedMessage, messages.linkAriaLabel))), jsx(LinkInputField, _extends({
355
- name: "url",
356
- autoComplete: "off",
357
- testId: testIds.urlInputField,
358
- label: customMessages !== null && customMessages !== void 0 && customMessages.linkLabel ? intl.formatMessage(customMessages.linkLabel) : intl.formatMessage(messages.linkLabel),
359
- placeholder: customMessages !== null && customMessages !== void 0 && customMessages.linkPlaceholder ? intl.formatMessage(customMessages === null || customMessages === void 0 ? void 0 : customMessages.linkPlaceholder) : intl.formatMessage(messages.linkPlaceholder),
360
- value: url,
361
- autoFocus: true,
362
- clearLabel: intl.formatMessage(formMessages.clearLink),
363
- error: invalidUrl ? intl.formatMessage(formMessages.linkInvalid) : null,
364
- spotlightTargetName: "link-picker-search-field-spotlight-target",
365
- "aria-readonly": isSubmitting
366
- }, a11yList, {
367
- onClear: handleUrlClear,
368
- onKeyDown: handleKeyDown,
369
- onChange: handleChangeUrl
370
- })), !hideDisplayText && jsx(DisplayTextInputField, {
371
- autoComplete: "off",
372
- name: "displayText",
373
- testId: testIds.textInputField,
374
- value: displayText,
375
- label: customMessages !== null && customMessages !== void 0 && customMessages.linkTextLabel ? intl.formatMessage(customMessages.linkTextLabel) : intl.formatMessage(linkTextMessages.linkTextLabel),
376
- placeholder: customMessages !== null && customMessages !== void 0 && customMessages.linkTextPlaceholder ? intl.formatMessage(customMessages === null || customMessages === void 0 ? void 0 : customMessages.linkTextPlaceholder) : intl.formatMessage(linkTextMessages.linkTextPlaceholder),
377
- clearLabel: intl.formatMessage(linkTextMessages.clearLinkText),
378
- readOnly: isSubmitting,
379
- onClear: handleClear,
380
- onChange: handleChangeText
381
- }), moveSubmitButton && jsx(Box, {
382
- xcss: FullWidthSubmitButtonStyles
383
- }, jsx(LinkPickerSubmitButton, {
384
- isEditing: isEditing,
385
- isLoading: isLoadingResults || !!isLoadingPlugins,
386
- isSubmitting: isSubmitting,
387
- customSubmitButtonLabel: customSubmitButtonLabel,
388
- error: error,
389
- items: items,
390
- queryState: queryState,
391
- submitMessageId: submitMessageId,
392
- testId: testIds.insertButton,
393
- url: url
394
- })), !!queryState && (isLoadingPlugins || isActivePlugin) && jsx(SearchResults, {
395
- activeTab: activeTab,
396
- tabs: tabs,
397
- activePlugin: activePlugin,
398
- isLoadingResults: isLoadingResults,
399
- isLoadingPlugins: isLoadingPlugins,
400
- isSubmitting: isSubmitting,
401
- linkSearchListId: linkSearchListId,
402
- error: error,
403
- featureFlags: featureFlags,
404
- activeIndex: activeIndex,
405
- selectedIndex: selectedIndex,
406
- items: items,
407
- queryState: queryState,
408
- handleKeyDown: handleKeyDown,
409
- handleSelected: handleSelected,
410
- handleTabChange: handleTabChange,
411
- handleSearchListOnChange: handleSearchListOnChange,
412
- adaptiveHeight: adaptiveHeight,
413
- retry: retry
414
- }), jsx(FormFooter, {
415
- error: error,
416
- items: items
417
- /** If the results section appears to be loading, impact whether the submit button is disabled */,
418
- isLoading: isLoadingResults || !!isLoadingPlugins,
419
- isSubmitting: isSubmitting,
420
- queryState: queryState,
421
- url: url,
422
- isEditing: isEditing,
423
- onCancel: onCancel,
424
- action: pluginAction
425
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
426
- ,
427
- css: !queryState || !(plugins !== null && plugins !== void 0 && plugins.length) ? formFooterMargin : undefined,
428
- customSubmitButtonLabel: customSubmitButtonLabel,
429
- submitMessageId: submitMessageId,
430
- hideSubmitButton: moveSubmitButton
431
- }));
432
- }));
@@ -1,63 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
- import { css, jsx } from '@emotion/react';
7
- var HEIGHT = 120;
8
- var noResultsSVGStyles = css({
9
- height: "".concat(HEIGHT, "px"),
10
- display: 'block'
11
- });
12
- export var NoResultsSVGOld = function NoResultsSVGOld() {
13
- var id = 'link-picker-ui-no-results-svg';
14
- return jsx("svg", {
15
- css: noResultsSVGStyles,
16
- height: "120",
17
- viewBox: "0 0 208 191",
18
- fill: "none",
19
- xmlns: "http://www.w3.org/2000/svg"
20
- }, jsx("g", {
21
- clipPath: "url(#".concat(id, "-a)")
22
- }, jsx("path", {
23
- opacity: ".3",
24
- d: "M105.28 190.44c-.93.03-1.86.05-2.79.06-1.3.01-2.36-1.04-2.36-2.34-.01-1.27 1-2.32 2.27-2.36h.07c5.93-.03 11.95-.67 17.74-1.9a2.352 2.352 0 0 1 .98 4.6 94.236 94.236 0 0 1-15.91 1.94ZM89.77 189.649c-.13 0-.27 0-.41-.02a91.17 91.17 0 0 1-18.27-4.49 2.353 2.353 0 1 1 1.59-4.43 85.94 85.94 0 0 0 17.32 4.25c1.29.18 2.19 1.36 2.01 2.65-.15 1.16-1.12 2-2.24 2.04ZM133.08 184.98c-.99.03-1.93-.56-2.29-1.54-.45-1.22.17-2.57 1.39-3.02a87.114 87.114 0 0 0 16.01-7.87 2.35 2.35 0 1 1 2.5 3.98c-5.32 3.33-11 6.13-16.87 8.3-.25.1-.49.14-.74.15ZM60.25 180.089c-.4.01-.81-.07-1.18-.27a92.004 92.004 0 0 1-15.61-10.48 2.35 2.35 0 0 1-.31-3.31c.83-1 2.31-1.14 3.31-.31a87.13 87.13 0 0 0 14.81 9.94c1.15.61 1.58 2.03.97 3.18a2.31 2.31 0 0 1-1.99 1.25ZM35.79 161.01c-.67.02-1.35-.24-1.83-.77a91.583 91.583 0 0 1-11.11-15.17 2.353 2.353 0 1 1 4.06-2.38c3 5.13 6.55 9.97 10.54 14.39.87.96.8 2.45-.17 3.32-.43.39-.96.59-1.49.61ZM179.7 145.469c-.42.01-.86-.08-1.25-.31a2.346 2.346 0 0 1-.87-3.21 86.618 86.618 0 0 0 7.22-16.31c.4-1.24 1.73-1.91 2.96-1.51 1.24.4 1.91 1.73 1.51 2.96a91.279 91.279 0 0 1-7.62 17.19c-.41.74-1.16 1.16-1.95 1.19ZM19.3 134.749c-.96.03-1.88-.53-2.26-1.47a90.64 90.64 0 0 1-5.23-18.06 2.35 2.35 0 0 1 1.9-2.73c1.28-.23 2.5.62 2.73 1.9a87.04 87.04 0 0 0 4.96 17.13c.49 1.2-.09 2.58-1.3 3.06-.26.1-.53.16-.8.17ZM190.19 116.26a2.346 2.346 0 0 1-2.4-2.74c1-5.84 1.39-11.83 1.18-17.8l-.01-.2c-.05-1.3.97-2.39 2.27-2.43 1.3-.05 2.39.97 2.43 2.27l.01.2c.22 6.29-.2 12.6-1.25 18.76a2.345 2.345 0 0 1-2.23 1.94ZM12.82 104.36c-1.3.05-2.39-.92-2.43-2.22v-.1c-.22-6.26.19-12.54 1.23-18.66a2.36 2.36 0 0 1 2.71-1.93 2.36 2.36 0 0 1 1.93 2.71 87.974 87.974 0 0 0-1.17 17.7c.05 1.31-.97 2.45-2.27 2.5ZM190 85.05a2.35 2.35 0 0 1-2.39-1.93A86.803 86.803 0 0 0 182.63 66a2.36 2.36 0 0 1 1.29-3.07c1.2-.49 2.58.09 3.07 1.29 2.36 5.8 4.13 11.88 5.25 18.06.23 1.28-.61 2.5-1.89 2.74l-.35.03ZM17.07 73.668c-.27.01-.54-.03-.81-.11a2.347 2.347 0 0 1-1.51-2.96 91.288 91.288 0 0 1 7.6-17.2 2.355 2.355 0 0 1 3.21-.88c1.13.64 1.52 2.08.88 3.21a87.027 87.027 0 0 0-7.21 16.32c-.32.96-1.2 1.59-2.16 1.62ZM179.22 55.98a2.34 2.34 0 0 1-2.11-1.16 87.748 87.748 0 0 0-10.56-14.38c-.87-.96-.8-2.45.17-3.32.96-.87 2.45-.8 3.32.17 4.22 4.66 7.96 9.75 11.13 15.15.66 1.12.28 2.56-.84 3.22-.35.2-.73.3-1.11.32ZM31.61 46.26c-.53.02-1.07-.14-1.53-.5a2.354 2.354 0 0 1-.41-3.3 92.27 92.27 0 0 1 13.01-13.57 2.36 2.36 0 0 1 3.32.27c.84.99.72 2.47-.27 3.32a87.993 87.993 0 0 0-12.35 12.88c-.44.57-1.1.88-1.77.9ZM159.12 32.35c-.56.02-1.12-.16-1.58-.54-4.59-3.8-9.57-7.14-14.83-9.93a2.35 2.35 0 0 1-.98-3.18 2.359 2.359 0 0 1 3.18-.98 91.78 91.78 0 0 1 15.62 10.46c1 .83 1.14 2.31.31 3.31-.44.54-1.08.83-1.72.86ZM54.62 25.45c-.81.03-1.61-.36-2.08-1.1a2.35 2.35 0 0 1 .74-3.24 91.806 91.806 0 0 1 16.87-8.32c1.22-.45 2.57.17 3.02 1.39.45 1.22-.17 2.57-1.39 3.02a86.792 86.792 0 0 0-16 7.89c-.36.23-.76.35-1.16.36ZM132.16 16.979c-.29.01-.59-.03-.87-.14-5.6-2-11.43-3.42-17.33-4.23a2.353 2.353 0 0 1 .64-4.66c6.22.85 12.36 2.35 18.27 4.46 1.22.44 1.86 1.78 1.42 3.01-.33.93-1.2 1.53-2.13 1.56ZM83.36 13.78a2.352 2.352 0 0 1-.57-4.65 93.98 93.98 0 0 1 18.69-2.03 2.356 2.356 0 0 1 .1 4.71h-.07c-5.93.03-11.95.69-17.74 1.92-.14.03-.28.04-.41.05Z",
25
- fill: "#B3BAC5"
26
- }), jsx("path", {
27
- opacity: ".3",
28
- d: "M190.8 34.81a.522.522 0 0 1-.39-.56l.06-.45c.05-.29.11-.6.19-.92.3-1.15.85-2.18 1.64-3.09.79-.91 1.93-1.67 3.4-2.26l2.48-1.01c1.48-.59 2.39-1.57 2.75-2.92.13-.49.17-.99.12-1.51a3.44 3.44 0 0 0-.47-1.46c-.27-.45-.64-.86-1.13-1.22-.49-.36-1.09-.63-1.81-.82-.78-.2-1.47-.23-2.09-.09-.62.14-1.17.39-1.65.74s-.88.8-1.2 1.34c-.33.54-.57 1.12-.73 1.72-.05.18-.09.36-.12.52-.09.47-.56.75-1.02.61L187 22.26c-.36-.11-.61-.46-.57-.83.01-.12.03-.24.05-.36.06-.34.13-.66.21-.98.3-1.15.81-2.22 1.53-3.21.72-.99 1.61-1.8 2.67-2.43 1.06-.63 2.26-1.04 3.62-1.24 1.36-.2 2.84-.08 4.45.34 1.67.44 3.07 1.07 4.2 1.89 1.14.82 2.03 1.74 2.68 2.75.65 1.02 1.06 2.1 1.22 3.25.16 1.15.1 2.27-.19 3.36-.45 1.72-1.23 3.09-2.32 4.11-1.1 1.02-2.41 1.82-3.95 2.39l-2.09.79c-.59.19-1.47.58-2.2 1.38-.07.08-.37.41-.67.92-.22.38-.38.75-.49 1.07-.09.26-.37.4-.63.33l-3.72-.98Zm-3.06 5.87c.25-.95.79-1.67 1.63-2.17.84-.5 1.73-.63 2.68-.38.95.25 1.67.8 2.17 1.65.5.85.62 1.75.37 2.7-.25.95-.8 1.66-1.65 2.15-.85.48-1.75.6-2.69.35-.95-.25-1.67-.79-2.15-1.62-.49-.84-.61-1.73-.36-2.68ZM18.51 21.94a.518.518 0 0 1-.35-.58l.09-.45c.07-.29.15-.59.26-.9.38-1.13.99-2.12 1.85-2.97.85-.86 2.03-1.53 3.55-2.03l2.54-.84c1.51-.49 2.49-1.4 2.94-2.73.16-.48.24-.98.22-1.5-.01-.52-.14-1.02-.37-1.49-.23-.47-.58-.9-1.05-1.29-.46-.39-1.05-.7-1.75-.94-.76-.26-1.46-.33-2.08-.23-.63.1-1.19.31-1.69.63s-.93.74-1.29 1.26a6.16 6.16 0 0 0-.86 1.67c-.06.18-.11.35-.15.51-.12.46-.61.71-1.06.54l-3.74-1.42a.803.803 0 0 1-.51-.87c.02-.12.05-.24.08-.36.08-.33.17-.65.28-.96.38-1.13.96-2.16 1.75-3.1s1.73-1.69 2.82-2.25c1.1-.56 2.33-.89 3.69-.99 1.37-.1 2.84.11 4.41.64 1.63.55 2.99 1.27 4.07 2.17 1.08.9 1.91 1.87 2.49 2.93.58 1.06.92 2.16 1 3.32a8.52 8.52 0 0 1-.42 3.34c-.57 1.69-1.43 3-2.6 3.94-1.16.94-2.53 1.65-4.1 2.12l-2.14.64c-.6.15-1.51.48-2.29 1.23-.08.08-.4.39-.73.87-.25.37-.43.72-.56 1.03a.52.52 0 0 1-.65.29l-3.65-1.23Zm-3.45 5.65c.31-.93.9-1.62 1.77-2.06.87-.44 1.77-.51 2.7-.2.93.31 1.61.91 2.05 1.79.44.88.5 1.79.19 2.72-.31.93-.91 1.61-1.79 2.03-.88.42-1.78.48-2.71.17-.93-.31-1.61-.9-2.04-1.77-.42-.85-.48-1.75-.17-2.68ZM12.39 180.998c-.24.09-.52 0-.64-.23-.07-.13-.14-.27-.21-.41-.13-.27-.25-.56-.37-.86a7.553 7.553 0 0 1-.43-3.47c.13-1.2.62-2.47 1.49-3.81l1.45-2.25c.87-1.33 1.06-2.66.57-3.97a4.47 4.47 0 0 0-.77-1.31c-.34-.4-.74-.71-1.22-.93-.48-.22-1.02-.33-1.63-.35-.61-.01-1.26.11-1.95.37-.75.28-1.34.65-1.77 1.13-.43.47-.73.99-.92 1.55-.19.56-.26 1.16-.22 1.79.04.63.17 1.24.39 1.83.07.18.13.34.2.49a.8.8 0 0 1-.48 1.09l-3.8 1.24a.788.788 0 0 1-.94-.36c-.06-.11-.11-.22-.17-.33-.15-.31-.28-.62-.39-.92a9.594 9.594 0 0 1-.59-3.51c.02-1.23.28-2.4.79-3.52.5-1.12 1.25-2.15 2.25-3.09s2.28-1.7 3.84-2.27c1.62-.6 3.12-.89 4.52-.87 1.4.02 2.66.26 3.78.71 1.12.46 2.07 1.11 2.86 1.96.79.85 1.38 1.8 1.77 2.86.62 1.67.77 3.24.46 4.7s-.93 2.87-1.86 4.23l-1.26 1.85c-.37.5-.87 1.32-1.01 2.39-.01.11-.07.55-.02 1.13.04.44.12.83.22 1.15a.53.53 0 0 1-.33.64l-3.61 1.35Zm.87 6.56c-.34-.92-.31-1.82.09-2.72.4-.89 1.06-1.51 1.98-1.85.92-.34 1.83-.3 2.72.11.9.41 1.52 1.08 1.86 2 .34.92.3 1.82-.12 2.7-.42.88-1.09 1.49-2 1.83-.92.34-1.82.31-2.7-.09-.88-.4-1.49-1.06-1.83-1.98Z",
29
- fill: "#C1C7D0"
30
- }), jsx("path", {
31
- d: "m149.36 134.209-7.15-6.93-9.63 9.95 7.15 6.93c1.83 1.77 3.11 4.02 3.71 6.49.6 2.47 1.89 4.72 3.71 6.49l29.03 28.1c4.4 4.26 11.41 4.14 15.67-.25 4.26-4.4 4.14-11.41-.25-15.67l-29.03-28.1a13.457 13.457 0 0 0-6.61-3.5 13.65 13.65 0 0 1-6.6-3.51Z",
32
- fill: "#CFD4DB"
33
- }), jsx("path", {
34
- d: "M155.68 137.628c-2.37-.55-4.56-1.73-6.31-3.43l-2.18-2.11a6.92 6.92 0 0 0-9.79.16 6.92 6.92 0 0 0 .16 9.79l2.18 2.11c1.75 1.7 3 3.84 3.63 6.19 2.35-1.78 4.57-3.75 6.66-5.91 2.07-2.13 3.95-4.41 5.65-6.8Z",
35
- fill: "#B3BAC5"
36
- }), jsx("path", {
37
- d: "M101.95 156.619c-15.47.25-30.11-5.54-41.22-16.3-22.95-22.21-23.54-58.95-1.33-81.9 10.76-11.11 25.21-17.37 40.67-17.63 15.47-.25 30.11 5.54 41.22 16.3 11.12 10.76 17.37 25.21 17.63 40.67.25 15.47-5.54 30.11-16.3 41.22-10.75 11.13-25.2 17.39-40.67 17.64Zm-1.65-102c-11.78.19-22.77 4.96-30.97 13.42-16.91 17.47-16.46 45.44 1.01 62.35 8.46 8.19 19.61 12.6 31.39 12.41 11.78-.19 22.77-4.96 30.97-13.42 8.19-8.46 12.6-19.61 12.41-31.39-.19-11.78-4.96-22.77-13.42-30.97-8.47-8.18-19.61-12.59-31.39-12.4Z",
38
- fill: "url(#".concat(id, "-b)")
39
- }), jsx("path", {
40
- d: "m118.92 85.84-5.34-5.25c-.79-.77-2.05-.76-2.83.03l-9.79 9.97-9.97-9.79c-.79-.77-2.05-.76-2.83.03l-5.25 5.34c-.77.79-.76 2.05.03 2.83l9.97 9.79-9.79 9.97c-.77.79-.76 2.05.03 2.83l5.34 5.25c.79.77 2.05.76 2.83-.03l9.79-9.97 9.97 9.79c.79.77 2.05.76 2.83-.03l5.25-5.34c.77-.79.76-2.05-.03-2.83l-9.97-9.79 9.79-9.97c.77-.79.76-2.06-.03-2.83Z",
41
- fill: "#C1C7D0"
42
- })), jsx("defs", null, jsx("linearGradient", {
43
- id: "".concat(id, "-b"),
44
- x1: "60.062",
45
- y1: "139.664",
46
- x2: "141.969",
47
- y2: "57.757",
48
- gradientUnits: "userSpaceOnUse"
49
- }, jsx("stop", {
50
- offset: ".557",
51
- stopColor: "#C1C7D0"
52
- }), jsx("stop", {
53
- offset: ".966",
54
- stopColor: "#E9EBEF",
55
- stopOpacity: ".5"
56
- })), jsx("clipPath", {
57
- id: "".concat(id, "-a")
58
- }, jsx("path", {
59
- fill: "#fff",
60
- transform: "translate(0 .62)",
61
- d: "M0 0h207.16v189.87H0z"
62
- }))));
63
- };
@@ -1,136 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- /**
3
- * @jsxRuntime classic
4
- * @jsx jsx
5
- */
6
- import { forwardRef, Fragment } from 'react';
7
-
8
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
- import { jsx } from '@emotion/react';
10
- import { useIntl } from 'react-intl-next';
11
- import { Text } from '@atlaskit/primitives';
12
- /* eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports */
13
- import { transformTimeStamp } from '../../../../transformTimeStamp';
14
- import { composeListItemStyles, imgStyles, itemIconStyles, itemNameStyles, listItemContainerInnerStyles, listItemContainerStyles, listItemContextStyles } from './styled';
15
- export var testIds = {
16
- searchResultItem: 'link-search-list-item',
17
- searchResultIcon: 'link-search-list-item-icon'
18
- };
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 (
37
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
38
- jsx("span", {
39
- css: itemIconStyles
40
- }, jsx(Glyph, {
41
- alt: alt,
42
- "data-testid": testIds.searchResultIcon
43
- }))
44
- );
45
- }
46
- return (
47
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
48
- jsx("span", {
49
- css: itemIconStyles
50
- }, jsx("img", {
51
- "data-testid": testIds.searchResultIcon,
52
- src: isSVG(icon) ? base64SVG(icon) : icon,
53
- alt: alt
54
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
55
- ,
56
- css: imgStyles
57
- }))
58
- );
59
- };
60
- var ListItemSubtitle = function ListItemSubtitle(_ref) {
61
- var _ref$items = _slicedToArray(_ref.items, 2),
62
- firstItem = _ref$items[0],
63
- secondItem = _ref$items[1];
64
- return /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 */(
65
- jsx("div", {
66
- "data-testid": "".concat(testIds.searchResultItem, "-subtitle"),
67
- css: listItemContextStyles
68
- }, jsx("div", {
69
- css: listItemContainerStyles
70
- }, jsx("span", {
71
- css: listItemContainerInnerStyles
72
- }, firstItem)), secondItem && jsx("div", {
73
- css: listItemContainerInnerStyles
74
- }, jsx(Fragment, null, "\xA0 \u2022\xA0 "), jsx(Fragment, null, secondItem)))
75
- );
76
- /* eslint-enable @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 */
77
- };
78
- var getDefaultSubtitleItems = function getDefaultSubtitleItems(item, intl) {
79
- var container = item.container;
80
- var date = transformTimeStamp(intl, item.lastViewedDate, item.lastUpdatedDate);
81
- if (container) {
82
- if (date) {
83
- return [container, date];
84
- }
85
- return [container];
86
- }
87
- if (date) {
88
- return [date];
89
- }
90
- return undefined;
91
- };
92
- export var LinkSearchListItemOld = /*#__PURE__*/forwardRef(function (_ref2, ref) {
93
- var item = _ref2.item,
94
- selected = _ref2.selected,
95
- id = _ref2.id,
96
- role = _ref2.role,
97
- onSelect = _ref2.onSelect,
98
- tabIndex = _ref2.tabIndex,
99
- onKeyDown = _ref2.onKeyDown,
100
- onFocus = _ref2.onFocus,
101
- _ref2$nameMaxLines = _ref2.nameMaxLines,
102
- nameMaxLines = _ref2$nameMaxLines === void 0 ? 1 : _ref2$nameMaxLines;
103
- var intl = useIntl();
104
- var handleSelect = function handleSelect() {
105
- return onSelect(item.objectId);
106
- };
107
- var subtitleItems = item.subtitleItems || getDefaultSubtitleItems(item, intl);
108
- return (
109
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
110
- jsx("div", {
111
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
112
- css: composeListItemStyles(selected),
113
- role: role,
114
- id: id,
115
- "aria-selected": selected,
116
- "data-testid": testIds.searchResultItem,
117
- onKeyDown: onKeyDown,
118
- onClick: handleSelect,
119
- onFocus: onFocus,
120
- tabIndex: tabIndex,
121
- ref: ref
122
- }, jsx(ListItemIcon, {
123
- item: item,
124
- intl: intl
125
- }), jsx("div", {
126
- css: itemNameStyles
127
- }, jsx(Text, {
128
- maxLines: nameMaxLines
129
- }, jsx("span", {
130
- "data-testid": "".concat(testIds.searchResultItem, "-title"),
131
- title: item.name
132
- }, item.name)), subtitleItems && jsx(ListItemSubtitle, {
133
- items: subtitleItems
134
- })))
135
- );
136
- });