@atlaskit/link-picker 1.10.0 → 1.10.2
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 +12 -0
- package/dist/cjs/analytics.codegen.js +1 -1
- package/dist/cjs/services/use-plugins/index.js +15 -1
- package/dist/cjs/ui/link-picker/index.js +13 -30
- package/dist/cjs/ui/link-picker/messages.js +58 -36
- package/dist/cjs/ui/link-picker/utils.js +19 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics.codegen.js +1 -1
- package/dist/es2019/services/use-plugins/index.js +11 -1
- package/dist/es2019/ui/link-picker/index.js +12 -28
- package/dist/es2019/ui/link-picker/messages.js +53 -35
- package/dist/es2019/ui/link-picker/utils.js +15 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics.codegen.js +1 -1
- package/dist/esm/services/use-plugins/index.js +11 -1
- package/dist/esm/ui/link-picker/index.js +12 -27
- package/dist/esm/ui/link-picker/messages.js +53 -35
- package/dist/esm/ui/link-picker/utils.js +14 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics.codegen.d.ts +5 -1
- package/dist/types/ui/link-picker/index.d.ts +0 -1
- package/dist/types/ui/link-picker/messages.d.ts +27 -9
- package/dist/types/ui/link-picker/utils.d.ts +2 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/link-picker
|
|
2
2
|
|
|
3
|
+
## 1.10.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8a538989c8d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8a538989c8d) - [ux] Updated label and Placeholder messages
|
|
8
|
+
|
|
9
|
+
## 1.10.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`df6de875d71`](https://bitbucket.org/atlassian/atlassian-frontend/commits/df6de875d71) - Adds operational logging for plugin resolve failures.
|
|
14
|
+
|
|
3
15
|
## 1.10.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -10,7 +10,7 @@ exports.default = void 0;
|
|
|
10
10
|
*
|
|
11
11
|
* Generates analytics utilities from the package analytics spec yaml
|
|
12
12
|
*
|
|
13
|
-
* @codegen <<SignedSource::
|
|
13
|
+
* @codegen <<SignedSource::05d8b1c9e46066efd0d11fa9d19c32a9>>
|
|
14
14
|
* @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
|
|
15
15
|
*/
|
|
16
16
|
function createEventPayload(eventKey, attributes) {
|
|
@@ -15,13 +15,24 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
15
15
|
|
|
16
16
|
var _react = require("react");
|
|
17
17
|
|
|
18
|
+
var _convertToError = require("@atlaskit/frontend-utilities/convert-to-error");
|
|
19
|
+
|
|
20
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
21
|
+
|
|
18
22
|
var _linkPicker = require("../../ui/link-picker");
|
|
19
23
|
|
|
24
|
+
var _analytics = _interopRequireDefault(require("../../analytics.codegen"));
|
|
25
|
+
|
|
26
|
+
var _constants = require("../../common/constants");
|
|
27
|
+
|
|
20
28
|
var _utils = require("./utils");
|
|
21
29
|
|
|
22
30
|
var _reducer = require("./reducer");
|
|
23
31
|
|
|
24
32
|
function usePlugins(state, activeTab, plugins) {
|
|
33
|
+
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
34
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
35
|
+
|
|
25
36
|
var _useState = (0, _react.useState)(0),
|
|
26
37
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
27
38
|
retries = _useState2[0],
|
|
@@ -101,6 +112,9 @@ function usePlugins(state, activeTab, plugins) {
|
|
|
101
112
|
type: 'ERROR',
|
|
102
113
|
payload: _context.t0
|
|
103
114
|
});
|
|
115
|
+
createAnalyticsEvent((0, _analytics.default)('operational.resultsResolve.failed', {
|
|
116
|
+
error: (0, _convertToError.convertToError)(_context.t0).toString()
|
|
117
|
+
})).fire(_constants.ANALYTICS_CHANNEL);
|
|
104
118
|
}
|
|
105
119
|
|
|
106
120
|
case 17:
|
|
@@ -118,7 +132,7 @@ function usePlugins(state, activeTab, plugins) {
|
|
|
118
132
|
|
|
119
133
|
updateResults();
|
|
120
134
|
return cancel;
|
|
121
|
-
}, [activePlugin, state, retries, dispatch]);
|
|
135
|
+
}, [activePlugin, state, retries, createAnalyticsEvent, dispatch]);
|
|
122
136
|
var tabs = (0, _react.useMemo)(function () {
|
|
123
137
|
if (!plugins || plugins.length <= 1) {
|
|
124
138
|
return [];
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.testIds = exports.default = exports.RECENT_SEARCH_LIST_SIZE =
|
|
10
|
+
exports.testIds = exports.default = exports.RECENT_SEARCH_LIST_SIZE = void 0;
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
@@ -53,8 +53,6 @@ var _browser = require("./browser");
|
|
|
53
53
|
|
|
54
54
|
var _announcer = _interopRequireDefault(require("./announcer"));
|
|
55
55
|
|
|
56
|
-
var _transformTimeStamp = require("./transformTimeStamp");
|
|
57
|
-
|
|
58
56
|
var _linkSearchList = _interopRequireWildcard(require("./link-search-list"));
|
|
59
57
|
|
|
60
58
|
var _linkSearchError = _interopRequireWildcard(require("./link-search-error"));
|
|
@@ -73,8 +71,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
73
71
|
|
|
74
72
|
var RECENT_SEARCH_LIST_SIZE = 5;
|
|
75
73
|
exports.RECENT_SEARCH_LIST_SIZE = RECENT_SEARCH_LIST_SIZE;
|
|
76
|
-
var CONTACT_SUPPORT_LINK = 'https://support.atlassian.com/contact/';
|
|
77
|
-
exports.CONTACT_SUPPORT_LINK = CONTACT_SUPPORT_LINK;
|
|
78
74
|
|
|
79
75
|
var testIds = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
80
76
|
linkPicker: 'link-picker',
|
|
@@ -331,14 +327,14 @@ function LinkPicker(_ref) {
|
|
|
331
327
|
invalidUrl: true
|
|
332
328
|
});
|
|
333
329
|
}, [handleInsert, isSelectedItem, selectedItem, url]);
|
|
334
|
-
var
|
|
330
|
+
var messages = isActivePlugin ? _messages.searchMessages : _messages.linkMessages;
|
|
335
331
|
var screenReaderDescriptionId = 'search-recent-links-field-description';
|
|
336
332
|
var linkSearchListId = 'link-picker-search-list';
|
|
337
333
|
var ariaActiveDescendant = selectedIndex > -1 ? "link-search-list-item-".concat(selectedIndex) : ''; // Added workaround with a screen reader Announcer specifically for VoiceOver + Safari
|
|
338
334
|
// as the Aria design pattern for combobox does not work in this case
|
|
339
335
|
// for details: https://a11y-internal.atlassian.net/browse/AK-740
|
|
340
336
|
|
|
341
|
-
var screenReaderText = _browser.browser.safari && getScreenReaderText(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
|
|
337
|
+
var screenReaderText = _browser.browser.safari && (0, _utils.getScreenReaderText)(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
|
|
342
338
|
var searchIcon = isActivePlugin && (0, _react2.jsx)("span", {
|
|
343
339
|
css: _styled.searchIconStyles,
|
|
344
340
|
"data-testid": testIds.searchIcon
|
|
@@ -357,23 +353,23 @@ function LinkPicker(_ref) {
|
|
|
357
353
|
delay: 250
|
|
358
354
|
}), (0, _react2.jsx)(_visuallyHidden.default, {
|
|
359
355
|
id: screenReaderDescriptionId
|
|
360
|
-
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage,
|
|
356
|
+
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, messages.linkAriaLabel)), (0, _react2.jsx)(LinkInputField, {
|
|
361
357
|
role: "combobox",
|
|
362
358
|
autoComplete: "off",
|
|
363
359
|
name: "url",
|
|
364
360
|
testId: testIds.urlInputField,
|
|
365
|
-
label: intl.formatMessage(
|
|
366
|
-
placeholder: intl.formatMessage(
|
|
361
|
+
label: intl.formatMessage(messages.linkLabel),
|
|
362
|
+
placeholder: intl.formatMessage(messages.linkPlaceholder),
|
|
367
363
|
value: url,
|
|
368
364
|
autoFocus: true,
|
|
369
365
|
elemBeforeInput: searchIcon,
|
|
370
|
-
clearLabel: intl.formatMessage(_messages.
|
|
366
|
+
clearLabel: intl.formatMessage(_messages.formMessages.clearLink),
|
|
371
367
|
"aria-expanded": true,
|
|
372
368
|
"aria-autocomplete": "list",
|
|
373
369
|
"aria-controls": linkSearchListId,
|
|
374
370
|
"aria-activedescendant": ariaActiveDescendant,
|
|
375
371
|
"aria-describedby": screenReaderDescriptionId,
|
|
376
|
-
error: invalidUrl ? intl.formatMessage(_messages.
|
|
372
|
+
error: invalidUrl ? intl.formatMessage(_messages.formMessages.linkInvalid) : null,
|
|
377
373
|
onClear: handleUrlClear,
|
|
378
374
|
onKeyDown: handleKeyDown,
|
|
379
375
|
onChange: handleChangeUrl
|
|
@@ -382,10 +378,10 @@ function LinkPicker(_ref) {
|
|
|
382
378
|
name: "displayText",
|
|
383
379
|
testId: testIds.textInputField,
|
|
384
380
|
value: displayText,
|
|
385
|
-
label: intl.formatMessage(_messages.
|
|
386
|
-
placeholder: intl.formatMessage(_messages.
|
|
387
|
-
clearLabel: intl.formatMessage(_messages.
|
|
388
|
-
"aria-label": intl.formatMessage(_messages.
|
|
381
|
+
label: intl.formatMessage(_messages.linkTextMessages.linkTextLabel),
|
|
382
|
+
placeholder: intl.formatMessage(_messages.linkTextMessages.linkTextPlaceholder),
|
|
383
|
+
clearLabel: intl.formatMessage(_messages.linkTextMessages.clearLinkText),
|
|
384
|
+
"aria-label": intl.formatMessage(_messages.linkTextMessages.linkTextAriaLabel),
|
|
389
385
|
onClear: handleClear,
|
|
390
386
|
onKeyDown: handleKeyDown,
|
|
391
387
|
onChange: handleChangeText
|
|
@@ -430,17 +426,4 @@ function LinkPicker(_ref) {
|
|
|
430
426
|
|
|
431
427
|
var _default = (0, _analytics2.withLinkPickerAnalyticsContext)( /*#__PURE__*/(0, _react.memo)(LinkPicker));
|
|
432
428
|
|
|
433
|
-
exports.default = _default;
|
|
434
|
-
|
|
435
|
-
function getScreenReaderText(items, selectedIndex, intl) {
|
|
436
|
-
if (items.length && selectedIndex > -1) {
|
|
437
|
-
var _items$selectedIndex = items[selectedIndex],
|
|
438
|
-
name = _items$selectedIndex.name,
|
|
439
|
-
container = _items$selectedIndex.container,
|
|
440
|
-
lastUpdatedDate = _items$selectedIndex.lastUpdatedDate,
|
|
441
|
-
lastViewedDate = _items$selectedIndex.lastViewedDate;
|
|
442
|
-
var date = (0, _transformTimeStamp.transformTimeStamp)(intl, lastViewedDate, lastUpdatedDate);
|
|
443
|
-
var 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(' ');
|
|
444
|
-
return [name, container, formattedDate].filter(Boolean).join(', ');
|
|
445
|
-
}
|
|
446
|
-
}
|
|
429
|
+
exports.default = _default;
|
|
@@ -3,61 +3,83 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.messages = void 0;
|
|
6
|
+
exports.searchMessages = exports.messages = exports.linkTextMessages = exports.linkMessages = exports.formMessages = void 0;
|
|
7
7
|
|
|
8
8
|
var _reactIntlNext = require("react-intl-next");
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
id: 'fabric.linkPicker.
|
|
10
|
+
var searchMessages = (0, _reactIntlNext.defineMessages)({
|
|
11
|
+
linkLabel: {
|
|
12
|
+
id: 'fabric.linkPicker.search.linkLabel',
|
|
13
13
|
defaultMessage: 'Search or paste a link',
|
|
14
|
-
description: '
|
|
15
|
-
},
|
|
16
|
-
linkPlaceholder: {
|
|
17
|
-
id: 'fabric.linkPicker.linkPlaceholder',
|
|
18
|
-
defaultMessage: 'Paste link',
|
|
19
|
-
description: 'Create a new link by pasting a URL.'
|
|
14
|
+
description: 'Label for the link input'
|
|
20
15
|
},
|
|
21
|
-
|
|
22
|
-
id: 'fabric.linkPicker.
|
|
23
|
-
defaultMessage: '
|
|
24
|
-
description: '
|
|
16
|
+
linkAriaLabel: {
|
|
17
|
+
id: 'fabric.linkPicker.search.linkAriaLabel',
|
|
18
|
+
defaultMessage: 'Suggestions will appear below as you type into the field',
|
|
19
|
+
description: 'Aria label for the link input'
|
|
25
20
|
},
|
|
21
|
+
linkPlaceholder: {
|
|
22
|
+
id: 'fabric.linkPicker.search.linkPlaceholder',
|
|
23
|
+
defaultMessage: 'Find recent links or paste a new link',
|
|
24
|
+
description: 'Placeholder text for the link input'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
exports.searchMessages = searchMessages;
|
|
28
|
+
var linkMessages = (0, _reactIntlNext.defineMessages)({
|
|
26
29
|
linkLabel: {
|
|
27
|
-
id: 'fabric.linkPicker.
|
|
30
|
+
id: 'fabric.linkPicker.linkLabel',
|
|
28
31
|
defaultMessage: 'Link',
|
|
29
|
-
description: '
|
|
32
|
+
description: 'Label for the link input'
|
|
33
|
+
},
|
|
34
|
+
linkAriaLabel: {
|
|
35
|
+
id: 'fabric.linkPicker.linkAriaLabel',
|
|
36
|
+
defaultMessage: 'Type or paste a link into the field',
|
|
37
|
+
description: 'Aria label for the link input'
|
|
30
38
|
},
|
|
39
|
+
linkPlaceholder: {
|
|
40
|
+
id: 'fabric.linkPicker.linkPlaceholder',
|
|
41
|
+
defaultMessage: 'Paste a link',
|
|
42
|
+
description: 'Placeholder text for the link input'
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
exports.linkMessages = linkMessages;
|
|
46
|
+
var formMessages = (0, _reactIntlNext.defineMessages)({
|
|
31
47
|
linkInvalid: {
|
|
32
48
|
id: 'fabric.linkPicker.linkInvalid',
|
|
33
49
|
defaultMessage: 'Enter a valid URL.',
|
|
34
|
-
description: '
|
|
35
|
-
},
|
|
36
|
-
linkTextLabel: {
|
|
37
|
-
id: 'fabric.linkPicker.displayText',
|
|
38
|
-
defaultMessage: 'Link text',
|
|
39
|
-
description: 'Link text label'
|
|
40
|
-
},
|
|
41
|
-
clearText: {
|
|
42
|
-
id: 'fabric.linkPicker.clearLinkText',
|
|
43
|
-
defaultMessage: 'Clear text',
|
|
44
|
-
description: 'Clears text on the link toolbar'
|
|
50
|
+
description: 'Error message shown for invalid links'
|
|
45
51
|
},
|
|
46
52
|
clearLink: {
|
|
47
53
|
id: 'fabric.linkPicker.clearLink',
|
|
48
54
|
defaultMessage: 'Clear link',
|
|
49
|
-
description: '
|
|
55
|
+
description: 'Tooltip message for link input clear button'
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
exports.formMessages = formMessages;
|
|
59
|
+
var linkTextMessages = (0, _reactIntlNext.defineMessages)({
|
|
60
|
+
linkTextLabel: {
|
|
61
|
+
id: 'fabric.linkPicker.linkTextLabel',
|
|
62
|
+
defaultMessage: 'Add a description (optional)',
|
|
63
|
+
description: 'Label for the link description input'
|
|
50
64
|
},
|
|
51
|
-
|
|
52
|
-
id: 'fabric.linkPicker.
|
|
53
|
-
defaultMessage: '
|
|
54
|
-
description: '
|
|
65
|
+
linkTextAriaLabel: {
|
|
66
|
+
id: 'fabric.linkPicker.linkTextAriaLabel',
|
|
67
|
+
defaultMessage: 'Link description',
|
|
68
|
+
description: 'Aria label for the link description input'
|
|
55
69
|
},
|
|
56
|
-
|
|
57
|
-
id: 'fabric.linkPicker.
|
|
58
|
-
defaultMessage: '
|
|
59
|
-
description: '
|
|
70
|
+
linkTextPlaceholder: {
|
|
71
|
+
id: 'fabric.linkPicker.linkTextPlaceholder',
|
|
72
|
+
defaultMessage: 'Give this link a title or description',
|
|
73
|
+
description: 'Placeholder text for the link description input'
|
|
60
74
|
},
|
|
75
|
+
clearLinkText: {
|
|
76
|
+
id: 'fabric.linkPicker.clearLinkText',
|
|
77
|
+
defaultMessage: 'Clear text',
|
|
78
|
+
description: 'Tooltip message for link input clear button'
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
exports.linkTextMessages = linkTextMessages;
|
|
82
|
+
var messages = (0, _reactIntlNext.defineMessages)({
|
|
61
83
|
timeUpdated: {
|
|
62
84
|
id: 'fabric.linkPicker.time.updated',
|
|
63
85
|
defaultMessage: 'Updated',
|
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getDataSource = void 0;
|
|
7
|
+
exports.getScreenReaderText = getScreenReaderText;
|
|
8
|
+
exports.isUndoEvent = exports.isRedoEvent = void 0;
|
|
7
9
|
|
|
8
10
|
var _browser = require("./browser");
|
|
9
11
|
|
|
12
|
+
var _transformTimeStamp = require("./transformTimeStamp");
|
|
13
|
+
|
|
10
14
|
var KeyZCode = 90;
|
|
11
15
|
var KeyYCode = 89;
|
|
12
16
|
|
|
@@ -36,4 +40,17 @@ var getDataSource = function getDataSource(item, plugin) {
|
|
|
36
40
|
return (_ref = (_item$meta$source = (_item$meta = item.meta) === null || _item$meta === void 0 ? void 0 : _item$meta.source) !== null && _item$meta$source !== void 0 ? _item$meta$source : plugin === null || plugin === void 0 ? void 0 : (_plugin$meta = plugin.meta) === null || _plugin$meta === void 0 ? void 0 : _plugin$meta.source) !== null && _ref !== void 0 ? _ref : 'unknown';
|
|
37
41
|
};
|
|
38
42
|
|
|
39
|
-
exports.getDataSource = getDataSource;
|
|
43
|
+
exports.getDataSource = getDataSource;
|
|
44
|
+
|
|
45
|
+
function getScreenReaderText(items, selectedIndex, intl) {
|
|
46
|
+
if (items.length && selectedIndex > -1) {
|
|
47
|
+
var _items$selectedIndex = items[selectedIndex],
|
|
48
|
+
name = _items$selectedIndex.name,
|
|
49
|
+
container = _items$selectedIndex.container,
|
|
50
|
+
lastUpdatedDate = _items$selectedIndex.lastUpdatedDate,
|
|
51
|
+
lastViewedDate = _items$selectedIndex.lastViewedDate;
|
|
52
|
+
var date = (0, _transformTimeStamp.transformTimeStamp)(intl, lastViewedDate, lastUpdatedDate);
|
|
53
|
+
var 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(' ');
|
|
54
|
+
return [name, container, formattedDate].filter(Boolean).join(', ');
|
|
55
|
+
}
|
|
56
|
+
}
|
package/dist/cjs/version.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates analytics utilities from the package analytics spec yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::05d8b1c9e46066efd0d11fa9d19c32a9>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
|
|
8
8
|
*/
|
|
9
9
|
function createEventPayload(eventKey, attributes) {
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState, useCallback } from 'react';
|
|
2
|
+
import { convertToError } from '@atlaskit/frontend-utilities/convert-to-error';
|
|
3
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
2
4
|
import { RECENT_SEARCH_LIST_SIZE } from '../../ui/link-picker';
|
|
5
|
+
import createEventPayload from '../../analytics.codegen';
|
|
6
|
+
import { ANALYTICS_CHANNEL } from '../../common/constants';
|
|
3
7
|
import { CancellationError, resolvePluginUpdates } from './utils';
|
|
4
8
|
import { usePluginReducer } from './reducer';
|
|
5
9
|
export function usePlugins(state, activeTab, plugins) {
|
|
10
|
+
const {
|
|
11
|
+
createAnalyticsEvent
|
|
12
|
+
} = useAnalyticsEvents();
|
|
6
13
|
const [retries, setRetries] = useState(0);
|
|
7
14
|
const [pluginState, dispatch] = usePluginReducer();
|
|
8
15
|
const activePlugin = plugins === null || plugins === void 0 ? void 0 : plugins[activeTab];
|
|
@@ -50,13 +57,16 @@ export function usePlugins(state, activeTab, plugins) {
|
|
|
50
57
|
type: 'ERROR',
|
|
51
58
|
payload: error
|
|
52
59
|
});
|
|
60
|
+
createAnalyticsEvent(createEventPayload('operational.resultsResolve.failed', {
|
|
61
|
+
error: convertToError(error).toString()
|
|
62
|
+
})).fire(ANALYTICS_CHANNEL);
|
|
53
63
|
}
|
|
54
64
|
}
|
|
55
65
|
};
|
|
56
66
|
|
|
57
67
|
updateResults();
|
|
58
68
|
return cancel;
|
|
59
|
-
}, [activePlugin, state, retries, dispatch]);
|
|
69
|
+
}, [activePlugin, state, retries, createAnalyticsEvent, dispatch]);
|
|
60
70
|
const tabs = useMemo(() => {
|
|
61
71
|
if (!plugins || plugins.length <= 1) {
|
|
62
72
|
return [];
|
|
@@ -15,18 +15,16 @@ import { normalizeUrl, isSafeUrl } from '../../common/utils/url';
|
|
|
15
15
|
import { usePlugins } from '../../services/use-plugins';
|
|
16
16
|
import { useSearchQuery } from '../../services/use-search-query';
|
|
17
17
|
import useFixHeight from '../../controllers/use-fix-height';
|
|
18
|
-
import {
|
|
18
|
+
import { searchMessages, linkMessages, formMessages, linkTextMessages } from './messages';
|
|
19
19
|
import TextInput from './text-input';
|
|
20
20
|
import { rootContainerStyles, searchIconStyles, tabsWrapperStyles, flexColumnStyles, formFooterMargin } from './styled';
|
|
21
21
|
import { browser } from './browser';
|
|
22
22
|
import Announcer from './announcer';
|
|
23
|
-
import { transformTimeStamp } from './transformTimeStamp';
|
|
24
23
|
import LinkSearchList, { testIds as listTestIds } from './link-search-list';
|
|
25
24
|
import LinkSearchError, { testIds as searchErrorTestIds } from './link-search-error';
|
|
26
25
|
import FormFooter, { testIds as formFooterTestIds } from './form-footer';
|
|
27
|
-
import { getDataSource } from './utils';
|
|
26
|
+
import { getDataSource, getScreenReaderText } from './utils';
|
|
28
27
|
export const RECENT_SEARCH_LIST_SIZE = 5;
|
|
29
|
-
export const CONTACT_SUPPORT_LINK = 'https://support.atlassian.com/contact/';
|
|
30
28
|
export const testIds = {
|
|
31
29
|
linkPicker: 'link-picker',
|
|
32
30
|
urlInputField: 'link-url',
|
|
@@ -280,7 +278,7 @@ function LinkPicker({
|
|
|
280
278
|
invalidUrl: true
|
|
281
279
|
});
|
|
282
280
|
}, [handleInsert, isSelectedItem, selectedItem, url]);
|
|
283
|
-
const
|
|
281
|
+
const messages = isActivePlugin ? searchMessages : linkMessages;
|
|
284
282
|
const screenReaderDescriptionId = 'search-recent-links-field-description';
|
|
285
283
|
const linkSearchListId = 'link-picker-search-list';
|
|
286
284
|
const ariaActiveDescendant = selectedIndex > -1 ? `link-search-list-item-${selectedIndex}` : ''; // Added workaround with a screen reader Announcer specifically for VoiceOver + Safari
|
|
@@ -306,23 +304,23 @@ function LinkPicker({
|
|
|
306
304
|
delay: 250
|
|
307
305
|
}), jsx(VisuallyHidden, {
|
|
308
306
|
id: screenReaderDescriptionId
|
|
309
|
-
}, jsx(FormattedMessage, messages.
|
|
307
|
+
}, jsx(FormattedMessage, messages.linkAriaLabel)), jsx(LinkInputField, {
|
|
310
308
|
role: "combobox",
|
|
311
309
|
autoComplete: "off",
|
|
312
310
|
name: "url",
|
|
313
311
|
testId: testIds.urlInputField,
|
|
314
312
|
label: intl.formatMessage(messages.linkLabel),
|
|
315
|
-
placeholder: intl.formatMessage(
|
|
313
|
+
placeholder: intl.formatMessage(messages.linkPlaceholder),
|
|
316
314
|
value: url,
|
|
317
315
|
autoFocus: true,
|
|
318
316
|
elemBeforeInput: searchIcon,
|
|
319
|
-
clearLabel: intl.formatMessage(
|
|
317
|
+
clearLabel: intl.formatMessage(formMessages.clearLink),
|
|
320
318
|
"aria-expanded": true,
|
|
321
319
|
"aria-autocomplete": "list",
|
|
322
320
|
"aria-controls": linkSearchListId,
|
|
323
321
|
"aria-activedescendant": ariaActiveDescendant,
|
|
324
322
|
"aria-describedby": screenReaderDescriptionId,
|
|
325
|
-
error: invalidUrl ? intl.formatMessage(
|
|
323
|
+
error: invalidUrl ? intl.formatMessage(formMessages.linkInvalid) : null,
|
|
326
324
|
onClear: handleUrlClear,
|
|
327
325
|
onKeyDown: handleKeyDown,
|
|
328
326
|
onChange: handleChangeUrl
|
|
@@ -331,10 +329,10 @@ function LinkPicker({
|
|
|
331
329
|
name: "displayText",
|
|
332
330
|
testId: testIds.textInputField,
|
|
333
331
|
value: displayText,
|
|
334
|
-
label: intl.formatMessage(
|
|
335
|
-
placeholder: intl.formatMessage(
|
|
336
|
-
clearLabel: intl.formatMessage(
|
|
337
|
-
"aria-label": intl.formatMessage(
|
|
332
|
+
label: intl.formatMessage(linkTextMessages.linkTextLabel),
|
|
333
|
+
placeholder: intl.formatMessage(linkTextMessages.linkTextPlaceholder),
|
|
334
|
+
clearLabel: intl.formatMessage(linkTextMessages.clearLinkText),
|
|
335
|
+
"aria-label": intl.formatMessage(linkTextMessages.linkTextAriaLabel),
|
|
338
336
|
onClear: handleClear,
|
|
339
337
|
onKeyDown: handleKeyDown,
|
|
340
338
|
onChange: handleChangeText
|
|
@@ -373,18 +371,4 @@ function LinkPicker({
|
|
|
373
371
|
}));
|
|
374
372
|
}
|
|
375
373
|
|
|
376
|
-
export default withLinkPickerAnalyticsContext( /*#__PURE__*/memo(LinkPicker));
|
|
377
|
-
|
|
378
|
-
function getScreenReaderText(items, selectedIndex, intl) {
|
|
379
|
-
if (items.length && selectedIndex > -1) {
|
|
380
|
-
const {
|
|
381
|
-
name,
|
|
382
|
-
container,
|
|
383
|
-
lastUpdatedDate,
|
|
384
|
-
lastViewedDate
|
|
385
|
-
} = items[selectedIndex];
|
|
386
|
-
const date = transformTimeStamp(intl, lastViewedDate, lastUpdatedDate);
|
|
387
|
-
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(' ');
|
|
388
|
-
return [name, container, formattedDate].filter(Boolean).join(', ');
|
|
389
|
-
}
|
|
390
|
-
}
|
|
374
|
+
export default withLinkPickerAnalyticsContext( /*#__PURE__*/memo(LinkPicker));
|
|
@@ -1,55 +1,73 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl-next';
|
|
2
|
-
export const
|
|
3
|
-
|
|
4
|
-
id: 'fabric.linkPicker.
|
|
2
|
+
export const searchMessages = defineMessages({
|
|
3
|
+
linkLabel: {
|
|
4
|
+
id: 'fabric.linkPicker.search.linkLabel',
|
|
5
5
|
defaultMessage: 'Search or paste a link',
|
|
6
|
-
description: '
|
|
7
|
-
},
|
|
8
|
-
linkPlaceholder: {
|
|
9
|
-
id: 'fabric.linkPicker.linkPlaceholder',
|
|
10
|
-
defaultMessage: 'Paste link',
|
|
11
|
-
description: 'Create a new link by pasting a URL.'
|
|
6
|
+
description: 'Label for the link input'
|
|
12
7
|
},
|
|
13
|
-
|
|
14
|
-
id: 'fabric.linkPicker.
|
|
15
|
-
defaultMessage: '
|
|
16
|
-
description: '
|
|
8
|
+
linkAriaLabel: {
|
|
9
|
+
id: 'fabric.linkPicker.search.linkAriaLabel',
|
|
10
|
+
defaultMessage: 'Suggestions will appear below as you type into the field',
|
|
11
|
+
description: 'Aria label for the link input'
|
|
17
12
|
},
|
|
13
|
+
linkPlaceholder: {
|
|
14
|
+
id: 'fabric.linkPicker.search.linkPlaceholder',
|
|
15
|
+
defaultMessage: 'Find recent links or paste a new link',
|
|
16
|
+
description: 'Placeholder text for the link input'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export const linkMessages = defineMessages({
|
|
18
20
|
linkLabel: {
|
|
19
|
-
id: 'fabric.linkPicker.
|
|
21
|
+
id: 'fabric.linkPicker.linkLabel',
|
|
20
22
|
defaultMessage: 'Link',
|
|
21
|
-
description: '
|
|
23
|
+
description: 'Label for the link input'
|
|
24
|
+
},
|
|
25
|
+
linkAriaLabel: {
|
|
26
|
+
id: 'fabric.linkPicker.linkAriaLabel',
|
|
27
|
+
defaultMessage: 'Type or paste a link into the field',
|
|
28
|
+
description: 'Aria label for the link input'
|
|
22
29
|
},
|
|
30
|
+
linkPlaceholder: {
|
|
31
|
+
id: 'fabric.linkPicker.linkPlaceholder',
|
|
32
|
+
defaultMessage: 'Paste a link',
|
|
33
|
+
description: 'Placeholder text for the link input'
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
export const formMessages = defineMessages({
|
|
23
37
|
linkInvalid: {
|
|
24
38
|
id: 'fabric.linkPicker.linkInvalid',
|
|
25
39
|
defaultMessage: 'Enter a valid URL.',
|
|
26
|
-
description: '
|
|
27
|
-
},
|
|
28
|
-
linkTextLabel: {
|
|
29
|
-
id: 'fabric.linkPicker.displayText',
|
|
30
|
-
defaultMessage: 'Link text',
|
|
31
|
-
description: 'Link text label'
|
|
32
|
-
},
|
|
33
|
-
clearText: {
|
|
34
|
-
id: 'fabric.linkPicker.clearLinkText',
|
|
35
|
-
defaultMessage: 'Clear text',
|
|
36
|
-
description: 'Clears text on the link toolbar'
|
|
40
|
+
description: 'Error message shown for invalid links'
|
|
37
41
|
},
|
|
38
42
|
clearLink: {
|
|
39
43
|
id: 'fabric.linkPicker.clearLink',
|
|
40
44
|
defaultMessage: 'Clear link',
|
|
41
|
-
description: '
|
|
45
|
+
description: 'Tooltip message for link input clear button'
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
export const linkTextMessages = defineMessages({
|
|
49
|
+
linkTextLabel: {
|
|
50
|
+
id: 'fabric.linkPicker.linkTextLabel',
|
|
51
|
+
defaultMessage: 'Add a description (optional)',
|
|
52
|
+
description: 'Label for the link description input'
|
|
42
53
|
},
|
|
43
|
-
|
|
44
|
-
id: 'fabric.linkPicker.
|
|
45
|
-
defaultMessage: '
|
|
46
|
-
description: '
|
|
54
|
+
linkTextAriaLabel: {
|
|
55
|
+
id: 'fabric.linkPicker.linkTextAriaLabel',
|
|
56
|
+
defaultMessage: 'Link description',
|
|
57
|
+
description: 'Aria label for the link description input'
|
|
47
58
|
},
|
|
48
|
-
|
|
49
|
-
id: 'fabric.linkPicker.
|
|
50
|
-
defaultMessage: '
|
|
51
|
-
description: '
|
|
59
|
+
linkTextPlaceholder: {
|
|
60
|
+
id: 'fabric.linkPicker.linkTextPlaceholder',
|
|
61
|
+
defaultMessage: 'Give this link a title or description',
|
|
62
|
+
description: 'Placeholder text for the link description input'
|
|
52
63
|
},
|
|
64
|
+
clearLinkText: {
|
|
65
|
+
id: 'fabric.linkPicker.clearLinkText',
|
|
66
|
+
defaultMessage: 'Clear text',
|
|
67
|
+
description: 'Tooltip message for link input clear button'
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export const messages = defineMessages({
|
|
53
71
|
timeUpdated: {
|
|
54
72
|
id: 'fabric.linkPicker.time.updated',
|
|
55
73
|
defaultMessage: 'Updated',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { browser } from './browser';
|
|
2
|
+
import { transformTimeStamp } from './transformTimeStamp';
|
|
2
3
|
const KeyZCode = 90;
|
|
3
4
|
const KeyYCode = 89;
|
|
4
5
|
export const isUndoEvent = e => {
|
|
@@ -19,4 +20,17 @@ export const getDataSource = (item, plugin) => {
|
|
|
19
20
|
var _ref, _item$meta$source, _item$meta, _plugin$meta;
|
|
20
21
|
|
|
21
22
|
return (_ref = (_item$meta$source = (_item$meta = item.meta) === null || _item$meta === void 0 ? void 0 : _item$meta.source) !== null && _item$meta$source !== void 0 ? _item$meta$source : plugin === null || plugin === void 0 ? void 0 : (_plugin$meta = plugin.meta) === null || _plugin$meta === void 0 ? void 0 : _plugin$meta.source) !== null && _ref !== void 0 ? _ref : 'unknown';
|
|
22
|
-
};
|
|
23
|
+
};
|
|
24
|
+
export function getScreenReaderText(items, selectedIndex, intl) {
|
|
25
|
+
if (items.length && selectedIndex > -1) {
|
|
26
|
+
const {
|
|
27
|
+
name,
|
|
28
|
+
container,
|
|
29
|
+
lastUpdatedDate,
|
|
30
|
+
lastViewedDate
|
|
31
|
+
} = items[selectedIndex];
|
|
32
|
+
const date = transformTimeStamp(intl, lastViewedDate, lastUpdatedDate);
|
|
33
|
+
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(' ');
|
|
34
|
+
return [name, container, formattedDate].filter(Boolean).join(', ');
|
|
35
|
+
}
|
|
36
|
+
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates analytics utilities from the package analytics spec yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::05d8b1c9e46066efd0d11fa9d19c32a9>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
|
|
8
8
|
*/
|
|
9
9
|
function createEventPayload(eventKey, attributes) {
|
|
@@ -2,10 +2,17 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import { useEffect, useMemo, useState, useCallback } from 'react';
|
|
5
|
+
import { convertToError } from '@atlaskit/frontend-utilities/convert-to-error';
|
|
6
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
7
|
import { RECENT_SEARCH_LIST_SIZE } from '../../ui/link-picker';
|
|
8
|
+
import createEventPayload from '../../analytics.codegen';
|
|
9
|
+
import { ANALYTICS_CHANNEL } from '../../common/constants';
|
|
6
10
|
import { CancellationError, resolvePluginUpdates } from './utils';
|
|
7
11
|
import { usePluginReducer } from './reducer';
|
|
8
12
|
export function usePlugins(state, activeTab, plugins) {
|
|
13
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
14
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
15
|
+
|
|
9
16
|
var _useState = useState(0),
|
|
10
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
11
18
|
retries = _useState2[0],
|
|
@@ -85,6 +92,9 @@ export function usePlugins(state, activeTab, plugins) {
|
|
|
85
92
|
type: 'ERROR',
|
|
86
93
|
payload: _context.t0
|
|
87
94
|
});
|
|
95
|
+
createAnalyticsEvent(createEventPayload('operational.resultsResolve.failed', {
|
|
96
|
+
error: convertToError(_context.t0).toString()
|
|
97
|
+
})).fire(ANALYTICS_CHANNEL);
|
|
88
98
|
}
|
|
89
99
|
|
|
90
100
|
case 17:
|
|
@@ -102,7 +112,7 @@ export function usePlugins(state, activeTab, plugins) {
|
|
|
102
112
|
|
|
103
113
|
updateResults();
|
|
104
114
|
return cancel;
|
|
105
|
-
}, [activePlugin, state, retries, dispatch]);
|
|
115
|
+
}, [activePlugin, state, retries, createAnalyticsEvent, dispatch]);
|
|
106
116
|
var tabs = useMemo(function () {
|
|
107
117
|
if (!plugins || plugins.length <= 1) {
|
|
108
118
|
return [];
|
|
@@ -21,18 +21,16 @@ import { normalizeUrl, isSafeUrl } from '../../common/utils/url';
|
|
|
21
21
|
import { usePlugins } from '../../services/use-plugins';
|
|
22
22
|
import { useSearchQuery } from '../../services/use-search-query';
|
|
23
23
|
import useFixHeight from '../../controllers/use-fix-height';
|
|
24
|
-
import {
|
|
24
|
+
import { searchMessages, linkMessages, formMessages, linkTextMessages } from './messages';
|
|
25
25
|
import TextInput from './text-input';
|
|
26
26
|
import { rootContainerStyles, searchIconStyles, tabsWrapperStyles, flexColumnStyles, formFooterMargin } from './styled';
|
|
27
27
|
import { browser } from './browser';
|
|
28
28
|
import Announcer from './announcer';
|
|
29
|
-
import { transformTimeStamp } from './transformTimeStamp';
|
|
30
29
|
import LinkSearchList, { testIds as listTestIds } from './link-search-list';
|
|
31
30
|
import LinkSearchError, { testIds as searchErrorTestIds } from './link-search-error';
|
|
32
31
|
import FormFooter, { testIds as formFooterTestIds } from './form-footer';
|
|
33
|
-
import { getDataSource } from './utils';
|
|
32
|
+
import { getDataSource, getScreenReaderText } from './utils';
|
|
34
33
|
export var RECENT_SEARCH_LIST_SIZE = 5;
|
|
35
|
-
export var CONTACT_SUPPORT_LINK = 'https://support.atlassian.com/contact/';
|
|
36
34
|
export var testIds = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
37
35
|
linkPicker: 'link-picker',
|
|
38
36
|
urlInputField: 'link-url',
|
|
@@ -286,7 +284,7 @@ function LinkPicker(_ref) {
|
|
|
286
284
|
invalidUrl: true
|
|
287
285
|
});
|
|
288
286
|
}, [handleInsert, isSelectedItem, selectedItem, url]);
|
|
289
|
-
var
|
|
287
|
+
var messages = isActivePlugin ? searchMessages : linkMessages;
|
|
290
288
|
var screenReaderDescriptionId = 'search-recent-links-field-description';
|
|
291
289
|
var linkSearchListId = 'link-picker-search-list';
|
|
292
290
|
var ariaActiveDescendant = selectedIndex > -1 ? "link-search-list-item-".concat(selectedIndex) : ''; // Added workaround with a screen reader Announcer specifically for VoiceOver + Safari
|
|
@@ -312,23 +310,23 @@ function LinkPicker(_ref) {
|
|
|
312
310
|
delay: 250
|
|
313
311
|
}), jsx(VisuallyHidden, {
|
|
314
312
|
id: screenReaderDescriptionId
|
|
315
|
-
}, jsx(FormattedMessage, messages.
|
|
313
|
+
}, jsx(FormattedMessage, messages.linkAriaLabel)), jsx(LinkInputField, {
|
|
316
314
|
role: "combobox",
|
|
317
315
|
autoComplete: "off",
|
|
318
316
|
name: "url",
|
|
319
317
|
testId: testIds.urlInputField,
|
|
320
318
|
label: intl.formatMessage(messages.linkLabel),
|
|
321
|
-
placeholder: intl.formatMessage(
|
|
319
|
+
placeholder: intl.formatMessage(messages.linkPlaceholder),
|
|
322
320
|
value: url,
|
|
323
321
|
autoFocus: true,
|
|
324
322
|
elemBeforeInput: searchIcon,
|
|
325
|
-
clearLabel: intl.formatMessage(
|
|
323
|
+
clearLabel: intl.formatMessage(formMessages.clearLink),
|
|
326
324
|
"aria-expanded": true,
|
|
327
325
|
"aria-autocomplete": "list",
|
|
328
326
|
"aria-controls": linkSearchListId,
|
|
329
327
|
"aria-activedescendant": ariaActiveDescendant,
|
|
330
328
|
"aria-describedby": screenReaderDescriptionId,
|
|
331
|
-
error: invalidUrl ? intl.formatMessage(
|
|
329
|
+
error: invalidUrl ? intl.formatMessage(formMessages.linkInvalid) : null,
|
|
332
330
|
onClear: handleUrlClear,
|
|
333
331
|
onKeyDown: handleKeyDown,
|
|
334
332
|
onChange: handleChangeUrl
|
|
@@ -337,10 +335,10 @@ function LinkPicker(_ref) {
|
|
|
337
335
|
name: "displayText",
|
|
338
336
|
testId: testIds.textInputField,
|
|
339
337
|
value: displayText,
|
|
340
|
-
label: intl.formatMessage(
|
|
341
|
-
placeholder: intl.formatMessage(
|
|
342
|
-
clearLabel: intl.formatMessage(
|
|
343
|
-
"aria-label": intl.formatMessage(
|
|
338
|
+
label: intl.formatMessage(linkTextMessages.linkTextLabel),
|
|
339
|
+
placeholder: intl.formatMessage(linkTextMessages.linkTextPlaceholder),
|
|
340
|
+
clearLabel: intl.formatMessage(linkTextMessages.clearLinkText),
|
|
341
|
+
"aria-label": intl.formatMessage(linkTextMessages.linkTextAriaLabel),
|
|
344
342
|
onClear: handleClear,
|
|
345
343
|
onKeyDown: handleKeyDown,
|
|
346
344
|
onChange: handleChangeText
|
|
@@ -383,17 +381,4 @@ function LinkPicker(_ref) {
|
|
|
383
381
|
}));
|
|
384
382
|
}
|
|
385
383
|
|
|
386
|
-
export default withLinkPickerAnalyticsContext( /*#__PURE__*/memo(LinkPicker));
|
|
387
|
-
|
|
388
|
-
function getScreenReaderText(items, selectedIndex, intl) {
|
|
389
|
-
if (items.length && selectedIndex > -1) {
|
|
390
|
-
var _items$selectedIndex = items[selectedIndex],
|
|
391
|
-
name = _items$selectedIndex.name,
|
|
392
|
-
container = _items$selectedIndex.container,
|
|
393
|
-
lastUpdatedDate = _items$selectedIndex.lastUpdatedDate,
|
|
394
|
-
lastViewedDate = _items$selectedIndex.lastViewedDate;
|
|
395
|
-
var date = transformTimeStamp(intl, lastViewedDate, lastUpdatedDate);
|
|
396
|
-
var 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(' ');
|
|
397
|
-
return [name, container, formattedDate].filter(Boolean).join(', ');
|
|
398
|
-
}
|
|
399
|
-
}
|
|
384
|
+
export default withLinkPickerAnalyticsContext( /*#__PURE__*/memo(LinkPicker));
|
|
@@ -1,55 +1,73 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl-next';
|
|
2
|
-
export var
|
|
3
|
-
|
|
4
|
-
id: 'fabric.linkPicker.
|
|
2
|
+
export var searchMessages = defineMessages({
|
|
3
|
+
linkLabel: {
|
|
4
|
+
id: 'fabric.linkPicker.search.linkLabel',
|
|
5
5
|
defaultMessage: 'Search or paste a link',
|
|
6
|
-
description: '
|
|
7
|
-
},
|
|
8
|
-
linkPlaceholder: {
|
|
9
|
-
id: 'fabric.linkPicker.linkPlaceholder',
|
|
10
|
-
defaultMessage: 'Paste link',
|
|
11
|
-
description: 'Create a new link by pasting a URL.'
|
|
6
|
+
description: 'Label for the link input'
|
|
12
7
|
},
|
|
13
|
-
|
|
14
|
-
id: 'fabric.linkPicker.
|
|
15
|
-
defaultMessage: '
|
|
16
|
-
description: '
|
|
8
|
+
linkAriaLabel: {
|
|
9
|
+
id: 'fabric.linkPicker.search.linkAriaLabel',
|
|
10
|
+
defaultMessage: 'Suggestions will appear below as you type into the field',
|
|
11
|
+
description: 'Aria label for the link input'
|
|
17
12
|
},
|
|
13
|
+
linkPlaceholder: {
|
|
14
|
+
id: 'fabric.linkPicker.search.linkPlaceholder',
|
|
15
|
+
defaultMessage: 'Find recent links or paste a new link',
|
|
16
|
+
description: 'Placeholder text for the link input'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export var linkMessages = defineMessages({
|
|
18
20
|
linkLabel: {
|
|
19
|
-
id: 'fabric.linkPicker.
|
|
21
|
+
id: 'fabric.linkPicker.linkLabel',
|
|
20
22
|
defaultMessage: 'Link',
|
|
21
|
-
description: '
|
|
23
|
+
description: 'Label for the link input'
|
|
24
|
+
},
|
|
25
|
+
linkAriaLabel: {
|
|
26
|
+
id: 'fabric.linkPicker.linkAriaLabel',
|
|
27
|
+
defaultMessage: 'Type or paste a link into the field',
|
|
28
|
+
description: 'Aria label for the link input'
|
|
22
29
|
},
|
|
30
|
+
linkPlaceholder: {
|
|
31
|
+
id: 'fabric.linkPicker.linkPlaceholder',
|
|
32
|
+
defaultMessage: 'Paste a link',
|
|
33
|
+
description: 'Placeholder text for the link input'
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
export var formMessages = defineMessages({
|
|
23
37
|
linkInvalid: {
|
|
24
38
|
id: 'fabric.linkPicker.linkInvalid',
|
|
25
39
|
defaultMessage: 'Enter a valid URL.',
|
|
26
|
-
description: '
|
|
27
|
-
},
|
|
28
|
-
linkTextLabel: {
|
|
29
|
-
id: 'fabric.linkPicker.displayText',
|
|
30
|
-
defaultMessage: 'Link text',
|
|
31
|
-
description: 'Link text label'
|
|
32
|
-
},
|
|
33
|
-
clearText: {
|
|
34
|
-
id: 'fabric.linkPicker.clearLinkText',
|
|
35
|
-
defaultMessage: 'Clear text',
|
|
36
|
-
description: 'Clears text on the link toolbar'
|
|
40
|
+
description: 'Error message shown for invalid links'
|
|
37
41
|
},
|
|
38
42
|
clearLink: {
|
|
39
43
|
id: 'fabric.linkPicker.clearLink',
|
|
40
44
|
defaultMessage: 'Clear link',
|
|
41
|
-
description: '
|
|
45
|
+
description: 'Tooltip message for link input clear button'
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
export var linkTextMessages = defineMessages({
|
|
49
|
+
linkTextLabel: {
|
|
50
|
+
id: 'fabric.linkPicker.linkTextLabel',
|
|
51
|
+
defaultMessage: 'Add a description (optional)',
|
|
52
|
+
description: 'Label for the link description input'
|
|
42
53
|
},
|
|
43
|
-
|
|
44
|
-
id: 'fabric.linkPicker.
|
|
45
|
-
defaultMessage: '
|
|
46
|
-
description: '
|
|
54
|
+
linkTextAriaLabel: {
|
|
55
|
+
id: 'fabric.linkPicker.linkTextAriaLabel',
|
|
56
|
+
defaultMessage: 'Link description',
|
|
57
|
+
description: 'Aria label for the link description input'
|
|
47
58
|
},
|
|
48
|
-
|
|
49
|
-
id: 'fabric.linkPicker.
|
|
50
|
-
defaultMessage: '
|
|
51
|
-
description: '
|
|
59
|
+
linkTextPlaceholder: {
|
|
60
|
+
id: 'fabric.linkPicker.linkTextPlaceholder',
|
|
61
|
+
defaultMessage: 'Give this link a title or description',
|
|
62
|
+
description: 'Placeholder text for the link description input'
|
|
52
63
|
},
|
|
64
|
+
clearLinkText: {
|
|
65
|
+
id: 'fabric.linkPicker.clearLinkText',
|
|
66
|
+
defaultMessage: 'Clear text',
|
|
67
|
+
description: 'Tooltip message for link input clear button'
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export var messages = defineMessages({
|
|
53
71
|
timeUpdated: {
|
|
54
72
|
id: 'fabric.linkPicker.time.updated',
|
|
55
73
|
defaultMessage: 'Updated',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { browser } from './browser';
|
|
2
|
+
import { transformTimeStamp } from './transformTimeStamp';
|
|
2
3
|
var KeyZCode = 90;
|
|
3
4
|
var KeyYCode = 89;
|
|
4
5
|
export var isUndoEvent = function isUndoEvent(e) {
|
|
@@ -19,4 +20,16 @@ export var getDataSource = function getDataSource(item, plugin) {
|
|
|
19
20
|
var _ref, _item$meta$source, _item$meta, _plugin$meta;
|
|
20
21
|
|
|
21
22
|
return (_ref = (_item$meta$source = (_item$meta = item.meta) === null || _item$meta === void 0 ? void 0 : _item$meta.source) !== null && _item$meta$source !== void 0 ? _item$meta$source : plugin === null || plugin === void 0 ? void 0 : (_plugin$meta = plugin.meta) === null || _plugin$meta === void 0 ? void 0 : _plugin$meta.source) !== null && _ref !== void 0 ? _ref : 'unknown';
|
|
22
|
-
};
|
|
23
|
+
};
|
|
24
|
+
export function getScreenReaderText(items, selectedIndex, intl) {
|
|
25
|
+
if (items.length && selectedIndex > -1) {
|
|
26
|
+
var _items$selectedIndex = items[selectedIndex],
|
|
27
|
+
name = _items$selectedIndex.name,
|
|
28
|
+
container = _items$selectedIndex.container,
|
|
29
|
+
lastUpdatedDate = _items$selectedIndex.lastUpdatedDate,
|
|
30
|
+
lastViewedDate = _items$selectedIndex.lastViewedDate;
|
|
31
|
+
var date = transformTimeStamp(intl, lastViewedDate, lastUpdatedDate);
|
|
32
|
+
var 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(' ');
|
|
33
|
+
return [name, container, formattedDate].filter(Boolean).join(', ');
|
|
34
|
+
}
|
|
35
|
+
}
|
package/dist/esm/version.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates analytics utilities from the package analytics spec yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::05d8b1c9e46066efd0d11fa9d19c32a9>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
|
|
8
8
|
*/
|
|
9
9
|
export declare type PackageMetaDataType = {
|
|
@@ -30,6 +30,9 @@ export declare type LinkPickerUnhandledErrorCaughtAttributesType = {
|
|
|
30
30
|
error: string;
|
|
31
31
|
componentStack: string | null;
|
|
32
32
|
};
|
|
33
|
+
export declare type ResultsResolveFailedAttributesType = {
|
|
34
|
+
error: string;
|
|
35
|
+
};
|
|
33
36
|
declare type AnalyticsEventAttributes = {
|
|
34
37
|
'ui.form.submitted.linkPicker': FormSubmittedLinkPickerAttributesType;
|
|
35
38
|
'ui.inlineDialog.viewed.linkPicker': InlineDialogViewedLinkPickerAttributesType;
|
|
@@ -37,6 +40,7 @@ declare type AnalyticsEventAttributes = {
|
|
|
37
40
|
'ui.textField.updated.linkField': TextFieldUpdatedLinkFieldAttributesType;
|
|
38
41
|
'ui.textField.updated.displayTextField': TextFieldUpdatedDisplayTextFieldAttributesType;
|
|
39
42
|
'ui.linkPicker.unhandledErrorCaught': LinkPickerUnhandledErrorCaughtAttributesType;
|
|
43
|
+
'operational.resultsResolve.failed': ResultsResolveFailedAttributesType;
|
|
40
44
|
};
|
|
41
45
|
declare function createEventPayload<K extends keyof AnalyticsEventAttributes>(eventKey: K, attributes: AnalyticsEventAttributes[K]): {
|
|
42
46
|
eventType: string;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
3
|
import { LinkInputType, LinkPickerPlugin } from '../types';
|
|
4
4
|
export declare const RECENT_SEARCH_LIST_SIZE = 5;
|
|
5
|
-
export declare const CONTACT_SUPPORT_LINK = "https://support.atlassian.com/contact/";
|
|
6
5
|
export declare const testIds: {
|
|
7
6
|
readonly clearUrlButton: "clear-text";
|
|
8
7
|
readonly urlError: "link-error";
|
|
@@ -1,35 +1,39 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
1
|
+
export declare const searchMessages: {
|
|
2
|
+
linkLabel: {
|
|
3
3
|
id: string;
|
|
4
4
|
defaultMessage: string;
|
|
5
5
|
description: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
linkAriaLabel: {
|
|
8
8
|
id: string;
|
|
9
9
|
defaultMessage: string;
|
|
10
10
|
description: string;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
linkPlaceholder: {
|
|
13
13
|
id: string;
|
|
14
14
|
defaultMessage: string;
|
|
15
15
|
description: string;
|
|
16
16
|
};
|
|
17
|
+
};
|
|
18
|
+
export declare const linkMessages: {
|
|
17
19
|
linkLabel: {
|
|
18
20
|
id: string;
|
|
19
21
|
defaultMessage: string;
|
|
20
22
|
description: string;
|
|
21
23
|
};
|
|
22
|
-
|
|
24
|
+
linkAriaLabel: {
|
|
23
25
|
id: string;
|
|
24
26
|
defaultMessage: string;
|
|
25
27
|
description: string;
|
|
26
28
|
};
|
|
27
|
-
|
|
29
|
+
linkPlaceholder: {
|
|
28
30
|
id: string;
|
|
29
31
|
defaultMessage: string;
|
|
30
32
|
description: string;
|
|
31
33
|
};
|
|
32
|
-
|
|
34
|
+
};
|
|
35
|
+
export declare const formMessages: {
|
|
36
|
+
linkInvalid: {
|
|
33
37
|
id: string;
|
|
34
38
|
defaultMessage: string;
|
|
35
39
|
description: string;
|
|
@@ -39,16 +43,30 @@ export declare const messages: {
|
|
|
39
43
|
defaultMessage: string;
|
|
40
44
|
description: string;
|
|
41
45
|
};
|
|
42
|
-
|
|
46
|
+
};
|
|
47
|
+
export declare const linkTextMessages: {
|
|
48
|
+
linkTextLabel: {
|
|
43
49
|
id: string;
|
|
44
50
|
defaultMessage: string;
|
|
45
51
|
description: string;
|
|
46
52
|
};
|
|
47
|
-
|
|
53
|
+
linkTextAriaLabel: {
|
|
54
|
+
id: string;
|
|
55
|
+
defaultMessage: string;
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
58
|
+
linkTextPlaceholder: {
|
|
48
59
|
id: string;
|
|
49
60
|
defaultMessage: string;
|
|
50
61
|
description: string;
|
|
51
62
|
};
|
|
63
|
+
clearLinkText: {
|
|
64
|
+
id: string;
|
|
65
|
+
defaultMessage: string;
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export declare const messages: {
|
|
52
70
|
timeUpdated: {
|
|
53
71
|
id: string;
|
|
54
72
|
defaultMessage: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { KeyboardEvent } from 'react';
|
|
2
|
+
import { IntlShape } from 'react-intl-next';
|
|
2
3
|
import { LinkPickerPlugin, LinkSearchListItemData } from '../types';
|
|
3
4
|
export declare const isUndoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
|
|
4
5
|
export declare const isRedoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
|
|
@@ -6,3 +7,4 @@ export declare const isRedoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolea
|
|
|
6
7
|
* Retrieve the data source for a link given the item and the plugin that resolved it
|
|
7
8
|
*/
|
|
8
9
|
export declare const getDataSource: (item: LinkSearchListItemData, plugin?: LinkPickerPlugin | undefined) => string;
|
|
10
|
+
export declare function getScreenReaderText(items: LinkSearchListItemData[], selectedIndex: number, intl: IntlShape): string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-picker",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"description": "Standalone link picker",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"@atlaskit/button": "^16.2.0",
|
|
35
35
|
"@atlaskit/empty-state": "^7.4.0",
|
|
36
36
|
"@atlaskit/form": "^8.5.1",
|
|
37
|
+
"@atlaskit/frontend-utilities": "^2.0.0",
|
|
37
38
|
"@atlaskit/icon": "^21.10.0",
|
|
38
39
|
"@atlaskit/spinner": "^15.1.0",
|
|
39
40
|
"@atlaskit/tabs": "^13.3.0",
|