@atlaskit/link-picker 4.2.2 → 4.2.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 +8 -0
- package/dist/cjs/ui/link-picker/index.js +8 -14
- package/dist/cjs/ui/link-picker/search-results/link-search-list/index.js +1 -8
- package/dist/cjs/ui/link-picker/text-input/index.js +0 -1
- package/dist/cjs/ui/main.js +1 -1
- package/dist/es2019/ui/link-picker/index.js +8 -14
- package/dist/es2019/ui/link-picker/search-results/link-search-list/index.js +1 -8
- package/dist/es2019/ui/link-picker/text-input/index.js +0 -1
- package/dist/es2019/ui/main.js +1 -1
- package/dist/esm/ui/link-picker/index.js +8 -14
- package/dist/esm/ui/link-picker/search-results/link-search-list/index.js +1 -8
- package/dist/esm/ui/link-picker/text-input/index.js +0 -1
- package/dist/esm/ui/main.js +1 -1
- package/dist/types/ui/link-picker/search-results/link-search-list/index.d.ts +0 -5
- package/dist/types-ts4.5/ui/link-picker/search-results/link-search-list/index.d.ts +0 -5
- package/package.json +11 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/link-picker
|
|
2
2
|
|
|
3
|
+
## 4.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`742c41eb2dc54`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/742c41eb2dc54) -
|
|
8
|
+
feature gate cleanup for platform-linking-link-picker-previewable-only
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 4.2.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -23,7 +23,6 @@ var _form = require("@atlaskit/form");
|
|
|
23
23
|
var _linkProvider = require("@atlaskit/link-provider");
|
|
24
24
|
var _url2 = require("@atlaskit/linking-common/url");
|
|
25
25
|
var _userAgent = require("@atlaskit/linking-common/user-agent");
|
|
26
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
26
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
28
27
|
var _linkUrl = _interopRequireDefault(require("@atlaskit/smart-card/link-url"));
|
|
29
28
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -152,8 +151,6 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
152
151
|
var isEditing = !!initUrl;
|
|
153
152
|
var selectedItem = items === null || items === void 0 ? void 0 : items[selectedIndex];
|
|
154
153
|
var isSelectedItem = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.url) === url;
|
|
155
|
-
var previewableOnly = (0, _platformFeatureFlags.fg)('platform-linking-link-picker-previewable-only') && previewableLinksOnly;
|
|
156
|
-
var flaggedSubmitOnInputChange = (0, _platformFeatureFlags.fg)('platform-linking-link-picker-previewable-only') && submitOnInputChange;
|
|
157
154
|
var _useLinkPickerAnalyti = (0, _analytics.useLinkPickerAnalytics)(),
|
|
158
155
|
trackAttribute = _useLinkPickerAnalyti.trackAttribute,
|
|
159
156
|
getAttributes = _useLinkPickerAnalyti.getAttributes;
|
|
@@ -246,13 +243,11 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
246
243
|
handleInsert(_url, name, 'typeAhead', _objectSpread({}, selectedItem));
|
|
247
244
|
}
|
|
248
245
|
}, [handleInsert, trackAttribute, items, activePlugin, isSubmitting]);
|
|
249
|
-
var handleClearInvalidUrl = (0,
|
|
250
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
251
|
-
(0, _react.useCallback)(function () {
|
|
246
|
+
var handleClearInvalidUrl = (0, _react.useCallback)(function () {
|
|
252
247
|
dispatch({
|
|
253
248
|
invalidUrl: false
|
|
254
249
|
});
|
|
255
|
-
}, [dispatch])
|
|
250
|
+
}, [dispatch]);
|
|
256
251
|
var handleSubmit = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
257
252
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(event) {
|
|
258
253
|
var normalized, urlResponse, responseObject;
|
|
@@ -277,7 +272,7 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
277
272
|
_context.next = 26;
|
|
278
273
|
break;
|
|
279
274
|
}
|
|
280
|
-
if (!
|
|
275
|
+
if (!previewableLinksOnly) {
|
|
281
276
|
_context.next = 25;
|
|
282
277
|
break;
|
|
283
278
|
}
|
|
@@ -324,7 +319,7 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
324
319
|
return function (_x) {
|
|
325
320
|
return _ref2.apply(this, arguments);
|
|
326
321
|
};
|
|
327
|
-
}(), [dispatch, handleInsert, isSelectedItem, selectedItem, url, isSubmitting,
|
|
322
|
+
}(), [dispatch, handleInsert, isSelectedItem, selectedItem, url, isSubmitting, previewableLinksOnly]);
|
|
328
323
|
var handleTabChange = (0, _react.useCallback)(function (activeTab) {
|
|
329
324
|
var _plugins$activeTab$ta, _plugins$activeTab;
|
|
330
325
|
dispatch({
|
|
@@ -420,8 +415,7 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
420
415
|
// for details: https://a11y-internal.atlassian.net/browse/AK-740
|
|
421
416
|
var screenReaderText = (0, _userAgent.browser)().safari && (0, _utils.getScreenReaderText)(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
|
|
422
417
|
var customSubmitButtonLabel = customMessages !== null && customMessages !== void 0 && customMessages.submitButtonLabel ? customMessages.submitButtonLabel : undefined;
|
|
423
|
-
var
|
|
424
|
-
var errorMessage = invalidUrl ? previewableOnly && !hasPreview ? /*#__PURE__*/React.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.formMessages.noEmbedAvailable, {
|
|
418
|
+
var errorMessage = invalidUrl ? previewableLinksOnly && !hasPreview ? /*#__PURE__*/React.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.formMessages.noEmbedAvailable, {
|
|
425
419
|
values: {
|
|
426
420
|
a: function a(chunk) {
|
|
427
421
|
return /*#__PURE__*/React.createElement(_linkUrl.default, {
|
|
@@ -436,7 +430,7 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
436
430
|
// Use onSubmitCapture instead of onSubmit so that any possible parent form isn't submitted
|
|
437
431
|
onSubmitCapture: handleSubmit,
|
|
438
432
|
className: (0, _runtime.ax)(["_19bv164s _u5f31pah _ca0q1k79 _n3td1t3k _vchhusvi _1e0ctcjq"])
|
|
439
|
-
}, /*#__PURE__*/React.createElement(_trackMount.TrackMount, null),
|
|
433
|
+
}, /*#__PURE__*/React.createElement(_trackMount.TrackMount, null), submitOnInputChange && /*#__PURE__*/React.createElement(_autoSubmitOnChange.default, {
|
|
440
434
|
url: url,
|
|
441
435
|
isSubmitting: isSubmitting,
|
|
442
436
|
isSelectedItem: isSelectedItem,
|
|
@@ -458,7 +452,7 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
458
452
|
value: url,
|
|
459
453
|
autoFocus: true,
|
|
460
454
|
clearLabel: intl.formatMessage(_messages.formMessages.clearLink),
|
|
461
|
-
error: errorMessage ||
|
|
455
|
+
error: errorMessage || additionalError,
|
|
462
456
|
spotlightTargetName: "link-picker-search-field-spotlight-target",
|
|
463
457
|
"aria-readonly": isSubmitting
|
|
464
458
|
}, a11yList, {
|
|
@@ -527,7 +521,7 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
527
521
|
action: pluginAction,
|
|
528
522
|
customSubmitButtonLabel: customSubmitButtonLabel,
|
|
529
523
|
submitMessageId: submitMessageId,
|
|
530
|
-
hideSubmitButton: moveSubmitButton ||
|
|
524
|
+
hideSubmitButton: moveSubmitButton || submitOnInputChange,
|
|
531
525
|
className: (0, _runtime.ax)([(!queryState || !(plugins !== null && plugins !== void 0 && plugins.length)) && "_19pkpxbi"])
|
|
532
526
|
}));
|
|
533
527
|
}));
|
|
@@ -15,7 +15,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
15
15
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
17
|
var _reactIntlNext = require("react-intl-next");
|
|
18
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
18
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
19
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
21
20
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
@@ -41,11 +40,6 @@ var listTitleStyles = {
|
|
|
41
40
|
color: "var(--ds-text-subtle, #505258)"
|
|
42
41
|
};
|
|
43
42
|
var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
44
|
-
titleRecentlyViewed: {
|
|
45
|
-
id: 'fabric.linkPicker.listTitle.recentlyViewed',
|
|
46
|
-
defaultMessage: 'Recently Viewed',
|
|
47
|
-
description: 'Describes type of items shown in the list for screen-reader users'
|
|
48
|
-
},
|
|
49
43
|
titleRecentlyViewedFormatted: {
|
|
50
44
|
id: 'fabric.linkPicker.listTitle.recentlyViewedFormatted',
|
|
51
45
|
defaultMessage: 'Recently viewed',
|
|
@@ -89,8 +83,7 @@ var LinkSearchList = exports.LinkSearchList = /*#__PURE__*/(0, _react.forwardRef
|
|
|
89
83
|
restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
90
84
|
var itemsContent;
|
|
91
85
|
var loadingContent;
|
|
92
|
-
var
|
|
93
|
-
var linkListTitle = hasSearchTerm ? messages.titleResults : recentlyViewedMessage;
|
|
86
|
+
var linkListTitle = hasSearchTerm ? messages.titleResults : messages.titleRecentlyViewedFormatted;
|
|
94
87
|
(0, _useTrackResultsShown.useTrackResultsShown)(isLoading, items, hasSearchTerm);
|
|
95
88
|
var itemRefs = (0, _react.useRef)({});
|
|
96
89
|
var itemRefCallback = (0, _react.useCallback)(function (el, id) {
|
|
@@ -101,7 +101,6 @@ var TextInput = exports.TextInput = function TextInput(_ref) {
|
|
|
101
101
|
onClick: handleClear,
|
|
102
102
|
testId: testIds.clearUrlButton
|
|
103
103
|
}, /*#__PURE__*/_react.default.createElement(_crossCircle.default, {
|
|
104
|
-
LEGACY_size: "medium",
|
|
105
104
|
label: clearLabel || '',
|
|
106
105
|
color: "var(--ds-icon-subtle, #505258)",
|
|
107
106
|
spacing: "spacious"
|
package/dist/cjs/ui/main.js
CHANGED
|
@@ -25,7 +25,7 @@ var testIds = exports.testIds = {
|
|
|
25
25
|
};
|
|
26
26
|
var PACKAGE_DATA = exports.PACKAGE_DATA = {
|
|
27
27
|
packageName: "@atlaskit/link-picker" || '',
|
|
28
|
-
packageVersion: "
|
|
28
|
+
packageVersion: "4.2.2" || '',
|
|
29
29
|
componentName: _constants.COMPONENT_NAME,
|
|
30
30
|
source: _constants.COMPONENT_NAME
|
|
31
31
|
};
|
|
@@ -12,7 +12,6 @@ import { HelperMessage } from '@atlaskit/form';
|
|
|
12
12
|
import { CardClient } from '@atlaskit/link-provider';
|
|
13
13
|
import { isSafeUrl, normalizeUrl } from '@atlaskit/linking-common/url';
|
|
14
14
|
import { browser } from '@atlaskit/linking-common/user-agent';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
15
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
17
16
|
import LinkUrl from '@atlaskit/smart-card/link-url';
|
|
18
17
|
import { N700 } from '@atlaskit/theme/colors';
|
|
@@ -143,8 +142,6 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
143
142
|
const isEditing = !!initUrl;
|
|
144
143
|
const selectedItem = items === null || items === void 0 ? void 0 : items[selectedIndex];
|
|
145
144
|
const isSelectedItem = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.url) === url;
|
|
146
|
-
const previewableOnly = fg('platform-linking-link-picker-previewable-only') && previewableLinksOnly;
|
|
147
|
-
const flaggedSubmitOnInputChange = fg('platform-linking-link-picker-previewable-only') && submitOnInputChange;
|
|
148
145
|
const {
|
|
149
146
|
trackAttribute,
|
|
150
147
|
getAttributes
|
|
@@ -241,13 +238,11 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
241
238
|
});
|
|
242
239
|
}
|
|
243
240
|
}, [handleInsert, trackAttribute, items, activePlugin, isSubmitting]);
|
|
244
|
-
const handleClearInvalidUrl =
|
|
245
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
246
|
-
useCallback(() => {
|
|
241
|
+
const handleClearInvalidUrl = useCallback(() => {
|
|
247
242
|
dispatch({
|
|
248
243
|
invalidUrl: false
|
|
249
244
|
});
|
|
250
|
-
}, [dispatch])
|
|
245
|
+
}, [dispatch]);
|
|
251
246
|
const handleSubmit = useCallback(async event => {
|
|
252
247
|
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
253
248
|
if (isSubmitting) {
|
|
@@ -259,7 +254,7 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
259
254
|
}
|
|
260
255
|
const normalized = normalizeUrl(url);
|
|
261
256
|
if (normalized) {
|
|
262
|
-
if (
|
|
257
|
+
if (previewableLinksOnly) {
|
|
263
258
|
try {
|
|
264
259
|
const urlResponse = await client.fetchData(normalized);
|
|
265
260
|
const responseObject = urlResponse === null || urlResponse === void 0 ? void 0 : urlResponse.data;
|
|
@@ -283,7 +278,7 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
283
278
|
return dispatch({
|
|
284
279
|
invalidUrl: true
|
|
285
280
|
});
|
|
286
|
-
}, [dispatch, handleInsert, isSelectedItem, selectedItem, url, isSubmitting,
|
|
281
|
+
}, [dispatch, handleInsert, isSelectedItem, selectedItem, url, isSubmitting, previewableLinksOnly]);
|
|
287
282
|
const handleTabChange = useCallback(activeTab => {
|
|
288
283
|
var _plugins$activeTab$ta, _plugins$activeTab;
|
|
289
284
|
dispatch({
|
|
@@ -377,8 +372,7 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
377
372
|
// for details: https://a11y-internal.atlassian.net/browse/AK-740
|
|
378
373
|
const screenReaderText = browser().safari && getScreenReaderText(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
|
|
379
374
|
const customSubmitButtonLabel = customMessages !== null && customMessages !== void 0 && customMessages.submitButtonLabel ? customMessages.submitButtonLabel : undefined;
|
|
380
|
-
const
|
|
381
|
-
const errorMessage = invalidUrl ? previewableOnly && !hasPreview ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, formMessages.noEmbedAvailable, {
|
|
375
|
+
const errorMessage = invalidUrl ? previewableLinksOnly && !hasPreview ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, formMessages.noEmbedAvailable, {
|
|
382
376
|
values: {
|
|
383
377
|
a: chunk => /*#__PURE__*/React.createElement(LinkUrl, {
|
|
384
378
|
target: "_blank",
|
|
@@ -391,7 +385,7 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
391
385
|
// Use onSubmitCapture instead of onSubmit so that any possible parent form isn't submitted
|
|
392
386
|
onSubmitCapture: handleSubmit,
|
|
393
387
|
className: ax(["_19bv164s _u5f31pah _ca0q1k79 _n3td1t3k _vchhusvi _1e0ctcjq"])
|
|
394
|
-
}, /*#__PURE__*/React.createElement(TrackMount, null),
|
|
388
|
+
}, /*#__PURE__*/React.createElement(TrackMount, null), submitOnInputChange && /*#__PURE__*/React.createElement(AutoSubmitOnChange, {
|
|
395
389
|
url: url,
|
|
396
390
|
isSubmitting: isSubmitting,
|
|
397
391
|
isSelectedItem: isSelectedItem,
|
|
@@ -413,7 +407,7 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
413
407
|
value: url,
|
|
414
408
|
autoFocus: true,
|
|
415
409
|
clearLabel: intl.formatMessage(formMessages.clearLink),
|
|
416
|
-
error: errorMessage ||
|
|
410
|
+
error: errorMessage || additionalError,
|
|
417
411
|
spotlightTargetName: "link-picker-search-field-spotlight-target",
|
|
418
412
|
"aria-readonly": isSubmitting
|
|
419
413
|
}, a11yList, {
|
|
@@ -482,7 +476,7 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
482
476
|
action: pluginAction,
|
|
483
477
|
customSubmitButtonLabel: customSubmitButtonLabel,
|
|
484
478
|
submitMessageId: submitMessageId,
|
|
485
|
-
hideSubmitButton: moveSubmitButton ||
|
|
479
|
+
hideSubmitButton: moveSubmitButton || submitOnInputChange,
|
|
486
480
|
className: ax([(!queryState || !(plugins !== null && plugins !== void 0 && plugins.length)) && "_19pkpxbi"])
|
|
487
481
|
}));
|
|
488
482
|
}));
|
|
@@ -5,7 +5,6 @@ import * as React from 'react';
|
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { forwardRef, Fragment, useCallback, useRef } from 'react';
|
|
7
7
|
import { defineMessages, FormattedMessage } from 'react-intl-next';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
10
9
|
import Spinner from '@atlaskit/spinner';
|
|
11
10
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
@@ -27,11 +26,6 @@ const listTitleStyles = {
|
|
|
27
26
|
color: "var(--ds-text-subtle, #505258)"
|
|
28
27
|
};
|
|
29
28
|
export const messages = defineMessages({
|
|
30
|
-
titleRecentlyViewed: {
|
|
31
|
-
id: 'fabric.linkPicker.listTitle.recentlyViewed',
|
|
32
|
-
defaultMessage: 'Recently Viewed',
|
|
33
|
-
description: 'Describes type of items shown in the list for screen-reader users'
|
|
34
|
-
},
|
|
35
29
|
titleRecentlyViewedFormatted: {
|
|
36
30
|
id: 'fabric.linkPicker.listTitle.recentlyViewedFormatted',
|
|
37
31
|
defaultMessage: 'Recently viewed',
|
|
@@ -78,8 +72,7 @@ export const LinkSearchList = /*#__PURE__*/forwardRef(({
|
|
|
78
72
|
var _activePlugin$uiOptio;
|
|
79
73
|
let itemsContent;
|
|
80
74
|
let loadingContent;
|
|
81
|
-
const
|
|
82
|
-
const linkListTitle = hasSearchTerm ? messages.titleResults : recentlyViewedMessage;
|
|
75
|
+
const linkListTitle = hasSearchTerm ? messages.titleResults : messages.titleRecentlyViewedFormatted;
|
|
83
76
|
useTrackResultsShown(isLoading, items, hasSearchTerm);
|
|
84
77
|
const itemRefs = useRef({});
|
|
85
78
|
const itemRefCallback = useCallback((el, id) => {
|
package/dist/es2019/ui/main.js
CHANGED
|
@@ -18,7 +18,6 @@ import { HelperMessage } from '@atlaskit/form';
|
|
|
18
18
|
import { CardClient } from '@atlaskit/link-provider';
|
|
19
19
|
import { isSafeUrl, normalizeUrl } from '@atlaskit/linking-common/url';
|
|
20
20
|
import { browser } from '@atlaskit/linking-common/user-agent';
|
|
21
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
21
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
23
22
|
import LinkUrl from '@atlaskit/smart-card/link-url';
|
|
24
23
|
import { N700 } from '@atlaskit/theme/colors';
|
|
@@ -144,8 +143,6 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
144
143
|
var isEditing = !!initUrl;
|
|
145
144
|
var selectedItem = items === null || items === void 0 ? void 0 : items[selectedIndex];
|
|
146
145
|
var isSelectedItem = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.url) === url;
|
|
147
|
-
var previewableOnly = fg('platform-linking-link-picker-previewable-only') && previewableLinksOnly;
|
|
148
|
-
var flaggedSubmitOnInputChange = fg('platform-linking-link-picker-previewable-only') && submitOnInputChange;
|
|
149
146
|
var _useLinkPickerAnalyti = useLinkPickerAnalytics(),
|
|
150
147
|
trackAttribute = _useLinkPickerAnalyti.trackAttribute,
|
|
151
148
|
getAttributes = _useLinkPickerAnalyti.getAttributes;
|
|
@@ -238,13 +235,11 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
238
235
|
handleInsert(_url, name, 'typeAhead', _objectSpread({}, selectedItem));
|
|
239
236
|
}
|
|
240
237
|
}, [handleInsert, trackAttribute, items, activePlugin, isSubmitting]);
|
|
241
|
-
var handleClearInvalidUrl =
|
|
242
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
243
|
-
useCallback(function () {
|
|
238
|
+
var handleClearInvalidUrl = useCallback(function () {
|
|
244
239
|
dispatch({
|
|
245
240
|
invalidUrl: false
|
|
246
241
|
});
|
|
247
|
-
}, [dispatch])
|
|
242
|
+
}, [dispatch]);
|
|
248
243
|
var handleSubmit = useCallback( /*#__PURE__*/function () {
|
|
249
244
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
250
245
|
var normalized, urlResponse, responseObject;
|
|
@@ -269,7 +264,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
269
264
|
_context.next = 26;
|
|
270
265
|
break;
|
|
271
266
|
}
|
|
272
|
-
if (!
|
|
267
|
+
if (!previewableLinksOnly) {
|
|
273
268
|
_context.next = 25;
|
|
274
269
|
break;
|
|
275
270
|
}
|
|
@@ -316,7 +311,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
316
311
|
return function (_x) {
|
|
317
312
|
return _ref2.apply(this, arguments);
|
|
318
313
|
};
|
|
319
|
-
}(), [dispatch, handleInsert, isSelectedItem, selectedItem, url, isSubmitting,
|
|
314
|
+
}(), [dispatch, handleInsert, isSelectedItem, selectedItem, url, isSubmitting, previewableLinksOnly]);
|
|
320
315
|
var handleTabChange = useCallback(function (activeTab) {
|
|
321
316
|
var _plugins$activeTab$ta, _plugins$activeTab;
|
|
322
317
|
dispatch({
|
|
@@ -412,8 +407,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
412
407
|
// for details: https://a11y-internal.atlassian.net/browse/AK-740
|
|
413
408
|
var screenReaderText = browser().safari && getScreenReaderText(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
|
|
414
409
|
var customSubmitButtonLabel = customMessages !== null && customMessages !== void 0 && customMessages.submitButtonLabel ? customMessages.submitButtonLabel : undefined;
|
|
415
|
-
var
|
|
416
|
-
var errorMessage = invalidUrl ? previewableOnly && !hasPreview ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, formMessages.noEmbedAvailable, {
|
|
410
|
+
var errorMessage = invalidUrl ? previewableLinksOnly && !hasPreview ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, formMessages.noEmbedAvailable, {
|
|
417
411
|
values: {
|
|
418
412
|
a: function a(chunk) {
|
|
419
413
|
return /*#__PURE__*/React.createElement(LinkUrl, {
|
|
@@ -428,7 +422,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
428
422
|
// Use onSubmitCapture instead of onSubmit so that any possible parent form isn't submitted
|
|
429
423
|
onSubmitCapture: handleSubmit,
|
|
430
424
|
className: ax(["_19bv164s _u5f31pah _ca0q1k79 _n3td1t3k _vchhusvi _1e0ctcjq"])
|
|
431
|
-
}, /*#__PURE__*/React.createElement(TrackMount, null),
|
|
425
|
+
}, /*#__PURE__*/React.createElement(TrackMount, null), submitOnInputChange && /*#__PURE__*/React.createElement(AutoSubmitOnChange, {
|
|
432
426
|
url: url,
|
|
433
427
|
isSubmitting: isSubmitting,
|
|
434
428
|
isSelectedItem: isSelectedItem,
|
|
@@ -450,7 +444,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
450
444
|
value: url,
|
|
451
445
|
autoFocus: true,
|
|
452
446
|
clearLabel: intl.formatMessage(formMessages.clearLink),
|
|
453
|
-
error: errorMessage ||
|
|
447
|
+
error: errorMessage || additionalError,
|
|
454
448
|
spotlightTargetName: "link-picker-search-field-spotlight-target",
|
|
455
449
|
"aria-readonly": isSubmitting
|
|
456
450
|
}, a11yList, {
|
|
@@ -519,7 +513,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
519
513
|
action: pluginAction,
|
|
520
514
|
customSubmitButtonLabel: customSubmitButtonLabel,
|
|
521
515
|
submitMessageId: submitMessageId,
|
|
522
|
-
hideSubmitButton: moveSubmitButton ||
|
|
516
|
+
hideSubmitButton: moveSubmitButton || submitOnInputChange,
|
|
523
517
|
className: ax([(!queryState || !(plugins !== null && plugins !== void 0 && plugins.length)) && "_19pkpxbi"])
|
|
524
518
|
}));
|
|
525
519
|
}));
|
|
@@ -10,7 +10,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
10
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
11
|
import { forwardRef, Fragment, useCallback, useRef } from 'react';
|
|
12
12
|
import { defineMessages, FormattedMessage } from 'react-intl-next';
|
|
13
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
13
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
15
14
|
import Spinner from '@atlaskit/spinner';
|
|
16
15
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
@@ -32,11 +31,6 @@ var listTitleStyles = {
|
|
|
32
31
|
color: "var(--ds-text-subtle, #505258)"
|
|
33
32
|
};
|
|
34
33
|
export var messages = defineMessages({
|
|
35
|
-
titleRecentlyViewed: {
|
|
36
|
-
id: 'fabric.linkPicker.listTitle.recentlyViewed',
|
|
37
|
-
defaultMessage: 'Recently Viewed',
|
|
38
|
-
description: 'Describes type of items shown in the list for screen-reader users'
|
|
39
|
-
},
|
|
40
34
|
titleRecentlyViewedFormatted: {
|
|
41
35
|
id: 'fabric.linkPicker.listTitle.recentlyViewedFormatted',
|
|
42
36
|
defaultMessage: 'Recently viewed',
|
|
@@ -80,8 +74,7 @@ export var LinkSearchList = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
80
74
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
81
75
|
var itemsContent;
|
|
82
76
|
var loadingContent;
|
|
83
|
-
var
|
|
84
|
-
var linkListTitle = hasSearchTerm ? messages.titleResults : recentlyViewedMessage;
|
|
77
|
+
var linkListTitle = hasSearchTerm ? messages.titleResults : messages.titleRecentlyViewedFormatted;
|
|
85
78
|
useTrackResultsShown(isLoading, items, hasSearchTerm);
|
|
86
79
|
var itemRefs = useRef({});
|
|
87
80
|
var itemRefCallback = useCallback(function (el, id) {
|
|
@@ -92,7 +92,6 @@ export var TextInput = function TextInput(_ref) {
|
|
|
92
92
|
onClick: handleClear,
|
|
93
93
|
testId: testIds.clearUrlButton
|
|
94
94
|
}, /*#__PURE__*/React.createElement(Selectclear, {
|
|
95
|
-
LEGACY_size: "medium",
|
|
96
95
|
label: clearLabel || '',
|
|
97
96
|
color: "var(--ds-icon-subtle, #505258)",
|
|
98
97
|
spacing: "spacious"
|
package/dist/esm/ui/main.js
CHANGED
|
@@ -5,11 +5,6 @@
|
|
|
5
5
|
import { type KeyboardEvent } from 'react';
|
|
6
6
|
import { type LinkPickerPlugin, type LinkSearchListItemData } from '../../../../common/types';
|
|
7
7
|
export declare const messages: {
|
|
8
|
-
titleRecentlyViewed: {
|
|
9
|
-
id: string;
|
|
10
|
-
defaultMessage: string;
|
|
11
|
-
description: string;
|
|
12
|
-
};
|
|
13
8
|
titleRecentlyViewedFormatted: {
|
|
14
9
|
id: string;
|
|
15
10
|
defaultMessage: string;
|
|
@@ -5,11 +5,6 @@
|
|
|
5
5
|
import { type KeyboardEvent } from 'react';
|
|
6
6
|
import { type LinkPickerPlugin, type LinkSearchListItemData } from '../../../../common/types';
|
|
7
7
|
export declare const messages: {
|
|
8
|
-
titleRecentlyViewed: {
|
|
9
|
-
id: string;
|
|
10
|
-
defaultMessage: string;
|
|
11
|
-
description: string;
|
|
12
|
-
};
|
|
13
8
|
titleRecentlyViewedFormatted: {
|
|
14
9
|
id: string;
|
|
15
10
|
defaultMessage: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-picker",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.3",
|
|
4
4
|
"description": "Standalone link picker",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,9 +32,6 @@
|
|
|
32
32
|
],
|
|
33
33
|
"atlaskit:src": "src/index.ts",
|
|
34
34
|
"platform-feature-flags": {
|
|
35
|
-
"platform-linking-link-picker-previewable-only": {
|
|
36
|
-
"type": "boolean"
|
|
37
|
-
},
|
|
38
35
|
"dst-a11y__replace-anchor-with-link__linking-platfo": {
|
|
39
36
|
"type": "boolean"
|
|
40
37
|
},
|
|
@@ -54,24 +51,24 @@
|
|
|
54
51
|
"@atlaskit/atlassian-context": "^0.6.0",
|
|
55
52
|
"@atlaskit/button": "^23.9.0",
|
|
56
53
|
"@atlaskit/css": "^0.19.0",
|
|
57
|
-
"@atlaskit/form": "^15.
|
|
54
|
+
"@atlaskit/form": "^15.3.0",
|
|
58
55
|
"@atlaskit/frontend-utilities": "^3.2.0",
|
|
59
56
|
"@atlaskit/heading": "^5.2.0",
|
|
60
|
-
"@atlaskit/icon": "^29.
|
|
57
|
+
"@atlaskit/icon": "^29.4.0",
|
|
61
58
|
"@atlaskit/intl-messages-provider": "^2.0.0",
|
|
62
|
-
"@atlaskit/link": "^3.
|
|
63
|
-
"@atlaskit/link-provider": "^4.
|
|
59
|
+
"@atlaskit/link": "^3.3.0",
|
|
60
|
+
"@atlaskit/link-provider": "^4.1.0",
|
|
64
61
|
"@atlaskit/linking-common": "^9.9.0",
|
|
65
62
|
"@atlaskit/onboarding": "^14.5.0",
|
|
66
63
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
67
64
|
"@atlaskit/primitives": "^17.0.0",
|
|
68
|
-
"@atlaskit/smart-card": "^43.
|
|
65
|
+
"@atlaskit/smart-card": "^43.20.0",
|
|
69
66
|
"@atlaskit/spinner": "^19.0.0",
|
|
70
67
|
"@atlaskit/tabs": "^18.3.0",
|
|
71
68
|
"@atlaskit/textfield": "^8.2.0",
|
|
72
69
|
"@atlaskit/theme": "^21.0.0",
|
|
73
|
-
"@atlaskit/tokens": "^9.
|
|
74
|
-
"@atlaskit/tooltip": "^20.
|
|
70
|
+
"@atlaskit/tokens": "^9.1.0",
|
|
71
|
+
"@atlaskit/tooltip": "^20.14.0",
|
|
75
72
|
"@atlaskit/ufo": "^0.4.0",
|
|
76
73
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
77
74
|
"@babel/runtime": "^7.0.0",
|
|
@@ -91,13 +88,13 @@
|
|
|
91
88
|
"@af/analytics-codegen": "workspace:^",
|
|
92
89
|
"@af/integration-testing": "workspace:^",
|
|
93
90
|
"@af/visual-regression": "workspace:^",
|
|
94
|
-
"@atlaskit/dropdown-menu": "^16.
|
|
91
|
+
"@atlaskit/dropdown-menu": "^16.4.0",
|
|
95
92
|
"@atlaskit/link-test-helpers": "^9.0.0",
|
|
93
|
+
"@atlassian/a11y-jest-testing": "^0.6.0",
|
|
96
94
|
"@atlassian/feature-flags-test-utils": "^1.0.0",
|
|
97
95
|
"@testing-library/dom": "^10.1.0",
|
|
98
96
|
"@testing-library/jest-dom": "^6.4.5",
|
|
99
|
-
"@testing-library/react": "^
|
|
100
|
-
"@testing-library/react-hooks": "^8.0.1",
|
|
97
|
+
"@testing-library/react": "^16.3.0",
|
|
101
98
|
"@testing-library/user-event": "^14.4.3",
|
|
102
99
|
"fetch-mock": "^8.0.0",
|
|
103
100
|
"jest-extended": "^4.0.2",
|