@atlaskit/link-picker 1.42.5 → 1.44.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 +24 -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/link-picker/search-results/link-search-list/index.js +16 -14
- package/dist/cjs/ui/link-picker/search-results/link-search-list/list-item/index.js +54 -30
- package/dist/cjs/ui/link-picker/search-results/link-search-list/list-item/styled.js +3 -11
- 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/link-picker/search-results/link-search-list/index.js +17 -15
- package/dist/es2019/ui/link-picker/search-results/link-search-list/list-item/index.js +43 -23
- package/dist/es2019/ui/link-picker/search-results/link-search-list/list-item/styled.js +3 -11
- 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/link-picker/search-results/link-search-list/index.js +17 -15
- package/dist/esm/ui/link-picker/search-results/link-search-list/list-item/index.js +54 -31
- package/dist/esm/ui/link-picker/search-results/link-search-list/list-item/styled.js +3 -11
- package/dist/esm/ui/main.js +1 -1
- package/dist/types/common/types.d.ts +17 -0
- package/dist/types/index.d.ts +1 -1
- 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/ui/link-picker/search-results/link-search-list/list-item/index.d.ts +1 -0
- package/dist/types/ui/link-picker/search-results/link-search-list/list-item/styled.d.ts +0 -1
- package/dist/types-ts4.5/common/types.d.ts +20 -0
- package/dist/types-ts4.5/index.d.ts +1 -1
- 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/dist/types-ts4.5/ui/link-picker/search-results/link-search-list/list-item/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/link-picker/search-results/link-search-list/list-item/styled.d.ts +0 -1
- package/package.json +2 -2
- /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,29 @@
|
|
|
1
1
|
# @atlaskit/link-picker
|
|
2
2
|
|
|
3
|
+
## 1.44.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#132649](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132649)
|
|
8
|
+
[`b99bd2fb0aeeb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b99bd2fb0aeeb) -
|
|
9
|
+
Fixes support for plugin empty state behind ff. If successful will be made available in future
|
|
10
|
+
release.
|
|
11
|
+
- [#131548](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/131548)
|
|
12
|
+
[`282ddb3575504`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/282ddb3575504) -
|
|
13
|
+
[ux] Allow custom subtitle content in the link picker, and allow link item names to extend over
|
|
14
|
+
multiple lines. Both changes are opt-in via a LinkPickerPlugin, so these new features will only
|
|
15
|
+
appear if the plugin is changed to consume them.
|
|
16
|
+
|
|
17
|
+
## 1.43.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [#131465](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/131465)
|
|
22
|
+
[`df8ea6dec9bdc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/df8ea6dec9bdc) -
|
|
23
|
+
[ux] Added in a new temporary prop, UNSAFE_moveSubmitButton, to the LinkPicker. This prop moves
|
|
24
|
+
the submit button below the input field and is only to be used in an experiment being run within
|
|
25
|
+
Confluence.
|
|
26
|
+
|
|
3
27
|
## 1.42.5
|
|
4
28
|
|
|
5
29
|
### 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
|
}));
|
|
@@ -12,6 +12,7 @@ var _react = require("react");
|
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
13
|
var _reactIntlNext = require("react-intl-next");
|
|
14
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
|
+
var _primitives = require("@atlaskit/primitives");
|
|
15
16
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
16
17
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
17
18
|
var _minHeightContainer = require("../../../../common/ui/min-height-container");
|
|
@@ -49,10 +50,11 @@ var testIds = exports.testIds = _objectSpread(_objectSpread(_objectSpread({}, _l
|
|
|
49
50
|
searchResultLoadingIndicator: 'link-picker.results-loading-indicator',
|
|
50
51
|
tabsLoadingIndicator: 'link-picker.tabs-loading-indicator'
|
|
51
52
|
});
|
|
52
|
-
var emptyStateNoResultsWrapper = (0,
|
|
53
|
-
minHeight:
|
|
53
|
+
var emptyStateNoResultsWrapper = (0, _primitives.xcss)({
|
|
54
|
+
minHeight: 'space.200'
|
|
54
55
|
});
|
|
55
56
|
var LinkSearchList = exports.LinkSearchList = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
57
|
+
var _activePlugin$uiOptio;
|
|
56
58
|
var onChange = _ref.onChange,
|
|
57
59
|
onSelect = _ref.onSelect,
|
|
58
60
|
onKeyDown = _ref.onKeyDown,
|
|
@@ -108,20 +110,19 @@ var LinkSearchList = exports.LinkSearchList = /*#__PURE__*/(0, _react.forwardRef
|
|
|
108
110
|
}, [activeIndex, items, onKeyDown]);
|
|
109
111
|
if ((items === null || items === void 0 ? void 0 : items.length) === 0) {
|
|
110
112
|
if ((0, _platformFeatureFlags.fg)('platform.linking-platform.link-picker.enable-empty-state')) {
|
|
111
|
-
if (hasSearchTerm) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
);
|
|
113
|
+
if (!hasSearchTerm) {
|
|
114
|
+
var _activePlugin$emptySt;
|
|
115
|
+
var emptyState = activePlugin === null || activePlugin === void 0 || (_activePlugin$emptySt = activePlugin.emptyStateNoResults) === null || _activePlugin$emptySt === void 0 ? void 0 : _activePlugin$emptySt.call(activePlugin);
|
|
116
|
+
if (emptyState) {
|
|
117
|
+
return (0, _react2.jsx)(_primitives.Box, {
|
|
118
|
+
xcss: emptyStateNoResultsWrapper
|
|
119
|
+
}, emptyState);
|
|
120
|
+
}
|
|
120
121
|
}
|
|
121
|
-
} else {
|
|
122
|
-
return (0, _react2.jsx)(_linkSearchNoResults.NoResults, null);
|
|
123
122
|
}
|
|
123
|
+
return (0, _react2.jsx)(_linkSearchNoResults.NoResults, null);
|
|
124
124
|
}
|
|
125
|
+
var listItemNameMaxLines = activePlugin === null || activePlugin === void 0 || (_activePlugin$uiOptio = activePlugin.uiOptions) === null || _activePlugin$uiOptio === void 0 ? void 0 : _activePlugin$uiOptio.listItemNameMaxLines;
|
|
125
126
|
if (items && items.length > 0) {
|
|
126
127
|
itemsContent = (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("div", {
|
|
127
128
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -162,7 +163,8 @@ var LinkSearchList = exports.LinkSearchList = /*#__PURE__*/(0, _react.forwardRef
|
|
|
162
163
|
tabIndex: getTabIndex(index),
|
|
163
164
|
ref: function ref(el) {
|
|
164
165
|
return itemRefCallback(el, item.objectId);
|
|
165
|
-
}
|
|
166
|
+
},
|
|
167
|
+
nameMaxLines: listItemNameMaxLines
|
|
166
168
|
});
|
|
167
169
|
})));
|
|
168
170
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.testIds = exports.LinkSearchListItem = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
9
|
var _react = require("react");
|
|
8
10
|
var _react2 = require("@emotion/react");
|
|
9
11
|
var _reactIntlNext = require("react-intl-next");
|
|
12
|
+
var _primitives = require("@atlaskit/primitives");
|
|
10
13
|
var _transformTimeStamp = require("../../../transformTimeStamp");
|
|
11
14
|
var _styled = require("./styled");
|
|
12
15
|
/**
|
|
@@ -63,21 +66,54 @@ var ListItemIcon = function ListItemIcon(props) {
|
|
|
63
66
|
}))
|
|
64
67
|
);
|
|
65
68
|
};
|
|
66
|
-
var
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
var ListItemSubtitle = function ListItemSubtitle(_ref) {
|
|
70
|
+
var _ref$items = (0, _slicedToArray2.default)(_ref.items, 2),
|
|
71
|
+
firstItem = _ref$items[0],
|
|
72
|
+
secondItem = _ref$items[1];
|
|
73
|
+
return /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 */(
|
|
74
|
+
(0, _react2.jsx)("div", {
|
|
75
|
+
"data-testid": "".concat(testIds.searchResultItem, "-subtitle"),
|
|
76
|
+
css: _styled.listItemContextStyles
|
|
77
|
+
}, (0, _react2.jsx)("div", {
|
|
78
|
+
css: _styled.listItemContainerStyles
|
|
79
|
+
}, (0, _react2.jsx)("span", {
|
|
80
|
+
css: _styled.listItemContainerInnerStyles
|
|
81
|
+
}, firstItem)), secondItem && (0, _react2.jsx)("div", {
|
|
82
|
+
css: _styled.listItemContainerInnerStyles
|
|
83
|
+
}, (0, _react2.jsx)(_react.Fragment, null, "\xA0 \u2022\xA0 "), (0, _react2.jsx)(_react.Fragment, null, secondItem)))
|
|
84
|
+
);
|
|
85
|
+
/* eslint-enable @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 */
|
|
86
|
+
};
|
|
87
|
+
var getDefaultSubtitleItems = function getDefaultSubtitleItems(item, intl) {
|
|
88
|
+
var container = item.container;
|
|
89
|
+
var date = (0, _transformTimeStamp.transformTimeStamp)(intl, item.lastViewedDate, item.lastUpdatedDate);
|
|
90
|
+
if (container) {
|
|
91
|
+
if (date) {
|
|
92
|
+
return [container, date];
|
|
93
|
+
}
|
|
94
|
+
return [container];
|
|
95
|
+
}
|
|
96
|
+
if (date) {
|
|
97
|
+
return [date];
|
|
98
|
+
}
|
|
99
|
+
return undefined;
|
|
100
|
+
};
|
|
101
|
+
var LinkSearchListItem = exports.LinkSearchListItem = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
102
|
+
var item = _ref2.item,
|
|
103
|
+
selected = _ref2.selected,
|
|
104
|
+
id = _ref2.id,
|
|
105
|
+
role = _ref2.role,
|
|
106
|
+
onSelect = _ref2.onSelect,
|
|
107
|
+
tabIndex = _ref2.tabIndex,
|
|
108
|
+
onKeyDown = _ref2.onKeyDown,
|
|
109
|
+
onFocus = _ref2.onFocus,
|
|
110
|
+
_ref2$nameMaxLines = _ref2.nameMaxLines,
|
|
111
|
+
nameMaxLines = _ref2$nameMaxLines === void 0 ? 1 : _ref2$nameMaxLines;
|
|
75
112
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
76
113
|
var handleSelect = function handleSelect() {
|
|
77
114
|
return onSelect(item.objectId);
|
|
78
115
|
};
|
|
79
|
-
var
|
|
80
|
-
var date = (0, _transformTimeStamp.transformTimeStamp)(intl, item.lastViewedDate, item.lastUpdatedDate);
|
|
116
|
+
var subtitleItems = item.subtitleItems || getDefaultSubtitleItems(item, intl);
|
|
81
117
|
return (0, _react2.jsx)("div", {
|
|
82
118
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
83
119
|
css: (0, _styled.composeListItemStyles)(selected),
|
|
@@ -95,24 +131,12 @@ var LinkSearchListItem = exports.LinkSearchListItem = /*#__PURE__*/(0, _react.fo
|
|
|
95
131
|
intl: intl
|
|
96
132
|
}), (0, _react2.jsx)("div", {
|
|
97
133
|
css: _styled.itemNameStyles
|
|
98
|
-
}, (0, _react2.jsx)(
|
|
99
|
-
|
|
100
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
101
|
-
,
|
|
102
|
-
css: _styled.listItemNameStyles,
|
|
103
|
-
title: item.name
|
|
104
|
-
}, item.name), (0, _react2.jsx)("div", {
|
|
105
|
-
"data-testid": "".concat(testIds.searchResultItem, "-subtitle"),
|
|
106
|
-
css: _styled.listItemContextStyles
|
|
107
|
-
}, container &&
|
|
108
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
109
|
-
(0, _react2.jsx)("div", {
|
|
110
|
-
css: _styled.listItemContainerStyles
|
|
134
|
+
}, (0, _react2.jsx)(_primitives.Text, {
|
|
135
|
+
maxLines: nameMaxLines
|
|
111
136
|
}, (0, _react2.jsx)("span", {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}, container && (0, _react2.jsx)(_react.Fragment, null, "\xA0 \u2022\xA0 "), (0, _react2.jsx)(_react.Fragment, null, date)))));
|
|
137
|
+
"data-testid": "".concat(testIds.searchResultItem, "-title"),
|
|
138
|
+
title: item.name
|
|
139
|
+
}, item.name)), subtitleItems && (0, _react2.jsx)(ListItemSubtitle, {
|
|
140
|
+
items: subtitleItems
|
|
141
|
+
})));
|
|
118
142
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.relativeFontSizeToBase16 = exports.
|
|
6
|
+
exports.relativeFontSizeToBase16 = exports.listItemContextStyles = exports.listItemContainerStyles = exports.listItemContainerInnerStyles = exports.itemNameStyles = exports.itemIconStyles = exports.imgStyles = exports.composeListItemStyles = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _colors = require("@atlaskit/theme/colors");
|
|
9
9
|
var _constants = require("@atlaskit/theme/constants");
|
|
@@ -68,16 +68,8 @@ var composeListItemStyles = exports.composeListItemStyles = function composeList
|
|
|
68
68
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
69
69
|
var itemNameStyles = exports.itemNameStyles = (0, _react.css)({
|
|
70
70
|
overflow: 'hidden',
|
|
71
|
-
alignContent: 'center'
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
75
|
-
var listItemNameStyles = exports.listItemNameStyles = (0, _react.css)({
|
|
76
|
-
color: "var(--ds-text, ".concat(_colors.N800, ")"),
|
|
77
|
-
overflow: 'hidden',
|
|
78
|
-
textOverflow: 'ellipsis',
|
|
79
|
-
whiteSpace: 'nowrap',
|
|
80
|
-
lineHeight: '20px'
|
|
71
|
+
alignContent: 'center',
|
|
72
|
+
width: '100%'
|
|
81
73
|
});
|
|
82
74
|
|
|
83
75
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
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.44.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
|
+
};
|