@atlaskit/link-picker 0.10.0 → 1.1.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.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/messages.js +12 -2
- package/dist/cjs/ui/link-picker.js +44 -18
- package/dist/cjs/ui/link-search-no-results/index.js +27 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/messages.js +12 -2
- package/dist/es2019/ui/link-picker.js +20 -5
- package/dist/es2019/ui/link-search-no-results/index.js +12 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/messages.js +12 -2
- package/dist/esm/ui/link-picker.js +45 -19
- package/dist/esm/ui/link-search-no-results/index.js +14 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/messages.d.ts +10 -0
- package/dist/types/types.d.ts +4 -1
- package/dist/types/ui/link-search-no-results/index.d.ts +4 -0
- package/example-helpers/mock-data.ts +4 -2
- package/package.json +4 -4
- package/report.api.md +65 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/link-picker
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`ba5d8ed23cc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ba5d8ed23cc) - Adds search error message
|
|
8
|
+
|
|
9
|
+
## 1.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [`2e20b02bb2c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e20b02bb2c) - Initial major version release
|
|
14
|
+
|
|
15
|
+
## 0.11.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [`a2286b0746a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a2286b0746a) - Added support for link picker plugins to resolve using a promise
|
|
20
|
+
|
|
3
21
|
## 0.10.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/dist/cjs/messages.js
CHANGED
|
@@ -89,14 +89,24 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
89
89
|
description: 'Describes type of items shown in the list for screen-reader users'
|
|
90
90
|
},
|
|
91
91
|
cancelButton: {
|
|
92
|
-
id: 'fabric.linkPicker.cancel
|
|
92
|
+
id: 'fabric.linkPicker.button.cancel',
|
|
93
93
|
defaultMessage: 'Cancel',
|
|
94
94
|
description: 'Button to cancel and dismiss the link picker'
|
|
95
95
|
},
|
|
96
96
|
insertButton: {
|
|
97
|
-
id: 'fabric.linkPicker.
|
|
97
|
+
id: 'fabric.linkPicker.button.insert',
|
|
98
98
|
defaultMessage: 'Insert',
|
|
99
99
|
description: 'Button to insert searched or selected link'
|
|
100
|
+
},
|
|
101
|
+
noResults: {
|
|
102
|
+
id: 'fabric.linkPicker.search.noResults.heading',
|
|
103
|
+
defaultMessage: 'We couldn’t find anything matching your search.',
|
|
104
|
+
description: 'Heading message shown when a search has no results'
|
|
105
|
+
},
|
|
106
|
+
noResultsDescription: {
|
|
107
|
+
id: 'fabric.linkPicker.search.noResults.description',
|
|
108
|
+
defaultMessage: 'Try again with a different term.',
|
|
109
|
+
description: 'Describes possible action when a search returns no results'
|
|
100
110
|
}
|
|
101
111
|
});
|
|
102
112
|
exports.messages = messages;
|
|
@@ -57,6 +57,8 @@ var _search = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/search
|
|
|
57
57
|
|
|
58
58
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
59
59
|
|
|
60
|
+
var _linkSearchNoResults = _interopRequireDefault(require("./link-search-no-results"));
|
|
61
|
+
|
|
60
62
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
61
63
|
|
|
62
64
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -357,7 +359,7 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
357
359
|
key: "updateResults",
|
|
358
360
|
value: function () {
|
|
359
361
|
var _updateResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
360
|
-
var queryVersion, activePlugin, updates,
|
|
362
|
+
var queryVersion, activePlugin, updates, done, value, _result$done, result;
|
|
361
363
|
|
|
362
364
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
363
365
|
while (1) {
|
|
@@ -385,59 +387,78 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
385
387
|
|
|
386
388
|
case 7:
|
|
387
389
|
if (!(queryVersion === this.queryVersion)) {
|
|
388
|
-
_context2.next =
|
|
390
|
+
_context2.next = 29;
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
done = false;
|
|
395
|
+
value = void 0;
|
|
396
|
+
|
|
397
|
+
if (!(updates instanceof Promise)) {
|
|
398
|
+
_context2.next = 17;
|
|
389
399
|
break;
|
|
390
400
|
}
|
|
391
401
|
|
|
392
|
-
|
|
402
|
+
done = true;
|
|
403
|
+
_context2.next = 14;
|
|
404
|
+
return updates;
|
|
405
|
+
|
|
406
|
+
case 14:
|
|
407
|
+
value = _context2.sent;
|
|
408
|
+
_context2.next = 22;
|
|
409
|
+
break;
|
|
410
|
+
|
|
411
|
+
case 17:
|
|
412
|
+
_context2.next = 19;
|
|
393
413
|
return updates.next();
|
|
394
414
|
|
|
395
|
-
case
|
|
396
|
-
|
|
397
|
-
done =
|
|
398
|
-
value =
|
|
415
|
+
case 19:
|
|
416
|
+
result = _context2.sent;
|
|
417
|
+
done = (_result$done = result.done) !== null && _result$done !== void 0 ? _result$done : false;
|
|
418
|
+
value = result.value;
|
|
399
419
|
|
|
420
|
+
case 22:
|
|
400
421
|
if (!(queryVersion !== this.queryVersion)) {
|
|
401
|
-
_context2.next =
|
|
422
|
+
_context2.next = 24;
|
|
402
423
|
break;
|
|
403
424
|
}
|
|
404
425
|
|
|
405
426
|
return _context2.abrupt("return");
|
|
406
427
|
|
|
407
|
-
case
|
|
428
|
+
case 24:
|
|
408
429
|
this.setState({
|
|
409
|
-
items: limit(value),
|
|
430
|
+
items: limit(value.data),
|
|
410
431
|
isLoading: !done
|
|
411
432
|
});
|
|
412
433
|
|
|
413
434
|
if (!done) {
|
|
414
|
-
_context2.next =
|
|
435
|
+
_context2.next = 27;
|
|
415
436
|
break;
|
|
416
437
|
}
|
|
417
438
|
|
|
418
439
|
return _context2.abrupt("return");
|
|
419
440
|
|
|
420
|
-
case
|
|
441
|
+
case 27:
|
|
421
442
|
_context2.next = 7;
|
|
422
443
|
break;
|
|
423
444
|
|
|
424
|
-
case
|
|
425
|
-
_context2.next =
|
|
445
|
+
case 29:
|
|
446
|
+
_context2.next = 34;
|
|
426
447
|
break;
|
|
427
448
|
|
|
428
|
-
case
|
|
429
|
-
_context2.prev =
|
|
449
|
+
case 31:
|
|
450
|
+
_context2.prev = 31;
|
|
430
451
|
_context2.t0 = _context2["catch"](6);
|
|
431
452
|
this.setState({
|
|
432
453
|
isLoading: false
|
|
433
454
|
});
|
|
434
455
|
|
|
435
|
-
case
|
|
456
|
+
case 34:
|
|
436
457
|
case "end":
|
|
437
458
|
return _context2.stop();
|
|
438
459
|
}
|
|
439
460
|
}
|
|
440
|
-
}, _callee2, this, [[6,
|
|
461
|
+
}, _callee2, this, [[6, 31]]);
|
|
441
462
|
}));
|
|
442
463
|
|
|
443
464
|
function updateResults() {
|
|
@@ -476,6 +497,7 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
476
497
|
size: "medium",
|
|
477
498
|
label: ''
|
|
478
499
|
}));
|
|
500
|
+
var noResults = activePlugin && !isLoading && !items.length && !(0, _url.isSafeUrl)(url);
|
|
479
501
|
return (0, _react2.jsx)("div", {
|
|
480
502
|
"data-testid": "link-picker",
|
|
481
503
|
className: "recent-list",
|
|
@@ -547,6 +569,10 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
547
569
|
onSelect: this.handleSelected,
|
|
548
570
|
onMouseEnter: this.handleMouseEnterResultItem,
|
|
549
571
|
onMouseLeave: this.handleMouseLeaveResultItem
|
|
572
|
+
}), noResults && (0, _react2.jsx)(_linkSearchNoResults.default, {
|
|
573
|
+
testId: "link-search-no-results",
|
|
574
|
+
header: formatMessage(_messages.messages.noResults),
|
|
575
|
+
description: formatMessage(_messages.messages.noResultsDescription)
|
|
550
576
|
}), (0, _react2.jsx)(_form.FormFooter, {
|
|
551
577
|
align: "end"
|
|
552
578
|
}, (0, _react2.jsx)(_button.ButtonGroup, null, (0, _react2.jsx)(_button.default, {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _emptyState = _interopRequireDefault(require("@atlaskit/empty-state"));
|
|
15
|
+
|
|
16
|
+
var _noResults = _interopRequireDefault(require("./no-results.svg"));
|
|
17
|
+
|
|
18
|
+
var NoResults = function NoResults(props) {
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_emptyState.default, (0, _extends2.default)({}, props, {
|
|
20
|
+
imageUrl: _noResults.default,
|
|
21
|
+
maxImageWidth: 130,
|
|
22
|
+
maxImageHeight: 130
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var _default = NoResults;
|
|
27
|
+
exports.default = _default;
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/messages.js
CHANGED
|
@@ -81,13 +81,23 @@ export const messages = defineMessages({
|
|
|
81
81
|
description: 'Describes type of items shown in the list for screen-reader users'
|
|
82
82
|
},
|
|
83
83
|
cancelButton: {
|
|
84
|
-
id: 'fabric.linkPicker.cancel
|
|
84
|
+
id: 'fabric.linkPicker.button.cancel',
|
|
85
85
|
defaultMessage: 'Cancel',
|
|
86
86
|
description: 'Button to cancel and dismiss the link picker'
|
|
87
87
|
},
|
|
88
88
|
insertButton: {
|
|
89
|
-
id: 'fabric.linkPicker.
|
|
89
|
+
id: 'fabric.linkPicker.button.insert',
|
|
90
90
|
defaultMessage: 'Insert',
|
|
91
91
|
description: 'Button to insert searched or selected link'
|
|
92
|
+
},
|
|
93
|
+
noResults: {
|
|
94
|
+
id: 'fabric.linkPicker.search.noResults.heading',
|
|
95
|
+
defaultMessage: 'We couldn’t find anything matching your search.',
|
|
96
|
+
description: 'Heading message shown when a search has no results'
|
|
97
|
+
},
|
|
98
|
+
noResultsDescription: {
|
|
99
|
+
id: 'fabric.linkPicker.search.noResults.description',
|
|
100
|
+
defaultMessage: 'Try again with a different term.',
|
|
101
|
+
description: 'Describes possible action when a search returns no results'
|
|
92
102
|
}
|
|
93
103
|
});
|
|
@@ -16,6 +16,7 @@ import Button, { ButtonGroup } from '@atlaskit/button';
|
|
|
16
16
|
import { FormFooter } from '@atlaskit/form';
|
|
17
17
|
import EditorSearchIcon from '@atlaskit/icon/glyph/editor/search';
|
|
18
18
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
19
|
+
import LinkSearchNoResults from './link-search-no-results';
|
|
19
20
|
export const RECENT_SEARCH_LIST_SIZE = 5;
|
|
20
21
|
|
|
21
22
|
class LinkPicker extends PureComponent {
|
|
@@ -319,17 +320,26 @@ class LinkPicker extends PureComponent {
|
|
|
319
320
|
|
|
320
321
|
try {
|
|
321
322
|
while (queryVersion === this.queryVersion) {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
323
|
+
let done = false;
|
|
324
|
+
let value;
|
|
325
|
+
|
|
326
|
+
if (updates instanceof Promise) {
|
|
327
|
+
done = true;
|
|
328
|
+
value = await updates;
|
|
329
|
+
} else {
|
|
330
|
+
var _result$done;
|
|
331
|
+
|
|
332
|
+
const result = await updates.next();
|
|
333
|
+
done = (_result$done = result.done) !== null && _result$done !== void 0 ? _result$done : false;
|
|
334
|
+
value = result.value;
|
|
335
|
+
}
|
|
326
336
|
|
|
327
337
|
if (queryVersion !== this.queryVersion) {
|
|
328
338
|
return;
|
|
329
339
|
}
|
|
330
340
|
|
|
331
341
|
this.setState({
|
|
332
|
-
items: limit(value),
|
|
342
|
+
items: limit(value.data),
|
|
333
343
|
isLoading: !done
|
|
334
344
|
});
|
|
335
345
|
|
|
@@ -377,6 +387,7 @@ class LinkPicker extends PureComponent {
|
|
|
377
387
|
size: "medium",
|
|
378
388
|
label: ''
|
|
379
389
|
}));
|
|
390
|
+
const noResults = activePlugin && !isLoading && !items.length && !isSafeUrl(url);
|
|
380
391
|
return jsx("div", {
|
|
381
392
|
"data-testid": "link-picker",
|
|
382
393
|
className: "recent-list",
|
|
@@ -448,6 +459,10 @@ class LinkPicker extends PureComponent {
|
|
|
448
459
|
onSelect: this.handleSelected,
|
|
449
460
|
onMouseEnter: this.handleMouseEnterResultItem,
|
|
450
461
|
onMouseLeave: this.handleMouseLeaveResultItem
|
|
462
|
+
}), noResults && jsx(LinkSearchNoResults, {
|
|
463
|
+
testId: "link-search-no-results",
|
|
464
|
+
header: formatMessage(messages.noResults),
|
|
465
|
+
description: formatMessage(messages.noResultsDescription)
|
|
451
466
|
}), jsx(FormFooter, {
|
|
452
467
|
align: "end"
|
|
453
468
|
}, jsx(ButtonGroup, null, jsx(Button, {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import EmptyState from '@atlaskit/empty-state';
|
|
4
|
+
import noResultsImg from './no-results.svg';
|
|
5
|
+
|
|
6
|
+
const NoResults = props => /*#__PURE__*/React.createElement(EmptyState, _extends({}, props, {
|
|
7
|
+
imageUrl: noResultsImg,
|
|
8
|
+
maxImageWidth: 130,
|
|
9
|
+
maxImageHeight: 130
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
export default NoResults;
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/messages.js
CHANGED
|
@@ -81,13 +81,23 @@ export var messages = defineMessages({
|
|
|
81
81
|
description: 'Describes type of items shown in the list for screen-reader users'
|
|
82
82
|
},
|
|
83
83
|
cancelButton: {
|
|
84
|
-
id: 'fabric.linkPicker.cancel
|
|
84
|
+
id: 'fabric.linkPicker.button.cancel',
|
|
85
85
|
defaultMessage: 'Cancel',
|
|
86
86
|
description: 'Button to cancel and dismiss the link picker'
|
|
87
87
|
},
|
|
88
88
|
insertButton: {
|
|
89
|
-
id: 'fabric.linkPicker.
|
|
89
|
+
id: 'fabric.linkPicker.button.insert',
|
|
90
90
|
defaultMessage: 'Insert',
|
|
91
91
|
description: 'Button to insert searched or selected link'
|
|
92
|
+
},
|
|
93
|
+
noResults: {
|
|
94
|
+
id: 'fabric.linkPicker.search.noResults.heading',
|
|
95
|
+
defaultMessage: 'We couldn’t find anything matching your search.',
|
|
96
|
+
description: 'Heading message shown when a search has no results'
|
|
97
|
+
},
|
|
98
|
+
noResultsDescription: {
|
|
99
|
+
id: 'fabric.linkPicker.search.noResults.description',
|
|
100
|
+
defaultMessage: 'Try again with a different term.',
|
|
101
|
+
description: 'Describes possible action when a search returns no results'
|
|
92
102
|
}
|
|
93
103
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -12,6 +11,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
12
11
|
|
|
13
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
13
|
|
|
14
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
15
|
+
|
|
15
16
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
17
|
|
|
17
18
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -32,6 +33,7 @@ import Button, { ButtonGroup } from '@atlaskit/button';
|
|
|
32
33
|
import { FormFooter } from '@atlaskit/form';
|
|
33
34
|
import EditorSearchIcon from '@atlaskit/icon/glyph/editor/search';
|
|
34
35
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
36
|
+
import LinkSearchNoResults from './link-search-no-results';
|
|
35
37
|
export var RECENT_SEARCH_LIST_SIZE = 5;
|
|
36
38
|
|
|
37
39
|
var LinkPicker = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -335,7 +337,7 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
335
337
|
key: "updateResults",
|
|
336
338
|
value: function () {
|
|
337
339
|
var _updateResults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
338
|
-
var queryVersion, activePlugin, updates,
|
|
340
|
+
var queryVersion, activePlugin, updates, done, value, _result$done, result;
|
|
339
341
|
|
|
340
342
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
341
343
|
while (1) {
|
|
@@ -363,59 +365,78 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
363
365
|
|
|
364
366
|
case 7:
|
|
365
367
|
if (!(queryVersion === this.queryVersion)) {
|
|
366
|
-
_context2.next =
|
|
368
|
+
_context2.next = 29;
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
done = false;
|
|
373
|
+
value = void 0;
|
|
374
|
+
|
|
375
|
+
if (!(updates instanceof Promise)) {
|
|
376
|
+
_context2.next = 17;
|
|
367
377
|
break;
|
|
368
378
|
}
|
|
369
379
|
|
|
370
|
-
|
|
380
|
+
done = true;
|
|
381
|
+
_context2.next = 14;
|
|
382
|
+
return updates;
|
|
383
|
+
|
|
384
|
+
case 14:
|
|
385
|
+
value = _context2.sent;
|
|
386
|
+
_context2.next = 22;
|
|
387
|
+
break;
|
|
388
|
+
|
|
389
|
+
case 17:
|
|
390
|
+
_context2.next = 19;
|
|
371
391
|
return updates.next();
|
|
372
392
|
|
|
373
|
-
case
|
|
374
|
-
|
|
375
|
-
done =
|
|
376
|
-
value =
|
|
393
|
+
case 19:
|
|
394
|
+
result = _context2.sent;
|
|
395
|
+
done = (_result$done = result.done) !== null && _result$done !== void 0 ? _result$done : false;
|
|
396
|
+
value = result.value;
|
|
377
397
|
|
|
398
|
+
case 22:
|
|
378
399
|
if (!(queryVersion !== this.queryVersion)) {
|
|
379
|
-
_context2.next =
|
|
400
|
+
_context2.next = 24;
|
|
380
401
|
break;
|
|
381
402
|
}
|
|
382
403
|
|
|
383
404
|
return _context2.abrupt("return");
|
|
384
405
|
|
|
385
|
-
case
|
|
406
|
+
case 24:
|
|
386
407
|
this.setState({
|
|
387
|
-
items: limit(value),
|
|
408
|
+
items: limit(value.data),
|
|
388
409
|
isLoading: !done
|
|
389
410
|
});
|
|
390
411
|
|
|
391
412
|
if (!done) {
|
|
392
|
-
_context2.next =
|
|
413
|
+
_context2.next = 27;
|
|
393
414
|
break;
|
|
394
415
|
}
|
|
395
416
|
|
|
396
417
|
return _context2.abrupt("return");
|
|
397
418
|
|
|
398
|
-
case
|
|
419
|
+
case 27:
|
|
399
420
|
_context2.next = 7;
|
|
400
421
|
break;
|
|
401
422
|
|
|
402
|
-
case
|
|
403
|
-
_context2.next =
|
|
423
|
+
case 29:
|
|
424
|
+
_context2.next = 34;
|
|
404
425
|
break;
|
|
405
426
|
|
|
406
|
-
case
|
|
407
|
-
_context2.prev =
|
|
427
|
+
case 31:
|
|
428
|
+
_context2.prev = 31;
|
|
408
429
|
_context2.t0 = _context2["catch"](6);
|
|
409
430
|
this.setState({
|
|
410
431
|
isLoading: false
|
|
411
432
|
});
|
|
412
433
|
|
|
413
|
-
case
|
|
434
|
+
case 34:
|
|
414
435
|
case "end":
|
|
415
436
|
return _context2.stop();
|
|
416
437
|
}
|
|
417
438
|
}
|
|
418
|
-
}, _callee2, this, [[6,
|
|
439
|
+
}, _callee2, this, [[6, 31]]);
|
|
419
440
|
}));
|
|
420
441
|
|
|
421
442
|
function updateResults() {
|
|
@@ -454,6 +475,7 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
454
475
|
size: "medium",
|
|
455
476
|
label: ''
|
|
456
477
|
}));
|
|
478
|
+
var noResults = activePlugin && !isLoading && !items.length && !isSafeUrl(url);
|
|
457
479
|
return jsx("div", {
|
|
458
480
|
"data-testid": "link-picker",
|
|
459
481
|
className: "recent-list",
|
|
@@ -525,6 +547,10 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
525
547
|
onSelect: this.handleSelected,
|
|
526
548
|
onMouseEnter: this.handleMouseEnterResultItem,
|
|
527
549
|
onMouseLeave: this.handleMouseLeaveResultItem
|
|
550
|
+
}), noResults && jsx(LinkSearchNoResults, {
|
|
551
|
+
testId: "link-search-no-results",
|
|
552
|
+
header: formatMessage(messages.noResults),
|
|
553
|
+
description: formatMessage(messages.noResultsDescription)
|
|
528
554
|
}), jsx(FormFooter, {
|
|
529
555
|
align: "end"
|
|
530
556
|
}, jsx(ButtonGroup, null, jsx(Button, {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import EmptyState from '@atlaskit/empty-state';
|
|
4
|
+
import noResultsImg from './no-results.svg';
|
|
5
|
+
|
|
6
|
+
var NoResults = function NoResults(props) {
|
|
7
|
+
return /*#__PURE__*/React.createElement(EmptyState, _extends({}, props, {
|
|
8
|
+
imageUrl: noResultsImg,
|
|
9
|
+
maxImageWidth: 130,
|
|
10
|
+
maxImageHeight: 130
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default NoResults;
|
package/dist/esm/version.json
CHANGED
package/dist/types/messages.d.ts
CHANGED
|
@@ -89,4 +89,14 @@ export declare const messages: {
|
|
|
89
89
|
defaultMessage: string;
|
|
90
90
|
description: string;
|
|
91
91
|
};
|
|
92
|
+
noResults: {
|
|
93
|
+
id: string;
|
|
94
|
+
defaultMessage: string;
|
|
95
|
+
description: string;
|
|
96
|
+
};
|
|
97
|
+
noResultsDescription: {
|
|
98
|
+
id: string;
|
|
99
|
+
defaultMessage: string;
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
92
102
|
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -32,6 +32,9 @@ export interface LinkPickerState {
|
|
|
32
32
|
/** Current query string / URL input field value */
|
|
33
33
|
query: string;
|
|
34
34
|
}
|
|
35
|
+
export interface ResolveResult {
|
|
36
|
+
data: LinkSearchListItemData[];
|
|
37
|
+
}
|
|
35
38
|
export interface LinkPickerPlugin {
|
|
36
|
-
resolve: (state: LinkPickerState) => AsyncGenerator<
|
|
39
|
+
resolve: (state: LinkPickerState) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
|
|
37
40
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// import sub from 'date-fns/sub';
|
|
2
|
-
|
|
3
1
|
export interface MockDataV3 {
|
|
4
2
|
ACTIVITIES_DATA: {
|
|
5
3
|
data: {
|
|
@@ -33,6 +31,8 @@ const MOCK_DATA_V3: MockDataV3 = {
|
|
|
33
31
|
'ari:cloud:townsquare:a5a01d21-1cc3-4f29-9565-f2bb8cd969f5:project/cae6f0ae-bd95-439a-835f-d93907a63f23',
|
|
34
32
|
type: 'project',
|
|
35
33
|
product: 'townsquare',
|
|
34
|
+
rootContainerId:
|
|
35
|
+
'ari:cloud:platform::site/9a257bbc-b7c6-47c8-b1dc-c3db3dc8914b',
|
|
36
36
|
contributors: [
|
|
37
37
|
{
|
|
38
38
|
profile: {
|
|
@@ -178,6 +178,8 @@ const MOCK_DATA_V3: MockDataV3 = {
|
|
|
178
178
|
'ari:cloud:townsquare:a3a01d21-1cc3-4f29-9565-f2bb8cd969f5:project/cae6f0ae-bd95-439a-835f-d93907a63f53',
|
|
179
179
|
type: 'project',
|
|
180
180
|
product: 'townsquare',
|
|
181
|
+
rootContainerId:
|
|
182
|
+
'ari:cloud:platform::site/9a257bbc-b7c6-47c8-b1dc-c3db3dc8914b',
|
|
181
183
|
contributors: [
|
|
182
184
|
{
|
|
183
185
|
profile: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-picker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Standalone link picker",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@atlaskit/button": "^16.2.0",
|
|
30
|
+
"@atlaskit/empty-state": "^7.3.0",
|
|
30
31
|
"@atlaskit/form": "^8.5.1",
|
|
31
32
|
"@atlaskit/icon": "^21.10.0",
|
|
32
33
|
"@atlaskit/spinner": "^15.1.0",
|
|
@@ -48,14 +49,13 @@
|
|
|
48
49
|
"@atlaskit/activity-provider": "^2.3.2",
|
|
49
50
|
"@atlaskit/button": "^16.3.0",
|
|
50
51
|
"@atlaskit/docs": "*",
|
|
51
|
-
"@atlaskit/
|
|
52
|
-
"@atlaskit/media-test-helpers": "^30.0.0",
|
|
52
|
+
"@atlaskit/link-test-helpers": "^1.1.0",
|
|
53
53
|
"@atlaskit/popup": "^1.3.5",
|
|
54
54
|
"@atlaskit/ssr": "*",
|
|
55
55
|
"@atlaskit/visual-regression": "*",
|
|
56
56
|
"@atlaskit/webdriver-runner": "*",
|
|
57
57
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
58
|
-
"@atlassian/link-picker-atlassian-plugin": "^
|
|
58
|
+
"@atlassian/link-picker-atlassian-plugin": "^11.0.0",
|
|
59
59
|
"@atlassian/search-provider": "^2.3.0",
|
|
60
60
|
"@testing-library/dom": "^7.7.3",
|
|
61
61
|
"@testing-library/react": "^8.0.1",
|
package/report.api.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/link-picker"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
/// <reference types="react" />
|
|
7
|
+
|
|
8
|
+
import { MessageDescriptor } from 'react-intl-next';
|
|
9
|
+
import { default as React_2 } from 'react';
|
|
10
|
+
import { WithIntlProps } from 'react-intl-next';
|
|
11
|
+
import { WrappedComponentProps } from 'react-intl-next';
|
|
12
|
+
|
|
13
|
+
// @public (undocumented)
|
|
14
|
+
export type LinkInputType = 'manual' | 'typeAhead';
|
|
15
|
+
|
|
16
|
+
// @public (undocumented)
|
|
17
|
+
export const LinkPicker: React_2.FC<
|
|
18
|
+
WithIntlProps<WrappedComponentProps<'intl'> & LinkPickerProps>
|
|
19
|
+
> & {
|
|
20
|
+
WrappedComponent: React_2.ComponentType<
|
|
21
|
+
WrappedComponentProps<'intl'> & LinkPickerProps
|
|
22
|
+
>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// @public (undocumented)
|
|
26
|
+
export interface LinkPickerPlugin {
|
|
27
|
+
// (undocumented)
|
|
28
|
+
resolve: (
|
|
29
|
+
state: LinkPickerState,
|
|
30
|
+
) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// @public (undocumented)
|
|
34
|
+
export interface LinkPickerProps {
|
|
35
|
+
displayText?: string | null;
|
|
36
|
+
onCancel: () => void;
|
|
37
|
+
onSubmit: (arg: OnSubmitParameter) => void;
|
|
38
|
+
plugins?: LinkPickerPlugin[];
|
|
39
|
+
url?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// @public (undocumented)
|
|
43
|
+
export interface LinkPickerState {
|
|
44
|
+
query: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// @public (undocumented)
|
|
48
|
+
export interface LinkSearchListItemData {
|
|
49
|
+
container?: string;
|
|
50
|
+
icon:
|
|
51
|
+
| string
|
|
52
|
+
| React.ComponentType<{
|
|
53
|
+
alt: string;
|
|
54
|
+
}>;
|
|
55
|
+
iconAlt: string | MessageDescriptor;
|
|
56
|
+
lastUpdatedDate?: Date;
|
|
57
|
+
lastViewedDate?: Date;
|
|
58
|
+
name: string;
|
|
59
|
+
objectId: string;
|
|
60
|
+
prefetch?: boolean;
|
|
61
|
+
url: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// (No @packageDocumentation comment for this package)
|
|
65
|
+
```
|