@atlaskit/link-picker 1.1.1 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/browser.js +39 -0
  3. package/dist/cjs/index.js +13 -0
  4. package/dist/cjs/messages.js +117 -0
  5. package/dist/cjs/transformTimeStamp.js +55 -0
  6. package/dist/cjs/types.js +5 -0
  7. package/dist/cjs/ui/announcer.js +64 -0
  8. package/dist/cjs/ui/link-picker.js +613 -0
  9. package/dist/cjs/ui/link-search-list/index.js +102 -0
  10. package/dist/cjs/ui/link-search-list/styled.js +21 -0
  11. package/dist/cjs/ui/link-search-no-results/index.js +27 -0
  12. package/dist/cjs/ui/link-search-no-results/no-results-svg/index.js +69 -0
  13. package/dist/cjs/ui/link-search-no-results/no-results-svg/styled.js +20 -0
  14. package/dist/cjs/ui/list-item/index.js +103 -0
  15. package/dist/cjs/ui/list-item/styled.js +59 -0
  16. package/dist/cjs/ui/styled.js +32 -0
  17. package/dist/cjs/ui/text-input/index.js +116 -0
  18. package/dist/cjs/ui/text-input/styled.js +25 -0
  19. package/dist/cjs/url.js +104 -0
  20. package/dist/cjs/utils.js +27 -0
  21. package/dist/cjs/version.json +5 -0
  22. package/dist/es2019/browser.js +34 -0
  23. package/dist/es2019/index.js +1 -0
  24. package/dist/es2019/messages.js +108 -0
  25. package/dist/es2019/transformTimeStamp.js +41 -0
  26. package/dist/es2019/types.js +1 -0
  27. package/dist/es2019/ui/announcer.js +38 -0
  28. package/dist/es2019/ui/link-picker.js +501 -0
  29. package/dist/es2019/ui/link-search-list/index.js +60 -0
  30. package/dist/es2019/ui/link-search-list/styled.js +13 -0
  31. package/dist/es2019/ui/link-search-no-results/index.js +10 -0
  32. package/dist/es2019/ui/link-search-no-results/no-results-svg/index.js +60 -0
  33. package/dist/es2019/ui/link-search-no-results/no-results-svg/styled.js +8 -0
  34. package/dist/es2019/ui/list-item/index.js +88 -0
  35. package/dist/es2019/ui/list-item/styled.js +65 -0
  36. package/dist/es2019/ui/styled.js +28 -0
  37. package/dist/es2019/ui/text-input/index.js +99 -0
  38. package/dist/es2019/ui/text-input/styled.js +15 -0
  39. package/dist/es2019/url.js +88 -0
  40. package/dist/es2019/utils.js +13 -0
  41. package/dist/es2019/version.json +5 -0
  42. package/dist/esm/browser.js +34 -0
  43. package/dist/esm/index.js +1 -0
  44. package/dist/esm/messages.js +108 -0
  45. package/dist/esm/transformTimeStamp.js +41 -0
  46. package/dist/esm/types.js +1 -0
  47. package/dist/esm/ui/announcer.js +51 -0
  48. package/dist/esm/ui/link-picker.js +591 -0
  49. package/dist/esm/ui/link-search-list/index.js +88 -0
  50. package/dist/esm/ui/link-search-list/styled.js +8 -0
  51. package/dist/esm/ui/link-search-no-results/index.js +14 -0
  52. package/dist/esm/ui/link-search-no-results/no-results-svg/index.js +60 -0
  53. package/dist/esm/ui/link-search-no-results/no-results-svg/styled.js +8 -0
  54. package/dist/esm/ui/list-item/index.js +90 -0
  55. package/dist/esm/ui/list-item/styled.js +37 -0
  56. package/dist/esm/ui/styled.js +16 -0
  57. package/dist/esm/ui/text-input/index.js +99 -0
  58. package/dist/esm/ui/text-input/styled.js +10 -0
  59. package/dist/esm/url.js +90 -0
  60. package/dist/esm/utils.js +13 -0
  61. package/dist/esm/version.json +5 -0
  62. package/dist/types/browser.d.ts +15 -0
  63. package/dist/types/index.d.ts +3 -0
  64. package/dist/types/messages.d.ts +107 -0
  65. package/dist/types/transformTimeStamp.d.ts +3 -0
  66. package/dist/types/types.d.ts +40 -0
  67. package/dist/types/ui/announcer.d.ts +22 -0
  68. package/dist/types/ui/link-picker.d.ts +52 -0
  69. package/dist/types/ui/link-search-list/index.d.ts +20 -0
  70. package/dist/types/ui/link-search-list/styled.d.ts +3 -0
  71. package/dist/types/ui/link-search-no-results/index.d.ts +4 -0
  72. package/dist/types/ui/link-search-no-results/no-results-svg/index.d.ts +4 -0
  73. package/dist/types/ui/link-search-no-results/no-results-svg/styled.d.ts +1 -0
  74. package/dist/types/ui/list-item/index.d.ts +17 -0
  75. package/dist/types/ui/list-item/styled.d.ts +7 -0
  76. package/dist/types/ui/styled.d.ts +4 -0
  77. package/dist/types/ui/text-input/index.d.ts +17 -0
  78. package/dist/types/ui/text-input/styled.d.ts +2 -0
  79. package/dist/types/url.d.ts +5 -0
  80. package/dist/types/utils.d.ts +3 -0
  81. package/package.json +1 -2
  82. package/report.api.md +56 -21
  83. package/example-helpers/flight-deck/_manifest.json +0 -9
  84. package/example-helpers/flight-deck/mockFDResponse.json +0 -133
  85. package/example-helpers/mock-data.ts +0 -318
  86. package/example-helpers/providers.ts +0 -39
@@ -0,0 +1,501 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+
3
+ /** @jsx jsx */
4
+ import React, { PureComponent } from 'react';
5
+ import { jsx } from '@emotion/react';
6
+ import { injectIntl } from 'react-intl-next';
7
+ import { messages } from '../messages';
8
+ import PanelTextInput from './text-input';
9
+ import LinkSearchList from './link-search-list';
10
+ import { normalizeUrl, isSafeUrl } from '../url';
11
+ import { recentListStyles, containerStyles, searchIconStyles, listTitleStyles } from './styled';
12
+ import { browser } from '../browser';
13
+ import { transformTimeStamp } from '../transformTimeStamp';
14
+ import Announcer from './announcer';
15
+ import Button, { ButtonGroup } from '@atlaskit/button';
16
+ import { FormFooter } from '@atlaskit/form';
17
+ import EditorSearchIcon from '@atlaskit/icon/glyph/editor/search';
18
+ import VisuallyHidden from '@atlaskit/visually-hidden';
19
+ import LinkSearchNoResults from './link-search-no-results';
20
+ export const RECENT_SEARCH_LIST_SIZE = 5;
21
+
22
+ class LinkPicker extends PureComponent {
23
+ constructor(props) {
24
+ super(props);
25
+
26
+ _defineProperty(this, "wrapperRef", /*#__PURE__*/React.createRef());
27
+
28
+ _defineProperty(this, "queryVersion", 0);
29
+
30
+ _defineProperty(this, "updateInput", async input => {
31
+ // If input is a valid URL, do not search or display link suggestions
32
+ if (input.length && isSafeUrl(input)) {
33
+ return this.setState({
34
+ url: input,
35
+ selectedIndex: -1,
36
+ items: [],
37
+ isLoading: false,
38
+ invalidUrl: null
39
+ });
40
+ }
41
+
42
+ return this.setState({
43
+ url: input,
44
+ // Unset selection on any input change
45
+ selectedIndex: -1,
46
+ invalidUrl: null
47
+ }, () => {
48
+ this.updateResults();
49
+ });
50
+ });
51
+
52
+ _defineProperty(this, "createClearHandler", field => {
53
+ return () => {
54
+ switch (field) {
55
+ case 'url':
56
+ {
57
+ this.updateInput('');
58
+ break;
59
+ }
60
+
61
+ case 'displayText':
62
+ {
63
+ this.setState({
64
+ [field]: ''
65
+ });
66
+ }
67
+ }
68
+ };
69
+ });
70
+
71
+ _defineProperty(this, "getScreenReaderText", () => {
72
+ const {
73
+ intl
74
+ } = this.props;
75
+ const {
76
+ items,
77
+ selectedIndex
78
+ } = this.state;
79
+
80
+ if (items.length && selectedIndex > -1) {
81
+ const {
82
+ name,
83
+ container,
84
+ lastUpdatedDate,
85
+ lastViewedDate
86
+ } = items[selectedIndex];
87
+ const date = transformTimeStamp(intl, lastViewedDate, lastUpdatedDate);
88
+ const formattedDate = [date === null || date === void 0 ? void 0 : date.pageAction, date === null || date === void 0 ? void 0 : date.dateString, date === null || date === void 0 ? void 0 : date.timeSince].filter(Boolean).join(' ');
89
+ return [name, container, formattedDate].filter(Boolean).join(', ');
90
+ }
91
+ });
92
+
93
+ _defineProperty(this, "isUrlPopulatedWithSelectedItem", () => {
94
+ /**
95
+ * When we use ArrowKey to navigate through result items,
96
+ * the URL field will be populated with the content of
97
+ * selected item.
98
+ * This function will check if the URL field is populated
99
+ * with selected item.
100
+ * It can be useful to detect whether we want to insert a
101
+ * smartlink or a hyperlink with customized title
102
+ */
103
+ const {
104
+ items,
105
+ selectedIndex,
106
+ url
107
+ } = this.state;
108
+ const selectedItem = items[selectedIndex];
109
+
110
+ if (selectedItem && selectedItem.url === url) {
111
+ return true;
112
+ }
113
+
114
+ return false;
115
+ });
116
+
117
+ _defineProperty(this, "handleSelected", objectId => {
118
+ const {
119
+ items
120
+ } = this.state;
121
+ const selectedItem = items.find(item => item.objectId === objectId);
122
+
123
+ if (selectedItem) {
124
+ const {
125
+ url,
126
+ name
127
+ } = selectedItem;
128
+ this.handleInsert(url, name, 'typeAhead');
129
+ }
130
+ });
131
+
132
+ _defineProperty(this, "handleInsert", (url, title, inputType) => {
133
+ const {
134
+ onSubmit
135
+ } = this.props;
136
+ const {
137
+ url: rawUrl,
138
+ displayText
139
+ } = this.state;
140
+
141
+ if (onSubmit) {
142
+ onSubmit({
143
+ url,
144
+ displayText: displayText || null,
145
+ title: title || null,
146
+ meta: {
147
+ inputMethod: inputType
148
+ },
149
+ ...(inputType === 'manual' ? {
150
+ rawUrl
151
+ } : {})
152
+ });
153
+ }
154
+ });
155
+
156
+ _defineProperty(this, "handleMouseEnterResultItem", objectId => {
157
+ const {
158
+ items
159
+ } = this.state;
160
+ const index = findIndex(items, item => item.objectId === objectId);
161
+ this.setState({
162
+ activeIndex: index
163
+ });
164
+ });
165
+
166
+ _defineProperty(this, "handleMouseLeaveResultItem", objectId => {
167
+ const {
168
+ items,
169
+ activeIndex
170
+ } = this.state;
171
+ const index = findIndex(items, item => item.objectId === objectId); // This is to avoid updating index that was set by other mouseenter event
172
+
173
+ if (activeIndex === index) {
174
+ this.setState({
175
+ activeIndex: -1
176
+ });
177
+ }
178
+ });
179
+
180
+ _defineProperty(this, "handleSubmit", () => {
181
+ const {
182
+ url,
183
+ selectedIndex,
184
+ items
185
+ } = this.state;
186
+ const selectedItem = items[selectedIndex];
187
+
188
+ if (this.isUrlPopulatedWithSelectedItem()) {
189
+ this.handleInsert(selectedItem.url, selectedItem.name, 'typeAhead');
190
+ } else if (url.length > 0) {
191
+ const normalized = normalizeUrl(url);
192
+
193
+ if (normalized) {
194
+ this.handleInsert(normalized, null, 'manual');
195
+ } else {
196
+ const {
197
+ intl
198
+ } = this.props;
199
+ const linkInvalid = intl.formatMessage(messages.linkInvalid);
200
+ this.setState({
201
+ invalidUrl: linkInvalid
202
+ });
203
+ }
204
+ }
205
+ });
206
+
207
+ _defineProperty(this, "handleKeyDown", event => {
208
+ const {
209
+ items,
210
+ activeIndex
211
+ } = this.state;
212
+ const {
213
+ keyCode
214
+ } = event;
215
+ const KEY_CODE_ARROW_DOWN = 40;
216
+ const KEY_CODE_ARROW_UP = 38;
217
+
218
+ if (!items || !items.length) {
219
+ return;
220
+ }
221
+
222
+ let updatedIndex = activeIndex;
223
+
224
+ switch (keyCode) {
225
+ case KEY_CODE_ARROW_DOWN:
226
+ // down
227
+ event.preventDefault();
228
+ updatedIndex = (activeIndex + 1) % items.length;
229
+ break;
230
+
231
+ case KEY_CODE_ARROW_UP:
232
+ // up
233
+ event.preventDefault();
234
+ updatedIndex = activeIndex > 0 ? activeIndex - 1 : items.length - 1;
235
+ break;
236
+ }
237
+
238
+ if ([KEY_CODE_ARROW_DOWN, KEY_CODE_ARROW_UP].includes(keyCode) && items[updatedIndex]) {
239
+ this.setState({
240
+ activeIndex: updatedIndex,
241
+ selectedIndex: updatedIndex,
242
+ url: items[updatedIndex].url,
243
+ invalidUrl: null
244
+ });
245
+ }
246
+ });
247
+
248
+ _defineProperty(this, "handleCancel", () => {
249
+ const {
250
+ onCancel
251
+ } = this.props;
252
+
253
+ if (onCancel) {
254
+ onCancel();
255
+ }
256
+ });
257
+
258
+ _defineProperty(this, "updateTextInput", displayText => {
259
+ this.setState({
260
+ displayText: displayText
261
+ });
262
+ });
263
+
264
+ this.state = {
265
+ selectedIndex: -1,
266
+ activeIndex: -1,
267
+ isLoading: false,
268
+ isEditing: !!props.url,
269
+ url: normalizeUrl(props.url) || '',
270
+ displayText: props.displayText || '',
271
+ items: [],
272
+ invalidUrl: null
273
+ };
274
+ /* Cache functions */
275
+
276
+ this.handleClearUrl = this.createClearHandler('url');
277
+ this.handleClearDisplayText = this.createClearHandler('displayText');
278
+ }
279
+
280
+ componentDidMount() {
281
+ this.loadInitialLinkSearchResult();
282
+ }
283
+
284
+ loadInitialLinkSearchResult() {
285
+ const {
286
+ url
287
+ } = this.state;
288
+
289
+ if (!url) {
290
+ this.updateResults();
291
+ }
292
+ }
293
+
294
+ getActivePlugin() {
295
+ if (!this.props.plugins || this.props.plugins.length === 0) {
296
+ return null;
297
+ }
298
+
299
+ return this.props.plugins[0];
300
+ }
301
+ /**
302
+ * Interface between link picker and plugins to update results
303
+ */
304
+
305
+
306
+ async updateResults() {
307
+ const queryVersion = ++this.queryVersion;
308
+ const activePlugin = this.getActivePlugin();
309
+
310
+ if (!activePlugin) {
311
+ return;
312
+ }
313
+
314
+ const updates = activePlugin.resolve({
315
+ query: this.state.url
316
+ });
317
+ this.setState({
318
+ isLoading: true,
319
+ items: []
320
+ });
321
+
322
+ try {
323
+ while (queryVersion === this.queryVersion) {
324
+ let done = false;
325
+ let value;
326
+
327
+ if (updates instanceof Promise) {
328
+ done = true;
329
+ value = await updates;
330
+ } else {
331
+ var _result$done;
332
+
333
+ const result = await updates.next();
334
+ done = (_result$done = result.done) !== null && _result$done !== void 0 ? _result$done : false;
335
+ value = result.value;
336
+ }
337
+
338
+ if (queryVersion !== this.queryVersion) {
339
+ return;
340
+ }
341
+
342
+ this.setState({
343
+ items: limit(value.data),
344
+ isLoading: !done
345
+ });
346
+
347
+ if (done) {
348
+ return;
349
+ }
350
+ }
351
+ } catch {
352
+ this.setState({
353
+ isLoading: false
354
+ });
355
+ }
356
+ }
357
+
358
+ render() {
359
+ const {
360
+ items,
361
+ isLoading,
362
+ isEditing,
363
+ activeIndex,
364
+ selectedIndex,
365
+ url,
366
+ displayText
367
+ } = this.state;
368
+ const {
369
+ intl: {
370
+ formatMessage
371
+ }
372
+ } = this.props;
373
+ const activePlugin = this.getActivePlugin();
374
+ const linkPlaceHolder = formatMessage(activePlugin ? messages.placeholder : messages.linkPlaceholder);
375
+ const linkLabel = formatMessage(messages.linkLabel);
376
+ const linkTextLabel = formatMessage(messages.linkTextLabel);
377
+ const linkTextPlaceHolder = formatMessage(messages.linkTextPlaceholder);
378
+ const screenReaderDescriptionId = 'search-recent-links-field-description';
379
+ const linkSearchListId = 'link-picker-search-list';
380
+ const ariaActiveDescendant = selectedIndex > -1 ? `link-search-list-item-${selectedIndex}` : ''; // Added workaround with a screen reader Announcer specifically for VoiceOver + Safari
381
+ // as the Aria design pattern for combobox does not work in this case
382
+ // for details: https://a11y-internal.atlassian.net/browse/AK-740
383
+
384
+ const screenReaderText = browser.safari && this.getScreenReaderText();
385
+ const searchIcon = activePlugin && jsx("span", {
386
+ css: searchIconStyles,
387
+ "data-testid": "link-picker-search-icon"
388
+ }, jsx(EditorSearchIcon, {
389
+ size: "medium",
390
+ label: ''
391
+ }));
392
+ const noResults = activePlugin && !isLoading && !items.length && !isSafeUrl(url);
393
+ return jsx("div", {
394
+ "data-testid": "link-picker",
395
+ className: "recent-list",
396
+ css: recentListStyles
397
+ }, jsx("div", {
398
+ css: containerStyles,
399
+ ref: this.wrapperRef
400
+ }, screenReaderText && jsx(Announcer, {
401
+ ariaLive: "assertive",
402
+ text: screenReaderText,
403
+ ariaRelevant: "additions",
404
+ delay: 250
405
+ }), jsx(VisuallyHidden, null, jsx("span", {
406
+ "aria-hidden": "true",
407
+ id: screenReaderDescriptionId
408
+ }, formatMessage(messages.searchLinkAriaDescription))), jsx(PanelTextInput, {
409
+ name: "link",
410
+ testId: "link-url",
411
+ role: "combobox",
412
+ label: linkLabel,
413
+ placeholder: linkPlaceHolder,
414
+ value: url,
415
+ autoFocus: true,
416
+ autoComplete: "off",
417
+ elemBeforeInput: searchIcon,
418
+ onSubmit: this.handleSubmit,
419
+ onChange: this.updateInput,
420
+ onKeyDown: this.handleKeyDown,
421
+ onClear: this.handleClearUrl,
422
+ error: this.state.invalidUrl,
423
+ clearLabel: formatMessage(messages.clearLink),
424
+ "aria-controls": linkSearchListId,
425
+ "aria-autocomplete": "list",
426
+ "aria-activedescendant": ariaActiveDescendant,
427
+ "aria-describedby": screenReaderDescriptionId,
428
+ "aria-expanded": true
429
+ }), jsx(PanelTextInput, {
430
+ name: "link-text",
431
+ testId: "link-text",
432
+ autoComplete: "off",
433
+ label: linkTextLabel,
434
+ placeholder: linkTextPlaceHolder,
435
+ "aria-label": formatMessage(messages.linkAriaLabel),
436
+ value: displayText,
437
+ onSubmit: this.handleSubmit,
438
+ onKeyDown: this.handleKeyDown,
439
+ onChange: this.updateTextInput,
440
+ onClear: this.handleClearDisplayText,
441
+ clearLabel: formatMessage(messages.clearText)
442
+ }), !!items.length && jsx("div", {
443
+ css: listTitleStyles,
444
+ id: "link-picker-list-title",
445
+ "data-testid": "link-picker-list-title"
446
+ }, formatMessage(this.state.url ? messages.titleResults : messages.titleRecentlyViewed)), jsx(VisuallyHidden, null, jsx("span", {
447
+ "aria-live": "polite",
448
+ "aria-atomic": "true",
449
+ id: "fabric.smartcard.linkpicker.suggested.results"
450
+ }, url && formatMessage(messages.searchLinkResults, {
451
+ count: items.length
452
+ }))), jsx(LinkSearchList, {
453
+ ariaLabelledBy: "link-picker-list-title",
454
+ ariaControls: "fabric.smartcard.linkpicker.suggested.results",
455
+ id: linkSearchListId,
456
+ role: "listbox",
457
+ items: items,
458
+ isLoading: isLoading,
459
+ selectedIndex: selectedIndex,
460
+ activeIndex: activeIndex,
461
+ onSelect: this.handleSelected,
462
+ onMouseEnter: this.handleMouseEnterResultItem,
463
+ onMouseLeave: this.handleMouseLeaveResultItem
464
+ }), noResults && jsx(LinkSearchNoResults, {
465
+ testId: "link-search-no-results",
466
+ header: formatMessage(messages.noResults),
467
+ description: formatMessage(messages.noResultsDescription)
468
+ }), jsx(FormFooter, {
469
+ align: "end"
470
+ }, jsx(ButtonGroup, null, jsx(Button, {
471
+ appearance: "default",
472
+ onClick: this.handleCancel,
473
+ testId: "link-picker-cancel-button"
474
+ }, formatMessage(messages.cancelButton)), jsx(Button, {
475
+ type: "submit",
476
+ appearance: "primary",
477
+ onClick: this.handleSubmit,
478
+ testId: "link-picker-insert-button"
479
+ }, formatMessage(isEditing ? messages.saveButton : messages.insertButton))))));
480
+ }
481
+
482
+ }
483
+
484
+ function findIndex(array, predicate) {
485
+ let index = -1;
486
+ array.some((item, i) => {
487
+ if (predicate(item)) {
488
+ index = i;
489
+ return true;
490
+ }
491
+
492
+ return false;
493
+ });
494
+ return index;
495
+ }
496
+
497
+ function limit(items) {
498
+ return items.slice(0, RECENT_SEARCH_LIST_SIZE);
499
+ }
500
+
501
+ export const LinkPickerWithIntl = injectIntl(LinkPicker);
@@ -0,0 +1,60 @@
1
+ /** @jsx jsx */
2
+ import { PureComponent } from 'react';
3
+ import { jsx } from '@emotion/react';
4
+ import Spinner from '@atlaskit/spinner';
5
+ import LinkSearchListItem from '../list-item';
6
+ import { listContainerStyles, spinnerContainerStyles, listStyles } from './styled';
7
+ export default class LinkSearchList extends PureComponent {
8
+ render() {
9
+ const {
10
+ onSelect,
11
+ onMouseEnter,
12
+ onMouseLeave,
13
+ items,
14
+ activeIndex,
15
+ selectedIndex,
16
+ isLoading,
17
+ ariaControls,
18
+ ariaLabelledBy,
19
+ role,
20
+ id
21
+ } = this.props;
22
+ let itemsContent;
23
+ let loadingContent;
24
+
25
+ if (items && items.length > 0) {
26
+ itemsContent = jsx("ul", {
27
+ "data-testid": "link-search-list",
28
+ css: listStyles,
29
+ id: id,
30
+ role: role,
31
+ "aria-controls": ariaControls,
32
+ "aria-labelledby": ariaLabelledBy
33
+ }, items.map((item, index) => jsx(LinkSearchListItem, {
34
+ id: `link-search-list-item-${index}`,
35
+ role: role && 'option',
36
+ item: item,
37
+ selected: selectedIndex === index,
38
+ active: activeIndex === index,
39
+ onMouseEnter: onMouseEnter,
40
+ onMouseLeave: onMouseLeave,
41
+ onSelect: onSelect,
42
+ key: item.objectId
43
+ })));
44
+ }
45
+
46
+ if (isLoading) {
47
+ loadingContent = jsx("div", {
48
+ css: spinnerContainerStyles
49
+ }, jsx(Spinner, {
50
+ testId: "link-picker.results-loading-indicator",
51
+ size: "medium"
52
+ }));
53
+ }
54
+
55
+ return jsx("div", {
56
+ css: listContainerStyles
57
+ }, itemsContent, loadingContent);
58
+ }
59
+
60
+ }
@@ -0,0 +1,13 @@
1
+ import { css } from '@emotion/react';
2
+ export const listContainerStyles = css`
3
+ padding-top: 0;
4
+ `;
5
+ export const spinnerContainerStyles = css`
6
+ text-align: center;
7
+ min-height: 80px;
8
+ margin-top: 30px;
9
+ `;
10
+ export const listStyles = css`
11
+ padding: 0;
12
+ list-style: none;
13
+ `;
@@ -0,0 +1,10 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import EmptyState from '@atlaskit/empty-state';
4
+ import NoResultsSVG from './no-results-svg';
5
+
6
+ const NoResults = props => /*#__PURE__*/React.createElement(EmptyState, _extends({}, props, {
7
+ renderImage: () => /*#__PURE__*/React.createElement(NoResultsSVG, null)
8
+ }));
9
+
10
+ export default NoResults;
@@ -0,0 +1,60 @@
1
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
2
+
3
+ /** @jsx jsx */
4
+ import { jsx } from '@emotion/react';
5
+ import { noResultsSVGStyles } from './styled';
6
+
7
+ const NoResultsSVG = () => {
8
+ const id = 'link-picker-ui-no-results-svg';
9
+ return jsx("svg", {
10
+ css: noResultsSVGStyles,
11
+ height: "120",
12
+ viewBox: "0 0 208 191",
13
+ fill: "none",
14
+ xmlns: "http://www.w3.org/2000/svg"
15
+ }, jsx("g", {
16
+ clipPath: `url(#${id}-a)`
17
+ }, jsx("path", {
18
+ opacity: ".3",
19
+ 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",
20
+ fill: "#B3BAC5"
21
+ }), jsx("path", {
22
+ opacity: ".3",
23
+ 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",
24
+ fill: "#C1C7D0"
25
+ }), jsx("path", {
26
+ 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",
27
+ fill: "#CFD4DB"
28
+ }), jsx("path", {
29
+ 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",
30
+ fill: "#B3BAC5"
31
+ }), jsx("path", {
32
+ 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",
33
+ fill: `url(#${id}-b)`
34
+ }), jsx("path", {
35
+ 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",
36
+ fill: "#C1C7D0"
37
+ })), jsx("defs", null, jsx("linearGradient", {
38
+ id: `${id}-b`,
39
+ x1: "60.062",
40
+ y1: "139.664",
41
+ x2: "141.969",
42
+ y2: "57.757",
43
+ gradientUnits: "userSpaceOnUse"
44
+ }, jsx("stop", {
45
+ offset: ".557",
46
+ stopColor: "#C1C7D0"
47
+ }), jsx("stop", {
48
+ offset: ".966",
49
+ stopColor: "#E9EBEF",
50
+ stopOpacity: ".5"
51
+ })), jsx("clipPath", {
52
+ id: `${id}-a`
53
+ }, jsx("path", {
54
+ fill: "#fff",
55
+ transform: "translate(0 .62)",
56
+ d: "M0 0h207.16v189.87H0z"
57
+ }))));
58
+ };
59
+
60
+ export default NoResultsSVG;
@@ -0,0 +1,8 @@
1
+ import { gridSize as getGridSize } from '@atlaskit/theme/constants';
2
+ import { css } from '@emotion/react';
3
+ const HEIGHT = 120;
4
+ export const noResultsSVGStyles = css`
5
+ height: ${HEIGHT}px;
6
+ margin: 0 auto ${getGridSize() * 3}px;
7
+ display: block;
8
+ `;