@atlaskit/link-picker 1.45.1 → 1.46.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 +20 -0
- package/dist/cjs/ui/error-boundary/error-boundary-fallback/index.js +11 -30
- package/dist/cjs/ui/link-picker/index.js +19 -6
- package/dist/cjs/ui/link-picker/search-results/index.js +8 -9
- package/dist/cjs/ui/link-picker/search-results/link-search-list/index.js +5 -4
- package/dist/cjs/ui/link-picker/search-results/search-results-container/index.js +20 -15
- package/dist/cjs/ui/loader-fallback/index.js +14 -21
- package/dist/cjs/ui/main.js +4 -13
- package/dist/es2019/ui/error-boundary/error-boundary-fallback/index.js +9 -25
- package/dist/es2019/ui/link-picker/index.js +17 -5
- package/dist/es2019/ui/link-picker/search-results/index.js +8 -9
- package/dist/es2019/ui/link-picker/search-results/link-search-list/index.js +4 -3
- package/dist/es2019/ui/link-picker/search-results/search-results-container/index.js +20 -14
- package/dist/es2019/ui/loader-fallback/index.js +14 -21
- package/dist/es2019/ui/main.js +5 -14
- package/dist/esm/ui/error-boundary/error-boundary-fallback/index.js +11 -29
- package/dist/esm/ui/link-picker/index.js +18 -5
- package/dist/esm/ui/link-picker/search-results/index.js +8 -9
- package/dist/esm/ui/link-picker/search-results/link-search-list/index.js +5 -4
- package/dist/esm/ui/link-picker/search-results/search-results-container/index.js +19 -15
- package/dist/esm/ui/loader-fallback/index.js +14 -21
- package/dist/esm/ui/main.js +5 -14
- package/dist/types/common/types.d.ts +2 -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/ui/link-picker/search-results/search-results-container/index.d.ts +8 -3
- package/dist/types-ts4.5/common/types.d.ts +2 -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/dist/types-ts4.5/ui/link-picker/search-results/search-results-container/index.d.ts +8 -3
- package/package.json +6 -9
- package/dist/cjs/controllers/use-fix-height/index.js +0 -22
- package/dist/cjs/ui/link-picker/styled.js +0 -18
- package/dist/es2019/controllers/use-fix-height/index.js +0 -16
- package/dist/es2019/ui/link-picker/styled.js +0 -19
- package/dist/esm/controllers/use-fix-height/index.js +0 -16
- package/dist/esm/ui/link-picker/styled.js +0 -12
- package/dist/types/controllers/use-fix-height/index.d.ts +0 -7
- package/dist/types/ui/link-picker/styled.d.ts +0 -2
- package/dist/types-ts4.5/controllers/use-fix-height/index.d.ts +0 -7
- package/dist/types-ts4.5/ui/link-picker/styled.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/link-picker
|
|
2
2
|
|
|
3
|
+
## 1.46.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 1.46.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#145714](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/145714)
|
|
14
|
+
[`bf057f6cc9712`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bf057f6cc9712) -
|
|
15
|
+
Updates the search results section to have a minimum height (by cleanup of ff
|
|
16
|
+
platform.linking-platform.link-picker.fixed-height-search-results). Can be opt-ed out by using the
|
|
17
|
+
newly added `adaptiveHeight` prop.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 1.45.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -6,20 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ErrorBoundaryFallback = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _reactIntlNext = require("react-intl-next");
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var _constants = require("../../../common/constants");
|
|
11
10
|
var _genericErrorSvg = require("../../../common/generic-error-svg");
|
|
12
11
|
var _emptyState = require("../../../common/ui/empty-state");
|
|
13
12
|
var _minHeightContainer = require("../../../common/ui/min-height-container");
|
|
14
|
-
var _styled = require("../../link-picker/styled");
|
|
15
13
|
/**
|
|
16
14
|
* @jsxRuntime classic
|
|
17
15
|
* @jsx jsx
|
|
18
16
|
*/
|
|
19
17
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
20
18
|
|
|
21
|
-
// eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
|
|
22
|
-
|
|
23
19
|
var errorBoundaryFallbackStyles = (0, _react.css)({
|
|
24
20
|
lineHeight: 'initial'
|
|
25
21
|
});
|
|
@@ -39,30 +35,15 @@ var ErrorBoundaryFallback = exports.ErrorBoundaryFallback = function ErrorBounda
|
|
|
39
35
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
40
36
|
var header = intl.formatMessage(messages.heading);
|
|
41
37
|
var description = intl.formatMessage(messages.description);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
return (
|
|
56
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
57
|
-
(0, _react.jsx)("div", {
|
|
58
|
-
css: _styled.rootContainerStyles,
|
|
59
|
-
"data-testid": "link-picker-root-error-boundary-ui"
|
|
60
|
-
}, (0, _react.jsx)(_emptyState.EmptyState, {
|
|
61
|
-
header: header,
|
|
62
|
-
renderImage: function renderImage() {
|
|
63
|
-
return (0, _react.jsx)(_genericErrorSvg.GenericErrorSVG, null);
|
|
64
|
-
},
|
|
65
|
-
description: description
|
|
66
|
-
}))
|
|
67
|
-
);
|
|
38
|
+
return (0, _react.jsx)(_minHeightContainer.MinHeightContainer, {
|
|
39
|
+
css: errorBoundaryFallbackStyles,
|
|
40
|
+
minHeight: _constants.LINK_PICKER_MIN_HEIGHT_IN_PX_FALLBACK,
|
|
41
|
+
"data-testid": "link-picker-root-error-boundary-ui"
|
|
42
|
+
}, (0, _react.jsx)(_emptyState.EmptyState, {
|
|
43
|
+
header: header,
|
|
44
|
+
renderImage: function renderImage() {
|
|
45
|
+
return (0, _react.jsx)(_genericErrorSvg.GenericErrorSVG, null);
|
|
46
|
+
},
|
|
47
|
+
description: description
|
|
48
|
+
}));
|
|
68
49
|
};
|
|
@@ -29,7 +29,6 @@ var _formFooter = require("./form-footer");
|
|
|
29
29
|
var _linkPickerSubmitButton = require("./form-footer/link-picker-submit-button");
|
|
30
30
|
var _messages = require("./messages");
|
|
31
31
|
var _searchResults = require("./search-results");
|
|
32
|
-
var _styled = require("./styled");
|
|
33
32
|
var _textInput = require("./text-input");
|
|
34
33
|
var _trackMount = require("./track-mount");
|
|
35
34
|
var _utils = require("./utils");
|
|
@@ -38,6 +37,19 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
38
37
|
* @jsxRuntime classic
|
|
39
38
|
* @jsx jsx
|
|
40
39
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
40
|
+
var rootContainerStyles = (0, _react2.css)({
|
|
41
|
+
paddingLeft: 'var(--link-picker-padding-left)',
|
|
42
|
+
paddingRight: 'var(--link-picker-padding-right)',
|
|
43
|
+
paddingTop: 'var(--link-picker-padding-top)',
|
|
44
|
+
paddingBottom: 'var(--link-picker-padding-bottom)',
|
|
45
|
+
boxSizing: 'border-box',
|
|
46
|
+
lineHeight: 'initial',
|
|
47
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
48
|
+
display: 'block !important'
|
|
49
|
+
});
|
|
50
|
+
var formFooterMargin = (0, _react2.css)({
|
|
51
|
+
marginTop: "var(--ds-space-200, 16px)"
|
|
52
|
+
});
|
|
41
53
|
var testIds = exports.testIds = _objectSpread(_objectSpread(_objectSpread({
|
|
42
54
|
linkPickerRoot: 'link-picker-root',
|
|
43
55
|
linkPicker: 'link-picker',
|
|
@@ -101,6 +113,8 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
101
113
|
customMessages = _ref.customMessages,
|
|
102
114
|
_ref$isSubmitting = _ref.isSubmitting,
|
|
103
115
|
isSubmitting = _ref$isSubmitting === void 0 ? false : _ref$isSubmitting,
|
|
116
|
+
_ref$adaptiveHeight = _ref.adaptiveHeight,
|
|
117
|
+
adaptiveHeight = _ref$adaptiveHeight === void 0 ? false : _ref$adaptiveHeight,
|
|
104
118
|
_ref$UNSAFE_moveSubmi = _ref.UNSAFE_moveSubmitButton,
|
|
105
119
|
UNSAFE_moveSubmitButton = _ref$UNSAFE_moveSubmi === void 0 ? false : _ref$UNSAFE_moveSubmi;
|
|
106
120
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
@@ -331,10 +345,8 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
331
345
|
var screenReaderText = (0, _userAgent.browser)().safari && (0, _utils.getScreenReaderText)(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
|
|
332
346
|
var customSubmitButtonLabel = customMessages !== null && customMessages !== void 0 && customMessages.submitButtonLabel ? customMessages.submitButtonLabel : undefined;
|
|
333
347
|
return (0, _react2.jsx)("form", {
|
|
334
|
-
"data-testid": testIds.linkPicker
|
|
335
|
-
|
|
336
|
-
,
|
|
337
|
-
css: _styled.rootContainerStyles
|
|
348
|
+
"data-testid": testIds.linkPicker,
|
|
349
|
+
css: rootContainerStyles
|
|
338
350
|
// Use onSubmitCapture instead of onSubmit so that any possible parent form isn't submitted
|
|
339
351
|
,
|
|
340
352
|
onSubmitCapture: handleSubmit
|
|
@@ -403,6 +415,7 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
403
415
|
handleSelected: handleSelected,
|
|
404
416
|
handleTabChange: handleTabChange,
|
|
405
417
|
handleSearchListOnChange: handleSearchListOnChange,
|
|
418
|
+
adaptiveHeight: adaptiveHeight,
|
|
406
419
|
retry: retry
|
|
407
420
|
}), (0, _react2.jsx)(_formFooter.FormFooter, {
|
|
408
421
|
error: error,
|
|
@@ -417,7 +430,7 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
417
430
|
action: pluginAction
|
|
418
431
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
419
432
|
,
|
|
420
|
-
css: !queryState || !(plugins !== null && plugins !== void 0 && plugins.length) ?
|
|
433
|
+
css: !queryState || !(plugins !== null && plugins !== void 0 && plugins.length) ? formFooterMargin : undefined
|
|
421
434
|
/* Show the feature discovery pulse when we're on the Jira tab, we haven't started typing a url and
|
|
422
435
|
the feature flag is enabled */,
|
|
423
436
|
createFeatureDiscovery: (activePlugin === null || activePlugin === void 0 ? void 0 : activePlugin.tabKey) === 'jira' && allowCreateFeatureDiscovery && (0, _platformFeatureFlags.fg)('platform.linking-platform.link-picker.enable-jira-create'),
|
|
@@ -6,14 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.testIds = exports.SearchResults = void 0;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
10
|
var _react = require("react");
|
|
12
11
|
var _react2 = require("@emotion/react");
|
|
13
12
|
var _primitives = require("@atlaskit/primitives");
|
|
14
13
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner/spinner"));
|
|
15
14
|
var _tabs = _interopRequireWildcard(require("@atlaskit/tabs"));
|
|
16
|
-
var _useFixHeight = require("../../../controllers/use-fix-height");
|
|
17
15
|
var _linkSearchError = require("./link-search-error");
|
|
18
16
|
var _linkSearchList = require("./link-search-list");
|
|
19
17
|
var _scrollingTabs = require("./scrolling-tabs");
|
|
@@ -61,20 +59,20 @@ var SearchResults = exports.SearchResults = function SearchResults(_ref) {
|
|
|
61
59
|
selectedIndex = _ref.selectedIndex,
|
|
62
60
|
handleSelected = _ref.handleSelected,
|
|
63
61
|
handleKeyDown = _ref.handleKeyDown,
|
|
62
|
+
adaptiveHeight = _ref.adaptiveHeight,
|
|
64
63
|
retry = _ref.retry;
|
|
65
64
|
var isActivePlugin = !!activePlugin;
|
|
66
|
-
|
|
67
|
-
// This will be redundant if we move towards fixed height search results section
|
|
68
|
-
var fixListHeightProps = (0, _useFixHeight.useFixHeight)(isLoadingResults);
|
|
69
65
|
var tabList = (0, _react2.jsx)(_tabs.TabList, null, tabs.map(function (tab) {
|
|
70
66
|
return (0, _react2.jsx)(_tabs.Tab, {
|
|
71
67
|
key: tab.tabTitle,
|
|
72
68
|
testId: testIds.tabItem
|
|
73
69
|
}, tab.tabTitle);
|
|
74
70
|
}));
|
|
75
|
-
return (0, _react2.jsx)(_searchResultsContainer.SearchResultsContainer,
|
|
76
|
-
hasTabs: !!tabs.length || isLoadingPlugins
|
|
77
|
-
|
|
71
|
+
return (0, _react2.jsx)(_searchResultsContainer.SearchResultsContainer, {
|
|
72
|
+
hasTabs: !!tabs.length || isLoadingPlugins,
|
|
73
|
+
adaptiveHeight: adaptiveHeight,
|
|
74
|
+
isLoadingResults: isLoadingResults
|
|
75
|
+
}, isLoadingPlugins && !!queryState && (0, _react2.jsx)("div", {
|
|
78
76
|
css: spinnerContainerStyles
|
|
79
77
|
}, (0, _react2.jsx)(_spinner.default, {
|
|
80
78
|
testId: testIds.tabsLoadingIndicator,
|
|
@@ -101,6 +99,7 @@ var SearchResults = exports.SearchResults = function SearchResults(_ref) {
|
|
|
101
99
|
onChange: handleSearchListOnChange,
|
|
102
100
|
onKeyDown: handleKeyDown,
|
|
103
101
|
hasSearchTerm: !!(queryState !== null && queryState !== void 0 && queryState.query.length),
|
|
104
|
-
activePlugin: activePlugin
|
|
102
|
+
activePlugin: activePlugin,
|
|
103
|
+
adaptiveHeight: adaptiveHeight
|
|
105
104
|
}), error ? (_activePlugin$errorFa = activePlugin === null || activePlugin === void 0 || (_activePlugin$errorFa2 = activePlugin.errorFallback) === null || _activePlugin$errorFa2 === void 0 ? void 0 : _activePlugin$errorFa2.call(activePlugin, error, retry)) !== null && _activePlugin$errorFa !== void 0 ? _activePlugin$errorFa : (0, _react2.jsx)(_linkSearchError.LinkSearchError, null) : null));
|
|
106
105
|
};
|
|
@@ -21,7 +21,7 @@ var _linkSearchNoResults = require("./link-search-no-results");
|
|
|
21
21
|
var _listItem = require("./list-item");
|
|
22
22
|
var _styled = require("./styled");
|
|
23
23
|
var _useTrackResultsShown = require("./use-track-results-shown");
|
|
24
|
-
var _excluded = ["onChange", "onSelect", "onKeyDown", "items", "activeIndex", "selectedIndex", "isLoading", "ariaControls", "ariaLabelledBy", "ariaReadOnly", "role", "id", "hasSearchTerm", "activePlugin"];
|
|
24
|
+
var _excluded = ["onChange", "onSelect", "onKeyDown", "items", "activeIndex", "selectedIndex", "isLoading", "ariaControls", "ariaLabelledBy", "ariaReadOnly", "role", "id", "hasSearchTerm", "activePlugin", "adaptiveHeight"];
|
|
25
25
|
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; }
|
|
26
26
|
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) { (0, _defineProperty2.default)(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; } /**
|
|
27
27
|
* @jsxRuntime classic
|
|
@@ -69,6 +69,7 @@ var LinkSearchList = exports.LinkSearchList = /*#__PURE__*/(0, _react.forwardRef
|
|
|
69
69
|
id = _ref.id,
|
|
70
70
|
hasSearchTerm = _ref.hasSearchTerm,
|
|
71
71
|
activePlugin = _ref.activePlugin,
|
|
72
|
+
adaptiveHeight = _ref.adaptiveHeight,
|
|
72
73
|
restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
73
74
|
var itemsContent;
|
|
74
75
|
var loadingContent;
|
|
@@ -140,7 +141,7 @@ var LinkSearchList = exports.LinkSearchList = /*#__PURE__*/(0, _react.forwardRef
|
|
|
140
141
|
}))), (0, _react2.jsx)("ul", {
|
|
141
142
|
id: id,
|
|
142
143
|
role: role
|
|
143
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
144
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
144
145
|
,
|
|
145
146
|
css: _styled.listStyles,
|
|
146
147
|
"aria-controls": "fabric.smartcard.linkpicker.suggested.results",
|
|
@@ -170,8 +171,8 @@ var LinkSearchList = exports.LinkSearchList = /*#__PURE__*/(0, _react.forwardRef
|
|
|
170
171
|
}
|
|
171
172
|
if (isLoading) {
|
|
172
173
|
loadingContent = (0, _react2.jsx)(_minHeightContainer.MinHeightContainer, {
|
|
173
|
-
minHeight:
|
|
174
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
174
|
+
minHeight: adaptiveHeight ? '80px' : '50px'
|
|
175
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
175
176
|
,
|
|
176
177
|
css: _styled.spinnerContainerStyles
|
|
177
178
|
}, (0, _react2.jsx)(_spinner.default, {
|
|
@@ -1,38 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.SearchResultsContainer = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
7
|
var _react = require("react");
|
|
11
8
|
var _react2 = require("@emotion/react");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
9
|
var _minHeightContainer = require("../../../../common/ui/min-height-container");
|
|
14
|
-
var _excluded = ["hasTabs"];
|
|
15
10
|
/**
|
|
16
11
|
* @jsxRuntime classic
|
|
17
12
|
* @jsx jsx
|
|
18
13
|
*/
|
|
14
|
+
|
|
19
15
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
|
+
|
|
20
17
|
var flexColumn = (0, _react2.css)({
|
|
21
18
|
display: 'flex',
|
|
22
19
|
flexDirection: 'column',
|
|
23
20
|
justifyContent: 'flex-start',
|
|
24
21
|
width: '100%'
|
|
25
22
|
});
|
|
26
|
-
var SearchResultsContainer = exports.SearchResultsContainer =
|
|
23
|
+
var SearchResultsContainer = exports.SearchResultsContainer = function SearchResultsContainer(_ref) {
|
|
27
24
|
var hasTabs = _ref.hasTabs,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
adaptiveHeight = _ref.adaptiveHeight,
|
|
26
|
+
isLoadingResults = _ref.isLoadingResults,
|
|
27
|
+
children = _ref.children;
|
|
28
|
+
var ref = (0, _react.useRef)(null);
|
|
29
|
+
var currentHeight = (0, _react.useRef)(null);
|
|
30
|
+
var fixedMinHeight = hasTabs ? '347px' : '302px';
|
|
31
|
+
var adaptiveMinHeight = isLoadingResults && !!currentHeight.current ? "".concat(currentHeight.current, "px") : 'auto';
|
|
32
|
+
var minheight = adaptiveHeight ? adaptiveMinHeight : fixedMinHeight;
|
|
33
|
+
(0, _react.useLayoutEffect)(function () {
|
|
34
|
+
if (ref.current && adaptiveHeight && !isLoadingResults) {
|
|
35
|
+
currentHeight.current = ref.current.getBoundingClientRect().height;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return (0, _react2.jsx)(_minHeightContainer.MinHeightContainer, {
|
|
34
39
|
ref: ref,
|
|
35
|
-
minHeight:
|
|
40
|
+
minHeight: minheight,
|
|
36
41
|
css: flexColumn
|
|
37
|
-
},
|
|
38
|
-
}
|
|
42
|
+
}, children);
|
|
43
|
+
};
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.LoaderFallback = void 0;
|
|
8
8
|
var _react = require("@emotion/react");
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
11
10
|
var _minHeightContainer = require("../../common/ui/min-height-container");
|
|
12
11
|
/**
|
|
@@ -24,36 +23,30 @@ var LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_TABS_WITH_PLUGIN_WITH_DISPLAYTEXT = '50
|
|
|
24
23
|
var LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_TABS_WITH_PLUGIN_WITHOUT_DISPLAYTEXT = '429px';
|
|
25
24
|
var LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_TABS_WITH_DISPLAYTEXT = '218px';
|
|
26
25
|
var LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_TABS_WITHOUT_DISPLAYTEXT = '141px';
|
|
27
|
-
// EDM-7122: can delete these two consts once min height container for link picker is firm for the loader
|
|
28
|
-
var LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_DISPLAYTEXT = '142px';
|
|
29
|
-
var LINK_PICKER_MIN_HEIGHT_IN_PX_WITH_DISPLAYTEXT = '220px';
|
|
30
26
|
var getEstimatedMinHeight = function getEstimatedMinHeight(_ref) {
|
|
31
27
|
var hideDisplayText = _ref.hideDisplayText,
|
|
32
28
|
isLoadingPlugins = _ref.isLoadingPlugins,
|
|
33
29
|
plugins = _ref.plugins,
|
|
34
30
|
url = _ref.url;
|
|
35
|
-
|
|
31
|
+
/**
|
|
32
|
+
* "Insert mode" (search results shown initially)
|
|
33
|
+
*/
|
|
34
|
+
if (!url) {
|
|
36
35
|
/**
|
|
37
|
-
*
|
|
36
|
+
* With tabs
|
|
38
37
|
*/
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*/
|
|
43
|
-
if (plugins && plugins.length > 1 || isLoadingPlugins) {
|
|
44
|
-
return hideDisplayText ? LINK_PICKER_MIN_HEIGHT_IN_PX_WITH_TABS_WITHOUT_DISPLAYTEXT : LINK_PICKER_MIN_HEIGHT_IN_PX_WITH_TABS_WITH_DISPLAYTEXT;
|
|
45
|
-
}
|
|
38
|
+
if (plugins && plugins.length > 1 || isLoadingPlugins) {
|
|
39
|
+
return hideDisplayText ? LINK_PICKER_MIN_HEIGHT_IN_PX_WITH_TABS_WITHOUT_DISPLAYTEXT : LINK_PICKER_MIN_HEIGHT_IN_PX_WITH_TABS_WITH_DISPLAYTEXT;
|
|
40
|
+
}
|
|
46
41
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
42
|
+
/**
|
|
43
|
+
* Without tabs
|
|
44
|
+
*/
|
|
45
|
+
if ((plugins === null || plugins === void 0 ? void 0 : plugins.length) === 1) {
|
|
46
|
+
return hideDisplayText ? LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_TABS_WITH_PLUGIN_WITHOUT_DISPLAYTEXT : LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_TABS_WITH_PLUGIN_WITH_DISPLAYTEXT;
|
|
53
47
|
}
|
|
54
|
-
return hideDisplayText ? LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_TABS_WITHOUT_DISPLAYTEXT : LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_TABS_WITH_DISPLAYTEXT;
|
|
55
48
|
}
|
|
56
|
-
return hideDisplayText ?
|
|
49
|
+
return hideDisplayText ? LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_TABS_WITHOUT_DISPLAYTEXT : LINK_PICKER_MIN_HEIGHT_IN_PX_WITHOUT_TABS_WITH_DISPLAYTEXT;
|
|
57
50
|
};
|
|
58
51
|
|
|
59
52
|
/**
|
package/dist/cjs/ui/main.js
CHANGED
|
@@ -12,7 +12,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
13
|
var _reactLooselyLazy = require("react-loosely-lazy");
|
|
14
14
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _constants = require("../common/constants");
|
|
17
16
|
var _sessionProvider = require("../controllers/session-provider");
|
|
18
17
|
var _errorBoundary = require("./error-boundary");
|
|
@@ -32,7 +31,7 @@ var testIds = exports.testIds = {
|
|
|
32
31
|
};
|
|
33
32
|
var PACKAGE_DATA = exports.PACKAGE_DATA = {
|
|
34
33
|
packageName: "@atlaskit/link-picker" || '',
|
|
35
|
-
packageVersion: "1.
|
|
34
|
+
packageVersion: "1.46.1" || '',
|
|
36
35
|
componentName: _constants.COMPONENT_NAME,
|
|
37
36
|
source: _constants.COMPONENT_NAME
|
|
38
37
|
};
|
|
@@ -55,26 +54,18 @@ var composeLinkPicker = exports.composeLinkPicker = function composeLinkPicker(C
|
|
|
55
54
|
var _props$paddingLeft, _props$paddingRight, _props$paddingTop, _props$paddingBottom, _ref2;
|
|
56
55
|
var component = props.component;
|
|
57
56
|
var RootComponent = component !== null && component !== void 0 ? component : DefaultRootComponent;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* When ff enabled: root container will provide width to component + loader + error boundary
|
|
61
|
-
* When ff disabled: component + loader + error boundary each providing their own width
|
|
62
|
-
* Cannot make this change easier at risk of regression as external adopters may have css override on the form element
|
|
63
|
-
*/
|
|
64
|
-
var RootFixedWidthContainer = (0, _platformFeatureFlags.fg)('platform.linking-platform.link-picker.fixed-height-search-results') ? FixedWidthContainer : _react.Fragment;
|
|
65
|
-
var LoaderFallbackContainer = (0, _platformFeatureFlags.fg)('platform.linking-platform.link-picker.fixed-height-search-results') ? _react.Fragment : FixedWidthContainer;
|
|
66
57
|
return (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
|
|
67
58
|
data: PACKAGE_DATA
|
|
68
59
|
}, (0, _react2.jsx)(_sessionProvider.LinkPickerSessionProvider, null, (0, _react2.jsx)(_messagesProvider.MessagesProvider, null, (0, _react2.jsx)("div", {
|
|
69
60
|
style: (_ref2 = {}, (0, _defineProperty2.default)(_ref2, '--link-picker-width', props.disableWidth ? '100%' : // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
70
61
|
"".concat(_constants.LINK_PICKER_WIDTH_IN_PX, "px")), (0, _defineProperty2.default)(_ref2, '--link-picker-padding-left', (_props$paddingLeft = props.paddingLeft) !== null && _props$paddingLeft !== void 0 ? _props$paddingLeft : "var(--ds-space-200, 16px)"), (0, _defineProperty2.default)(_ref2, '--link-picker-padding-right', (_props$paddingRight = props.paddingRight) !== null && _props$paddingRight !== void 0 ? _props$paddingRight : "var(--ds-space-200, 16px)"), (0, _defineProperty2.default)(_ref2, '--link-picker-padding-top', (_props$paddingTop = props.paddingTop) !== null && _props$paddingTop !== void 0 ? _props$paddingTop : "var(--ds-space-200, 16px)"), (0, _defineProperty2.default)(_ref2, '--link-picker-padding-bottom', (_props$paddingBottom = props.paddingBottom) !== null && _props$paddingBottom !== void 0 ? _props$paddingBottom : "var(--ds-space-200, 16px)"), _ref2)
|
|
71
|
-
}, (0, _react2.jsx)(
|
|
72
|
-
fallback: (0, _react2.jsx)(
|
|
62
|
+
}, (0, _react2.jsx)(FixedWidthContainer, null, (0, _react2.jsx)(_errorBoundary.ErrorBoundary, null, (0, _react2.jsx)(_reactLooselyLazy.LazySuspense, {
|
|
63
|
+
fallback: (0, _react2.jsx)(_loaderFallback.LoaderFallback, {
|
|
73
64
|
url: props.url,
|
|
74
65
|
hideDisplayText: props.hideDisplayText,
|
|
75
66
|
isLoadingPlugins: props.isLoadingPlugins,
|
|
76
67
|
plugins: props.plugins
|
|
77
|
-
})
|
|
68
|
+
})
|
|
78
69
|
}, (0, _react2.jsx)(RootComponent, (0, _extends2.default)({}, props, {
|
|
79
70
|
"data-testid": testIds.linkPickerRoot
|
|
80
71
|
}), (0, _react2.jsx)(Component, props)))))))));
|
|
@@ -5,13 +5,10 @@
|
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { css, jsx } from '@emotion/react';
|
|
7
7
|
import { defineMessages, useIntl } from 'react-intl-next';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { LINK_PICKER_MIN_HEIGHT_IN_PX_FALLBACK } from '../../../common/constants';
|
|
10
9
|
import { GenericErrorSVG } from '../../../common/generic-error-svg';
|
|
11
10
|
import { EmptyState } from '../../../common/ui/empty-state';
|
|
12
11
|
import { MinHeightContainer } from '../../../common/ui/min-height-container';
|
|
13
|
-
// eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
|
|
14
|
-
import { rootContainerStyles } from '../../link-picker/styled';
|
|
15
12
|
const errorBoundaryFallbackStyles = css({
|
|
16
13
|
lineHeight: 'initial'
|
|
17
14
|
});
|
|
@@ -31,26 +28,13 @@ export const ErrorBoundaryFallback = () => {
|
|
|
31
28
|
const intl = useIntl();
|
|
32
29
|
const header = intl.formatMessage(messages.heading);
|
|
33
30
|
const description = intl.formatMessage(messages.description);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
return (
|
|
46
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
47
|
-
jsx("div", {
|
|
48
|
-
css: rootContainerStyles,
|
|
49
|
-
"data-testid": "link-picker-root-error-boundary-ui"
|
|
50
|
-
}, jsx(EmptyState, {
|
|
51
|
-
header: header,
|
|
52
|
-
renderImage: () => jsx(GenericErrorSVG, null),
|
|
53
|
-
description: description
|
|
54
|
-
}))
|
|
55
|
-
);
|
|
31
|
+
return jsx(MinHeightContainer, {
|
|
32
|
+
css: errorBoundaryFallbackStyles,
|
|
33
|
+
minHeight: LINK_PICKER_MIN_HEIGHT_IN_PX_FALLBACK,
|
|
34
|
+
"data-testid": "link-picker-root-error-boundary-ui"
|
|
35
|
+
}, jsx(EmptyState, {
|
|
36
|
+
header: header,
|
|
37
|
+
renderImage: () => jsx(GenericErrorSVG, null),
|
|
38
|
+
description: description
|
|
39
|
+
}));
|
|
56
40
|
};
|
|
@@ -6,7 +6,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
6
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
|
-
import { jsx } from '@emotion/react';
|
|
9
|
+
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { FormattedMessage, useIntl } from 'react-intl-next';
|
|
11
11
|
import uuid from 'uuid';
|
|
12
12
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
@@ -26,10 +26,22 @@ import { FormFooter, testIds as formFooterTestIds } from './form-footer';
|
|
|
26
26
|
import { LinkPickerSubmitButton } from './form-footer/link-picker-submit-button';
|
|
27
27
|
import { formMessages, linkMessages, linkTextMessages, searchMessages } from './messages';
|
|
28
28
|
import { SearchResults, testIds as searchTestIds } from './search-results';
|
|
29
|
-
import { formFooterMargin, rootContainerStyles } from './styled';
|
|
30
29
|
import { testIds as textFieldTestIds, TextInput } from './text-input';
|
|
31
30
|
import { TrackMount } from './track-mount';
|
|
32
31
|
import { getDataSource, getScreenReaderText } from './utils';
|
|
32
|
+
const rootContainerStyles = css({
|
|
33
|
+
paddingLeft: 'var(--link-picker-padding-left)',
|
|
34
|
+
paddingRight: 'var(--link-picker-padding-right)',
|
|
35
|
+
paddingTop: 'var(--link-picker-padding-top)',
|
|
36
|
+
paddingBottom: 'var(--link-picker-padding-bottom)',
|
|
37
|
+
boxSizing: 'border-box',
|
|
38
|
+
lineHeight: 'initial',
|
|
39
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
40
|
+
display: 'block !important'
|
|
41
|
+
});
|
|
42
|
+
const formFooterMargin = css({
|
|
43
|
+
marginTop: "var(--ds-space-200, 16px)"
|
|
44
|
+
});
|
|
33
45
|
export const testIds = {
|
|
34
46
|
linkPickerRoot: 'link-picker-root',
|
|
35
47
|
linkPicker: 'link-picker',
|
|
@@ -99,6 +111,7 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
99
111
|
featureFlags,
|
|
100
112
|
customMessages,
|
|
101
113
|
isSubmitting = false,
|
|
114
|
+
adaptiveHeight = false,
|
|
102
115
|
UNSAFE_moveSubmitButton = false
|
|
103
116
|
}) => {
|
|
104
117
|
const {
|
|
@@ -332,9 +345,7 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
332
345
|
const screenReaderText = browser().safari && getScreenReaderText(items !== null && items !== void 0 ? items : [], selectedIndex, intl);
|
|
333
346
|
const customSubmitButtonLabel = customMessages !== null && customMessages !== void 0 && customMessages.submitButtonLabel ? customMessages.submitButtonLabel : undefined;
|
|
334
347
|
return jsx("form", {
|
|
335
|
-
"data-testid": testIds.linkPicker
|
|
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
|
|
337
|
-
,
|
|
348
|
+
"data-testid": testIds.linkPicker,
|
|
338
349
|
css: rootContainerStyles
|
|
339
350
|
// Use onSubmitCapture instead of onSubmit so that any possible parent form isn't submitted
|
|
340
351
|
,
|
|
@@ -404,6 +415,7 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
404
415
|
handleSelected: handleSelected,
|
|
405
416
|
handleTabChange: handleTabChange,
|
|
406
417
|
handleSearchListOnChange: handleSearchListOnChange,
|
|
418
|
+
adaptiveHeight: adaptiveHeight,
|
|
407
419
|
retry: retry
|
|
408
420
|
}), jsx(FormFooter, {
|
|
409
421
|
error: error,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
/**
|
|
3
2
|
* @jsxRuntime classic
|
|
4
3
|
* @jsx jsx
|
|
@@ -10,7 +9,6 @@ import { css, jsx } from '@emotion/react';
|
|
|
10
9
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
11
10
|
import Spinner from '@atlaskit/spinner/spinner';
|
|
12
11
|
import Tabs, { Tab, TabList } from '@atlaskit/tabs';
|
|
13
|
-
import { useFixHeight } from '../../../controllers/use-fix-height';
|
|
14
12
|
import { LinkSearchError, testIds as searchErrorTestIds } from './link-search-error';
|
|
15
13
|
import { LinkSearchList, testIds as listTestIds } from './link-search-list';
|
|
16
14
|
import { ScrollingTabList } from './scrolling-tabs';
|
|
@@ -52,20 +50,20 @@ export const SearchResults = ({
|
|
|
52
50
|
selectedIndex,
|
|
53
51
|
handleSelected,
|
|
54
52
|
handleKeyDown,
|
|
53
|
+
adaptiveHeight,
|
|
55
54
|
retry
|
|
56
55
|
}) => {
|
|
57
56
|
var _activePlugin$errorFa, _activePlugin$errorFa2;
|
|
58
57
|
const isActivePlugin = !!activePlugin;
|
|
59
|
-
|
|
60
|
-
// This will be redundant if we move towards fixed height search results section
|
|
61
|
-
const fixListHeightProps = useFixHeight(isLoadingResults);
|
|
62
58
|
const tabList = jsx(TabList, null, tabs.map(tab => jsx(Tab, {
|
|
63
59
|
key: tab.tabTitle,
|
|
64
60
|
testId: testIds.tabItem
|
|
65
61
|
}, tab.tabTitle)));
|
|
66
|
-
return jsx(SearchResultsContainer,
|
|
67
|
-
hasTabs: !!tabs.length || isLoadingPlugins
|
|
68
|
-
|
|
62
|
+
return jsx(SearchResultsContainer, {
|
|
63
|
+
hasTabs: !!tabs.length || isLoadingPlugins,
|
|
64
|
+
adaptiveHeight: adaptiveHeight,
|
|
65
|
+
isLoadingResults: isLoadingResults
|
|
66
|
+
}, isLoadingPlugins && !!queryState && jsx("div", {
|
|
69
67
|
css: spinnerContainerStyles
|
|
70
68
|
}, jsx(Spinner, {
|
|
71
69
|
testId: testIds.tabsLoadingIndicator,
|
|
@@ -92,6 +90,7 @@ export const SearchResults = ({
|
|
|
92
90
|
onChange: handleSearchListOnChange,
|
|
93
91
|
onKeyDown: handleKeyDown,
|
|
94
92
|
hasSearchTerm: !!(queryState !== null && queryState !== void 0 && queryState.query.length),
|
|
95
|
-
activePlugin: activePlugin
|
|
93
|
+
activePlugin: activePlugin,
|
|
94
|
+
adaptiveHeight: adaptiveHeight
|
|
96
95
|
}), error ? (_activePlugin$errorFa = activePlugin === null || activePlugin === void 0 ? void 0 : (_activePlugin$errorFa2 = activePlugin.errorFallback) === null || _activePlugin$errorFa2 === void 0 ? void 0 : _activePlugin$errorFa2.call(activePlugin, error, retry)) !== null && _activePlugin$errorFa !== void 0 ? _activePlugin$errorFa : jsx(LinkSearchError, null) : null));
|
|
97
96
|
};
|
|
@@ -61,6 +61,7 @@ export const LinkSearchList = /*#__PURE__*/forwardRef(({
|
|
|
61
61
|
id,
|
|
62
62
|
hasSearchTerm,
|
|
63
63
|
activePlugin,
|
|
64
|
+
adaptiveHeight,
|
|
64
65
|
...restProps
|
|
65
66
|
}, ref) => {
|
|
66
67
|
var _activePlugin$uiOptio;
|
|
@@ -134,7 +135,7 @@ export const LinkSearchList = /*#__PURE__*/forwardRef(({
|
|
|
134
135
|
}))), jsx("ul", {
|
|
135
136
|
id: id,
|
|
136
137
|
role: role
|
|
137
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
138
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
138
139
|
,
|
|
139
140
|
css: listStyles,
|
|
140
141
|
"aria-controls": "fabric.smartcard.linkpicker.suggested.results",
|
|
@@ -158,8 +159,8 @@ export const LinkSearchList = /*#__PURE__*/forwardRef(({
|
|
|
158
159
|
}
|
|
159
160
|
if (isLoading) {
|
|
160
161
|
loadingContent = jsx(MinHeightContainer, {
|
|
161
|
-
minHeight:
|
|
162
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
162
|
+
minHeight: adaptiveHeight ? '80px' : '50px'
|
|
163
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
163
164
|
,
|
|
164
165
|
css: spinnerContainerStyles
|
|
165
166
|
}, jsx(Spinner, {
|