@atlaskit/link-picker 1.10.1 → 1.10.3
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/ui/link-picker/index.js +20 -37
- 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/ui/link-picker/index.js +19 -35
- 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/ui/link-picker/index.js +19 -34
- 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/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/dist/types-ts4.0/analytics.codegen.d.ts +52 -0
- package/dist/types-ts4.0/common/analytics/context.d.ts +28 -0
- package/dist/types-ts4.0/common/analytics/index.d.ts +2 -0
- package/dist/types-ts4.0/common/analytics/input-field-tracking.d.ts +17 -0
- package/dist/types-ts4.0/common/constants.d.ts +2 -0
- package/dist/types-ts4.0/common/generic-error-svg/index.d.ts +4 -0
- package/dist/types-ts4.0/common/generic-error-svg/styled.d.ts +1 -0
- package/dist/types-ts4.0/common/utils/url.d.ts +5 -0
- package/dist/types-ts4.0/controllers/use-fix-height/index.d.ts +8 -0
- package/dist/types-ts4.0/index.d.ts +3 -0
- package/dist/types-ts4.0/services/use-plugins/index.d.ts +14 -0
- package/dist/types-ts4.0/services/use-plugins/reducer.d.ts +33 -0
- package/dist/types-ts4.0/services/use-plugins/utils.d.ts +18 -0
- package/dist/types-ts4.0/services/use-search-query/index.d.ts +3 -0
- package/dist/types-ts4.0/ui/error-boundary/index.d.ts +27 -0
- package/dist/types-ts4.0/ui/error-boundary-fallback/index.d.ts +3 -0
- package/dist/types-ts4.0/ui/index.d.ts +5 -0
- package/dist/types-ts4.0/ui/link-picker/announcer.d.ts +22 -0
- package/dist/types-ts4.0/ui/link-picker/browser.d.ts +15 -0
- package/dist/types-ts4.0/ui/link-picker/form-footer/index.d.ts +13 -0
- package/dist/types-ts4.0/ui/link-picker/form-footer/styled.d.ts +1 -0
- package/dist/types-ts4.0/ui/link-picker/index.d.ts +69 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-error/index.d.ts +20 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-list/index.d.ts +43 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/index.d.ts +19 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.d.ts +4 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/styled.d.ts +1 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/styled.d.ts +1 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-list/styled.d.ts +4 -0
- package/dist/types-ts4.0/ui/link-picker/list-item/index.d.ts +17 -0
- package/dist/types-ts4.0/ui/link-picker/list-item/styled.d.ts +9 -0
- package/dist/types-ts4.0/ui/link-picker/messages.d.ts +85 -0
- package/dist/types-ts4.0/ui/link-picker/styled.d.ts +9 -0
- package/dist/types-ts4.0/ui/link-picker/text-input/index.d.ts +14 -0
- package/dist/types-ts4.0/ui/link-picker/text-input/styled.d.ts +2 -0
- package/dist/types-ts4.0/ui/link-picker/transformTimeStamp.d.ts +3 -0
- package/dist/types-ts4.0/ui/link-picker/utils.d.ts +10 -0
- package/dist/types-ts4.0/ui/loader-fallback/index.d.ts +3 -0
- package/dist/types-ts4.0/ui/types.d.ts +57 -0
- package/package.json +11 -4
- package/report.api.md +45 -65
|
@@ -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',
|
|
@@ -160,9 +158,9 @@ function LinkPicker(_ref) {
|
|
|
160
158
|
});
|
|
161
159
|
}, []);
|
|
162
160
|
var handleKeyDown = useCallback(function (event) {
|
|
163
|
-
var
|
|
164
|
-
var
|
|
165
|
-
var
|
|
161
|
+
var key = event.key;
|
|
162
|
+
var KEY_ARROW_DOWN = 'ArrowDown';
|
|
163
|
+
var KEY_ARROW_UP = 'ArrowUp';
|
|
166
164
|
|
|
167
165
|
if (!items || !items.length) {
|
|
168
166
|
return;
|
|
@@ -170,14 +168,14 @@ function LinkPicker(_ref) {
|
|
|
170
168
|
|
|
171
169
|
var updatedIndex = activeIndex;
|
|
172
170
|
|
|
173
|
-
switch (
|
|
174
|
-
case
|
|
171
|
+
switch (key) {
|
|
172
|
+
case KEY_ARROW_DOWN:
|
|
175
173
|
// down
|
|
176
174
|
event.preventDefault();
|
|
177
175
|
updatedIndex = (activeIndex + 1) % items.length;
|
|
178
176
|
break;
|
|
179
177
|
|
|
180
|
-
case
|
|
178
|
+
case KEY_ARROW_UP:
|
|
181
179
|
// up
|
|
182
180
|
event.preventDefault();
|
|
183
181
|
updatedIndex = activeIndex > 0 ? activeIndex - 1 : items.length - 1;
|
|
@@ -186,7 +184,7 @@ function LinkPicker(_ref) {
|
|
|
186
184
|
|
|
187
185
|
var item = items[updatedIndex];
|
|
188
186
|
|
|
189
|
-
if ([
|
|
187
|
+
if ([KEY_ARROW_DOWN, KEY_ARROW_UP].includes(key) && item) {
|
|
190
188
|
/**
|
|
191
189
|
* Manually track that the url has been updated using searchResult method
|
|
192
190
|
*/
|
|
@@ -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
|
@@ -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;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
+
*
|
|
4
|
+
* Generates analytics utilities from the package analytics spec yaml
|
|
5
|
+
*
|
|
6
|
+
* @codegen <<SignedSource::05d8b1c9e46066efd0d11fa9d19c32a9>>
|
|
7
|
+
* @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
|
|
8
|
+
*/
|
|
9
|
+
export declare type PackageMetaDataType = {
|
|
10
|
+
packageName: '@atlaskit/link-picker';
|
|
11
|
+
packageVersion: string;
|
|
12
|
+
source: 'linkPicker';
|
|
13
|
+
componentName: 'linkPicker';
|
|
14
|
+
};
|
|
15
|
+
export declare type LinkPickerAnalyticsContextType = {
|
|
16
|
+
linkState: 'editLink' | 'newLink';
|
|
17
|
+
linkFieldContent: 'url' | 'text_string' | null;
|
|
18
|
+
linkFieldContentInputMethod: 'manual' | 'paste' | 'searchResult' | null;
|
|
19
|
+
linkFieldContentInputSource: string | null;
|
|
20
|
+
displayTextFieldContent: 'text_string' | null;
|
|
21
|
+
displayTextFieldContentInputMethod: 'manual' | 'paste' | null;
|
|
22
|
+
};
|
|
23
|
+
export declare type FormSubmittedLinkPickerAttributesType = {};
|
|
24
|
+
export declare type InlineDialogViewedLinkPickerAttributesType = {};
|
|
25
|
+
export declare type InlineDialogClosedLinkPickerAttributesType = {};
|
|
26
|
+
export declare type TextFieldUpdatedLinkFieldAttributesType = {};
|
|
27
|
+
export declare type TextFieldUpdatedDisplayTextFieldAttributesType = {};
|
|
28
|
+
export declare type LinkPickerUnhandledErrorCaughtAttributesType = {
|
|
29
|
+
browserInfo: string;
|
|
30
|
+
error: string;
|
|
31
|
+
componentStack: string | null;
|
|
32
|
+
};
|
|
33
|
+
export declare type ResultsResolveFailedAttributesType = {
|
|
34
|
+
error: string;
|
|
35
|
+
};
|
|
36
|
+
declare type AnalyticsEventAttributes = {
|
|
37
|
+
'ui.form.submitted.linkPicker': FormSubmittedLinkPickerAttributesType;
|
|
38
|
+
'ui.inlineDialog.viewed.linkPicker': InlineDialogViewedLinkPickerAttributesType;
|
|
39
|
+
'ui.inlineDialog.closed.linkPicker': InlineDialogClosedLinkPickerAttributesType;
|
|
40
|
+
'ui.textField.updated.linkField': TextFieldUpdatedLinkFieldAttributesType;
|
|
41
|
+
'ui.textField.updated.displayTextField': TextFieldUpdatedDisplayTextFieldAttributesType;
|
|
42
|
+
'ui.linkPicker.unhandledErrorCaught': LinkPickerUnhandledErrorCaughtAttributesType;
|
|
43
|
+
'operational.resultsResolve.failed': ResultsResolveFailedAttributesType;
|
|
44
|
+
};
|
|
45
|
+
declare function createEventPayload<K extends keyof AnalyticsEventAttributes>(eventKey: K, attributes: AnalyticsEventAttributes[K]): {
|
|
46
|
+
eventType: string;
|
|
47
|
+
actionSubject: string;
|
|
48
|
+
action: string;
|
|
49
|
+
actionSubjectId: string;
|
|
50
|
+
attributes: AnalyticsEventAttributes[K];
|
|
51
|
+
};
|
|
52
|
+
export default createEventPayload;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LinkPickerAnalyticsContextType } from '../../analytics.codegen';
|
|
3
|
+
export declare type TrackAttribute = <K extends keyof LinkPickerAnalyticsContextType>(attribute: K, value: LinkPickerAnalyticsContextType[K]) => void;
|
|
4
|
+
interface AnalyticsContextType {
|
|
5
|
+
/**
|
|
6
|
+
* Update a single attribute in the analytics context
|
|
7
|
+
*/
|
|
8
|
+
trackAttribute: TrackAttribute;
|
|
9
|
+
/**
|
|
10
|
+
* Update a set of attributes in the analytics context
|
|
11
|
+
*/
|
|
12
|
+
trackAttributes: (attributes: Partial<LinkPickerAnalyticsContextType>) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieve the current set of attributes
|
|
15
|
+
* Can be used by components to derive/compute new attributes for specific events
|
|
16
|
+
*/
|
|
17
|
+
getAttributes: () => LinkPickerAnalyticsContextType;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Hook that exposes the context-level attribute getters and setters.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useLinkPickerAnalytics: () => AnalyticsContextType;
|
|
23
|
+
/**
|
|
24
|
+
* Wraps a component with the analytics context + listener to update events with contextual-level attributes.
|
|
25
|
+
* Should be implemented once at the root of the link picker.
|
|
26
|
+
*/
|
|
27
|
+
export declare function withLinkPickerAnalyticsContext<P>(WrappedComponent: React.ComponentType<P>): React.ComponentType<P>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LinkPickerAnalyticsContextType } from '../../analytics.codegen';
|
|
3
|
+
declare type InputFields = 'link' | 'displayText';
|
|
4
|
+
/**
|
|
5
|
+
* Wraps an input field and connects it to the link picker analytics context to provide a baseline of analytics tracking
|
|
6
|
+
* @param WrappedComponent The input field to be tracked
|
|
7
|
+
* @param field The name of the field (ie matching actionSubjectId)
|
|
8
|
+
* @param filterOnChangeEventAttrs Function to hook into and filter/customise the default attribute tracking logic
|
|
9
|
+
* @returns HOC Input field with tracking
|
|
10
|
+
*/
|
|
11
|
+
export declare const withInputFieldTracking: <P extends {
|
|
12
|
+
onBlur?: ((e: React.FocusEvent<HTMLInputElement>) => void) | undefined;
|
|
13
|
+
onChange?: ((e: React.ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
14
|
+
onClear?: Function | undefined;
|
|
15
|
+
onFocus?: ((e: React.FocusEvent<HTMLInputElement>) => void) | undefined;
|
|
16
|
+
}, Field extends InputFields>(WrappedComponent: React.ComponentType<P>, field: Field, filterOnChangeEventAttrs?: <OnChangeAttributes extends Partial<LinkPickerAnalyticsContextType>>(event: React.ChangeEvent<HTMLInputElement>, attributes: OnChangeAttributes) => OnChangeAttributes) => React.ComponentType<P>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const genericErrorStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LinkPickerPlugin, LinkPickerPluginErrorFallback, LinkPickerState, LinkSearchListItemData } from '../../ui/types';
|
|
2
|
+
export interface LinkPickerPluginsService {
|
|
3
|
+
items: LinkSearchListItemData[] | null;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
isActivePlugin: boolean;
|
|
6
|
+
activePlugin?: LinkPickerPlugin;
|
|
7
|
+
tabs: {
|
|
8
|
+
tabTitle: string;
|
|
9
|
+
}[];
|
|
10
|
+
error: unknown | null;
|
|
11
|
+
retry: () => void;
|
|
12
|
+
errorFallback?: LinkPickerPluginErrorFallback;
|
|
13
|
+
}
|
|
14
|
+
export declare function usePlugins(state: LinkPickerState | null, activeTab: number, plugins?: LinkPickerPlugin[]): LinkPickerPluginsService;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LinkSearchListItemData } from '../../ui/types';
|
|
3
|
+
export interface PluginState {
|
|
4
|
+
items: LinkSearchListItemData[] | null;
|
|
5
|
+
error: unknown | null;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const ACTION_CLEAR = "CLEAR";
|
|
9
|
+
export declare const ACTION_LOADING = "LOADING";
|
|
10
|
+
export declare const ACTION_SUCCESS = "SUCCESS";
|
|
11
|
+
export declare const ACTION_ERRORED = "ERROR";
|
|
12
|
+
interface ClearAction {
|
|
13
|
+
type: typeof ACTION_CLEAR;
|
|
14
|
+
}
|
|
15
|
+
interface ResolveLoadingAction {
|
|
16
|
+
type: typeof ACTION_LOADING;
|
|
17
|
+
}
|
|
18
|
+
interface ResolveSuccessAction {
|
|
19
|
+
type: typeof ACTION_SUCCESS;
|
|
20
|
+
payload: Pick<PluginState, 'items' | 'isLoading'>;
|
|
21
|
+
}
|
|
22
|
+
interface ResolveErrorAction {
|
|
23
|
+
type: typeof ACTION_ERRORED;
|
|
24
|
+
payload: PluginState['error'];
|
|
25
|
+
}
|
|
26
|
+
export declare type ReducerAction = ClearAction | ResolveLoadingAction | ResolveSuccessAction | ResolveErrorAction;
|
|
27
|
+
export declare const INITIAL_STATE: PluginState;
|
|
28
|
+
export declare function reducer(state: PluginState, action: ReducerAction): PluginState;
|
|
29
|
+
export declare const usePluginReducer: () => [
|
|
30
|
+
PluginState,
|
|
31
|
+
import("react").Dispatch<ReducerAction>
|
|
32
|
+
];
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LinkPickerPlugin, LinkPickerState, ResolveResult } from '../../ui/types';
|
|
2
|
+
export declare class CancellationError extends Error {
|
|
3
|
+
}
|
|
4
|
+
export declare const cancellable: <T extends unknown>(promise: Promise<T>) => {
|
|
5
|
+
promise: Promise<T>;
|
|
6
|
+
cancel: () => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Wraps the resolve with a cancellation wrapper and makes promise + generator plugin resolves more compatible
|
|
10
|
+
* Calling cancel for generator plugin prevents it from yielding any further updates
|
|
11
|
+
*/
|
|
12
|
+
export declare const resolvePluginUpdates: (plugin: LinkPickerPlugin, state: LinkPickerState) => {
|
|
13
|
+
cancel: () => void;
|
|
14
|
+
next: () => Promise<{
|
|
15
|
+
done?: boolean;
|
|
16
|
+
value: ResolveResult;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { Component, ReactNode } from 'react';
|
|
2
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
+
declare type ErrorBoundaryErrorInfo = {
|
|
4
|
+
componentStack: string;
|
|
5
|
+
};
|
|
6
|
+
export interface ErrorBoundaryProps extends WithAnalyticsEventsProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
channel: string;
|
|
9
|
+
ErrorComponent?: React.ComponentType;
|
|
10
|
+
onError?: (error: Error, info?: ErrorBoundaryErrorInfo) => void;
|
|
11
|
+
}
|
|
12
|
+
declare type ErrorBoundaryPayload = {
|
|
13
|
+
error: Error | string;
|
|
14
|
+
info?: ErrorBoundaryErrorInfo;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
declare type ErrorBoundaryState = {
|
|
18
|
+
hasError: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare class BaseErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
21
|
+
constructor(props: ErrorBoundaryProps);
|
|
22
|
+
fireAnalytics: (analyticsErrorPayload: ErrorBoundaryPayload) => void;
|
|
23
|
+
componentDidCatch(error: Error, info?: ErrorBoundaryErrorInfo): void;
|
|
24
|
+
render(): React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
declare const ErrorBoundary: React.ForwardRefExoticComponent<Omit<ErrorBoundaryProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
27
|
+
export default ErrorBoundary;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PackageMetaDataType } from '../analytics.codegen';
|
|
3
|
+
import { LinkPickerProps } from './link-picker';
|
|
4
|
+
export declare const PACKAGE_DATA: PackageMetaDataType;
|
|
5
|
+
export declare const ComposedLinkPicker: React.MemoExoticComponent<(props: LinkPickerProps) => JSX.Element>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { AriaAttributes, Ref } from 'react';
|
|
2
|
+
declare type AnnouncerProps = {
|
|
3
|
+
ref?: Ref<HTMLDivElement>;
|
|
4
|
+
/** Set 'false' for announcing only changed text
|
|
5
|
+
* (not announce duplicate part of string after second render),
|
|
6
|
+
* and 'true' for announcing all the string after each render */
|
|
7
|
+
ariaAtomic?: AriaAttributes['aria-atomic'];
|
|
8
|
+
/** Set politeness settings */
|
|
9
|
+
ariaLive?: AriaAttributes['aria-live'];
|
|
10
|
+
/** Used to describe what types of changes have occurred to an aria-live region */
|
|
11
|
+
ariaRelevant?: AriaAttributes['aria-relevant'];
|
|
12
|
+
/** Role used to set attribute role. See more details https://dequeuniversity.com/library/aria/liveregion-playground#configOptions */
|
|
13
|
+
role?: 'status' | 'log' | 'alert' | 'timer' | 'marquee';
|
|
14
|
+
/** Text message that will be announced */
|
|
15
|
+
text: string;
|
|
16
|
+
/** Debounce delay.
|
|
17
|
+
* Set delay (ms) to prevent announce the same string multiple times.
|
|
18
|
+
* It can be useful for cases when the parent component re-renders with the same announcer's text. */
|
|
19
|
+
delay?: number;
|
|
20
|
+
};
|
|
21
|
+
declare const _default: React.NamedExoticComponent<AnnouncerProps>;
|
|
22
|
+
export default _default;
|