@atlaskit/link-datasource 6.4.9 → 6.4.11

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/hooks/useDatasourceTableState.js +7 -1
  3. package/dist/cjs/ui/assets-modal/modal/render-assets-content/index.js +6 -2
  4. package/dist/cjs/ui/common/error-state/no-results.compiled.css +2 -0
  5. package/dist/cjs/ui/common/error-state/no-results.js +4 -2
  6. package/dist/cjs/ui/common/modal/display-view-dropdown/display-view-drop-down.js +4 -2
  7. package/dist/cjs/ui/common/modal/mode-switcher/index.compiled.css +0 -1
  8. package/dist/cjs/ui/common/modal/mode-switcher/index.js +3 -7
  9. package/dist/cjs/ui/common/modal/site-selector/index.js +2 -5
  10. package/dist/cjs/ui/confluence-search-modal/modal/index.js +6 -2
  11. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +7 -3
  12. package/dist/cjs/ui/issue-like-table/index.compiled.css +2 -0
  13. package/dist/cjs/ui/issue-like-table/index.js +57 -1
  14. package/dist/cjs/ui/jira-issues-modal/modal/index.js +5 -2
  15. package/dist/es2019/hooks/useDatasourceTableState.js +6 -1
  16. package/dist/es2019/ui/assets-modal/modal/render-assets-content/index.js +6 -2
  17. package/dist/es2019/ui/common/error-state/no-results.compiled.css +2 -0
  18. package/dist/es2019/ui/common/error-state/no-results.js +3 -1
  19. package/dist/es2019/ui/common/modal/display-view-dropdown/display-view-drop-down.js +4 -2
  20. package/dist/es2019/ui/common/modal/mode-switcher/index.compiled.css +0 -1
  21. package/dist/es2019/ui/common/modal/mode-switcher/index.js +3 -7
  22. package/dist/es2019/ui/common/modal/site-selector/index.js +2 -5
  23. package/dist/es2019/ui/confluence-search-modal/modal/index.js +6 -2
  24. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +7 -3
  25. package/dist/es2019/ui/issue-like-table/index.compiled.css +2 -0
  26. package/dist/es2019/ui/issue-like-table/index.js +51 -1
  27. package/dist/es2019/ui/jira-issues-modal/modal/index.js +5 -2
  28. package/dist/esm/hooks/useDatasourceTableState.js +7 -1
  29. package/dist/esm/ui/assets-modal/modal/render-assets-content/index.js +6 -2
  30. package/dist/esm/ui/common/error-state/no-results.compiled.css +2 -0
  31. package/dist/esm/ui/common/error-state/no-results.js +4 -2
  32. package/dist/esm/ui/common/modal/display-view-dropdown/display-view-drop-down.js +4 -2
  33. package/dist/esm/ui/common/modal/mode-switcher/index.compiled.css +0 -1
  34. package/dist/esm/ui/common/modal/mode-switcher/index.js +3 -7
  35. package/dist/esm/ui/common/modal/site-selector/index.js +2 -5
  36. package/dist/esm/ui/confluence-search-modal/modal/index.js +6 -2
  37. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +7 -3
  38. package/dist/esm/ui/issue-like-table/index.compiled.css +2 -0
  39. package/dist/esm/ui/issue-like-table/index.js +57 -1
  40. package/dist/esm/ui/jira-issues-modal/modal/index.js +5 -2
  41. package/dist/types/ui/common/error-state/no-results.d.ts +3 -1
  42. package/package.json +6 -6
  43. package/link-datasource.docs.tsx +0 -169
@@ -8,6 +8,7 @@ import FeatureGates from '@atlaskit/feature-gate-js-client';
8
8
  import IntlMessagesProvider from '@atlaskit/intl-messages-provider/main';
9
9
  import LinkComponent from '@atlaskit/link';
10
10
  import { CloseButton, ModalBody, ModalFooter, ModalHeader, ModalTitle } from '@atlaskit/modal-dialog';
11
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
11
12
  import { Box, Flex } from '@atlaskit/primitives/compiled';
12
13
  import { useDatasourceAnalyticsEvents } from '../../../analytics';
13
14
  import { DatasourceAction, DatasourceSearchMethod } from '../../../analytics/types';
@@ -152,6 +153,9 @@ export const PlainConfluenceSearchConfigModal = props => {
152
153
  siteSelectorLabel = availableSites && availableSites.length > 1 ? confluenceSearchModalMessages.insertIssuesTitleManySites : confluenceSearchModalMessages.insertIssuesTitle;
153
154
  }
154
155
  const resolvedWithNoResults = status === 'resolved' && !responseItems.length;
156
+ // With columns available the table can keep its headers and show the empty state in place of
157
+ // the rows, instead of replacing the whole table with it.
158
+ const shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length && fg('platform_lp_sllv_ux_improvements');
155
159
  const hasConfluenceSearchParams = selectedConfluenceSite && (parameters === null || parameters === void 0 ? void 0 : parameters.searchString);
156
160
  const selectedConfluenceSiteUrl = selectedConfluenceSite === null || selectedConfluenceSite === void 0 ? void 0 : selectedConfluenceSite.url;
157
161
  const confluenceSearchUrl = useMemo(() => {
@@ -234,7 +238,7 @@ export const PlainConfluenceSearchConfigModal = props => {
234
238
  return /*#__PURE__*/React.createElement(AccessRequired, {
235
239
  url: selectedConfluenceSiteUrl || urlBeingEdited
236
240
  });
237
- } else if (resolvedWithNoResults || status === 'forbidden') {
241
+ } else if (resolvedWithNoResults && !shouldRenderTableWithNoResults || status === 'forbidden') {
238
242
  return /*#__PURE__*/React.createElement(NoResults, null);
239
243
  } else if (status === 'empty' || !columns.length) {
240
244
  // persist the empty state when making the initial /data request which contains the columns
@@ -257,7 +261,7 @@ export const PlainConfluenceSearchConfigModal = props => {
257
261
  }, /*#__PURE__*/React.createElement(DatasourcesTableInModalPreview, {
258
262
  testId: "confluence-search-datasource-table"
259
263
  }));
260
- }, [status, resolvedWithNoResults, columns.length, selectedConfluenceSiteUrl, urlBeingEdited, hasConfluenceSearchParams, formatMessage, reset, selectedConfluenceSite]);
264
+ }, [status, resolvedWithNoResults, shouldRenderTableWithNoResults, columns.length, selectedConfluenceSiteUrl, urlBeingEdited, hasConfluenceSearchParams, formatMessage, reset, selectedConfluenceSite]);
261
265
  const renderInlineLinkModalContent = useCallback(() => {
262
266
  if (status === 'unauthorized') {
263
267
  return /*#__PURE__*/React.createElement(AccessRequired, {
@@ -173,7 +173,11 @@ const DatasourceTableViewWithoutAnalytics = ({
173
173
  shouldForceRequest: true
174
174
  });
175
175
  }, [reset]);
176
- if (status === 'resolved' && !responseItems.length || status === 'forbidden') {
176
+ const isResolvedWithNoResults = status === 'resolved' && !responseItems.length;
177
+ // With columns available the table can keep its headers and footer and show the empty state
178
+ // in place of the rows, instead of replacing the whole view with it.
179
+ const shouldRenderTableWithNoResults = isResolvedWithNoResults && hasColumns && fg('platform_lp_sllv_ux_improvements');
180
+ if (isResolvedWithNoResults && !shouldRenderTableWithNoResults || status === 'forbidden') {
177
181
  return /*#__PURE__*/React.createElement(NoResults, null);
178
182
  }
179
183
  if (status === 'unauthorized') {
@@ -225,9 +229,9 @@ const DatasourceTableViewWithoutAnalytics = ({
225
229
  isCompact: true
226
230
  }), /*#__PURE__*/React.createElement(TableFooter, {
227
231
  datasourceId: datasourceId,
228
- itemCount: isDataReady ? totalCount : undefined,
232
+ itemCount: isDataReady ? totalCount : shouldRenderTableWithNoResults ? 0 : undefined,
229
233
  onRefresh: onRefresh,
230
- isLoading: !isDataReady || status === 'loading',
234
+ isLoading: shouldRenderTableWithNoResults ? false : !isDataReady || status === 'loading',
231
235
  url: url
232
236
  })));
233
237
  };
@@ -78,6 +78,7 @@ thead.has-column-picker ._10i2idpf:nth-last-of-type(2){border-right:0}.ProseMirr
78
78
  ._19bv1b66{padding-left:var(--ds-space-050,4px)}
79
79
  ._19bvze3t{padding-left:var(--ds-space-0,0)}
80
80
  ._19pkidpf{margin-top:0}
81
+ ._1bah1h6o{justify-content:center}
81
82
  ._1bsb1osq{width:100%}
82
83
  ._1bto1l2s{text-overflow:ellipsis}
83
84
  ._1cimn7od [data-testid=button-connect-account]>span{white-space:unset}
@@ -87,6 +88,7 @@ thead.has-column-picker ._10i2idpf:nth-last-of-type(2){border-right:0}.ProseMirr
87
88
  ._1ixkusic:last-of-type{text-align:right}
88
89
  ._1lhc1b66:first-of-type{padding-left:var(--ds-space-050,4px)}
89
90
  ._1lrw1sd4{background-size:40px 100%,14px 100%,40px 100%,14px 100%,100% 75pt,100% 14px,100% 40px,100% 10px}
91
+ ._1ltvidpf{left:0}
90
92
  ._1nd0cs5v [data-testid=datasource-header-content--container]{-webkit-line-clamp:2}
91
93
  ._1o0zidpf{border-bottom-right-radius:0}
92
94
  ._1o59pxbi:last-of-type{padding-right:var(--ds-space-200,1pc)}
@@ -25,6 +25,7 @@ import Tooltip from '@atlaskit/tooltip';
25
25
  import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExperiences';
26
26
  import { useDatasourceExperienceId } from '../../contexts/datasource-experience-id';
27
27
  import { useIsInPDFRender } from '../../hooks/useIsInPDFRender';
28
+ import { NoResults } from '../common/error-state/no-results';
28
29
  import { ColumnPicker } from './column-picker';
29
30
  import { DragColumnPreview } from './drag-column-preview';
30
31
  import { DraggableTableHeading } from './draggable-table-heading';
@@ -57,6 +58,23 @@ const wrappedStyles = null;
57
58
  const richTextCellStyles = null;
58
59
  const tableContainerStyles = null;
59
60
 
61
+ // The cell spans every column, so it is as wide as the scrollable table rather than the part of it
62
+ // that is on screen. Sticking to the left edge of the scrollport keeps the empty state centred on
63
+ // what the user can actually see while the headers still scroll behind it.
64
+ const noResultsCellContentStyles = null;
65
+ const getHorizontalScrollParent = element => {
66
+ let current = element;
67
+ while (current) {
68
+ const {
69
+ overflowX
70
+ } = getComputedStyle(current);
71
+ if (overflowX === 'auto' || overflowX === 'scroll') {
72
+ return current;
73
+ }
74
+ current = current.parentElement;
75
+ }
76
+ };
77
+
60
78
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled
61
79
  const Table = forwardRef(({
62
80
  as: C = "table",
@@ -293,6 +311,26 @@ export const IssueLikeDataTableView = ({
293
311
  }, [isInPDFRender, onNextPage, status, hasNextPage]);
294
312
  const hasData = items.length > 0;
295
313
 
314
+ // A resolved response with no items still carries column metadata, so the table can keep its
315
+ // headers and render the empty state where the rows would normally be.
316
+ const hasNoResults = status === 'resolved' && !hasData && fg('platform_lp_sllv_ux_improvements');
317
+ const [noResultsWidth, setNoResultsWidth] = useState();
318
+ useEffect(() => {
319
+ const container = containerRef.current;
320
+ if (!hasNoResults || !container) {
321
+ return;
322
+ }
323
+ const scrollport = getHorizontalScrollParent(container) || container;
324
+ const updateWidth = () => setNoResultsWidth(scrollport.clientWidth || undefined);
325
+ updateWidth();
326
+ if (typeof ResizeObserver === 'undefined') {
327
+ return;
328
+ }
329
+ const observer = new ResizeObserver(updateWidth);
330
+ observer.observe(scrollport);
331
+ return () => observer.disconnect();
332
+ }, [hasNoResults]);
333
+
296
334
  // This variable contains initial Y mouse coordinate, so we can restrict
297
335
  // autoScroller in X axis only
298
336
  const initialAutoScrollerClientY = useRef();
@@ -583,7 +621,19 @@ export const IssueLikeDataTableView = ({
583
621
  })))), /*#__PURE__*/React.createElement("tbody", {
584
622
  "data-testid": testId && `${testId}--body`,
585
623
  className: ax(["_n7zlidpf"])
586
- }, rows.map(({
624
+ }, hasNoResults && /*#__PURE__*/React.createElement("tr", {
625
+ "data-testid": testId && `${testId}--no-results-row`
626
+ }, /*#__PURE__*/React.createElement(InlineEditableTableCell, {
627
+ colSpan: Math.max(headerColumns.length + (onVisibleColumnKeysChange ? 1 : 0), 1)
628
+ }, /*#__PURE__*/React.createElement("div", {
629
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- width is measured from the scrollport at runtime
630
+ style: {
631
+ width: noResultsWidth
632
+ },
633
+ className: ax(["_kqsw1if8 _1ltvidpf _1e0c1txw _1bah1h6o"])
634
+ }, /*#__PURE__*/React.createElement(NoResults, {
635
+ isCompact: true
636
+ })))), rows.map(({
587
637
  key,
588
638
  cells,
589
639
  ref
@@ -120,6 +120,9 @@ const PlainJiraIssuesConfigModal = props => {
120
120
  destinationObjectTypes
121
121
  }), [destinationObjectTypes, extensionKey]);
122
122
  const resolvedWithNoResults = status === 'resolved' && !responseItems.length;
123
+ // With columns available the table can keep its headers and show the empty state in place of
124
+ // the rows, instead of replacing the whole table with it.
125
+ const shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length && fg('platform_lp_sllv_ux_improvements');
123
126
  const jqlUrl = selectedJiraSite && jql && `${selectedJiraSite.url}/issues/?jql=${encodeURI(jql)}`;
124
127
  const shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'table';
125
128
  const isDataReady = (visibleColumnKeys || []).length > 0;
@@ -293,7 +296,7 @@ const PlainJiraIssuesConfigModal = props => {
293
296
  return /*#__PURE__*/React.createElement(AccessRequired, {
294
297
  url: selectedJiraSiteUrl || urlBeingEdited
295
298
  });
296
- } else if (resolvedWithNoResults || status === 'forbidden') {
299
+ } else if (resolvedWithNoResults && !shouldRenderTableWithNoResults || status === 'forbidden') {
297
300
  return /*#__PURE__*/React.createElement(NoResults, null);
298
301
  } else if (status === 'empty' || !columns.length) {
299
302
  // persist the empty state when making the initial /data request which contains the columns
@@ -322,7 +325,7 @@ const PlainJiraIssuesConfigModal = props => {
322
325
  }, /*#__PURE__*/React.createElement(DatasourcesTableInModalPreview, {
323
326
  testId: "jira-datasource-table"
324
327
  }));
325
- }, [columns.length, currentSearchMethod, formatMessage, jql, jqlUrl, resolvedWithNoResults, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited, reset]);
328
+ }, [columns.length, currentSearchMethod, formatMessage, jql, jqlUrl, resolvedWithNoResults, shouldRenderTableWithNoResults, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited, reset]);
326
329
  const siteSelectorLabel = useMemo(() => {
327
330
  if (fg('confluence-issue-terminology-refresh')) {
328
331
  return availableSites && availableSites.length > 1 ? modalMessages.insertIssuesTitleManySitesIssueTermRefresh : modalMessages.insertIssuesTitleIssueTermRefresh;
@@ -5,6 +5,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
  import { useCallback, useEffect, useRef, useState } from 'react';
6
6
  import isEqual from 'lodash/isEqual';
7
7
  import { isFedRamp } from '@atlaskit/atlassian-context/is-fedramp';
8
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
8
9
  import { DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE, useDatasourceClientExtension } from '@atlaskit/link-client-extension';
9
10
  import { useDatasourceAnalyticsEvents } from '../analytics';
10
11
  import { useDatasourceActions } from '../state';
@@ -231,6 +232,7 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
231
232
  entityType,
232
233
  newIds,
233
234
  aris,
235
+ shouldApplySchemaWithoutItems,
234
236
  isUserLoadingNextPage,
235
237
  currentLoadedItemCount,
236
238
  newlyLoadedItemCount,
@@ -341,7 +343,11 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
341
343
  if (fieldKeys.length > 0) {
342
344
  setLastRequestedFieldKeys(fieldKeys);
343
345
  }
344
- if ((isSchemaFromData && schema || fullSchema.properties.length > 0) && items.length > 0) {
346
+
347
+ // A response with no items still describes its columns, so the schema is worth applying
348
+ // to let the table keep its headers while showing the empty state.
349
+ shouldApplySchemaWithoutItems = items.length === 0 && fg('platform_lp_sllv_ux_improvements');
350
+ if ((isSchemaFromData && schema || fullSchema.properties.length > 0) && (items.length > 0 || shouldApplySchemaWithoutItems)) {
345
351
  applySchemaProperties(schema || fullSchema, fieldKeys);
346
352
  }
347
353
  isUserLoadingNextPage = responseItems.length !== 0 && !shouldRequestFirstPage;
@@ -3,6 +3,7 @@ import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { useCallback, useMemo } from 'react';
6
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
6
7
  import { AccessRequired } from '../../../common/error-state/access-required';
7
8
  import { ModalLoadingError } from '../../../common/error-state/modal-loading-error';
8
9
  import { NoResults } from '../../../common/error-state/no-results';
@@ -54,6 +55,9 @@ export var RenderAssetsContent = function RenderAssetsContent(props) {
54
55
  onVisibleColumnKeysChange = props.onVisibleColumnKeysChange,
55
56
  isFetchingInitialData = props.isFetchingInitialData;
56
57
  var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
58
+ // With columns available the table can keep its headers and show the empty state in place of
59
+ // the rows, instead of replacing the whole table with it.
60
+ var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length && fg('platform_lp_sllv_ux_improvements');
57
61
  var issueLikeDataTableView = useMemo(function () {
58
62
  return /*#__PURE__*/React.createElement("div", {
59
63
  className: ax(["_1reo1wug _18m91wug _4t3i1pna _1e0c11p5", "_19itia51 _n7zl1mpn _13li1mok _qrwq1mok _1itkz1kv _12vemgnk _1lrw1sd4 _qmxj1c00"])
@@ -80,12 +84,12 @@ export var RenderAssetsContent = function RenderAssetsContent(props) {
80
84
  return /*#__PURE__*/React.createElement(UnauthorizedView, null);
81
85
  } else if (status === 'empty') {
82
86
  return /*#__PURE__*/React.createElement(EmptyView, null);
83
- } else if (resolvedWithNoResults) {
87
+ } else if (resolvedWithNoResults && !shouldRenderTableWithNoResults) {
84
88
  return /*#__PURE__*/React.createElement(NoResultsView, null);
85
89
  } else if (status === 'loading' && !columns.length) {
86
90
  return /*#__PURE__*/React.createElement(LoadingView, null);
87
91
  }
88
92
  return issueLikeDataTableView;
89
- }, [columns.length, isFetchingInitialData, issueLikeDataTableView, resolvedWithNoResults, status]);
93
+ }, [columns.length, isFetchingInitialData, issueLikeDataTableView, resolvedWithNoResults, shouldRenderTableWithNoResults, status]);
90
94
  return renderAssetsContentView();
91
95
  };
@@ -1,11 +1,13 @@
1
1
  ._zulp1ejb{gap:var(--ds-space-300,24px)}
2
2
  ._zulppxbi{gap:var(--ds-space-200,1pc)}._10fp1h6o{justify-self:center}
3
3
  ._18u0oahv{margin-left:var(--ds-space-600,3pc)}
4
+ ._19pk1ejb{margin-top:var(--ds-space-300,24px)}
4
5
  ._19pkoahv{margin-top:var(--ds-space-600,3pc)}
5
6
  ._1wpz1h6o{align-self:center}
6
7
  ._2hwxoahv{margin-right:var(--ds-space-600,3pc)}
7
8
  ._4cvr1h6o{align-items:center}
8
9
  ._6a6z1h6o{justify-items:center}
10
+ ._otyr1ejb{margin-bottom:var(--ds-space-300,24px)}
9
11
  ._otyroahv{margin-bottom:var(--ds-space-600,3pc)}
10
12
  ._p12fko4j{max-width:19pc}
11
13
  ._y3gn1h6o{text-align:center}
@@ -11,11 +11,13 @@ import { SpotSearchNoResult } from '../../../common/ui/spot/error-state/search-n
11
11
  import { loadingErrorMessages } from './messages';
12
12
  var styles = {
13
13
  noResultsContainerStyles: "_4cvr1h6o _6a6z1h6o _1wpz1h6o _10fp1h6o _19pkoahv _2hwxoahv _otyroahv _18u0oahv",
14
+ noResultsCompactContainerStyles: "_4cvr1h6o _6a6z1h6o _1wpz1h6o _10fp1h6o _19pk1ejb _2hwxoahv _otyr1ejb _18u0oahv",
14
15
  noResultsContentStyles: "_zulp1ejb _4cvr1h6o _6a6z1h6o _p12fko4j",
15
16
  noResultsMessageContainerStyles: "_zulppxbi _4cvr1h6o _6a6z1h6o _y3gn1h6o"
16
17
  };
17
18
  export var NoResults = function NoResults(_ref) {
18
- var onRefresh = _ref.onRefresh;
19
+ var isCompact = _ref.isCompact,
20
+ onRefresh = _ref.onRefresh;
19
21
  var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
20
22
  fireEvent = _useDatasourceAnalyti.fireEvent;
21
23
  var _useIntl = useIntl(),
@@ -24,7 +26,7 @@ export var NoResults = function NoResults(_ref) {
24
26
  fireEvent('ui.emptyResult.shown.datasource', {});
25
27
  }, [fireEvent]);
26
28
  return /*#__PURE__*/React.createElement(Grid, {
27
- xcss: styles.noResultsContainerStyles,
29
+ xcss: isCompact ? styles.noResultsCompactContainerStyles : styles.noResultsContainerStyles,
28
30
  testId: "datasource-modal--no-results"
29
31
  }, /*#__PURE__*/React.createElement(Grid, {
30
32
  xcss: styles.noResultsContentStyles
@@ -9,10 +9,12 @@ import { FormattedMessage, useIntl } from 'react-intl';
9
9
  import Button from '@atlaskit/button/new';
10
10
  import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
11
11
  import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { Box } from '@atlaskit/primitives/compiled';
13
14
  import { displayViewDropDownMessages } from './messages';
14
15
  var styles = {
15
- dropDownItemGroupStyles: "_2rko12b0 _1bsb1pna _4t3i7iqz"
16
+ dropDownItemGroupStyles: "_2rko12b0 _1bsb1pna _4t3i7iqz",
17
+ dropDownItemGroupStylesWithoutFixedHeight: "_2rko12b0 _1bsb1pna"
16
18
  };
17
19
  var InlineIcon = /*#__PURE__*/React.createElement("svg", {
18
20
  xmlns: "http://www.w3.org/2000/svg",
@@ -62,7 +64,7 @@ export var DisplayViewDropDown = function DisplayViewDropDown(_ref) {
62
64
  },
63
65
  testId: "datasource-modal--view-drop-down"
64
66
  }, /*#__PURE__*/React.createElement(Box, {
65
- xcss: styles.dropDownItemGroupStyles
67
+ xcss: fg('platform_lp_sllv_ux_improvements') ? styles.dropDownItemGroupStylesWithoutFixedHeight : styles.dropDownItemGroupStyles
66
68
  }, /*#__PURE__*/React.createElement(DropdownItemGroup, null, /*#__PURE__*/React.createElement(DropdownItem, {
67
69
  testId: "dropdown-item-table",
68
70
  onClick: function onClick() {
@@ -12,7 +12,6 @@
12
12
  ._1bah1h6o{justify-content:center}
13
13
  ._1e0c116y{display:inline-flex}
14
14
  ._1e0c1txw{display:flex}
15
- ._1e0cglyw{display:none}
16
15
  ._1j55105o:disabled{opacity:.5}
17
16
  ._1tke1tcg{min-height:24px}
18
17
  ._4cvr1h6o{align-items:center}
@@ -3,7 +3,6 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./index.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import React from 'react';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import Tooltip from '@atlaskit/tooltip';
8
7
  import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
9
8
  import { DatasourceAction } from '../../../../analytics/types';
@@ -12,7 +11,6 @@ import { DisplayViewDropDown } from '../display-view-dropdown/display-view-drop-
12
11
  import { useViewModeContext } from './useViewModeContext';
13
12
  var modeSwitcherStyles = null;
14
13
  var compactModeSwitcherStyles = null;
15
- var modeInputStyles = null;
16
14
  var modeFocusStyles = null;
17
15
  var modeSwitcherLabelStyles = null;
18
16
  var modeSwitcherLabelSelectedStyles = null;
@@ -30,7 +28,6 @@ export var ModeSwitcher = function ModeSwitcher(props) {
30
28
  var handleModeChange = function handleModeChange(event) {
31
29
  onOptionValueChange(event.currentTarget.value);
32
30
  };
33
- var RadioWrapper = fg('navx-5290-sllv-modal-a11y-updates') ? VisuallyHidden : React.Fragment;
34
31
  return options.length > 0 ? /*#__PURE__*/React.createElement("fieldset", {
35
32
  "data-testid": "mode-toggle-container",
36
33
  disabled: isDisabled,
@@ -48,16 +45,15 @@ export var ModeSwitcher = function ModeSwitcher(props) {
48
45
  return /*#__PURE__*/React.createElement("label", _extends({}, tooltipProps, {
49
46
  key: value,
50
47
  "data-testid": "mode-toggle-".concat(value),
51
- className: ax(["_11c8fhey _2rko1b66 _1h6d1j28 _189ee4h9 _1dqonqa1 _syaz1rpy _vchhusvi _k48p1wq8 _u5f3utpp _19bvutpp _1tke1tcg _1e0c1txw _4cvr1h6o _1bah1h6o _d0altlke _irr31dpa", isCompact && "_ca0qv77o _u5f31b66 _n3tdv77o _19bv1b66", isSelected && "_2rko1b66 _1h6dq98m _bfhk15s3 _syaz6x5g _d0altlke _irr315s3", isDisabled && "_irr31j28 _d0al13gf", isOptionDisabled && "_syaz1gmx", isOptionDisabled && "_irr31j28 _d0al13gf", fg('navx-5290-sllv-modal-a11y-updates') && "_1e387g83 _7glxv77o"])
52
- }), label, /*#__PURE__*/React.createElement(RadioWrapper, null, /*#__PURE__*/React.createElement("input", {
48
+ className: ax(["_11c8fhey _2rko1b66 _1h6d1j28 _189ee4h9 _1dqonqa1 _syaz1rpy _vchhusvi _k48p1wq8 _u5f3utpp _19bvutpp _1tke1tcg _1e0c1txw _4cvr1h6o _1bah1h6o _d0altlke _irr31dpa", isCompact && "_ca0qv77o _u5f31b66 _n3tdv77o _19bv1b66", isSelected && "_2rko1b66 _1h6dq98m _bfhk15s3 _syaz6x5g _d0altlke _irr315s3", isDisabled && "_irr31j28 _d0al13gf", isOptionDisabled && "_syaz1gmx", isOptionDisabled && "_irr31j28 _d0al13gf", "_1e387g83 _7glxv77o"])
49
+ }), label, /*#__PURE__*/React.createElement(VisuallyHidden, null, /*#__PURE__*/React.createElement("input", {
53
50
  "aria-checked": isSelected,
54
51
  "aria-disabled": isOptionDisabled,
55
52
  checked: isSelected,
56
53
  disabled: isOptionDisabled,
57
54
  onChange: handleModeChange,
58
55
  type: "radio",
59
- value: value,
60
- className: ax([!fg('navx-5290-sllv-modal-a11y-updates') && "_1e0cglyw"])
56
+ value: value
61
57
  })));
62
58
  });
63
59
  })) : null;
@@ -10,7 +10,6 @@ import { useIntl } from 'react-intl';
10
10
  import Button from '@atlaskit/button/new';
11
11
  import Heading from '@atlaskit/heading';
12
12
  import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
13
- import { fg } from '@atlaskit/platform-feature-flags';
14
13
  import { Box } from '@atlaskit/primitives/compiled';
15
14
  import { PopupSelect } from '@atlaskit/select';
16
15
  import { siteSelectorMessages } from './messages';
@@ -76,10 +75,8 @@ export var SiteSelector = function SiteSelector(props) {
76
75
  size: "small"
77
76
  });
78
77
  },
79
- testId: "".concat(testId, "__control")
80
- }, fg('navx-5290-sllv-modal-a11y-updates') ? {
81
- 'aria-label': selectedSiteOption !== null && selectedSiteOption !== void 0 && selectedSiteOption.label ? "".concat(formatMessage(siteSelectorMessages.chooseSite), ": ").concat(selectedSiteOption.label) : formatMessage(siteSelectorMessages.chooseSite)
82
- } : {}, {
78
+ testId: "".concat(testId, "__control"),
79
+ "aria-label": selectedSiteOption !== null && selectedSiteOption !== void 0 && selectedSiteOption.label ? "".concat(formatMessage(siteSelectorMessages.chooseSite), ": ").concat(selectedSiteOption.label) : formatMessage(siteSelectorMessages.chooseSite),
83
80
  autoFocus: true
84
81
  }), (selectedSiteOption === null || selectedSiteOption === void 0 ? void 0 : selectedSiteOption.label) || formatMessage(siteSelectorMessages.chooseSite));
85
82
  }
@@ -11,6 +11,7 @@ import FeatureGates from '@atlaskit/feature-gate-js-client';
11
11
  import IntlMessagesProvider from '@atlaskit/intl-messages-provider/main';
12
12
  import LinkComponent from '@atlaskit/link';
13
13
  import { CloseButton, ModalBody, ModalFooter, ModalHeader, ModalTitle } from '@atlaskit/modal-dialog';
14
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
14
15
  import { Box, Flex } from '@atlaskit/primitives/compiled';
15
16
  import { useDatasourceAnalyticsEvents } from '../../../analytics';
16
17
  import { DatasourceAction, DatasourceSearchMethod } from '../../../analytics/types';
@@ -151,6 +152,9 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
151
152
  siteSelectorLabel = availableSites && availableSites.length > 1 ? confluenceSearchModalMessages.insertIssuesTitleManySites : confluenceSearchModalMessages.insertIssuesTitle;
152
153
  }
153
154
  var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
155
+ // With columns available the table can keep its headers and show the empty state in place of
156
+ // the rows, instead of replacing the whole table with it.
157
+ var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length && fg('platform_lp_sllv_ux_improvements');
154
158
  var hasConfluenceSearchParams = selectedConfluenceSite && (parameters === null || parameters === void 0 ? void 0 : parameters.searchString);
155
159
  var selectedConfluenceSiteUrl = selectedConfluenceSite === null || selectedConfluenceSite === void 0 ? void 0 : selectedConfluenceSite.url;
156
160
  var confluenceSearchUrl = useMemo(function () {
@@ -237,7 +241,7 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
237
241
  return /*#__PURE__*/React.createElement(AccessRequired, {
238
242
  url: selectedConfluenceSiteUrl || urlBeingEdited
239
243
  });
240
- } else if (resolvedWithNoResults || status === 'forbidden') {
244
+ } else if (resolvedWithNoResults && !shouldRenderTableWithNoResults || status === 'forbidden') {
241
245
  return /*#__PURE__*/React.createElement(NoResults, null);
242
246
  } else if (status === 'empty' || !columns.length) {
243
247
  // persist the empty state when making the initial /data request which contains the columns
@@ -260,7 +264,7 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
260
264
  }, /*#__PURE__*/React.createElement(DatasourcesTableInModalPreview, {
261
265
  testId: "confluence-search-datasource-table"
262
266
  }));
263
- }, [status, resolvedWithNoResults, columns.length, selectedConfluenceSiteUrl, urlBeingEdited, hasConfluenceSearchParams, formatMessage, reset, selectedConfluenceSite]);
267
+ }, [status, resolvedWithNoResults, shouldRenderTableWithNoResults, columns.length, selectedConfluenceSiteUrl, urlBeingEdited, hasConfluenceSearchParams, formatMessage, reset, selectedConfluenceSite]);
264
268
  var renderInlineLinkModalContent = useCallback(function () {
265
269
  if (status === 'unauthorized') {
266
270
  return /*#__PURE__*/React.createElement(AccessRequired, {
@@ -179,7 +179,11 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
179
179
  shouldForceRequest: true
180
180
  });
181
181
  }, [reset]);
182
- if (status === 'resolved' && !responseItems.length || status === 'forbidden') {
182
+ var isResolvedWithNoResults = status === 'resolved' && !responseItems.length;
183
+ // With columns available the table can keep its headers and footer and show the empty state
184
+ // in place of the rows, instead of replacing the whole view with it.
185
+ var shouldRenderTableWithNoResults = isResolvedWithNoResults && hasColumns && fg('platform_lp_sllv_ux_improvements');
186
+ if (isResolvedWithNoResults && !shouldRenderTableWithNoResults || status === 'forbidden') {
183
187
  return /*#__PURE__*/React.createElement(NoResults, null);
184
188
  }
185
189
  if (status === 'unauthorized') {
@@ -231,9 +235,9 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
231
235
  isCompact: true
232
236
  }), /*#__PURE__*/React.createElement(TableFooter, {
233
237
  datasourceId: datasourceId,
234
- itemCount: isDataReady ? totalCount : undefined,
238
+ itemCount: isDataReady ? totalCount : shouldRenderTableWithNoResults ? 0 : undefined,
235
239
  onRefresh: onRefresh,
236
- isLoading: !isDataReady || status === 'loading',
240
+ isLoading: shouldRenderTableWithNoResults ? false : !isDataReady || status === 'loading',
237
241
  url: url
238
242
  })));
239
243
  };
@@ -78,6 +78,7 @@ thead.has-column-picker ._10i2idpf:nth-last-of-type(2){border-right:0}.ProseMirr
78
78
  ._19bv1b66{padding-left:var(--ds-space-050,4px)}
79
79
  ._19bvze3t{padding-left:var(--ds-space-0,0)}
80
80
  ._19pkidpf{margin-top:0}
81
+ ._1bah1h6o{justify-content:center}
81
82
  ._1bsb1osq{width:100%}
82
83
  ._1bto1l2s{text-overflow:ellipsis}
83
84
  ._1cimn7od [data-testid=button-connect-account]>span{white-space:unset}
@@ -87,6 +88,7 @@ thead.has-column-picker ._10i2idpf:nth-last-of-type(2){border-right:0}.ProseMirr
87
88
  ._1ixkusic:last-of-type{text-align:right}
88
89
  ._1lhc1b66:first-of-type{padding-left:var(--ds-space-050,4px)}
89
90
  ._1lrw1sd4{background-size:40px 100%,14px 100%,40px 100%,14px 100%,100% 75pt,100% 14px,100% 40px,100% 10px}
91
+ ._1ltvidpf{left:0}
90
92
  ._1nd0cs5v [data-testid=datasource-header-content--container]{-webkit-line-clamp:2}
91
93
  ._1o0zidpf{border-bottom-right-radius:0}
92
94
  ._1o59pxbi:last-of-type{padding-right:var(--ds-space-200,1pc)}
@@ -38,6 +38,7 @@ import Tooltip from '@atlaskit/tooltip';
38
38
  import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExperiences';
39
39
  import { useDatasourceExperienceId } from '../../contexts/datasource-experience-id';
40
40
  import { useIsInPDFRender } from '../../hooks/useIsInPDFRender';
41
+ import { NoResults } from '../common/error-state/no-results';
41
42
  import { ColumnPicker } from './column-picker';
42
43
  import { DragColumnPreview } from './drag-column-preview';
43
44
  import { DraggableTableHeading } from './draggable-table-heading';
@@ -70,6 +71,22 @@ var wrappedStyles = null;
70
71
  var richTextCellStyles = null;
71
72
  var tableContainerStyles = null;
72
73
 
74
+ // The cell spans every column, so it is as wide as the scrollable table rather than the part of it
75
+ // that is on screen. Sticking to the left edge of the scrollport keeps the empty state centred on
76
+ // what the user can actually see while the headers still scroll behind it.
77
+ var noResultsCellContentStyles = null;
78
+ var getHorizontalScrollParent = function getHorizontalScrollParent(element) {
79
+ var current = element;
80
+ while (current) {
81
+ var _getComputedStyle = getComputedStyle(current),
82
+ overflowX = _getComputedStyle.overflowX;
83
+ if (overflowX === 'auto' || overflowX === 'scroll') {
84
+ return current;
85
+ }
86
+ current = current.parentElement;
87
+ }
88
+ };
89
+
73
90
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled
74
91
  var Table = forwardRef(function (_ref2, __cmplr) {
75
92
  var _ref2$as = _ref2.as,
@@ -337,6 +354,33 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref6) {
337
354
  }, [isInPDFRender, onNextPage, status, hasNextPage]);
338
355
  var hasData = items.length > 0;
339
356
 
357
+ // A resolved response with no items still carries column metadata, so the table can keep its
358
+ // headers and render the empty state where the rows would normally be.
359
+ var hasNoResults = status === 'resolved' && !hasData && fg('platform_lp_sllv_ux_improvements');
360
+ var _useState7 = useState(),
361
+ _useState8 = _slicedToArray(_useState7, 2),
362
+ noResultsWidth = _useState8[0],
363
+ setNoResultsWidth = _useState8[1];
364
+ useEffect(function () {
365
+ var container = containerRef.current;
366
+ if (!hasNoResults || !container) {
367
+ return;
368
+ }
369
+ var scrollport = getHorizontalScrollParent(container) || container;
370
+ var updateWidth = function updateWidth() {
371
+ return setNoResultsWidth(scrollport.clientWidth || undefined);
372
+ };
373
+ updateWidth();
374
+ if (typeof ResizeObserver === 'undefined') {
375
+ return;
376
+ }
377
+ var observer = new ResizeObserver(updateWidth);
378
+ observer.observe(scrollport);
379
+ return function () {
380
+ return observer.disconnect();
381
+ };
382
+ }, [hasNoResults]);
383
+
340
384
  // This variable contains initial Y mouse coordinate, so we can restrict
341
385
  // autoScroller in X axis only
342
386
  var initialAutoScrollerClientY = useRef();
@@ -647,7 +691,19 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref6) {
647
691
  })))), /*#__PURE__*/React.createElement("tbody", {
648
692
  "data-testid": testId && "".concat(testId, "--body"),
649
693
  className: ax(["_n7zlidpf"])
650
- }, rows.map(function (_ref16) {
694
+ }, hasNoResults && /*#__PURE__*/React.createElement("tr", {
695
+ "data-testid": testId && "".concat(testId, "--no-results-row")
696
+ }, /*#__PURE__*/React.createElement(InlineEditableTableCell, {
697
+ colSpan: Math.max(headerColumns.length + (onVisibleColumnKeysChange ? 1 : 0), 1)
698
+ }, /*#__PURE__*/React.createElement("div", {
699
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- width is measured from the scrollport at runtime
700
+ style: {
701
+ width: noResultsWidth
702
+ },
703
+ className: ax(["_kqsw1if8 _1ltvidpf _1e0c1txw _1bah1h6o"])
704
+ }, /*#__PURE__*/React.createElement(NoResults, {
705
+ isCompact: true
706
+ })))), rows.map(function (_ref16) {
651
707
  var key = _ref16.key,
652
708
  cells = _ref16.cells,
653
709
  ref = _ref16.ref;
@@ -130,6 +130,9 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
130
130
  };
131
131
  }, [destinationObjectTypes, extensionKey]);
132
132
  var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
133
+ // With columns available the table can keep its headers and show the empty state in place of
134
+ // the rows, instead of replacing the whole table with it.
135
+ var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length && fg('platform_lp_sllv_ux_improvements');
133
136
  var jqlUrl = selectedJiraSite && jql && "".concat(selectedJiraSite.url, "/issues/?jql=").concat(encodeURI(jql));
134
137
  var shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'table';
135
138
  var isDataReady = (visibleColumnKeys || []).length > 0;
@@ -308,7 +311,7 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
308
311
  return /*#__PURE__*/React.createElement(AccessRequired, {
309
312
  url: selectedJiraSiteUrl || urlBeingEdited
310
313
  });
311
- } else if (resolvedWithNoResults || status === 'forbidden') {
314
+ } else if (resolvedWithNoResults && !shouldRenderTableWithNoResults || status === 'forbidden') {
312
315
  return /*#__PURE__*/React.createElement(NoResults, null);
313
316
  } else if (status === 'empty' || !columns.length) {
314
317
  // persist the empty state when making the initial /data request which contains the columns
@@ -337,7 +340,7 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
337
340
  }, /*#__PURE__*/React.createElement(DatasourcesTableInModalPreview, {
338
341
  testId: "jira-datasource-table"
339
342
  }));
340
- }, [columns.length, currentSearchMethod, formatMessage, jql, jqlUrl, resolvedWithNoResults, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited, reset]);
343
+ }, [columns.length, currentSearchMethod, formatMessage, jql, jqlUrl, resolvedWithNoResults, shouldRenderTableWithNoResults, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited, reset]);
341
344
  var siteSelectorLabel = useMemo(function () {
342
345
  if (fg('confluence-issue-terminology-refresh')) {
343
346
  return availableSites && availableSites.length > 1 ? modalMessages.insertIssuesTitleManySitesIssueTermRefresh : modalMessages.insertIssuesTitleIssueTermRefresh;
@@ -1,5 +1,7 @@
1
1
  interface NoResultsProps {
2
+ /** Tightens the vertical spacing, for when there is less room than a full view to fill. */
3
+ isCompact?: boolean;
2
4
  onRefresh?: () => void;
3
5
  }
4
- export declare const NoResults: ({ onRefresh }: NoResultsProps) => JSX.Element;
6
+ export declare const NoResults: ({ isCompact, onRefresh }: NoResultsProps) => JSX.Element;
5
7
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "6.4.9",
3
+ "version": "6.4.11",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -57,8 +57,8 @@
57
57
  "@atlaskit/inline-edit": "^16.2.0",
58
58
  "@atlaskit/intl-messages-provider": "^4.2.0",
59
59
  "@atlaskit/jql-ast": "^4.0.0",
60
- "@atlaskit/jql-editor": "^7.5.0",
61
- "@atlaskit/jql-editor-autocomplete-rest": "^4.3.0",
60
+ "@atlaskit/jql-editor": "^7.6.0",
61
+ "@atlaskit/jql-editor-autocomplete-rest": "^4.4.0",
62
62
  "@atlaskit/layering": "^5.0.0",
63
63
  "@atlaskit/link": "^5.0.0",
64
64
  "@atlaskit/link-client-extension": "^7.1.0",
@@ -86,13 +86,13 @@
86
86
  "@atlaskit/tag": "^15.4.0",
87
87
  "@atlaskit/textfield": "^10.0.0",
88
88
  "@atlaskit/theme": "^28.0.0",
89
- "@atlaskit/tokens": "^16.6.0",
89
+ "@atlaskit/tokens": "^16.7.0",
90
90
  "@atlaskit/tooltip": "^24.0.0",
91
91
  "@atlaskit/ufo": "^1.0.0",
92
92
  "@atlaskit/visually-hidden": "^4.2.0",
93
93
  "@atlaskit/width-detector": "^7.0.0",
94
94
  "@babel/runtime": "^7.0.0",
95
- "@compiled/react": "^1.0.0",
95
+ "@compiled/react": "^1.0.2",
96
96
  "@types/dompurify": "^2.2.3",
97
97
  "date-fns": "^2.17.0",
98
98
  "debounce-promise": "^3.1.2",
@@ -188,7 +188,7 @@
188
188
  "platform_lp_sllv_richtext_margin_reset": {
189
189
  "type": "boolean"
190
190
  },
191
- "navx-5290-sllv-modal-a11y-updates": {
191
+ "platform_lp_sllv_ux_improvements": {
192
192
  "type": "boolean"
193
193
  },
194
194
  "navx-5509-sllv-link-new-tab-hint": {