@atlaskit/link-picker 1.42.5 → 1.43.0
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 +10 -0
- package/dist/cjs/ui/link-picker/form-footer/index.js +15 -26
- package/dist/cjs/ui/link-picker/form-footer/link-picker-submit-button/index.js +52 -0
- package/dist/cjs/ui/link-picker/index.js +32 -3
- package/dist/cjs/ui/main.js +1 -1
- package/dist/es2019/ui/link-picker/form-footer/index.js +15 -24
- package/dist/es2019/ui/link-picker/form-footer/link-picker-submit-button/index.js +45 -0
- package/dist/es2019/ui/link-picker/index.js +30 -4
- package/dist/es2019/ui/main.js +1 -1
- package/dist/esm/ui/link-picker/form-footer/index.js +16 -27
- package/dist/esm/ui/link-picker/form-footer/link-picker-submit-button/index.js +44 -0
- package/dist/esm/ui/link-picker/index.js +33 -4
- package/dist/esm/ui/main.js +1 -1
- package/dist/types/common/types.d.ts +6 -0
- package/dist/types/ui/link-picker/form-footer/index.d.ts +3 -11
- package/dist/types/ui/link-picker/form-footer/link-picker-submit-button/index.d.ts +33 -0
- package/dist/{types-ts4.5/ui/link-picker/form-footer → types/ui/link-picker/form-footer/link-picker-submit-button}/utils.d.ts +1 -1
- package/dist/types-ts4.5/common/types.d.ts +6 -0
- package/dist/types-ts4.5/ui/link-picker/form-footer/index.d.ts +3 -11
- package/dist/types-ts4.5/ui/link-picker/form-footer/link-picker-submit-button/index.d.ts +33 -0
- package/dist/{types/ui/link-picker/form-footer → types-ts4.5/ui/link-picker/form-footer/link-picker-submit-button}/utils.d.ts +1 -1
- package/package.json +1 -1
- /package/dist/cjs/ui/link-picker/form-footer/{utils.js → link-picker-submit-button/utils.js} +0 -0
- /package/dist/es2019/ui/link-picker/form-footer/{utils.js → link-picker-submit-button/utils.js} +0 -0
- /package/dist/esm/ui/link-picker/form-footer/{utils.js → link-picker-submit-button/utils.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/link-picker
|
|
2
2
|
|
|
3
|
+
## 1.43.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#131465](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/131465)
|
|
8
|
+
[`df8ea6dec9bdc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/df8ea6dec9bdc) -
|
|
9
|
+
[ux] Added in a new temporary prop, UNSAFE_moveSubmitButton, to the LinkPicker. This prop moves
|
|
10
|
+
the submit button below the input field and is only to be used in an experiment being run within
|
|
11
|
+
Confluence.
|
|
12
|
+
|
|
3
13
|
## 1.42.5
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -11,16 +11,14 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
var _react = require("react");
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
13
|
var _reactIntlNext = require("react-intl-next");
|
|
14
|
-
var _uuid = _interopRequireDefault(require("uuid"));
|
|
15
14
|
var _button = _interopRequireWildcard(require("@atlaskit/button"));
|
|
16
|
-
var _loadingButton = _interopRequireDefault(require("@atlaskit/button/loading-button"));
|
|
17
15
|
var _add = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/add"));
|
|
18
16
|
var _add2 = _interopRequireDefault(require("@atlaskit/icon/utility/add"));
|
|
19
17
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
20
18
|
var _errors = require("../../../common/utils/errors");
|
|
21
19
|
var _featureDiscovery = _interopRequireDefault(require("./feature-discovery"));
|
|
22
|
-
var
|
|
23
|
-
var _excluded = ["isLoading", "isSubmitting", "error", "url", "queryState", "items", "isEditing", "onCancel", "action", "createFeatureDiscovery", "customSubmitButtonLabel"];
|
|
20
|
+
var _linkPickerSubmitButton = require("./link-picker-submit-button");
|
|
21
|
+
var _excluded = ["isLoading", "isSubmitting", "error", "url", "queryState", "items", "isEditing", "onCancel", "action", "createFeatureDiscovery", "customSubmitButtonLabel", "submitMessageId", "hideSubmitButton"];
|
|
24
22
|
/**
|
|
25
23
|
* @jsxRuntime classic
|
|
26
24
|
* @jsx jsx
|
|
@@ -41,16 +39,6 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
|
41
39
|
defaultMessage: 'Cancel',
|
|
42
40
|
description: 'Button to cancel and dismiss the link picker'
|
|
43
41
|
},
|
|
44
|
-
saveButton: {
|
|
45
|
-
id: 'fabric.linkPicker.button.save',
|
|
46
|
-
defaultMessage: 'Save',
|
|
47
|
-
description: 'Button to save edited link'
|
|
48
|
-
},
|
|
49
|
-
insertButton: {
|
|
50
|
-
id: 'fabric.linkPicker.button.insert',
|
|
51
|
-
defaultMessage: 'Insert',
|
|
52
|
-
description: 'Button to insert searched or selected link'
|
|
53
|
-
},
|
|
54
42
|
submittingStatusMessage: {
|
|
55
43
|
id: 'fabric.linkPicker.status.submitting',
|
|
56
44
|
defaultMessage: 'Submitting',
|
|
@@ -79,16 +67,13 @@ var FormFooter = exports.FormFooter = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
79
67
|
_ref$createFeatureDis = _ref.createFeatureDiscovery,
|
|
80
68
|
createFeatureDiscovery = _ref$createFeatureDis === void 0 ? false : _ref$createFeatureDis,
|
|
81
69
|
customSubmitButtonLabel = _ref.customSubmitButtonLabel,
|
|
70
|
+
submitMessageId = _ref.submitMessageId,
|
|
71
|
+
hideSubmitButton = _ref.hideSubmitButton,
|
|
82
72
|
restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
83
73
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
84
|
-
var submitMessageId = (0, _react.useMemo)(function () {
|
|
85
|
-
return (0, _uuid.default)();
|
|
86
|
-
}, []);
|
|
87
74
|
if (error && error instanceof _errors.UnauthenticatedError) {
|
|
88
75
|
return null;
|
|
89
76
|
}
|
|
90
|
-
var isSubmitDisabled = (0, _utils.checkSubmitDisabled)(isLoading, isSubmitting, error, url, queryState, items);
|
|
91
|
-
var insertButtonMsg = isEditing ? messages.saveButton : messages.insertButton;
|
|
92
77
|
var createButton = function createButton(pluginAction) {
|
|
93
78
|
return (0, _react2.jsx)(_button.default, {
|
|
94
79
|
testId: testIds.actionButton,
|
|
@@ -120,12 +105,16 @@ var FormFooter = exports.FormFooter = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
120
105
|
testId: testIds.cancelButton,
|
|
121
106
|
isDisabled: isSubmitting,
|
|
122
107
|
"aria-labelledby": isSubmitting ? submitMessageId : undefined
|
|
123
|
-
}, intl.formatMessage(messages.cancelButton)), (0, _react2.jsx)(
|
|
124
|
-
|
|
125
|
-
|
|
108
|
+
}, intl.formatMessage(messages.cancelButton)), !hideSubmitButton && (0, _react2.jsx)(_linkPickerSubmitButton.LinkPickerSubmitButton, {
|
|
109
|
+
isEditing: isEditing,
|
|
110
|
+
isLoading: isLoading,
|
|
111
|
+
isSubmitting: isSubmitting,
|
|
112
|
+
customSubmitButtonLabel: customSubmitButtonLabel,
|
|
113
|
+
error: error,
|
|
114
|
+
items: items,
|
|
115
|
+
queryState: queryState,
|
|
116
|
+
submitMessageId: submitMessageId,
|
|
126
117
|
testId: testIds.insertButton,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
isLoading: isSubmitting
|
|
130
|
-
}, customSubmitButtonLabel ? intl.formatMessage(customSubmitButtonLabel) : intl.formatMessage(insertButtonMsg))));
|
|
118
|
+
url: url
|
|
119
|
+
})));
|
|
131
120
|
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.messages = exports.LinkPickerSubmitButton = void 0;
|
|
8
|
+
var _react = require("@emotion/react");
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _loadingButton = _interopRequireDefault(require("@atlaskit/button/loading-button"));
|
|
11
|
+
var _utils = require("./utils");
|
|
12
|
+
/**
|
|
13
|
+
* @jsxRuntime classic
|
|
14
|
+
* @jsx jsx
|
|
15
|
+
*/
|
|
16
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
17
|
+
|
|
18
|
+
var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
19
|
+
saveButton: {
|
|
20
|
+
id: 'fabric.linkPicker.button.save',
|
|
21
|
+
defaultMessage: 'Save',
|
|
22
|
+
description: 'Button to save edited link'
|
|
23
|
+
},
|
|
24
|
+
insertButton: {
|
|
25
|
+
id: 'fabric.linkPicker.button.insert',
|
|
26
|
+
defaultMessage: 'Insert',
|
|
27
|
+
description: 'Button to insert searched or selected link'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var LinkPickerSubmitButton = exports.LinkPickerSubmitButton = function LinkPickerSubmitButton(_ref) {
|
|
31
|
+
var isEditing = _ref.isEditing,
|
|
32
|
+
isLoading = _ref.isLoading,
|
|
33
|
+
isSubmitting = _ref.isSubmitting,
|
|
34
|
+
customSubmitButtonLabel = _ref.customSubmitButtonLabel,
|
|
35
|
+
error = _ref.error,
|
|
36
|
+
items = _ref.items,
|
|
37
|
+
queryState = _ref.queryState,
|
|
38
|
+
submitMessageId = _ref.submitMessageId,
|
|
39
|
+
testId = _ref.testId,
|
|
40
|
+
url = _ref.url;
|
|
41
|
+
var intl = (0, _reactIntlNext.useIntl)();
|
|
42
|
+
var insertButtonMsg = isEditing ? messages.saveButton : messages.insertButton;
|
|
43
|
+
var isSubmitDisabled = (0, _utils.checkSubmitDisabled)(isLoading, isSubmitting, error, url, queryState, items);
|
|
44
|
+
return (0, _react.jsx)(_loadingButton.default, {
|
|
45
|
+
type: "submit",
|
|
46
|
+
appearance: "primary",
|
|
47
|
+
testId: testId,
|
|
48
|
+
isDisabled: isSubmitDisabled,
|
|
49
|
+
"aria-labelledby": isSubmitting ? submitMessageId : undefined,
|
|
50
|
+
isLoading: isSubmitting
|
|
51
|
+
}, customSubmitButtonLabel ? intl.formatMessage(customSubmitButtonLabel) : intl.formatMessage(insertButtonMsg));
|
|
52
|
+
};
|
|
@@ -11,10 +11,12 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
var _react = require("react");
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
13
|
var _reactIntlNext = require("react-intl-next");
|
|
14
|
+
var _uuid = _interopRequireDefault(require("uuid"));
|
|
14
15
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
15
16
|
var _url2 = require("@atlaskit/linking-common/url");
|
|
16
17
|
var _userAgent = require("@atlaskit/linking-common/user-agent");
|
|
17
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
|
+
var _primitives = require("@atlaskit/primitives");
|
|
18
20
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
19
21
|
var _analytics = require("../../common/analytics");
|
|
20
22
|
var _constants = require("../../common/constants");
|
|
@@ -24,6 +26,7 @@ var _usePlugins2 = require("../../services/use-plugins");
|
|
|
24
26
|
var _useSearchQuery = require("../../services/use-search-query");
|
|
25
27
|
var _announcer = require("./announcer");
|
|
26
28
|
var _formFooter = require("./form-footer");
|
|
29
|
+
var _linkPickerSubmitButton = require("./form-footer/link-picker-submit-button");
|
|
27
30
|
var _messages = require("./messages");
|
|
28
31
|
var _searchResults = require("./search-results");
|
|
29
32
|
var _styled = require("./styled");
|
|
@@ -52,6 +55,11 @@ var initState = {
|
|
|
52
55
|
/** This only allows the feature discovery pulse - to be shown the ff must be on and active tab be Jira */
|
|
53
56
|
allowCreateFeatureDiscovery: true
|
|
54
57
|
};
|
|
58
|
+
var FullWidthSubmitButtonStyles = (0, _primitives.xcss)({
|
|
59
|
+
marginTop: 'space.200',
|
|
60
|
+
display: 'flex',
|
|
61
|
+
flexDirection: 'column'
|
|
62
|
+
});
|
|
55
63
|
function reducer(state, payload) {
|
|
56
64
|
if (payload.url && state.url !== payload.url) {
|
|
57
65
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -92,7 +100,9 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
92
100
|
featureFlags = _ref.featureFlags,
|
|
93
101
|
customMessages = _ref.customMessages,
|
|
94
102
|
_ref$isSubmitting = _ref.isSubmitting,
|
|
95
|
-
isSubmitting = _ref$isSubmitting === void 0 ? false : _ref$isSubmitting
|
|
103
|
+
isSubmitting = _ref$isSubmitting === void 0 ? false : _ref$isSubmitting,
|
|
104
|
+
_ref$UNSAFE_moveSubmi = _ref.UNSAFE_moveSubmitButton,
|
|
105
|
+
UNSAFE_moveSubmitButton = _ref$UNSAFE_moveSubmi === void 0 ? false : _ref$UNSAFE_moveSubmi;
|
|
96
106
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
97
107
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
98
108
|
var _useReducer = (0, _react.useReducer)(reducer, _objectSpread(_objectSpread({}, initState), {}, {
|
|
@@ -126,6 +136,9 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
126
136
|
var _useLinkPickerAnalyti = (0, _analytics.useLinkPickerAnalytics)(),
|
|
127
137
|
trackAttribute = _useLinkPickerAnalyti.trackAttribute,
|
|
128
138
|
getAttributes = _useLinkPickerAnalyti.getAttributes;
|
|
139
|
+
var submitMessageId = (0, _react.useMemo)(function () {
|
|
140
|
+
return (0, _uuid.default)();
|
|
141
|
+
}, []);
|
|
129
142
|
(0, _react.useLayoutEffect)(function () {
|
|
130
143
|
if (onContentResize) {
|
|
131
144
|
onContentResize();
|
|
@@ -316,6 +329,7 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
316
329
|
// as the Aria design pattern for combobox does not work in this case
|
|
317
330
|
// for details: https://a11y-internal.atlassian.net/browse/AK-740
|
|
318
331
|
var screenReaderText = (0, _userAgent.browser)().safari && (0, _utils.getScreenReaderText)(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
|
|
332
|
+
var customSubmitButtonLabel = customMessages !== null && customMessages !== void 0 && customMessages.submitButtonLabel ? customMessages.submitButtonLabel : undefined;
|
|
319
333
|
return (0, _react2.jsx)("form", {
|
|
320
334
|
"data-testid": testIds.linkPicker
|
|
321
335
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -358,7 +372,20 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
358
372
|
readOnly: isSubmitting,
|
|
359
373
|
onClear: handleClear,
|
|
360
374
|
onChange: handleChangeText
|
|
361
|
-
}),
|
|
375
|
+
}), UNSAFE_moveSubmitButton && (0, _react2.jsx)(_primitives.Box, {
|
|
376
|
+
xcss: FullWidthSubmitButtonStyles
|
|
377
|
+
}, (0, _react2.jsx)(_linkPickerSubmitButton.LinkPickerSubmitButton, {
|
|
378
|
+
isEditing: isEditing,
|
|
379
|
+
isLoading: isLoadingResults || !!isLoadingPlugins,
|
|
380
|
+
isSubmitting: isSubmitting,
|
|
381
|
+
customSubmitButtonLabel: customSubmitButtonLabel,
|
|
382
|
+
error: error,
|
|
383
|
+
items: items,
|
|
384
|
+
queryState: queryState,
|
|
385
|
+
submitMessageId: submitMessageId,
|
|
386
|
+
testId: testIds.insertButton,
|
|
387
|
+
url: url
|
|
388
|
+
})), !!queryState && (isLoadingPlugins || isActivePlugin) && (0, _react2.jsx)(_searchResults.SearchResults, {
|
|
362
389
|
activeTab: activeTab,
|
|
363
390
|
tabs: tabs,
|
|
364
391
|
activePlugin: activePlugin,
|
|
@@ -394,6 +421,8 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
394
421
|
/* Show the feature discovery pulse when we're on the Jira tab, we haven't started typing a url and
|
|
395
422
|
the feature flag is enabled */,
|
|
396
423
|
createFeatureDiscovery: (activePlugin === null || activePlugin === void 0 ? void 0 : activePlugin.tabKey) === 'jira' && allowCreateFeatureDiscovery && (0, _platformFeatureFlags.fg)('platform.linking-platform.link-picker.enable-jira-create'),
|
|
397
|
-
customSubmitButtonLabel:
|
|
424
|
+
customSubmitButtonLabel: customSubmitButtonLabel,
|
|
425
|
+
submitMessageId: submitMessageId,
|
|
426
|
+
hideSubmitButton: UNSAFE_moveSubmitButton
|
|
398
427
|
}));
|
|
399
428
|
}));
|
package/dist/cjs/ui/main.js
CHANGED
|
@@ -32,7 +32,7 @@ var testIds = exports.testIds = {
|
|
|
32
32
|
};
|
|
33
33
|
var PACKAGE_DATA = exports.PACKAGE_DATA = {
|
|
34
34
|
packageName: "@atlaskit/link-picker" || '',
|
|
35
|
-
packageVersion: "1.
|
|
35
|
+
packageVersion: "1.43.0" || '',
|
|
36
36
|
componentName: _constants.COMPONENT_NAME,
|
|
37
37
|
source: _constants.COMPONENT_NAME
|
|
38
38
|
};
|
|
@@ -3,20 +3,18 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
* @jsxRuntime classic
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
|
-
import { memo
|
|
6
|
+
import { memo } from 'react';
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { defineMessages, useIntl } from 'react-intl-next';
|
|
11
|
-
import uuid from 'uuid';
|
|
12
11
|
import Button, { ButtonGroup } from '@atlaskit/button';
|
|
13
|
-
import LoadingButton from '@atlaskit/button/loading-button';
|
|
14
12
|
import EditorAddIconLegacy from '@atlaskit/icon/glyph/editor/add';
|
|
15
13
|
import EditorAddIcon from '@atlaskit/icon/utility/add';
|
|
16
14
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
17
15
|
import { UnauthenticatedError } from '../../../common/utils/errors';
|
|
18
16
|
import FeatureDiscovery from './feature-discovery';
|
|
19
|
-
import {
|
|
17
|
+
import { LinkPickerSubmitButton } from './link-picker-submit-button';
|
|
20
18
|
const formFooterStyles = css({
|
|
21
19
|
display: 'flex',
|
|
22
20
|
justifyContent: 'flex-end'
|
|
@@ -30,16 +28,6 @@ export const messages = defineMessages({
|
|
|
30
28
|
defaultMessage: 'Cancel',
|
|
31
29
|
description: 'Button to cancel and dismiss the link picker'
|
|
32
30
|
},
|
|
33
|
-
saveButton: {
|
|
34
|
-
id: 'fabric.linkPicker.button.save',
|
|
35
|
-
defaultMessage: 'Save',
|
|
36
|
-
description: 'Button to save edited link'
|
|
37
|
-
},
|
|
38
|
-
insertButton: {
|
|
39
|
-
id: 'fabric.linkPicker.button.insert',
|
|
40
|
-
defaultMessage: 'Insert',
|
|
41
|
-
description: 'Button to insert searched or selected link'
|
|
42
|
-
},
|
|
43
31
|
submittingStatusMessage: {
|
|
44
32
|
id: 'fabric.linkPicker.status.submitting',
|
|
45
33
|
defaultMessage: 'Submitting',
|
|
@@ -66,15 +54,14 @@ export const FormFooter = /*#__PURE__*/memo(({
|
|
|
66
54
|
action,
|
|
67
55
|
createFeatureDiscovery = false,
|
|
68
56
|
customSubmitButtonLabel,
|
|
57
|
+
submitMessageId,
|
|
58
|
+
hideSubmitButton,
|
|
69
59
|
...restProps
|
|
70
60
|
}) => {
|
|
71
61
|
const intl = useIntl();
|
|
72
|
-
const submitMessageId = useMemo(() => uuid(), []);
|
|
73
62
|
if (error && error instanceof UnauthenticatedError) {
|
|
74
63
|
return null;
|
|
75
64
|
}
|
|
76
|
-
const isSubmitDisabled = checkSubmitDisabled(isLoading, isSubmitting, error, url, queryState, items);
|
|
77
|
-
const insertButtonMsg = isEditing ? messages.saveButton : messages.insertButton;
|
|
78
65
|
const createButton = pluginAction => jsx(Button, {
|
|
79
66
|
testId: testIds.actionButton,
|
|
80
67
|
onClick: pluginAction.callback,
|
|
@@ -104,12 +91,16 @@ export const FormFooter = /*#__PURE__*/memo(({
|
|
|
104
91
|
testId: testIds.cancelButton,
|
|
105
92
|
isDisabled: isSubmitting,
|
|
106
93
|
"aria-labelledby": isSubmitting ? submitMessageId : undefined
|
|
107
|
-
}, intl.formatMessage(messages.cancelButton)), jsx(
|
|
108
|
-
|
|
109
|
-
|
|
94
|
+
}, intl.formatMessage(messages.cancelButton)), !hideSubmitButton && jsx(LinkPickerSubmitButton, {
|
|
95
|
+
isEditing: isEditing,
|
|
96
|
+
isLoading: isLoading,
|
|
97
|
+
isSubmitting: isSubmitting,
|
|
98
|
+
customSubmitButtonLabel: customSubmitButtonLabel,
|
|
99
|
+
error: error,
|
|
100
|
+
items: items,
|
|
101
|
+
queryState: queryState,
|
|
102
|
+
submitMessageId: submitMessageId,
|
|
110
103
|
testId: testIds.insertButton,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
isLoading: isSubmitting
|
|
114
|
-
}, customSubmitButtonLabel ? intl.formatMessage(customSubmitButtonLabel) : intl.formatMessage(insertButtonMsg))));
|
|
104
|
+
url: url
|
|
105
|
+
})));
|
|
115
106
|
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
import { defineMessages, useIntl } from 'react-intl-next';
|
|
8
|
+
import LoadingButton from '@atlaskit/button/loading-button';
|
|
9
|
+
import { checkSubmitDisabled } from './utils';
|
|
10
|
+
export const messages = defineMessages({
|
|
11
|
+
saveButton: {
|
|
12
|
+
id: 'fabric.linkPicker.button.save',
|
|
13
|
+
defaultMessage: 'Save',
|
|
14
|
+
description: 'Button to save edited link'
|
|
15
|
+
},
|
|
16
|
+
insertButton: {
|
|
17
|
+
id: 'fabric.linkPicker.button.insert',
|
|
18
|
+
defaultMessage: 'Insert',
|
|
19
|
+
description: 'Button to insert searched or selected link'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export const LinkPickerSubmitButton = ({
|
|
23
|
+
isEditing,
|
|
24
|
+
isLoading,
|
|
25
|
+
isSubmitting,
|
|
26
|
+
customSubmitButtonLabel,
|
|
27
|
+
error,
|
|
28
|
+
items,
|
|
29
|
+
queryState,
|
|
30
|
+
submitMessageId,
|
|
31
|
+
testId,
|
|
32
|
+
url
|
|
33
|
+
}) => {
|
|
34
|
+
const intl = useIntl();
|
|
35
|
+
const insertButtonMsg = isEditing ? messages.saveButton : messages.insertButton;
|
|
36
|
+
const isSubmitDisabled = checkSubmitDisabled(isLoading, isSubmitting, error, url, queryState, items);
|
|
37
|
+
return jsx(LoadingButton, {
|
|
38
|
+
type: "submit",
|
|
39
|
+
appearance: "primary",
|
|
40
|
+
testId: testId,
|
|
41
|
+
isDisabled: isSubmitDisabled,
|
|
42
|
+
"aria-labelledby": isSubmitting ? submitMessageId : undefined,
|
|
43
|
+
isLoading: isSubmitting
|
|
44
|
+
}, customSubmitButtonLabel ? intl.formatMessage(customSubmitButtonLabel) : intl.formatMessage(insertButtonMsg));
|
|
45
|
+
};
|
|
@@ -3,15 +3,17 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
* @jsxRuntime classic
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
|
-
import { Fragment, memo, useCallback, useLayoutEffect, useReducer } from 'react';
|
|
6
|
+
import { Fragment, memo, useCallback, useLayoutEffect, useMemo, useReducer } from 'react';
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
10
10
|
import { FormattedMessage, useIntl } from 'react-intl-next';
|
|
11
|
+
import uuid from 'uuid';
|
|
11
12
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
12
13
|
import { isSafeUrl, normalizeUrl } from '@atlaskit/linking-common/url';
|
|
13
14
|
import { browser } from '@atlaskit/linking-common/user-agent';
|
|
14
15
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
15
17
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
16
18
|
import { useLinkPickerAnalytics, withInputFieldTracking, withLinkPickerAnalyticsContext } from '../../common/analytics';
|
|
17
19
|
import { ANALYTICS_CHANNEL } from '../../common/constants';
|
|
@@ -21,6 +23,7 @@ import { usePlugins } from '../../services/use-plugins';
|
|
|
21
23
|
import { useSearchQuery } from '../../services/use-search-query';
|
|
22
24
|
import { Announcer } from './announcer';
|
|
23
25
|
import { FormFooter, testIds as formFooterTestIds } from './form-footer';
|
|
26
|
+
import { LinkPickerSubmitButton } from './form-footer/link-picker-submit-button';
|
|
24
27
|
import { formMessages, linkMessages, linkTextMessages, searchMessages } from './messages';
|
|
25
28
|
import { SearchResults, testIds as searchTestIds } from './search-results';
|
|
26
29
|
import { formFooterMargin, rootContainerStyles } from './styled';
|
|
@@ -47,6 +50,11 @@ const initState = {
|
|
|
47
50
|
/** This only allows the feature discovery pulse - to be shown the ff must be on and active tab be Jira */
|
|
48
51
|
allowCreateFeatureDiscovery: true
|
|
49
52
|
};
|
|
53
|
+
const FullWidthSubmitButtonStyles = xcss({
|
|
54
|
+
marginTop: 'space.200',
|
|
55
|
+
display: 'flex',
|
|
56
|
+
flexDirection: 'column'
|
|
57
|
+
});
|
|
50
58
|
function reducer(state, payload) {
|
|
51
59
|
if (payload.url && state.url !== payload.url) {
|
|
52
60
|
return {
|
|
@@ -90,7 +98,8 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
90
98
|
hideDisplayText,
|
|
91
99
|
featureFlags,
|
|
92
100
|
customMessages,
|
|
93
|
-
isSubmitting = false
|
|
101
|
+
isSubmitting = false,
|
|
102
|
+
UNSAFE_moveSubmitButton = false
|
|
94
103
|
}) => {
|
|
95
104
|
const {
|
|
96
105
|
createAnalyticsEvent
|
|
@@ -128,6 +137,7 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
128
137
|
trackAttribute,
|
|
129
138
|
getAttributes
|
|
130
139
|
} = useLinkPickerAnalytics();
|
|
140
|
+
const submitMessageId = useMemo(() => uuid(), []);
|
|
131
141
|
useLayoutEffect(() => {
|
|
132
142
|
if (onContentResize) {
|
|
133
143
|
onContentResize();
|
|
@@ -320,6 +330,7 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
320
330
|
// as the Aria design pattern for combobox does not work in this case
|
|
321
331
|
// for details: https://a11y-internal.atlassian.net/browse/AK-740
|
|
322
332
|
const screenReaderText = browser().safari && getScreenReaderText(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
|
|
333
|
+
const customSubmitButtonLabel = customMessages !== null && customMessages !== void 0 && customMessages.submitButtonLabel ? customMessages.submitButtonLabel : undefined;
|
|
323
334
|
return jsx("form", {
|
|
324
335
|
"data-testid": testIds.linkPicker
|
|
325
336
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -362,7 +373,20 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
362
373
|
readOnly: isSubmitting,
|
|
363
374
|
onClear: handleClear,
|
|
364
375
|
onChange: handleChangeText
|
|
365
|
-
}),
|
|
376
|
+
}), UNSAFE_moveSubmitButton && jsx(Box, {
|
|
377
|
+
xcss: FullWidthSubmitButtonStyles
|
|
378
|
+
}, jsx(LinkPickerSubmitButton, {
|
|
379
|
+
isEditing: isEditing,
|
|
380
|
+
isLoading: isLoadingResults || !!isLoadingPlugins,
|
|
381
|
+
isSubmitting: isSubmitting,
|
|
382
|
+
customSubmitButtonLabel: customSubmitButtonLabel,
|
|
383
|
+
error: error,
|
|
384
|
+
items: items,
|
|
385
|
+
queryState: queryState,
|
|
386
|
+
submitMessageId: submitMessageId,
|
|
387
|
+
testId: testIds.insertButton,
|
|
388
|
+
url: url
|
|
389
|
+
})), !!queryState && (isLoadingPlugins || isActivePlugin) && jsx(SearchResults, {
|
|
366
390
|
activeTab: activeTab,
|
|
367
391
|
tabs: tabs,
|
|
368
392
|
activePlugin: activePlugin,
|
|
@@ -398,6 +422,8 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
398
422
|
/* Show the feature discovery pulse when we're on the Jira tab, we haven't started typing a url and
|
|
399
423
|
the feature flag is enabled */,
|
|
400
424
|
createFeatureDiscovery: (activePlugin === null || activePlugin === void 0 ? void 0 : activePlugin.tabKey) === 'jira' && allowCreateFeatureDiscovery && fg('platform.linking-platform.link-picker.enable-jira-create'),
|
|
401
|
-
customSubmitButtonLabel:
|
|
425
|
+
customSubmitButtonLabel: customSubmitButtonLabel,
|
|
426
|
+
submitMessageId: submitMessageId,
|
|
427
|
+
hideSubmitButton: UNSAFE_moveSubmitButton
|
|
402
428
|
}));
|
|
403
429
|
}));
|
package/dist/es2019/ui/main.js
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["isLoading", "isSubmitting", "error", "url", "queryState", "items", "isEditing", "onCancel", "action", "createFeatureDiscovery", "customSubmitButtonLabel"];
|
|
3
|
+
var _excluded = ["isLoading", "isSubmitting", "error", "url", "queryState", "items", "isEditing", "onCancel", "action", "createFeatureDiscovery", "customSubmitButtonLabel", "submitMessageId", "hideSubmitButton"];
|
|
4
4
|
/**
|
|
5
5
|
* @jsxRuntime classic
|
|
6
6
|
* @jsx jsx
|
|
7
7
|
*/
|
|
8
|
-
import { memo
|
|
8
|
+
import { memo } from 'react';
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
11
|
import { css, jsx } from '@emotion/react';
|
|
12
12
|
import { defineMessages, useIntl } from 'react-intl-next';
|
|
13
|
-
import uuid from 'uuid';
|
|
14
13
|
import Button, { ButtonGroup } from '@atlaskit/button';
|
|
15
|
-
import LoadingButton from '@atlaskit/button/loading-button';
|
|
16
14
|
import EditorAddIconLegacy from '@atlaskit/icon/glyph/editor/add';
|
|
17
15
|
import EditorAddIcon from '@atlaskit/icon/utility/add';
|
|
18
16
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
19
17
|
import { UnauthenticatedError } from '../../../common/utils/errors';
|
|
20
18
|
import FeatureDiscovery from './feature-discovery';
|
|
21
|
-
import {
|
|
19
|
+
import { LinkPickerSubmitButton } from './link-picker-submit-button';
|
|
22
20
|
var formFooterStyles = css({
|
|
23
21
|
display: 'flex',
|
|
24
22
|
justifyContent: 'flex-end'
|
|
@@ -32,16 +30,6 @@ export var messages = defineMessages({
|
|
|
32
30
|
defaultMessage: 'Cancel',
|
|
33
31
|
description: 'Button to cancel and dismiss the link picker'
|
|
34
32
|
},
|
|
35
|
-
saveButton: {
|
|
36
|
-
id: 'fabric.linkPicker.button.save',
|
|
37
|
-
defaultMessage: 'Save',
|
|
38
|
-
description: 'Button to save edited link'
|
|
39
|
-
},
|
|
40
|
-
insertButton: {
|
|
41
|
-
id: 'fabric.linkPicker.button.insert',
|
|
42
|
-
defaultMessage: 'Insert',
|
|
43
|
-
description: 'Button to insert searched or selected link'
|
|
44
|
-
},
|
|
45
33
|
submittingStatusMessage: {
|
|
46
34
|
id: 'fabric.linkPicker.status.submitting',
|
|
47
35
|
defaultMessage: 'Submitting',
|
|
@@ -70,16 +58,13 @@ export var FormFooter = /*#__PURE__*/memo(function (_ref) {
|
|
|
70
58
|
_ref$createFeatureDis = _ref.createFeatureDiscovery,
|
|
71
59
|
createFeatureDiscovery = _ref$createFeatureDis === void 0 ? false : _ref$createFeatureDis,
|
|
72
60
|
customSubmitButtonLabel = _ref.customSubmitButtonLabel,
|
|
61
|
+
submitMessageId = _ref.submitMessageId,
|
|
62
|
+
hideSubmitButton = _ref.hideSubmitButton,
|
|
73
63
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
74
64
|
var intl = useIntl();
|
|
75
|
-
var submitMessageId = useMemo(function () {
|
|
76
|
-
return uuid();
|
|
77
|
-
}, []);
|
|
78
65
|
if (error && error instanceof UnauthenticatedError) {
|
|
79
66
|
return null;
|
|
80
67
|
}
|
|
81
|
-
var isSubmitDisabled = checkSubmitDisabled(isLoading, isSubmitting, error, url, queryState, items);
|
|
82
|
-
var insertButtonMsg = isEditing ? messages.saveButton : messages.insertButton;
|
|
83
68
|
var createButton = function createButton(pluginAction) {
|
|
84
69
|
return jsx(Button, {
|
|
85
70
|
testId: testIds.actionButton,
|
|
@@ -111,12 +96,16 @@ export var FormFooter = /*#__PURE__*/memo(function (_ref) {
|
|
|
111
96
|
testId: testIds.cancelButton,
|
|
112
97
|
isDisabled: isSubmitting,
|
|
113
98
|
"aria-labelledby": isSubmitting ? submitMessageId : undefined
|
|
114
|
-
}, intl.formatMessage(messages.cancelButton)), jsx(
|
|
115
|
-
|
|
116
|
-
|
|
99
|
+
}, intl.formatMessage(messages.cancelButton)), !hideSubmitButton && jsx(LinkPickerSubmitButton, {
|
|
100
|
+
isEditing: isEditing,
|
|
101
|
+
isLoading: isLoading,
|
|
102
|
+
isSubmitting: isSubmitting,
|
|
103
|
+
customSubmitButtonLabel: customSubmitButtonLabel,
|
|
104
|
+
error: error,
|
|
105
|
+
items: items,
|
|
106
|
+
queryState: queryState,
|
|
107
|
+
submitMessageId: submitMessageId,
|
|
117
108
|
testId: testIds.insertButton,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
isLoading: isSubmitting
|
|
121
|
-
}, customSubmitButtonLabel ? intl.formatMessage(customSubmitButtonLabel) : intl.formatMessage(insertButtonMsg))));
|
|
109
|
+
url: url
|
|
110
|
+
})));
|
|
122
111
|
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
import { defineMessages, useIntl } from 'react-intl-next';
|
|
8
|
+
import LoadingButton from '@atlaskit/button/loading-button';
|
|
9
|
+
import { checkSubmitDisabled } from './utils';
|
|
10
|
+
export var messages = defineMessages({
|
|
11
|
+
saveButton: {
|
|
12
|
+
id: 'fabric.linkPicker.button.save',
|
|
13
|
+
defaultMessage: 'Save',
|
|
14
|
+
description: 'Button to save edited link'
|
|
15
|
+
},
|
|
16
|
+
insertButton: {
|
|
17
|
+
id: 'fabric.linkPicker.button.insert',
|
|
18
|
+
defaultMessage: 'Insert',
|
|
19
|
+
description: 'Button to insert searched or selected link'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export var LinkPickerSubmitButton = function LinkPickerSubmitButton(_ref) {
|
|
23
|
+
var isEditing = _ref.isEditing,
|
|
24
|
+
isLoading = _ref.isLoading,
|
|
25
|
+
isSubmitting = _ref.isSubmitting,
|
|
26
|
+
customSubmitButtonLabel = _ref.customSubmitButtonLabel,
|
|
27
|
+
error = _ref.error,
|
|
28
|
+
items = _ref.items,
|
|
29
|
+
queryState = _ref.queryState,
|
|
30
|
+
submitMessageId = _ref.submitMessageId,
|
|
31
|
+
testId = _ref.testId,
|
|
32
|
+
url = _ref.url;
|
|
33
|
+
var intl = useIntl();
|
|
34
|
+
var insertButtonMsg = isEditing ? messages.saveButton : messages.insertButton;
|
|
35
|
+
var isSubmitDisabled = checkSubmitDisabled(isLoading, isSubmitting, error, url, queryState, items);
|
|
36
|
+
return jsx(LoadingButton, {
|
|
37
|
+
type: "submit",
|
|
38
|
+
appearance: "primary",
|
|
39
|
+
testId: testId,
|
|
40
|
+
isDisabled: isSubmitDisabled,
|
|
41
|
+
"aria-labelledby": isSubmitting ? submitMessageId : undefined,
|
|
42
|
+
isLoading: isSubmitting
|
|
43
|
+
}, customSubmitButtonLabel ? intl.formatMessage(customSubmitButtonLabel) : intl.formatMessage(insertButtonMsg));
|
|
44
|
+
};
|
|
@@ -7,15 +7,17 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
* @jsxRuntime classic
|
|
8
8
|
* @jsx jsx
|
|
9
9
|
*/
|
|
10
|
-
import { Fragment, memo, useCallback, useLayoutEffect, useReducer } from 'react';
|
|
10
|
+
import { Fragment, memo, useCallback, useLayoutEffect, useMemo, useReducer } from 'react';
|
|
11
11
|
|
|
12
12
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
13
|
import { jsx } from '@emotion/react';
|
|
14
14
|
import { FormattedMessage, useIntl } from 'react-intl-next';
|
|
15
|
+
import uuid from 'uuid';
|
|
15
16
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
16
17
|
import { isSafeUrl, normalizeUrl } from '@atlaskit/linking-common/url';
|
|
17
18
|
import { browser } from '@atlaskit/linking-common/user-agent';
|
|
18
19
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
19
21
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
20
22
|
import { useLinkPickerAnalytics, withInputFieldTracking, withLinkPickerAnalyticsContext } from '../../common/analytics';
|
|
21
23
|
import { ANALYTICS_CHANNEL } from '../../common/constants';
|
|
@@ -25,6 +27,7 @@ import { usePlugins } from '../../services/use-plugins';
|
|
|
25
27
|
import { useSearchQuery } from '../../services/use-search-query';
|
|
26
28
|
import { Announcer } from './announcer';
|
|
27
29
|
import { FormFooter, testIds as formFooterTestIds } from './form-footer';
|
|
30
|
+
import { LinkPickerSubmitButton } from './form-footer/link-picker-submit-button';
|
|
28
31
|
import { formMessages, linkMessages, linkTextMessages, searchMessages } from './messages';
|
|
29
32
|
import { SearchResults, testIds as searchTestIds } from './search-results';
|
|
30
33
|
import { formFooterMargin, rootContainerStyles } from './styled';
|
|
@@ -48,6 +51,11 @@ var initState = {
|
|
|
48
51
|
/** This only allows the feature discovery pulse - to be shown the ff must be on and active tab be Jira */
|
|
49
52
|
allowCreateFeatureDiscovery: true
|
|
50
53
|
};
|
|
54
|
+
var FullWidthSubmitButtonStyles = xcss({
|
|
55
|
+
marginTop: 'space.200',
|
|
56
|
+
display: 'flex',
|
|
57
|
+
flexDirection: 'column'
|
|
58
|
+
});
|
|
51
59
|
function reducer(state, payload) {
|
|
52
60
|
if (payload.url && state.url !== payload.url) {
|
|
53
61
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -88,7 +96,9 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
88
96
|
featureFlags = _ref.featureFlags,
|
|
89
97
|
customMessages = _ref.customMessages,
|
|
90
98
|
_ref$isSubmitting = _ref.isSubmitting,
|
|
91
|
-
isSubmitting = _ref$isSubmitting === void 0 ? false : _ref$isSubmitting
|
|
99
|
+
isSubmitting = _ref$isSubmitting === void 0 ? false : _ref$isSubmitting,
|
|
100
|
+
_ref$UNSAFE_moveSubmi = _ref.UNSAFE_moveSubmitButton,
|
|
101
|
+
UNSAFE_moveSubmitButton = _ref$UNSAFE_moveSubmi === void 0 ? false : _ref$UNSAFE_moveSubmi;
|
|
92
102
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
93
103
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
94
104
|
var _useReducer = useReducer(reducer, _objectSpread(_objectSpread({}, initState), {}, {
|
|
@@ -122,6 +132,9 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
122
132
|
var _useLinkPickerAnalyti = useLinkPickerAnalytics(),
|
|
123
133
|
trackAttribute = _useLinkPickerAnalyti.trackAttribute,
|
|
124
134
|
getAttributes = _useLinkPickerAnalyti.getAttributes;
|
|
135
|
+
var submitMessageId = useMemo(function () {
|
|
136
|
+
return uuid();
|
|
137
|
+
}, []);
|
|
125
138
|
useLayoutEffect(function () {
|
|
126
139
|
if (onContentResize) {
|
|
127
140
|
onContentResize();
|
|
@@ -312,6 +325,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
312
325
|
// as the Aria design pattern for combobox does not work in this case
|
|
313
326
|
// for details: https://a11y-internal.atlassian.net/browse/AK-740
|
|
314
327
|
var screenReaderText = browser().safari && getScreenReaderText(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
|
|
328
|
+
var customSubmitButtonLabel = customMessages !== null && customMessages !== void 0 && customMessages.submitButtonLabel ? customMessages.submitButtonLabel : undefined;
|
|
315
329
|
return jsx("form", {
|
|
316
330
|
"data-testid": testIds.linkPicker
|
|
317
331
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -354,7 +368,20 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
354
368
|
readOnly: isSubmitting,
|
|
355
369
|
onClear: handleClear,
|
|
356
370
|
onChange: handleChangeText
|
|
357
|
-
}),
|
|
371
|
+
}), UNSAFE_moveSubmitButton && jsx(Box, {
|
|
372
|
+
xcss: FullWidthSubmitButtonStyles
|
|
373
|
+
}, jsx(LinkPickerSubmitButton, {
|
|
374
|
+
isEditing: isEditing,
|
|
375
|
+
isLoading: isLoadingResults || !!isLoadingPlugins,
|
|
376
|
+
isSubmitting: isSubmitting,
|
|
377
|
+
customSubmitButtonLabel: customSubmitButtonLabel,
|
|
378
|
+
error: error,
|
|
379
|
+
items: items,
|
|
380
|
+
queryState: queryState,
|
|
381
|
+
submitMessageId: submitMessageId,
|
|
382
|
+
testId: testIds.insertButton,
|
|
383
|
+
url: url
|
|
384
|
+
})), !!queryState && (isLoadingPlugins || isActivePlugin) && jsx(SearchResults, {
|
|
358
385
|
activeTab: activeTab,
|
|
359
386
|
tabs: tabs,
|
|
360
387
|
activePlugin: activePlugin,
|
|
@@ -390,6 +417,8 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
390
417
|
/* Show the feature discovery pulse when we're on the Jira tab, we haven't started typing a url and
|
|
391
418
|
the feature flag is enabled */,
|
|
392
419
|
createFeatureDiscovery: (activePlugin === null || activePlugin === void 0 ? void 0 : activePlugin.tabKey) === 'jira' && allowCreateFeatureDiscovery && fg('platform.linking-platform.link-picker.enable-jira-create'),
|
|
393
|
-
customSubmitButtonLabel:
|
|
420
|
+
customSubmitButtonLabel: customSubmitButtonLabel,
|
|
421
|
+
submitMessageId: submitMessageId,
|
|
422
|
+
hideSubmitButton: UNSAFE_moveSubmitButton
|
|
394
423
|
}));
|
|
395
424
|
}));
|
package/dist/esm/ui/main.js
CHANGED
|
@@ -137,6 +137,12 @@ export interface LinkPickerProps {
|
|
|
137
137
|
featureFlags?: Record<string, unknown>;
|
|
138
138
|
/** Controls showing a "submission in-progres" UX */
|
|
139
139
|
isSubmitting?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Do not utilize this! This is a temporary prop that is being used for a specific experiment.
|
|
142
|
+
* This prop controls where the submit button appears. When true the submit button will move below the input field and be full width
|
|
143
|
+
* @internal
|
|
144
|
+
* */
|
|
145
|
+
UNSAFE_moveSubmitButton?: boolean;
|
|
140
146
|
}
|
|
141
147
|
type CustomLinkPickerMessages = {
|
|
142
148
|
/** Label for the link input field */
|
|
@@ -8,16 +8,6 @@ export declare const messages: {
|
|
|
8
8
|
defaultMessage: string;
|
|
9
9
|
description: string;
|
|
10
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
11
|
submittingStatusMessage: {
|
|
22
12
|
id: string;
|
|
23
13
|
defaultMessage: string;
|
|
@@ -46,6 +36,8 @@ interface FormFooterProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
46
36
|
action?: LinkPickerPluginAction;
|
|
47
37
|
createFeatureDiscovery?: boolean;
|
|
48
38
|
customSubmitButtonLabel?: MessageDescriptor;
|
|
39
|
+
submitMessageId?: string;
|
|
40
|
+
hideSubmitButton?: boolean;
|
|
49
41
|
}
|
|
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>;
|
|
42
|
+
export declare const FormFooter: import("react").MemoExoticComponent<({ isLoading, isSubmitting, error, url, queryState, items, isEditing, onCancel, action, createFeatureDiscovery, customSubmitButtonLabel, submitMessageId, hideSubmitButton, ...restProps }: FormFooterProps) => jsx.JSX.Element | null>;
|
|
51
43
|
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { jsx } from '@emotion/react';
|
|
6
|
+
import { type MessageDescriptor } from 'react-intl-next';
|
|
7
|
+
import type { LinkPickerState, LinkSearchListItemData } from '../../../../common/types';
|
|
8
|
+
type LinkPickerButtonGroupProps = {
|
|
9
|
+
isEditing?: boolean;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
isSubmitting: boolean;
|
|
12
|
+
customSubmitButtonLabel?: MessageDescriptor;
|
|
13
|
+
error: unknown | null;
|
|
14
|
+
items: LinkSearchListItemData[] | null;
|
|
15
|
+
queryState: LinkPickerState | null;
|
|
16
|
+
submitMessageId?: string;
|
|
17
|
+
testId?: string;
|
|
18
|
+
url: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const messages: {
|
|
21
|
+
saveButton: {
|
|
22
|
+
id: string;
|
|
23
|
+
defaultMessage: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
insertButton: {
|
|
27
|
+
id: string;
|
|
28
|
+
defaultMessage: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare const LinkPickerSubmitButton: ({ isEditing, isLoading, isSubmitting, customSubmitButtonLabel, error, items, queryState, submitMessageId, testId, url, }: LinkPickerButtonGroupProps) => jsx.JSX.Element;
|
|
33
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type LinkPickerState, type LinkSearchListItemData } from '
|
|
1
|
+
import { type LinkPickerState, type LinkSearchListItemData } from '../../../../common/types';
|
|
2
2
|
export declare const checkSubmitDisabled: (isLoading: boolean, isSubmitting: boolean, error: unknown | null, url: string, queryState: LinkPickerState | null, items: LinkSearchListItemData[] | null) => boolean;
|
|
@@ -137,6 +137,12 @@ export interface LinkPickerProps {
|
|
|
137
137
|
featureFlags?: Record<string, unknown>;
|
|
138
138
|
/** Controls showing a "submission in-progres" UX */
|
|
139
139
|
isSubmitting?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Do not utilize this! This is a temporary prop that is being used for a specific experiment.
|
|
142
|
+
* This prop controls where the submit button appears. When true the submit button will move below the input field and be full width
|
|
143
|
+
* @internal
|
|
144
|
+
* */
|
|
145
|
+
UNSAFE_moveSubmitButton?: boolean;
|
|
140
146
|
}
|
|
141
147
|
type CustomLinkPickerMessages = {
|
|
142
148
|
/** Label for the link input field */
|
|
@@ -8,16 +8,6 @@ export declare const messages: {
|
|
|
8
8
|
defaultMessage: string;
|
|
9
9
|
description: string;
|
|
10
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
11
|
submittingStatusMessage: {
|
|
22
12
|
id: string;
|
|
23
13
|
defaultMessage: string;
|
|
@@ -46,6 +36,8 @@ interface FormFooterProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
46
36
|
action?: LinkPickerPluginAction;
|
|
47
37
|
createFeatureDiscovery?: boolean;
|
|
48
38
|
customSubmitButtonLabel?: MessageDescriptor;
|
|
39
|
+
submitMessageId?: string;
|
|
40
|
+
hideSubmitButton?: boolean;
|
|
49
41
|
}
|
|
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>;
|
|
42
|
+
export declare const FormFooter: import("react").MemoExoticComponent<({ isLoading, isSubmitting, error, url, queryState, items, isEditing, onCancel, action, createFeatureDiscovery, customSubmitButtonLabel, submitMessageId, hideSubmitButton, ...restProps }: FormFooterProps) => jsx.JSX.Element | null>;
|
|
51
43
|
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { jsx } from '@emotion/react';
|
|
6
|
+
import { type MessageDescriptor } from 'react-intl-next';
|
|
7
|
+
import type { LinkPickerState, LinkSearchListItemData } from '../../../../common/types';
|
|
8
|
+
type LinkPickerButtonGroupProps = {
|
|
9
|
+
isEditing?: boolean;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
isSubmitting: boolean;
|
|
12
|
+
customSubmitButtonLabel?: MessageDescriptor;
|
|
13
|
+
error: unknown | null;
|
|
14
|
+
items: LinkSearchListItemData[] | null;
|
|
15
|
+
queryState: LinkPickerState | null;
|
|
16
|
+
submitMessageId?: string;
|
|
17
|
+
testId?: string;
|
|
18
|
+
url: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const messages: {
|
|
21
|
+
saveButton: {
|
|
22
|
+
id: string;
|
|
23
|
+
defaultMessage: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
insertButton: {
|
|
27
|
+
id: string;
|
|
28
|
+
defaultMessage: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare const LinkPickerSubmitButton: ({ isEditing, isLoading, isSubmitting, customSubmitButtonLabel, error, items, queryState, submitMessageId, testId, url, }: LinkPickerButtonGroupProps) => jsx.JSX.Element;
|
|
33
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type LinkPickerState, type LinkSearchListItemData } from '
|
|
1
|
+
import { type LinkPickerState, type LinkSearchListItemData } from '../../../../common/types';
|
|
2
2
|
export declare const checkSubmitDisabled: (isLoading: boolean, isSubmitting: boolean, error: unknown | null, url: string, queryState: LinkPickerState | null, items: LinkSearchListItemData[] | null) => boolean;
|
package/package.json
CHANGED
/package/dist/cjs/ui/link-picker/form-footer/{utils.js → link-picker-submit-button/utils.js}
RENAMED
|
File without changes
|
/package/dist/es2019/ui/link-picker/form-footer/{utils.js → link-picker-submit-button/utils.js}
RENAMED
|
File without changes
|
/package/dist/esm/ui/link-picker/form-footer/{utils.js → link-picker-submit-button/utils.js}
RENAMED
|
File without changes
|