@atlaskit/link-picker 2.0.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 +17 -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 +6 -10
  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,436 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- /* eslint-disable @atlassian/tangerine/import/no-parent-imports */
3
- /**
4
- * @jsxRuntime classic
5
- * @jsx jsx
6
- */
7
- import { Fragment, memo, useCallback, useLayoutEffect, useMemo, useReducer } from 'react';
8
-
9
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
- import { css, jsx } from '@emotion/react';
11
- import { FormattedMessage, useIntl } from 'react-intl-next';
12
- import uuid from 'uuid';
13
- import { useAnalyticsEvents } from '@atlaskit/analytics-next';
14
- import { isSafeUrl, normalizeUrl } from '@atlaskit/linking-common/url';
15
- import { browser } from '@atlaskit/linking-common/user-agent';
16
- import { Box, xcss } from '@atlaskit/primitives';
17
- import VisuallyHidden from '@atlaskit/visually-hidden';
18
- import { useLinkPickerAnalytics, withInputFieldTracking, withLinkPickerAnalyticsContext } from '../../../common/analytics';
19
- import { ANALYTICS_CHANNEL } from '../../../common/constants';
20
- import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
21
- import { handleNavKeyDown } from '../../../common/utils/handleNavKeyDown';
22
- import { usePlugins } from '../../../services/use-plugins';
23
- import { useSearchQuery } from '../../../services/use-search-query';
24
- import { Announcer } from '../announcer';
25
- import { FormFooter, testIds as formFooterTestIds } from '../form-footer';
26
- import { LinkPickerSubmitButton } from '../form-footer/link-picker-submit-button';
27
- import { formMessages, linkMessages, linkTextMessages, searchMessages } from '../messages';
28
- import { SearchResults, testIds as searchTestIds } from '../search-results';
29
- import { testIds as textFieldTestIds, TextInput } from '../text-input';
30
- import { TrackMount } from '../track-mount';
31
- import { getDataSource, getScreenReaderText } from '../utils';
32
- const rootContainerStyles = css({
33
- paddingLeft: 'var(--link-picker-padding-left)',
34
- paddingRight: 'var(--link-picker-padding-right)',
35
- paddingTop: 'var(--link-picker-padding-top)',
36
- paddingBottom: 'var(--link-picker-padding-bottom)',
37
- boxSizing: 'border-box',
38
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
39
- lineHeight: 'initial',
40
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
41
- display: 'block !important'
42
- });
43
- const formFooterMargin = css({
44
- marginTop: "var(--ds-space-200, 16px)"
45
- });
46
- export const testIds = {
47
- linkPickerRoot: 'link-picker-root',
48
- linkPicker: 'link-picker',
49
- urlInputField: 'link-url',
50
- textInputField: 'link-text',
51
- ...searchTestIds,
52
- ...formFooterTestIds,
53
- ...textFieldTestIds
54
- };
55
- const initState = {
56
- url: '',
57
- displayText: '',
58
- activeIndex: -1,
59
- selectedIndex: -1,
60
- invalidUrl: false,
61
- activeTab: 0,
62
- preventHidingRecents: false
63
- };
64
- const FullWidthSubmitButtonStyles = xcss({
65
- marginTop: 'space.200',
66
- display: 'flex',
67
- flexDirection: 'column'
68
- });
69
- function reducer(state, payload) {
70
- if (payload.url && state.url !== payload.url) {
71
- return {
72
- ...state,
73
- invalidUrl: false,
74
- selectedIndex: isSafeUrl(payload.url) && payload.url.length ? -1 : state.selectedIndex,
75
- ...payload
76
- };
77
- }
78
- return {
79
- ...state,
80
- ...payload
81
- };
82
- }
83
-
84
- /**
85
- * Bind input fields to analytics tracking
86
- */
87
-
88
- const getLinkFieldContent = value => {
89
- if (!Boolean(value)) {
90
- return null;
91
- }
92
- return isSafeUrl(value) ? 'url' : 'text_string';
93
- };
94
- const LinkInputField = withInputFieldTracking(TextInput, 'link', (event, attributes) => ({
95
- ...attributes,
96
- linkFieldContent: getLinkFieldContent(event.currentTarget.value)
97
- }));
98
- const DisplayTextInputField = withInputFieldTracking(TextInput, 'displayText');
99
- export const LinkPickerOld = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
100
- onSubmit,
101
- onCancel,
102
- onContentResize,
103
- plugins,
104
- isLoadingPlugins,
105
- url: initUrl,
106
- displayText: initDisplayText,
107
- hideDisplayText,
108
- featureFlags,
109
- customMessages,
110
- isSubmitting = false,
111
- adaptiveHeight = false,
112
- moveSubmitButton = false
113
- }) => {
114
- const {
115
- createAnalyticsEvent
116
- } = useAnalyticsEvents();
117
- const [state, dispatch] = useReducer(reducer, {
118
- ...initState,
119
- url: normalizeUrl(initUrl) || '',
120
- displayText: initDisplayText || ''
121
- });
122
- const {
123
- activeIndex,
124
- selectedIndex,
125
- url,
126
- displayText,
127
- invalidUrl,
128
- activeTab
129
- } = state;
130
- const intl = useIntl();
131
- const queryState = useSearchQuery(state);
132
- const {
133
- items,
134
- isLoading: isLoadingResults,
135
- isActivePlugin,
136
- activePlugin,
137
- tabs,
138
- error,
139
- retry,
140
- pluginAction
141
- } = usePlugins(queryState, activeTab, plugins);
142
- const isEditing = !!initUrl;
143
- const selectedItem = items === null || items === void 0 ? void 0 : items[selectedIndex];
144
- const isSelectedItem = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.url) === url;
145
- const {
146
- trackAttribute,
147
- getAttributes
148
- } = useLinkPickerAnalytics();
149
- const submitMessageId = useMemo(() => uuid(), []);
150
- useLayoutEffect(() => {
151
- if (onContentResize) {
152
- onContentResize();
153
- }
154
- }, [onContentResize, items, isLoadingResults, isActivePlugin, tabs]);
155
- const handleChangeUrl = useCallback(e => {
156
- if (isSubmitting) {
157
- // Prevent changing url while submitting
158
- return;
159
- }
160
-
161
- /** Any on change event is triggered by manual input or paste, so source is null */
162
- trackAttribute('linkFieldContentInputSource', null);
163
- dispatch({
164
- url: e.currentTarget.value,
165
- // If the last action was changing tabs, make sure we're now allowing recents to be hidden
166
- preventHidingRecents: false
167
- });
168
- }, [dispatch, trackAttribute, isSubmitting]);
169
- const handleChangeText = useCallback(e => {
170
- dispatch({
171
- displayText: e.currentTarget.value
172
- });
173
- }, [dispatch]);
174
- const handleClear = useCallback(field => {
175
- dispatch({
176
- activeIndex: -1,
177
- selectedIndex: -1,
178
- [field]: ''
179
- });
180
- }, [dispatch]);
181
- const handleUrlClear = useCallback(() => {
182
- if (isSubmitting) {
183
- // Prevent clearing url while submitting
184
- return;
185
- }
186
- trackAttribute('linkFieldContentInputSource', null);
187
- handleClear('url');
188
- }, [trackAttribute, handleClear, isSubmitting]);
189
- const handleInsert = useCallback((url, title, inputType, data) => {
190
- const event = createAnalyticsEvent(createEventPayload('ui.form.submitted.linkPicker', {}));
191
-
192
- // Clone the event so that it can be emitted for consumer usage
193
- // This must happen BEFORE the original event is fired!
194
- const consumerEvent = event.clone();
195
- // Cloned event doesnt have the attributes that are added by
196
- // the analytics listener in the LinkPickerAnalyticsContext, add them here
197
- consumerEvent === null || consumerEvent === void 0 ? void 0 : consumerEvent.update({
198
- attributes: getAttributes()
199
- });
200
- // Dispatch the original event to our channel
201
- event.fire(ANALYTICS_CHANNEL);
202
- onSubmit({
203
- url,
204
- displayText: displayText || null,
205
- title: title || null,
206
- meta: {
207
- inputMethod: inputType
208
- },
209
- data,
210
- ...(inputType === 'manual' ? {
211
- rawUrl: state.url
212
- } : {})
213
- }, consumerEvent);
214
- }, [displayText, onSubmit, state.url, createAnalyticsEvent, getAttributes]);
215
- const handleSelected = useCallback(objectId => {
216
- if (isSubmitting) {
217
- // Prevent changing selection while submitting
218
- return;
219
- }
220
- const selectedItem = items === null || items === void 0 ? void 0 : items.find(item => item.objectId === objectId);
221
- if (selectedItem) {
222
- const {
223
- url,
224
- name
225
- } = selectedItem;
226
- /**
227
- * Manually track that the url has been updated using searchResult method
228
- */
229
- dispatchEvent(new Event('submit'));
230
- trackAttribute('linkFieldContent', getLinkFieldContent(url));
231
- trackAttribute('linkFieldContentInputMethod', 'searchResult');
232
- trackAttribute('linkFieldContentInputSource', getDataSource(selectedItem, activePlugin));
233
- handleInsert(url, name, 'typeAhead', {
234
- ...selectedItem
235
- });
236
- }
237
- }, [handleInsert, trackAttribute, items, activePlugin, isSubmitting]);
238
- const handleSubmit = useCallback(event => {
239
- event === null || event === void 0 ? void 0 : event.preventDefault();
240
- if (isSubmitting) {
241
- // Prevent submit while submitting
242
- return;
243
- }
244
- if (isSelectedItem && selectedItem) {
245
- return handleInsert(selectedItem.url, selectedItem.name, 'typeAhead');
246
- }
247
- const normalized = normalizeUrl(url);
248
- if (normalized) {
249
- return handleInsert(normalized, null, 'manual');
250
- }
251
- return dispatch({
252
- invalidUrl: true
253
- });
254
- }, [dispatch, handleInsert, isSelectedItem, selectedItem, url, isSubmitting]);
255
- const handleTabChange = useCallback(activeTab => {
256
- var _plugins$activeTab$ta, _plugins$activeTab;
257
- dispatch({
258
- // We don't want any selection to exist after changing tab, as the selection
259
- // wouldn't mean anything.
260
- activeIndex: -1,
261
- selectedIndex: -1,
262
- // We don't want recents to be hidden, even though we don't have a selection
263
- preventHidingRecents: true,
264
- invalidUrl: false,
265
- activeTab
266
- });
267
- trackAttribute('tab', (_plugins$activeTab$ta = plugins === null || plugins === void 0 ? 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);
268
- }, [dispatch, plugins, trackAttribute]);
269
- const handleSearchListOnChange = id => {
270
- if (isSubmitting) {
271
- // Prevent changing item while submitting
272
- return;
273
- }
274
- const index = items === null || items === void 0 ? void 0 : items.findIndex(item => item.objectId === id);
275
- if (typeof index === 'number') {
276
- const item = items === null || items === void 0 ? void 0 : items[index];
277
- if (item) {
278
- /**
279
- * Manually track that the url has been updated using searchResult method
280
- */
281
- trackAttribute('linkFieldContent', getLinkFieldContent(item.url));
282
- trackAttribute('linkFieldContentInputMethod', 'searchResult');
283
- trackAttribute('linkFieldContentInputSource', getDataSource(item, activePlugin));
284
- dispatch({
285
- activeIndex: index,
286
- selectedIndex: index,
287
- url: item.url,
288
- invalidUrl: false
289
- });
290
- }
291
- }
292
- };
293
- const handleKeyDown = useCallback(event => {
294
- if (!(items !== null && items !== void 0 && items.length)) {
295
- return;
296
- }
297
- let updatedIndex = activeIndex;
298
- if (event.key === 'Enter') {
299
- event.preventDefault();
300
- if (selectedItem) {
301
- handleSelected(selectedItem.objectId);
302
- } else {
303
- // triggers validation error message
304
- handleSubmit();
305
- }
306
- } else {
307
- updatedIndex = handleNavKeyDown(event, items.length, activeIndex);
308
- }
309
- const item = items[updatedIndex];
310
- if (['Enter', 'ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key) && item) {
311
- /**
312
- * Manually track that the url has been updated using searchResult method
313
- */
314
- trackAttribute('linkFieldContent', getLinkFieldContent(item.url));
315
- trackAttribute('linkFieldContentInputMethod', 'searchResult');
316
- trackAttribute('linkFieldContentInputSource', getDataSource(item, activePlugin));
317
- dispatch({
318
- activeIndex: updatedIndex,
319
- selectedIndex: updatedIndex,
320
- url: item.url,
321
- invalidUrl: false
322
- });
323
- }
324
- }, [items, activeIndex, selectedItem, handleSelected, handleSubmit, trackAttribute, activePlugin]);
325
- const messages = isActivePlugin ? searchMessages : linkMessages;
326
- const screenReaderDescriptionId = 'search-recent-links-field-description';
327
- const linkSearchListId = 'link-picker-search-list';
328
- const ariaActiveDescendant = selectedIndex > -1 ? `link-search-list-item-${selectedIndex}` : '';
329
- const a11yList = isActivePlugin || isLoadingPlugins ? {
330
- role: 'combobox',
331
- // When a combobox popup is not visible, the element with role combobox has aria-expanded set to false
332
- // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded#combobox
333
- 'aria-expanded': !!(items !== null && items !== void 0 && items.length),
334
- 'aria-autocomplete': 'list',
335
- 'aria-controls': linkSearchListId,
336
- 'aria-activedescendant': ariaActiveDescendant,
337
- 'aria-describedby': screenReaderDescriptionId
338
- } : undefined;
339
-
340
- // Added workaround with a screen reader Announcer specifically for VoiceOver + Safari
341
- // as the Aria design pattern for combobox does not work in this case
342
- // for details: https://a11y-internal.atlassian.net/browse/AK-740
343
- const screenReaderText = browser().safari && getScreenReaderText(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
344
- const customSubmitButtonLabel = customMessages !== null && customMessages !== void 0 && customMessages.submitButtonLabel ? customMessages.submitButtonLabel : undefined;
345
- return jsx("form", {
346
- "data-testid": testIds.linkPicker,
347
- css: rootContainerStyles
348
- // Use onSubmitCapture instead of onSubmit so that any possible parent form isn't submitted
349
- ,
350
- onSubmitCapture: handleSubmit
351
- }, jsx(TrackMount, null), isActivePlugin && jsx(Fragment, null, screenReaderText && jsx(Announcer, {
352
- ariaLive: "assertive",
353
- text: screenReaderText,
354
- ariaRelevant: "additions",
355
- delay: 250
356
- }), jsx(VisuallyHidden, {
357
- id: screenReaderDescriptionId
358
- }, customMessages !== null && customMessages !== void 0 && customMessages.linkAriaLabel ? jsx(FormattedMessage, customMessages.linkAriaLabel) : jsx(FormattedMessage, messages.linkAriaLabel))), jsx(LinkInputField, _extends({
359
- name: "url",
360
- autoComplete: "off",
361
- testId: testIds.urlInputField,
362
- label: customMessages !== null && customMessages !== void 0 && customMessages.linkLabel ? intl.formatMessage(customMessages.linkLabel) : intl.formatMessage(messages.linkLabel),
363
- placeholder: customMessages !== null && customMessages !== void 0 && customMessages.linkPlaceholder ? intl.formatMessage(customMessages === null || customMessages === void 0 ? void 0 : customMessages.linkPlaceholder) : intl.formatMessage(messages.linkPlaceholder),
364
- value: url,
365
- autoFocus: true,
366
- clearLabel: intl.formatMessage(formMessages.clearLink),
367
- error: invalidUrl ? intl.formatMessage(formMessages.linkInvalid) : null,
368
- spotlightTargetName: "link-picker-search-field-spotlight-target",
369
- "aria-readonly": isSubmitting
370
- }, a11yList, {
371
- onClear: handleUrlClear,
372
- onKeyDown: handleKeyDown,
373
- onChange: handleChangeUrl
374
- })), !hideDisplayText && jsx(DisplayTextInputField, {
375
- autoComplete: "off",
376
- name: "displayText",
377
- testId: testIds.textInputField,
378
- value: displayText,
379
- label: customMessages !== null && customMessages !== void 0 && customMessages.linkTextLabel ? intl.formatMessage(customMessages.linkTextLabel) : intl.formatMessage(linkTextMessages.linkTextLabel),
380
- placeholder: customMessages !== null && customMessages !== void 0 && customMessages.linkTextPlaceholder ? intl.formatMessage(customMessages === null || customMessages === void 0 ? void 0 : customMessages.linkTextPlaceholder) : intl.formatMessage(linkTextMessages.linkTextPlaceholder),
381
- clearLabel: intl.formatMessage(linkTextMessages.clearLinkText),
382
- readOnly: isSubmitting,
383
- onClear: handleClear,
384
- onChange: handleChangeText
385
- }), moveSubmitButton && jsx(Box, {
386
- xcss: FullWidthSubmitButtonStyles
387
- }, jsx(LinkPickerSubmitButton, {
388
- isEditing: isEditing,
389
- isLoading: isLoadingResults || !!isLoadingPlugins,
390
- isSubmitting: isSubmitting,
391
- customSubmitButtonLabel: customSubmitButtonLabel,
392
- error: error,
393
- items: items,
394
- queryState: queryState,
395
- submitMessageId: submitMessageId,
396
- testId: testIds.insertButton,
397
- url: url
398
- })), !!queryState && (isLoadingPlugins || isActivePlugin) && jsx(SearchResults, {
399
- activeTab: activeTab,
400
- tabs: tabs,
401
- activePlugin: activePlugin,
402
- isLoadingResults: isLoadingResults,
403
- isLoadingPlugins: isLoadingPlugins,
404
- isSubmitting: isSubmitting,
405
- linkSearchListId: linkSearchListId,
406
- error: error,
407
- featureFlags: featureFlags,
408
- activeIndex: activeIndex,
409
- selectedIndex: selectedIndex,
410
- items: items,
411
- queryState: queryState,
412
- handleKeyDown: handleKeyDown,
413
- handleSelected: handleSelected,
414
- handleTabChange: handleTabChange,
415
- handleSearchListOnChange: handleSearchListOnChange,
416
- adaptiveHeight: adaptiveHeight,
417
- retry: retry
418
- }), jsx(FormFooter, {
419
- error: error,
420
- items: items
421
- /** If the results section appears to be loading, impact whether the submit button is disabled */,
422
- isLoading: isLoadingResults || !!isLoadingPlugins,
423
- isSubmitting: isSubmitting,
424
- queryState: queryState,
425
- url: url,
426
- isEditing: isEditing,
427
- onCancel: onCancel,
428
- action: pluginAction
429
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
430
- ,
431
- css: !queryState || !(plugins !== null && plugins !== void 0 && plugins.length) ? formFooterMargin : undefined,
432
- customSubmitButtonLabel: customSubmitButtonLabel,
433
- submitMessageId: submitMessageId,
434
- hideSubmitButton: moveSubmitButton
435
- }));
436
- }));
@@ -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
- const HEIGHT = 120;
8
- const noResultsSVGStyles = css({
9
- height: `${HEIGHT}px`,
10
- display: 'block'
11
- });
12
- export const NoResultsSVGOld = () => {
13
- const 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(#${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(#${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: `${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: `${id}-a`
58
- }, jsx("path", {
59
- fill: "#fff",
60
- transform: "translate(0 .62)",
61
- d: "M0 0h207.16v189.87H0z"
62
- }))));
63
- };
@@ -1,132 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { forwardRef, Fragment } from 'react';
6
-
7
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
- import { jsx } from '@emotion/react';
9
- import { useIntl } from 'react-intl-next';
10
- import { Text } from '@atlaskit/primitives';
11
- /* eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports */
12
- import { transformTimeStamp } from '../../../../transformTimeStamp';
13
- import { composeListItemStyles, imgStyles, itemIconStyles, itemNameStyles, listItemContainerInnerStyles, listItemContainerStyles, listItemContextStyles } from './styled';
14
- export const testIds = {
15
- searchResultItem: 'link-search-list-item',
16
- searchResultIcon: 'link-search-list-item-icon'
17
- };
18
- const isSVG = icon => icon.startsWith('<svg') && icon.endsWith('</svg>');
19
- const base64SVG = icon => `data:image/svg+xml;base64,${Buffer.from(icon).toString('base64')}`;
20
- const ListItemIcon = props => {
21
- const {
22
- item,
23
- intl
24
- } = props;
25
- const {
26
- icon,
27
- iconAlt
28
- } = item;
29
- if (!icon) {
30
- return null;
31
- }
32
- const alt = typeof iconAlt === 'string' ? iconAlt : intl.formatMessage(iconAlt);
33
- if (typeof icon !== 'string') {
34
- const Glyph = icon;
35
- return (
36
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
37
- jsx("span", {
38
- css: itemIconStyles
39
- }, jsx(Glyph, {
40
- alt: alt,
41
- "data-testid": testIds.searchResultIcon
42
- }))
43
- );
44
- }
45
- return (
46
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
47
- jsx("span", {
48
- css: itemIconStyles
49
- }, jsx("img", {
50
- "data-testid": testIds.searchResultIcon,
51
- src: isSVG(icon) ? base64SVG(icon) : icon,
52
- alt: alt
53
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
54
- ,
55
- css: imgStyles
56
- }))
57
- );
58
- };
59
- const ListItemSubtitle = ({
60
- items: [firstItem, secondItem]
61
- }) => {
62
- return /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 */(
63
- jsx("div", {
64
- "data-testid": `${testIds.searchResultItem}-subtitle`,
65
- css: listItemContextStyles
66
- }, jsx("div", {
67
- css: listItemContainerStyles
68
- }, jsx("span", {
69
- css: listItemContainerInnerStyles
70
- }, firstItem)), secondItem && jsx("div", {
71
- css: listItemContainerInnerStyles
72
- }, jsx(Fragment, null, "\xA0 \u2022\xA0 "), jsx(Fragment, null, secondItem)))
73
- );
74
- /* eslint-enable @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 */
75
- };
76
- const getDefaultSubtitleItems = (item, intl) => {
77
- const container = item.container;
78
- const date = transformTimeStamp(intl, item.lastViewedDate, item.lastUpdatedDate);
79
- if (container) {
80
- if (date) {
81
- return [container, date];
82
- }
83
- return [container];
84
- }
85
- if (date) {
86
- return [date];
87
- }
88
- return undefined;
89
- };
90
- export const LinkSearchListItemOld = /*#__PURE__*/forwardRef(({
91
- item,
92
- selected,
93
- id,
94
- role,
95
- onSelect,
96
- tabIndex,
97
- onKeyDown,
98
- onFocus,
99
- nameMaxLines = 1
100
- }, ref) => {
101
- const intl = useIntl();
102
- const handleSelect = () => onSelect(item.objectId);
103
- const subtitleItems = item.subtitleItems || getDefaultSubtitleItems(item, intl);
104
- return (
105
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
106
- jsx("div", {
107
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
108
- css: composeListItemStyles(selected),
109
- role: role,
110
- id: id,
111
- "aria-selected": selected,
112
- "data-testid": testIds.searchResultItem,
113
- onKeyDown: onKeyDown,
114
- onClick: handleSelect,
115
- onFocus: onFocus,
116
- tabIndex: tabIndex,
117
- ref: ref
118
- }, jsx(ListItemIcon, {
119
- item: item,
120
- intl: intl
121
- }), jsx("div", {
122
- css: itemNameStyles
123
- }, jsx(Text, {
124
- maxLines: nameMaxLines
125
- }, jsx("span", {
126
- "data-testid": `${testIds.searchResultItem}-title`,
127
- title: item.name
128
- }, item.name)), subtitleItems && jsx(ListItemSubtitle, {
129
- items: subtitleItems
130
- })))
131
- );
132
- });