@atlaskit/link-picker 1.31.0 → 1.32.1
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 +16 -0
- package/dist/cjs/ui/index.js +1 -1
- package/dist/cjs/ui/link-picker/form-footer/index.js +33 -9
- package/dist/cjs/ui/link-picker/form-footer/utils.js +4 -1
- package/dist/cjs/ui/link-picker/index.js +37 -7
- package/dist/cjs/ui/link-picker/search-results/index.js +2 -0
- package/dist/cjs/ui/link-picker/search-results/link-search-list/index.js +3 -1
- package/dist/cjs/ui/messages-provider/lazy-messages-provider/utils/fetch-messages-for-locale.js +5 -15
- package/dist/es2019/ui/index.js +1 -1
- package/dist/es2019/ui/link-picker/form-footer/index.js +29 -8
- package/dist/es2019/ui/link-picker/form-footer/utils.js +4 -1
- package/dist/es2019/ui/link-picker/index.js +36 -7
- package/dist/es2019/ui/link-picker/search-results/index.js +2 -0
- package/dist/es2019/ui/link-picker/search-results/link-search-list/index.js +2 -0
- package/dist/es2019/ui/messages-provider/lazy-messages-provider/utils/fetch-messages-for-locale.js +0 -10
- package/dist/esm/ui/index.js +1 -1
- package/dist/esm/ui/link-picker/form-footer/index.js +33 -9
- package/dist/esm/ui/link-picker/form-footer/utils.js +4 -1
- package/dist/esm/ui/link-picker/index.js +37 -7
- package/dist/esm/ui/link-picker/search-results/index.js +2 -0
- package/dist/esm/ui/link-picker/search-results/link-search-list/index.js +3 -1
- package/dist/esm/ui/messages-provider/lazy-messages-provider/utils/fetch-messages-for-locale.js +5 -15
- package/dist/types/ui/link-picker/form-footer/index.d.ts +26 -1
- package/dist/types/ui/link-picker/form-footer/utils.d.ts +1 -1
- package/dist/types/ui/link-picker/index.d.ts +3 -0
- package/dist/types/ui/link-picker/search-results/index.d.ts +2 -1
- package/dist/types/ui/link-picker/search-results/link-search-list/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/link-picker/form-footer/index.d.ts +26 -1
- package/dist/types-ts4.5/ui/link-picker/form-footer/utils.d.ts +1 -1
- package/dist/types-ts4.5/ui/link-picker/index.d.ts +3 -0
- package/dist/types-ts4.5/ui/link-picker/search-results/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/link-picker/search-results/link-search-list/index.d.ts +1 -0
- package/package.json +3 -3
|
@@ -24,6 +24,7 @@ export const SearchResults = ({
|
|
|
24
24
|
activePlugin,
|
|
25
25
|
isLoadingPlugins,
|
|
26
26
|
isLoadingResults,
|
|
27
|
+
isSubmitting,
|
|
27
28
|
handleTabChange,
|
|
28
29
|
handleSearchListOnChange,
|
|
29
30
|
featureFlags,
|
|
@@ -65,6 +66,7 @@ export const SearchResults = ({
|
|
|
65
66
|
})), !error && jsx(LinkSearchList, {
|
|
66
67
|
id: linkSearchListId,
|
|
67
68
|
role: "listbox",
|
|
69
|
+
ariaReadOnly: isSubmitting,
|
|
68
70
|
items: items,
|
|
69
71
|
isLoading: isLoadingResults,
|
|
70
72
|
selectedIndex: selectedIndex,
|
|
@@ -48,6 +48,7 @@ export const LinkSearchList = /*#__PURE__*/forwardRef(({
|
|
|
48
48
|
isLoading,
|
|
49
49
|
ariaControls,
|
|
50
50
|
ariaLabelledBy,
|
|
51
|
+
ariaReadOnly,
|
|
51
52
|
role,
|
|
52
53
|
id,
|
|
53
54
|
hasSearchTerm,
|
|
@@ -124,6 +125,7 @@ export const LinkSearchList = /*#__PURE__*/forwardRef(({
|
|
|
124
125
|
css: listStyles,
|
|
125
126
|
"aria-controls": "fabric.smartcard.linkpicker.suggested.results",
|
|
126
127
|
"aria-labelledby": testIds.resultListTitle,
|
|
128
|
+
"aria-readonly": ariaReadOnly,
|
|
127
129
|
"data-testid": testIds.searchResultList
|
|
128
130
|
}, items.map((item, index) => jsx(LinkSearchListItem, {
|
|
129
131
|
id: `${testIds.searchResultItem}-${index}`,
|
package/dist/es2019/ui/messages-provider/lazy-messages-provider/utils/fetch-messages-for-locale.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
import messages from '../../../../i18n/en';
|
|
3
1
|
export const fetchMessagesForLocale = async locale => {
|
|
4
2
|
try {
|
|
5
3
|
const messages = await import( /* webpackChunkName: "@atlaskit-internal_link-picker-i18n-[request]" */`../../../../i18n/${locale.replace('-', '_')}`);
|
|
@@ -14,12 +12,4 @@ export const fetchMessagesForLocale = async locale => {
|
|
|
14
12
|
} catch (e) {
|
|
15
13
|
// ignore
|
|
16
14
|
}
|
|
17
|
-
if (getBooleanFF('platform.linking-platform.link-create.tmp-fix-translations')) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* English bundled by default as this is the majority of users
|
|
23
|
-
*/
|
|
24
|
-
return messages;
|
|
25
15
|
};
|
package/dist/esm/ui/index.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["isLoading", "error", "url", "queryState", "items", "isEditing", "onCancel", "action", "createFeatureDiscovery", "customSubmitButtonLabel"];
|
|
3
|
+
var _excluded = ["isLoading", "isSubmitting", "error", "url", "queryState", "items", "isEditing", "onCancel", "action", "createFeatureDiscovery", "customSubmitButtonLabel"];
|
|
4
4
|
/** @jsx jsx */
|
|
5
|
-
import { memo } from 'react';
|
|
5
|
+
import { memo, useMemo } from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { defineMessages, useIntl } from 'react-intl-next';
|
|
8
|
+
import uuid from 'uuid';
|
|
8
9
|
import Button, { ButtonGroup } from '@atlaskit/button';
|
|
10
|
+
import LoadingButton from '@atlaskit/button/loading-button';
|
|
9
11
|
import EditorAddIcon from '@atlaskit/icon/glyph/editor/add';
|
|
12
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
10
13
|
import { UnauthenticatedError } from '../../../common/utils/errors';
|
|
11
14
|
import FeatureDiscovery from './feature-discovery';
|
|
12
15
|
import { formFooterActionStyles, formFooterStyles } from './styled';
|
|
13
16
|
import { checkSubmitDisabled } from './utils';
|
|
14
|
-
var messages = defineMessages({
|
|
17
|
+
export var messages = defineMessages({
|
|
15
18
|
cancelButton: {
|
|
16
19
|
id: 'fabric.linkPicker.button.cancel',
|
|
17
20
|
defaultMessage: 'Cancel',
|
|
@@ -26,17 +29,25 @@ var messages = defineMessages({
|
|
|
26
29
|
id: 'fabric.linkPicker.button.insert',
|
|
27
30
|
defaultMessage: 'Insert',
|
|
28
31
|
description: 'Button to insert searched or selected link'
|
|
32
|
+
},
|
|
33
|
+
submittingStatusMessage: {
|
|
34
|
+
id: 'fabric.linkPicker.status.submitting',
|
|
35
|
+
defaultMessage: 'Submitting',
|
|
36
|
+
description: 'Accessibility text to indicate the form has been submitted, and submission is in-progress'
|
|
29
37
|
}
|
|
30
38
|
});
|
|
31
39
|
export var testIds = {
|
|
32
40
|
insertButton: 'link-picker-insert-button',
|
|
33
41
|
cancelButton: 'link-picker-cancel-button',
|
|
34
42
|
actionButton: 'link-picker-action-button',
|
|
43
|
+
submitStatusA11yIndicator: 'link-picker-submit-status-a11y-indicator',
|
|
35
44
|
/** Feature discovery for action button (css pulse) */
|
|
36
45
|
actionButtonDiscovery: 'link-picker-action-button-discovery'
|
|
37
46
|
};
|
|
38
47
|
export var FormFooter = /*#__PURE__*/memo(function (_ref) {
|
|
39
48
|
var isLoading = _ref.isLoading,
|
|
49
|
+
_ref$isSubmitting = _ref.isSubmitting,
|
|
50
|
+
isSubmitting = _ref$isSubmitting === void 0 ? false : _ref$isSubmitting,
|
|
40
51
|
error = _ref.error,
|
|
41
52
|
url = _ref.url,
|
|
42
53
|
queryState = _ref.queryState,
|
|
@@ -49,10 +60,13 @@ export var FormFooter = /*#__PURE__*/memo(function (_ref) {
|
|
|
49
60
|
customSubmitButtonLabel = _ref.customSubmitButtonLabel,
|
|
50
61
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
51
62
|
var intl = useIntl();
|
|
63
|
+
var submitMessageId = useMemo(function () {
|
|
64
|
+
return uuid();
|
|
65
|
+
}, []);
|
|
52
66
|
if (error && error instanceof UnauthenticatedError) {
|
|
53
67
|
return null;
|
|
54
68
|
}
|
|
55
|
-
var isSubmitDisabled = checkSubmitDisabled(isLoading, error, url, queryState, items);
|
|
69
|
+
var isSubmitDisabled = checkSubmitDisabled(isLoading, isSubmitting, error, url, queryState, items);
|
|
56
70
|
var insertButtonMsg = isEditing ? messages.saveButton : messages.insertButton;
|
|
57
71
|
var createButton = function createButton(pluginAction) {
|
|
58
72
|
return jsx(Button, {
|
|
@@ -62,23 +76,33 @@ export var FormFooter = /*#__PURE__*/memo(function (_ref) {
|
|
|
62
76
|
iconBefore: jsx(EditorAddIcon, {
|
|
63
77
|
label: "",
|
|
64
78
|
size: "medium"
|
|
65
|
-
})
|
|
79
|
+
}),
|
|
80
|
+
isDisabled: isSubmitting,
|
|
81
|
+
"aria-labelledby": isSubmitting ? submitMessageId : undefined
|
|
66
82
|
}, typeof pluginAction.label === 'string' ? pluginAction.label : intl.formatMessage(pluginAction.label));
|
|
67
83
|
};
|
|
68
84
|
return jsx("footer", _extends({
|
|
69
85
|
css: formFooterStyles
|
|
70
|
-
}, restProps),
|
|
86
|
+
}, restProps), isSubmitting && jsx(VisuallyHidden, {
|
|
87
|
+
role: "status",
|
|
88
|
+
id: submitMessageId,
|
|
89
|
+
testId: testIds.submitStatusA11yIndicator
|
|
90
|
+
}, intl.formatMessage(messages.submittingStatusMessage)), action && jsx("div", {
|
|
71
91
|
css: formFooterActionStyles
|
|
72
92
|
}, createFeatureDiscovery ? jsx(FeatureDiscovery, {
|
|
73
93
|
testId: testIds.actionButtonDiscovery
|
|
74
94
|
}, createButton(action)) : createButton(action)), jsx(ButtonGroup, null, jsx(Button, {
|
|
75
95
|
appearance: "subtle",
|
|
76
96
|
onClick: onCancel,
|
|
77
|
-
testId: testIds.cancelButton
|
|
78
|
-
|
|
97
|
+
testId: testIds.cancelButton,
|
|
98
|
+
isDisabled: isSubmitting,
|
|
99
|
+
"aria-labelledby": isSubmitting ? submitMessageId : undefined
|
|
100
|
+
}, intl.formatMessage(messages.cancelButton)), jsx(LoadingButton, {
|
|
79
101
|
type: "submit",
|
|
80
102
|
appearance: "primary",
|
|
81
103
|
testId: testIds.insertButton,
|
|
82
|
-
isDisabled: isSubmitDisabled
|
|
104
|
+
isDisabled: isSubmitDisabled,
|
|
105
|
+
"aria-labelledby": isSubmitting ? submitMessageId : undefined,
|
|
106
|
+
isLoading: isSubmitting
|
|
83
107
|
}, customSubmitButtonLabel ? intl.formatMessage(customSubmitButtonLabel) : intl.formatMessage(insertButtonMsg))));
|
|
84
108
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { normalizeUrl } from '@atlaskit/linking-common/url';
|
|
2
|
-
export var checkSubmitDisabled = function checkSubmitDisabled(isLoading, error, url, queryState, items) {
|
|
2
|
+
export var checkSubmitDisabled = function checkSubmitDisabled(isLoading, isSubmitting, error, url, queryState, items) {
|
|
3
3
|
/*
|
|
4
4
|
* Enable insert when search term is a valid url and it can be normalized
|
|
5
5
|
* Need to explicitly enable it here otherwise next condition could meet
|
|
@@ -7,6 +7,9 @@ export var checkSubmitDisabled = function checkSubmitDisabled(isLoading, error,
|
|
|
7
7
|
* This should effectively be the validation function for the form, ie if the form
|
|
8
8
|
* could be submitted, then it should not be disabled
|
|
9
9
|
*/
|
|
10
|
+
if (isSubmitting) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
10
13
|
if (url && normalizeUrl(url)) {
|
|
11
14
|
return false;
|
|
12
15
|
}
|
|
@@ -80,7 +80,9 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
80
80
|
initDisplayText = _ref.displayText,
|
|
81
81
|
hideDisplayText = _ref.hideDisplayText,
|
|
82
82
|
featureFlags = _ref.featureFlags,
|
|
83
|
-
customMessages = _ref.customMessages
|
|
83
|
+
customMessages = _ref.customMessages,
|
|
84
|
+
_ref$isSubmitting = _ref.isSubmitting,
|
|
85
|
+
isSubmitting = _ref$isSubmitting === void 0 ? false : _ref$isSubmitting;
|
|
84
86
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
85
87
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
86
88
|
var _useReducer = useReducer(reducer, _objectSpread(_objectSpread({}, initState), {}, {
|
|
@@ -120,6 +122,11 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
120
122
|
}
|
|
121
123
|
}, [onContentResize, items, isLoadingResults, isActivePlugin, tabs]);
|
|
122
124
|
var handleChangeUrl = useCallback(function (e) {
|
|
125
|
+
if (isSubmitting) {
|
|
126
|
+
// Prevent changing url while submitting
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
123
130
|
/** Any on change event is triggered by manual input or paste, so source is null */
|
|
124
131
|
trackAttribute('linkFieldContentInputSource', null);
|
|
125
132
|
dispatch({
|
|
@@ -127,7 +134,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
127
134
|
// If the last action was changing tabs, make sure we're now allowing recents to be hidden
|
|
128
135
|
preventHidingRecents: false
|
|
129
136
|
});
|
|
130
|
-
}, [dispatch, trackAttribute]);
|
|
137
|
+
}, [dispatch, trackAttribute, isSubmitting]);
|
|
131
138
|
var handleChangeText = useCallback(function (e) {
|
|
132
139
|
dispatch({
|
|
133
140
|
displayText: e.currentTarget.value
|
|
@@ -140,9 +147,13 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
140
147
|
}, field, ''));
|
|
141
148
|
}, [dispatch]);
|
|
142
149
|
var handleUrlClear = useCallback(function () {
|
|
150
|
+
if (isSubmitting) {
|
|
151
|
+
// Prevent clearing url while submitting
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
143
154
|
trackAttribute('linkFieldContentInputSource', null);
|
|
144
155
|
handleClear('url');
|
|
145
|
-
}, [trackAttribute, handleClear]);
|
|
156
|
+
}, [trackAttribute, handleClear, isSubmitting]);
|
|
146
157
|
var handleInsert = useCallback(function (url, title, inputType) {
|
|
147
158
|
var event = createAnalyticsEvent(createEventPayload('ui.form.submitted.linkPicker', {}));
|
|
148
159
|
|
|
@@ -168,6 +179,10 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
168
179
|
} : {}), consumerEvent);
|
|
169
180
|
}, [displayText, onSubmit, state.url, createAnalyticsEvent, getAttributes]);
|
|
170
181
|
var handleSelected = useCallback(function (objectId) {
|
|
182
|
+
if (isSubmitting) {
|
|
183
|
+
// Prevent changing selection while submitting
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
171
186
|
var selectedItem = items === null || items === void 0 ? void 0 : items.find(function (item) {
|
|
172
187
|
return item.objectId === objectId;
|
|
173
188
|
});
|
|
@@ -183,9 +198,13 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
183
198
|
trackAttribute('linkFieldContentInputSource', getDataSource(selectedItem, activePlugin));
|
|
184
199
|
handleInsert(_url, name, 'typeAhead');
|
|
185
200
|
}
|
|
186
|
-
}, [handleInsert, trackAttribute, items, activePlugin]);
|
|
201
|
+
}, [handleInsert, trackAttribute, items, activePlugin, isSubmitting]);
|
|
187
202
|
var handleSubmit = useCallback(function (event) {
|
|
188
203
|
event === null || event === void 0 || event.preventDefault();
|
|
204
|
+
if (isSubmitting) {
|
|
205
|
+
// Prevent submit while submitting
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
189
208
|
if (isSelectedItem && selectedItem) {
|
|
190
209
|
return handleInsert(selectedItem.url, selectedItem.name, 'typeAhead');
|
|
191
210
|
}
|
|
@@ -196,7 +215,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
196
215
|
return dispatch({
|
|
197
216
|
invalidUrl: true
|
|
198
217
|
});
|
|
199
|
-
}, [dispatch, handleInsert, isSelectedItem, selectedItem, url]);
|
|
218
|
+
}, [dispatch, handleInsert, isSelectedItem, selectedItem, url, isSubmitting]);
|
|
200
219
|
var handleTabChange = useCallback(function (activeTab) {
|
|
201
220
|
var _plugins$activeTab$ta, _plugins$activeTab;
|
|
202
221
|
dispatch({
|
|
@@ -212,6 +231,10 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
212
231
|
trackAttribute('tab', (_plugins$activeTab$ta = plugins === null || plugins === void 0 || (_plugins$activeTab = plugins[activeTab]) === null || _plugins$activeTab === void 0 ? void 0 : _plugins$activeTab.tabKey) !== null && _plugins$activeTab$ta !== void 0 ? _plugins$activeTab$ta : null);
|
|
213
232
|
}, [dispatch, plugins, trackAttribute]);
|
|
214
233
|
var handleSearchListOnChange = function handleSearchListOnChange(id) {
|
|
234
|
+
if (isSubmitting) {
|
|
235
|
+
// Prevent changing item while submitting
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
215
238
|
var index = items === null || items === void 0 ? void 0 : items.findIndex(function (item) {
|
|
216
239
|
return item.objectId === id;
|
|
217
240
|
});
|
|
@@ -276,8 +299,11 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
276
299
|
var screenReaderText = browser().safari && getScreenReaderText(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
|
|
277
300
|
return jsx("form", {
|
|
278
301
|
"data-testid": testIds.linkPicker,
|
|
279
|
-
css: rootContainerStyles
|
|
280
|
-
onSubmit
|
|
302
|
+
css: rootContainerStyles
|
|
303
|
+
// Use onSubmitCapture instead of onSubmit when FF enabled so that any possible parent form isn't submitted
|
|
304
|
+
,
|
|
305
|
+
onSubmit: getBooleanFF('platform.linking-platform.link-picker.use-onsubmitcapture') ? undefined : handleSubmit,
|
|
306
|
+
onSubmitCapture: getBooleanFF('platform.linking-platform.link-picker.use-onsubmitcapture') ? handleSubmit : undefined
|
|
281
307
|
}, jsx(TrackMount, null), screenReaderText && jsx(Announcer, {
|
|
282
308
|
ariaLive: "assertive",
|
|
283
309
|
text: screenReaderText,
|
|
@@ -300,6 +326,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
300
326
|
"aria-controls": linkSearchListId,
|
|
301
327
|
"aria-activedescendant": ariaActiveDescendant,
|
|
302
328
|
"aria-describedby": screenReaderDescriptionId,
|
|
329
|
+
"aria-readonly": isSubmitting,
|
|
303
330
|
error: invalidUrl ? intl.formatMessage(formMessages.linkInvalid) : null,
|
|
304
331
|
spotlightTargetName: "link-picker-search-field-spotlight-target",
|
|
305
332
|
onClear: handleUrlClear,
|
|
@@ -313,6 +340,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
313
340
|
label: customMessages !== null && customMessages !== void 0 && customMessages.linkTextLabel ? intl.formatMessage(customMessages.linkTextLabel) : intl.formatMessage(linkTextMessages.linkTextLabel),
|
|
314
341
|
placeholder: customMessages !== null && customMessages !== void 0 && customMessages.linkTextPlaceholder ? intl.formatMessage(customMessages === null || customMessages === void 0 ? void 0 : customMessages.linkTextPlaceholder) : intl.formatMessage(linkTextMessages.linkTextPlaceholder),
|
|
315
342
|
clearLabel: intl.formatMessage(linkTextMessages.clearLinkText),
|
|
343
|
+
readOnly: isSubmitting,
|
|
316
344
|
onClear: handleClear,
|
|
317
345
|
onChange: handleChangeText
|
|
318
346
|
}), !!queryState && (isLoadingPlugins || isActivePlugin) && jsx(SearchResults, {
|
|
@@ -321,6 +349,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
321
349
|
activePlugin: activePlugin,
|
|
322
350
|
isLoadingResults: isLoadingResults,
|
|
323
351
|
isLoadingPlugins: isLoadingPlugins,
|
|
352
|
+
isSubmitting: isSubmitting,
|
|
324
353
|
linkSearchListId: linkSearchListId,
|
|
325
354
|
error: error,
|
|
326
355
|
featureFlags: featureFlags,
|
|
@@ -338,6 +367,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
338
367
|
items: items
|
|
339
368
|
/** If the results section appears to be loading, impact whether the submit button is disabled */,
|
|
340
369
|
isLoading: isLoadingResults || !!isLoadingPlugins,
|
|
370
|
+
isSubmitting: isSubmitting,
|
|
341
371
|
queryState: queryState,
|
|
342
372
|
url: url,
|
|
343
373
|
isEditing: isEditing,
|
|
@@ -26,6 +26,7 @@ export var SearchResults = function SearchResults(_ref) {
|
|
|
26
26
|
activePlugin = _ref.activePlugin,
|
|
27
27
|
isLoadingPlugins = _ref.isLoadingPlugins,
|
|
28
28
|
isLoadingResults = _ref.isLoadingResults,
|
|
29
|
+
isSubmitting = _ref.isSubmitting,
|
|
29
30
|
handleTabChange = _ref.handleTabChange,
|
|
30
31
|
handleSearchListOnChange = _ref.handleSearchListOnChange,
|
|
31
32
|
featureFlags = _ref.featureFlags,
|
|
@@ -67,6 +68,7 @@ export var SearchResults = function SearchResults(_ref) {
|
|
|
67
68
|
})), !error && jsx(LinkSearchList, {
|
|
68
69
|
id: linkSearchListId,
|
|
69
70
|
role: "listbox",
|
|
71
|
+
ariaReadOnly: isSubmitting,
|
|
70
72
|
items: items,
|
|
71
73
|
isLoading: isLoadingResults,
|
|
72
74
|
selectedIndex: selectedIndex,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var _excluded = ["onChange", "onSelect", "onKeyDown", "items", "activeIndex", "selectedIndex", "isLoading", "ariaControls", "ariaLabelledBy", "role", "id", "hasSearchTerm", "activePlugin"];
|
|
4
|
+
var _excluded = ["onChange", "onSelect", "onKeyDown", "items", "activeIndex", "selectedIndex", "isLoading", "ariaControls", "ariaLabelledBy", "ariaReadOnly", "role", "id", "hasSearchTerm", "activePlugin"];
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
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; }
|
|
7
7
|
/** @jsx jsx */
|
|
@@ -51,6 +51,7 @@ export var LinkSearchList = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
51
51
|
isLoading = _ref.isLoading,
|
|
52
52
|
ariaControls = _ref.ariaControls,
|
|
53
53
|
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
54
|
+
ariaReadOnly = _ref.ariaReadOnly,
|
|
54
55
|
role = _ref.role,
|
|
55
56
|
id = _ref.id,
|
|
56
57
|
hasSearchTerm = _ref.hasSearchTerm,
|
|
@@ -126,6 +127,7 @@ export var LinkSearchList = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
126
127
|
css: listStyles,
|
|
127
128
|
"aria-controls": "fabric.smartcard.linkpicker.suggested.results",
|
|
128
129
|
"aria-labelledby": testIds.resultListTitle,
|
|
130
|
+
"aria-readonly": ariaReadOnly,
|
|
129
131
|
"data-testid": testIds.searchResultList
|
|
130
132
|
}, items.map(function (item, index) {
|
|
131
133
|
return jsx(LinkSearchListItem, {
|
package/dist/esm/ui/messages-provider/lazy-messages-provider/utils/fetch-messages-for-locale.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
|
-
import messages from '../../../../i18n/en';
|
|
5
3
|
export var fetchMessagesForLocale = /*#__PURE__*/function () {
|
|
6
4
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(locale) {
|
|
7
|
-
var
|
|
5
|
+
var messages, parentLocale, _messages;
|
|
8
6
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
9
7
|
while (1) switch (_context.prev = _context.next) {
|
|
10
8
|
case 0:
|
|
@@ -12,8 +10,8 @@ export var fetchMessagesForLocale = /*#__PURE__*/function () {
|
|
|
12
10
|
_context.next = 3;
|
|
13
11
|
return import( /* webpackChunkName: "@atlaskit-internal_link-picker-i18n-[request]" */"../../../../i18n/".concat(locale.replace('-', '_')));
|
|
14
12
|
case 3:
|
|
15
|
-
|
|
16
|
-
return _context.abrupt("return",
|
|
13
|
+
messages = _context.sent;
|
|
14
|
+
return _context.abrupt("return", messages.default);
|
|
17
15
|
case 7:
|
|
18
16
|
_context.prev = 7;
|
|
19
17
|
_context.t0 = _context["catch"](0);
|
|
@@ -23,20 +21,12 @@ export var fetchMessagesForLocale = /*#__PURE__*/function () {
|
|
|
23
21
|
_context.next = 13;
|
|
24
22
|
return import( /* webpackChunkName: "@atlaskit-internal_link-picker-i18n-[request]" */"../../../../i18n/".concat(parentLocale));
|
|
25
23
|
case 13:
|
|
26
|
-
|
|
27
|
-
return _context.abrupt("return",
|
|
24
|
+
_messages = _context.sent;
|
|
25
|
+
return _context.abrupt("return", _messages.default);
|
|
28
26
|
case 17:
|
|
29
27
|
_context.prev = 17;
|
|
30
28
|
_context.t1 = _context["catch"](9);
|
|
31
29
|
case 19:
|
|
32
|
-
if (!getBooleanFF('platform.linking-platform.link-create.tmp-fix-translations')) {
|
|
33
|
-
_context.next = 21;
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
return _context.abrupt("return");
|
|
37
|
-
case 21:
|
|
38
|
-
return _context.abrupt("return", messages);
|
|
39
|
-
case 22:
|
|
40
30
|
case "end":
|
|
41
31
|
return _context.stop();
|
|
42
32
|
}
|
|
@@ -2,16 +2,41 @@
|
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import { MessageDescriptor } from 'react-intl-next';
|
|
4
4
|
import { LinkPickerPluginAction, LinkPickerState, LinkSearchListItemData } from '../../../common/types';
|
|
5
|
+
export declare const messages: {
|
|
6
|
+
cancelButton: {
|
|
7
|
+
id: string;
|
|
8
|
+
defaultMessage: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
saveButton: {
|
|
12
|
+
id: string;
|
|
13
|
+
defaultMessage: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
insertButton: {
|
|
17
|
+
id: string;
|
|
18
|
+
defaultMessage: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
submittingStatusMessage: {
|
|
22
|
+
id: string;
|
|
23
|
+
defaultMessage: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
5
27
|
export declare const testIds: {
|
|
6
28
|
readonly insertButton: "link-picker-insert-button";
|
|
7
29
|
readonly cancelButton: "link-picker-cancel-button";
|
|
8
30
|
readonly actionButton: "link-picker-action-button";
|
|
31
|
+
readonly submitStatusA11yIndicator: "link-picker-submit-status-a11y-indicator";
|
|
9
32
|
/** Feature discovery for action button (css pulse) */
|
|
10
33
|
readonly actionButtonDiscovery: "link-picker-action-button-discovery";
|
|
11
34
|
};
|
|
12
35
|
interface FormFooterProps extends React.HTMLAttributes<HTMLElement> {
|
|
13
36
|
/** If the results section appears to be loading, impact whether the submit button is disabled */
|
|
14
37
|
isLoading: boolean;
|
|
38
|
+
/** Controls showing a "submission in-progres" UX */
|
|
39
|
+
isSubmitting?: boolean;
|
|
15
40
|
error: unknown | null;
|
|
16
41
|
url: string;
|
|
17
42
|
queryState: LinkPickerState | null;
|
|
@@ -22,5 +47,5 @@ interface FormFooterProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
22
47
|
createFeatureDiscovery?: boolean;
|
|
23
48
|
customSubmitButtonLabel?: MessageDescriptor;
|
|
24
49
|
}
|
|
25
|
-
export declare const FormFooter: import("react").MemoExoticComponent<({ isLoading, error, url, queryState, items, isEditing, onCancel, action, createFeatureDiscovery, customSubmitButtonLabel, ...restProps }: FormFooterProps) => jsx.JSX.Element | null>;
|
|
50
|
+
export declare const FormFooter: import("react").MemoExoticComponent<({ isLoading, isSubmitting, error, url, queryState, items, isEditing, onCancel, action, createFeatureDiscovery, customSubmitButtonLabel, ...restProps }: FormFooterProps) => jsx.JSX.Element | null>;
|
|
26
51
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { LinkPickerState, LinkSearchListItemData } from '../../../common/types';
|
|
2
|
-
export declare const checkSubmitDisabled: (isLoading: boolean, error: unknown | null, url: string, queryState: LinkPickerState | null, items: LinkSearchListItemData[] | null) => boolean;
|
|
2
|
+
export declare const checkSubmitDisabled: (isLoading: boolean, isSubmitting: boolean, error: unknown | null, url: string, queryState: LinkPickerState | null, items: LinkSearchListItemData[] | null) => boolean;
|
|
@@ -8,6 +8,7 @@ export declare const testIds: {
|
|
|
8
8
|
readonly insertButton: "link-picker-insert-button";
|
|
9
9
|
readonly cancelButton: "link-picker-cancel-button";
|
|
10
10
|
readonly actionButton: "link-picker-action-button";
|
|
11
|
+
readonly submitStatusA11yIndicator: "link-picker-submit-status-a11y-indicator";
|
|
11
12
|
readonly actionButtonDiscovery: "link-picker-action-button-discovery";
|
|
12
13
|
readonly tabsLoadingIndicator: string;
|
|
13
14
|
readonly tabList: string;
|
|
@@ -81,6 +82,8 @@ export interface LinkPickerProps {
|
|
|
81
82
|
/** Allows for customisation of text in the link picker. */
|
|
82
83
|
customMessages?: CustomLinkPickerMessages;
|
|
83
84
|
featureFlags?: Record<string, unknown>;
|
|
85
|
+
/** Controls showing a "submission in-progres" UX */
|
|
86
|
+
isSubmitting?: boolean;
|
|
84
87
|
}
|
|
85
88
|
type CustomLinkPickerMessages = {
|
|
86
89
|
/** Label for the link input field */
|
|
@@ -21,6 +21,7 @@ export type SearchResultsProps = {
|
|
|
21
21
|
}[];
|
|
22
22
|
isLoadingPlugins?: boolean;
|
|
23
23
|
isLoadingResults: boolean;
|
|
24
|
+
isSubmitting?: boolean;
|
|
24
25
|
activeTab: number;
|
|
25
26
|
handleTabChange: (activeTab: number) => void;
|
|
26
27
|
handleSearchListOnChange: (id: string) => void;
|
|
@@ -37,4 +38,4 @@ export type SearchResultsProps = {
|
|
|
37
38
|
error?: unknown;
|
|
38
39
|
retry: () => void;
|
|
39
40
|
};
|
|
40
|
-
export declare const SearchResults: ({ tabs, activeTab, activePlugin, isLoadingPlugins, isLoadingResults, handleTabChange, handleSearchListOnChange, featureFlags, linkSearchListId, error, queryState, items, activeIndex, selectedIndex, handleSelected, handleKeyDown, retry, }: SearchResultsProps) => jsx.JSX.Element;
|
|
41
|
+
export declare const SearchResults: ({ tabs, activeTab, activePlugin, isLoadingPlugins, isLoadingResults, isSubmitting, handleTabChange, handleSearchListOnChange, featureFlags, linkSearchListId, error, queryState, items, activeIndex, selectedIndex, handleSelected, handleKeyDown, retry, }: SearchResultsProps) => jsx.JSX.Element;
|
|
@@ -38,6 +38,7 @@ export interface LinkSearchListProps extends Omit<React.HTMLAttributes<LinkSearc
|
|
|
38
38
|
onKeyDown?: (e: KeyboardEvent<LinkSearchListElement>) => void;
|
|
39
39
|
ariaControls?: string;
|
|
40
40
|
ariaLabelledBy?: string;
|
|
41
|
+
ariaReadOnly?: boolean;
|
|
41
42
|
role?: string;
|
|
42
43
|
id?: string;
|
|
43
44
|
hasSearchTerm?: boolean;
|
|
@@ -2,16 +2,41 @@
|
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import { MessageDescriptor } from 'react-intl-next';
|
|
4
4
|
import { LinkPickerPluginAction, LinkPickerState, LinkSearchListItemData } from '../../../common/types';
|
|
5
|
+
export declare const messages: {
|
|
6
|
+
cancelButton: {
|
|
7
|
+
id: string;
|
|
8
|
+
defaultMessage: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
saveButton: {
|
|
12
|
+
id: string;
|
|
13
|
+
defaultMessage: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
insertButton: {
|
|
17
|
+
id: string;
|
|
18
|
+
defaultMessage: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
submittingStatusMessage: {
|
|
22
|
+
id: string;
|
|
23
|
+
defaultMessage: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
5
27
|
export declare const testIds: {
|
|
6
28
|
readonly insertButton: "link-picker-insert-button";
|
|
7
29
|
readonly cancelButton: "link-picker-cancel-button";
|
|
8
30
|
readonly actionButton: "link-picker-action-button";
|
|
31
|
+
readonly submitStatusA11yIndicator: "link-picker-submit-status-a11y-indicator";
|
|
9
32
|
/** Feature discovery for action button (css pulse) */
|
|
10
33
|
readonly actionButtonDiscovery: "link-picker-action-button-discovery";
|
|
11
34
|
};
|
|
12
35
|
interface FormFooterProps extends React.HTMLAttributes<HTMLElement> {
|
|
13
36
|
/** If the results section appears to be loading, impact whether the submit button is disabled */
|
|
14
37
|
isLoading: boolean;
|
|
38
|
+
/** Controls showing a "submission in-progres" UX */
|
|
39
|
+
isSubmitting?: boolean;
|
|
15
40
|
error: unknown | null;
|
|
16
41
|
url: string;
|
|
17
42
|
queryState: LinkPickerState | null;
|
|
@@ -22,5 +47,5 @@ interface FormFooterProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
22
47
|
createFeatureDiscovery?: boolean;
|
|
23
48
|
customSubmitButtonLabel?: MessageDescriptor;
|
|
24
49
|
}
|
|
25
|
-
export declare const FormFooter: import("react").MemoExoticComponent<({ isLoading, error, url, queryState, items, isEditing, onCancel, action, createFeatureDiscovery, customSubmitButtonLabel, ...restProps }: FormFooterProps) => jsx.JSX.Element | null>;
|
|
50
|
+
export declare const FormFooter: import("react").MemoExoticComponent<({ isLoading, isSubmitting, error, url, queryState, items, isEditing, onCancel, action, createFeatureDiscovery, customSubmitButtonLabel, ...restProps }: FormFooterProps) => jsx.JSX.Element | null>;
|
|
26
51
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { LinkPickerState, LinkSearchListItemData } from '../../../common/types';
|
|
2
|
-
export declare const checkSubmitDisabled: (isLoading: boolean, error: unknown | null, url: string, queryState: LinkPickerState | null, items: LinkSearchListItemData[] | null) => boolean;
|
|
2
|
+
export declare const checkSubmitDisabled: (isLoading: boolean, isSubmitting: boolean, error: unknown | null, url: string, queryState: LinkPickerState | null, items: LinkSearchListItemData[] | null) => boolean;
|
|
@@ -8,6 +8,7 @@ export declare const testIds: {
|
|
|
8
8
|
readonly insertButton: "link-picker-insert-button";
|
|
9
9
|
readonly cancelButton: "link-picker-cancel-button";
|
|
10
10
|
readonly actionButton: "link-picker-action-button";
|
|
11
|
+
readonly submitStatusA11yIndicator: "link-picker-submit-status-a11y-indicator";
|
|
11
12
|
readonly actionButtonDiscovery: "link-picker-action-button-discovery";
|
|
12
13
|
readonly tabsLoadingIndicator: string;
|
|
13
14
|
readonly tabList: string;
|
|
@@ -81,6 +82,8 @@ export interface LinkPickerProps {
|
|
|
81
82
|
/** Allows for customisation of text in the link picker. */
|
|
82
83
|
customMessages?: CustomLinkPickerMessages;
|
|
83
84
|
featureFlags?: Record<string, unknown>;
|
|
85
|
+
/** Controls showing a "submission in-progres" UX */
|
|
86
|
+
isSubmitting?: boolean;
|
|
84
87
|
}
|
|
85
88
|
type CustomLinkPickerMessages = {
|
|
86
89
|
/** Label for the link input field */
|
|
@@ -21,6 +21,7 @@ export type SearchResultsProps = {
|
|
|
21
21
|
}[];
|
|
22
22
|
isLoadingPlugins?: boolean;
|
|
23
23
|
isLoadingResults: boolean;
|
|
24
|
+
isSubmitting?: boolean;
|
|
24
25
|
activeTab: number;
|
|
25
26
|
handleTabChange: (activeTab: number) => void;
|
|
26
27
|
handleSearchListOnChange: (id: string) => void;
|
|
@@ -37,4 +38,4 @@ export type SearchResultsProps = {
|
|
|
37
38
|
error?: unknown;
|
|
38
39
|
retry: () => void;
|
|
39
40
|
};
|
|
40
|
-
export declare const SearchResults: ({ tabs, activeTab, activePlugin, isLoadingPlugins, isLoadingResults, handleTabChange, handleSearchListOnChange, featureFlags, linkSearchListId, error, queryState, items, activeIndex, selectedIndex, handleSelected, handleKeyDown, retry, }: SearchResultsProps) => jsx.JSX.Element;
|
|
41
|
+
export declare const SearchResults: ({ tabs, activeTab, activePlugin, isLoadingPlugins, isLoadingResults, isSubmitting, handleTabChange, handleSearchListOnChange, featureFlags, linkSearchListId, error, queryState, items, activeIndex, selectedIndex, handleSelected, handleKeyDown, retry, }: SearchResultsProps) => jsx.JSX.Element;
|
|
@@ -38,6 +38,7 @@ export interface LinkSearchListProps extends Omit<React.HTMLAttributes<LinkSearc
|
|
|
38
38
|
onKeyDown?: (e: KeyboardEvent<LinkSearchListElement>) => void;
|
|
39
39
|
ariaControls?: string;
|
|
40
40
|
ariaLabelledBy?: string;
|
|
41
|
+
ariaReadOnly?: boolean;
|
|
41
42
|
role?: string;
|
|
42
43
|
id?: string;
|
|
43
44
|
hasSearchTerm?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-picker",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.1",
|
|
4
4
|
"description": "Standalone link picker",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"platform.linking-platform.link-picker.enable-jira-create": {
|
|
51
51
|
"type": "boolean"
|
|
52
52
|
},
|
|
53
|
-
"platform.linking-platform.link-
|
|
53
|
+
"platform.linking-platform.link-picker.use-onsubmitcapture": {
|
|
54
54
|
"type": "boolean"
|
|
55
55
|
}
|
|
56
56
|
},
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"@atlaskit/dropdown-menu": "^12.1.0",
|
|
97
97
|
"@atlaskit/link-provider": "^1.6.0",
|
|
98
98
|
"@atlaskit/link-test-helpers": "^6.2.0",
|
|
99
|
-
"@atlaskit/primitives": "^1.
|
|
99
|
+
"@atlaskit/primitives": "^1.17.0",
|
|
100
100
|
"@atlaskit/visual-regression": "*",
|
|
101
101
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
102
102
|
"@atlassian/feature-flags-test-utils": "*",
|