@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/link-picker
2
2
 
3
+ ## 1.10.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
8
+
9
+ ## 1.10.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`8a538989c8d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8a538989c8d) - [ux] Updated label and Placeholder messages
14
+
3
15
  ## 1.10.1
4
16
 
5
17
  ### Patch Changes
@@ -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 = exports.CONTACT_SUPPORT_LINK = void 0;
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',
@@ -205,9 +201,9 @@ function LinkPicker(_ref) {
205
201
  });
206
202
  }, []);
207
203
  var handleKeyDown = (0, _react.useCallback)(function (event) {
208
- var keyCode = event.keyCode;
209
- var KEY_CODE_ARROW_DOWN = 40;
210
- var KEY_CODE_ARROW_UP = 38;
204
+ var key = event.key;
205
+ var KEY_ARROW_DOWN = 'ArrowDown';
206
+ var KEY_ARROW_UP = 'ArrowUp';
211
207
 
212
208
  if (!items || !items.length) {
213
209
  return;
@@ -215,14 +211,14 @@ function LinkPicker(_ref) {
215
211
 
216
212
  var updatedIndex = activeIndex;
217
213
 
218
- switch (keyCode) {
219
- case KEY_CODE_ARROW_DOWN:
214
+ switch (key) {
215
+ case KEY_ARROW_DOWN:
220
216
  // down
221
217
  event.preventDefault();
222
218
  updatedIndex = (activeIndex + 1) % items.length;
223
219
  break;
224
220
 
225
- case KEY_CODE_ARROW_UP:
221
+ case KEY_ARROW_UP:
226
222
  // up
227
223
  event.preventDefault();
228
224
  updatedIndex = activeIndex > 0 ? activeIndex - 1 : items.length - 1;
@@ -231,7 +227,7 @@ function LinkPicker(_ref) {
231
227
 
232
228
  var item = items[updatedIndex];
233
229
 
234
- if ([KEY_CODE_ARROW_DOWN, KEY_CODE_ARROW_UP].includes(keyCode) && item) {
230
+ if ([KEY_ARROW_DOWN, KEY_ARROW_UP].includes(key) && item) {
235
231
  /**
236
232
  * Manually track that the url has been updated using searchResult method
237
233
  */
@@ -331,14 +327,14 @@ function LinkPicker(_ref) {
331
327
  invalidUrl: true
332
328
  });
333
329
  }, [handleInsert, isSelectedItem, selectedItem, url]);
334
- var linkPlaceHolder = isActivePlugin ? _messages.messages.placeholder : _messages.messages.linkPlaceholder;
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, _messages.messages.searchLinkAriaDescription)), (0, _react2.jsx)(LinkInputField, {
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(_messages.messages.linkLabel),
366
- placeholder: intl.formatMessage(linkPlaceHolder),
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.messages.clearLink),
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.messages.linkInvalid) : null,
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.messages.linkTextLabel),
386
- placeholder: intl.formatMessage(_messages.messages.linkTextPlaceholder),
387
- clearLabel: intl.formatMessage(_messages.messages.clearText),
388
- "aria-label": intl.formatMessage(_messages.messages.linkAriaLabel),
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 messages = (0, _reactIntlNext.defineMessages)({
11
- placeholder: {
12
- id: 'fabric.linkPicker.hyperlinkToolbarPlaceholder',
10
+ var searchMessages = (0, _reactIntlNext.defineMessages)({
11
+ linkLabel: {
12
+ id: 'fabric.linkPicker.search.linkLabel',
13
13
  defaultMessage: 'Search or paste a link',
14
- description: 'Search or paste a link'
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
- linkTextPlaceholder: {
22
- id: 'fabric.linkPicker.linkTextPlaceholder',
23
- defaultMessage: 'Add a description',
24
- description: 'Text to display'
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.linkAddress',
30
+ id: 'fabric.linkPicker.linkLabel',
28
31
  defaultMessage: 'Link',
29
- description: 'Link Label'
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: 'Input Error the URL is invalid'
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: 'Clears link in the link toolbar'
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
- searchLinkAriaDescription: {
52
- id: 'fabric.linkPicker.hyperlink.searchLinkAriaDescription',
53
- defaultMessage: 'Suggestions will appear below as you type into the field',
54
- description: 'Describes what the search field does for screen reader users.'
65
+ linkTextAriaLabel: {
66
+ id: 'fabric.linkPicker.linkTextAriaLabel',
67
+ defaultMessage: 'Link description',
68
+ description: 'Aria label for the link description input'
55
69
  },
56
- linkAriaLabel: {
57
- id: 'fabric.linkPicker.hyperlink.linkAriaLabel',
58
- defaultMessage: 'Link label',
59
- description: 'aria label for a link'
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.isUndoEvent = exports.isRedoEvent = exports.getDataSource = void 0;
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
+ }
@@ -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
  }
@@ -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 { messages } from './messages';
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',
@@ -154,10 +152,10 @@ function LinkPicker({
154
152
  }, []);
155
153
  const handleKeyDown = useCallback(event => {
156
154
  const {
157
- keyCode
155
+ key
158
156
  } = event;
159
- const KEY_CODE_ARROW_DOWN = 40;
160
- const KEY_CODE_ARROW_UP = 38;
157
+ const KEY_ARROW_DOWN = 'ArrowDown';
158
+ const KEY_ARROW_UP = 'ArrowUp';
161
159
 
162
160
  if (!items || !items.length) {
163
161
  return;
@@ -165,14 +163,14 @@ function LinkPicker({
165
163
 
166
164
  let updatedIndex = activeIndex;
167
165
 
168
- switch (keyCode) {
169
- case KEY_CODE_ARROW_DOWN:
166
+ switch (key) {
167
+ case KEY_ARROW_DOWN:
170
168
  // down
171
169
  event.preventDefault();
172
170
  updatedIndex = (activeIndex + 1) % items.length;
173
171
  break;
174
172
 
175
- case KEY_CODE_ARROW_UP:
173
+ case KEY_ARROW_UP:
176
174
  // up
177
175
  event.preventDefault();
178
176
  updatedIndex = activeIndex > 0 ? activeIndex - 1 : items.length - 1;
@@ -181,7 +179,7 @@ function LinkPicker({
181
179
 
182
180
  const item = items[updatedIndex];
183
181
 
184
- if ([KEY_CODE_ARROW_DOWN, KEY_CODE_ARROW_UP].includes(keyCode) && item) {
182
+ if ([KEY_ARROW_DOWN, KEY_ARROW_UP].includes(key) && item) {
185
183
  /**
186
184
  * Manually track that the url has been updated using searchResult method
187
185
  */
@@ -280,7 +278,7 @@ function LinkPicker({
280
278
  invalidUrl: true
281
279
  });
282
280
  }, [handleInsert, isSelectedItem, selectedItem, url]);
283
- const linkPlaceHolder = isActivePlugin ? messages.placeholder : messages.linkPlaceholder;
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.searchLinkAriaDescription)), jsx(LinkInputField, {
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(linkPlaceHolder),
313
+ placeholder: intl.formatMessage(messages.linkPlaceholder),
316
314
  value: url,
317
315
  autoFocus: true,
318
316
  elemBeforeInput: searchIcon,
319
- clearLabel: intl.formatMessage(messages.clearLink),
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(messages.linkInvalid) : null,
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(messages.linkTextLabel),
335
- placeholder: intl.formatMessage(messages.linkTextPlaceholder),
336
- clearLabel: intl.formatMessage(messages.clearText),
337
- "aria-label": intl.formatMessage(messages.linkAriaLabel),
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 messages = defineMessages({
3
- placeholder: {
4
- id: 'fabric.linkPicker.hyperlinkToolbarPlaceholder',
2
+ export const 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 const 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 const 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 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
- 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 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
+ }
@@ -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
  }