@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.
Files changed (57) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/ui/link-picker/index.js +20 -37
  3. package/dist/cjs/ui/link-picker/messages.js +58 -36
  4. package/dist/cjs/ui/link-picker/utils.js +19 -2
  5. package/dist/cjs/version.json +1 -1
  6. package/dist/es2019/ui/link-picker/index.js +19 -35
  7. package/dist/es2019/ui/link-picker/messages.js +53 -35
  8. package/dist/es2019/ui/link-picker/utils.js +15 -1
  9. package/dist/es2019/version.json +1 -1
  10. package/dist/esm/ui/link-picker/index.js +19 -34
  11. package/dist/esm/ui/link-picker/messages.js +53 -35
  12. package/dist/esm/ui/link-picker/utils.js +14 -1
  13. package/dist/esm/version.json +1 -1
  14. package/dist/types/ui/link-picker/index.d.ts +0 -1
  15. package/dist/types/ui/link-picker/messages.d.ts +27 -9
  16. package/dist/types/ui/link-picker/utils.d.ts +2 -0
  17. package/dist/types-ts4.0/analytics.codegen.d.ts +52 -0
  18. package/dist/types-ts4.0/common/analytics/context.d.ts +28 -0
  19. package/dist/types-ts4.0/common/analytics/index.d.ts +2 -0
  20. package/dist/types-ts4.0/common/analytics/input-field-tracking.d.ts +17 -0
  21. package/dist/types-ts4.0/common/constants.d.ts +2 -0
  22. package/dist/types-ts4.0/common/generic-error-svg/index.d.ts +4 -0
  23. package/dist/types-ts4.0/common/generic-error-svg/styled.d.ts +1 -0
  24. package/dist/types-ts4.0/common/utils/url.d.ts +5 -0
  25. package/dist/types-ts4.0/controllers/use-fix-height/index.d.ts +8 -0
  26. package/dist/types-ts4.0/index.d.ts +3 -0
  27. package/dist/types-ts4.0/services/use-plugins/index.d.ts +14 -0
  28. package/dist/types-ts4.0/services/use-plugins/reducer.d.ts +33 -0
  29. package/dist/types-ts4.0/services/use-plugins/utils.d.ts +18 -0
  30. package/dist/types-ts4.0/services/use-search-query/index.d.ts +3 -0
  31. package/dist/types-ts4.0/ui/error-boundary/index.d.ts +27 -0
  32. package/dist/types-ts4.0/ui/error-boundary-fallback/index.d.ts +3 -0
  33. package/dist/types-ts4.0/ui/index.d.ts +5 -0
  34. package/dist/types-ts4.0/ui/link-picker/announcer.d.ts +22 -0
  35. package/dist/types-ts4.0/ui/link-picker/browser.d.ts +15 -0
  36. package/dist/types-ts4.0/ui/link-picker/form-footer/index.d.ts +13 -0
  37. package/dist/types-ts4.0/ui/link-picker/form-footer/styled.d.ts +1 -0
  38. package/dist/types-ts4.0/ui/link-picker/index.d.ts +69 -0
  39. package/dist/types-ts4.0/ui/link-picker/link-search-error/index.d.ts +20 -0
  40. package/dist/types-ts4.0/ui/link-picker/link-search-list/index.d.ts +43 -0
  41. package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/index.d.ts +19 -0
  42. package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.d.ts +4 -0
  43. package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/styled.d.ts +1 -0
  44. package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/styled.d.ts +1 -0
  45. package/dist/types-ts4.0/ui/link-picker/link-search-list/styled.d.ts +4 -0
  46. package/dist/types-ts4.0/ui/link-picker/list-item/index.d.ts +17 -0
  47. package/dist/types-ts4.0/ui/link-picker/list-item/styled.d.ts +9 -0
  48. package/dist/types-ts4.0/ui/link-picker/messages.d.ts +85 -0
  49. package/dist/types-ts4.0/ui/link-picker/styled.d.ts +9 -0
  50. package/dist/types-ts4.0/ui/link-picker/text-input/index.d.ts +14 -0
  51. package/dist/types-ts4.0/ui/link-picker/text-input/styled.d.ts +2 -0
  52. package/dist/types-ts4.0/ui/link-picker/transformTimeStamp.d.ts +3 -0
  53. package/dist/types-ts4.0/ui/link-picker/utils.d.ts +10 -0
  54. package/dist/types-ts4.0/ui/loader-fallback/index.d.ts +3 -0
  55. package/dist/types-ts4.0/ui/types.d.ts +57 -0
  56. package/package.json +11 -4
  57. 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 { messages } from './messages';
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 keyCode = event.keyCode;
164
- var KEY_CODE_ARROW_DOWN = 40;
165
- var KEY_CODE_ARROW_UP = 38;
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 (keyCode) {
174
- case KEY_CODE_ARROW_DOWN:
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 KEY_CODE_ARROW_UP:
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 ([KEY_CODE_ARROW_DOWN, KEY_CODE_ARROW_UP].includes(keyCode) && item) {
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 linkPlaceHolder = isActivePlugin ? messages.placeholder : messages.linkPlaceholder;
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.searchLinkAriaDescription)), jsx(LinkInputField, {
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(linkPlaceHolder),
319
+ placeholder: intl.formatMessage(messages.linkPlaceholder),
322
320
  value: url,
323
321
  autoFocus: true,
324
322
  elemBeforeInput: searchIcon,
325
- clearLabel: intl.formatMessage(messages.clearLink),
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(messages.linkInvalid) : null,
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(messages.linkTextLabel),
341
- placeholder: intl.formatMessage(messages.linkTextPlaceholder),
342
- clearLabel: intl.formatMessage(messages.clearText),
343
- "aria-label": intl.formatMessage(messages.linkAriaLabel),
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 messages = defineMessages({
3
- placeholder: {
4
- id: 'fabric.linkPicker.hyperlinkToolbarPlaceholder',
2
+ export var searchMessages = defineMessages({
3
+ linkLabel: {
4
+ id: 'fabric.linkPicker.search.linkLabel',
5
5
  defaultMessage: 'Search or paste a link',
6
- description: 'Search or paste a link'
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
- linkTextPlaceholder: {
14
- id: 'fabric.linkPicker.linkTextPlaceholder',
15
- defaultMessage: 'Add a description',
16
- description: 'Text to display'
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.linkAddress',
21
+ id: 'fabric.linkPicker.linkLabel',
20
22
  defaultMessage: 'Link',
21
- description: 'Link Label'
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: 'Input Error the URL is invalid'
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: 'Clears link in the link toolbar'
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
- searchLinkAriaDescription: {
44
- id: 'fabric.linkPicker.hyperlink.searchLinkAriaDescription',
45
- defaultMessage: 'Suggestions will appear below as you type into the field',
46
- description: 'Describes what the search field does for screen reader users.'
54
+ linkTextAriaLabel: {
55
+ id: 'fabric.linkPicker.linkTextAriaLabel',
56
+ defaultMessage: 'Link description',
57
+ description: 'Aria label for the link description input'
47
58
  },
48
- linkAriaLabel: {
49
- id: 'fabric.linkPicker.hyperlink.linkAriaLabel',
50
- defaultMessage: 'Link label',
51
- description: 'aria label for a link'
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
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.10.1",
3
+ "version": "1.10.3",
4
4
  "sideEffects": false
5
5
  }
@@ -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 messages: {
2
- placeholder: {
1
+ export declare const searchMessages: {
2
+ linkLabel: {
3
3
  id: string;
4
4
  defaultMessage: string;
5
5
  description: string;
6
6
  };
7
- linkPlaceholder: {
7
+ linkAriaLabel: {
8
8
  id: string;
9
9
  defaultMessage: string;
10
10
  description: string;
11
11
  };
12
- linkTextPlaceholder: {
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
- linkInvalid: {
24
+ linkAriaLabel: {
23
25
  id: string;
24
26
  defaultMessage: string;
25
27
  description: string;
26
28
  };
27
- linkTextLabel: {
29
+ linkPlaceholder: {
28
30
  id: string;
29
31
  defaultMessage: string;
30
32
  description: string;
31
33
  };
32
- clearText: {
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
- searchLinkAriaDescription: {
46
+ };
47
+ export declare const linkTextMessages: {
48
+ linkTextLabel: {
43
49
  id: string;
44
50
  defaultMessage: string;
45
51
  description: string;
46
52
  };
47
- linkAriaLabel: {
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,2 @@
1
+ export { useLinkPickerAnalytics, withLinkPickerAnalyticsContext, } from './context';
2
+ export { withInputFieldTracking } from './input-field-tracking';
@@ -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,2 @@
1
+ export declare const ANALYTICS_CHANNEL = "media";
2
+ export declare const COMPONENT_NAME = "linkPicker";
@@ -0,0 +1,4 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ declare const GenericErrorSVG: (props: React.SVGProps<SVGSVGElement>) => jsx.JSX.Element;
4
+ export default GenericErrorSVG;
@@ -0,0 +1 @@
1
+ export declare const genericErrorStyles: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,5 @@
1
+ export declare const isSafeUrl: (url: string) => boolean;
2
+ /**
3
+ * Adds protocol to url if needed.
4
+ */
5
+ export declare function normalizeUrl(url?: string | null): string | null;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ declare const useFixHeight: (shouldFixHeight: boolean) => {
3
+ ref: import("react").RefObject<HTMLDivElement>;
4
+ style: {
5
+ minHeight: string | number;
6
+ } | undefined;
7
+ };
8
+ export default useFixHeight;
@@ -0,0 +1,3 @@
1
+ export { ComposedLinkPicker as LinkPicker } from './ui';
2
+ export type { LinkPickerProps } from './ui/link-picker';
3
+ export type { LinkInputType, LinkPickerPlugin, LinkPickerState, LinkSearchListItemData, LinkPickerPluginErrorFallback, } from './ui/types';
@@ -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,3 @@
1
+ import { LinkPickerState } from '../../ui/types';
2
+ import { PickerState } from '../../ui/link-picker';
3
+ export declare function useSearchQuery(state: PickerState): LinkPickerState | null;
@@ -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,3 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ export declare const ErrorBoundaryFallback: () => jsx.JSX.Element;
@@ -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;