@atlaskit/link-datasource 2.5.6 → 2.5.7

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 2.5.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#117343](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117343)
8
+ [`d5fc4325dc0e4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d5fc4325dc0e4) -
9
+ [ux] Limit total results count to 1000 for Assets LoL. Show 1000+ if total is >= 1000
10
+
3
11
  ## 2.5.6
4
12
 
5
13
  ### Patch Changes
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports.default = exports.AssetsItemCount = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _reactIntlNext = require("react-intl-next");
@@ -20,13 +20,13 @@ var _messages4 = require("./messages");
20
20
  var searchCountStyles = (0, _primitives.xcss)({
21
21
  flex: 1
22
22
  });
23
- var TableSearchCount = function TableSearchCount(_ref) {
24
- var url = _ref.url,
25
- searchCount = _ref.searchCount,
26
- _ref$testId = _ref.testId,
27
- testId = _ref$testId === void 0 ? 'datasource-table-total-results-count' : _ref$testId,
28
- _ref$prefixTextType = _ref.prefixTextType,
29
- prefixTextType = _ref$prefixTextType === void 0 ? 'issue' : _ref$prefixTextType;
23
+ var AssetsItemCount = exports.AssetsItemCount = function AssetsItemCount(_ref) {
24
+ var searchCount = _ref.searchCount,
25
+ url = _ref.url,
26
+ testId = _ref.testId;
27
+ var capCount = searchCount >= 1000;
28
+ var displayCount = capCount ? 1000 : searchCount;
29
+ var countModifier = capCount ? '+' : '';
30
30
  return /*#__PURE__*/_react.default.createElement(_primitives.Flex, {
31
31
  testId: testId,
32
32
  xcss: searchCountStyles,
@@ -43,7 +43,38 @@ var TableSearchCount = function TableSearchCount(_ref) {
43
43
  }
44
44
  }, /*#__PURE__*/_react.default.createElement(_heading.default, {
45
45
  level: "h200"
46
- }, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource.total-count-i18n-single-key') ? /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages4.searchCountMessages["".concat(prefixTextType, "CountText")], {
46
+ }, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedNumber, {
47
+ value: displayCount
48
+ }), countModifier, ' ', /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages3.footerMessages.itemText, {
49
+ values: {
50
+ itemCount: searchCount
51
+ }
52
+ })))));
53
+ };
54
+ var TableSearchCount = function TableSearchCount(_ref2) {
55
+ var url = _ref2.url,
56
+ searchCount = _ref2.searchCount,
57
+ _ref2$testId = _ref2.testId,
58
+ testId = _ref2$testId === void 0 ? 'datasource-table-total-results-count' : _ref2$testId,
59
+ _ref2$prefixTextType = _ref2.prefixTextType,
60
+ prefixTextType = _ref2$prefixTextType === void 0 ? 'issue' : _ref2$prefixTextType;
61
+ return /*#__PURE__*/_react.default.createElement(_primitives.Flex, {
62
+ testId: testId,
63
+ xcss: searchCountStyles,
64
+ alignItems: "center"
65
+ }, /*#__PURE__*/_react.default.createElement(_linkUrl.default, {
66
+ href: url,
67
+ target: "_blank",
68
+ testId: "item-count-url"
69
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
70
+ ,
71
+ style: {
72
+ color: "var(--ds-text-accent-gray, ".concat(_colors.N800, ")"),
73
+ textDecoration: !url ? 'none' : ''
74
+ }
75
+ }, /*#__PURE__*/_react.default.createElement(_heading.default, {
76
+ level: "h200"
77
+ }, (0, _platformFeatureFlags.fg)('platform.linking-platform.datasource.total-count-i18n-single-key') ? /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages4.searchCountMessages["".concat(prefixTextType, "CountText")], {
47
78
  values: {
48
79
  searchCount: searchCount
49
80
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
@@ -12,13 +13,16 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
12
13
  var _reactIntlNext = require("react-intl-next");
13
14
  var _button = _interopRequireDefault(require("@atlaskit/button"));
14
15
  var _refresh = _interopRequireDefault(require("@atlaskit/icon/glyph/refresh"));
16
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
17
  var _primitives = require("@atlaskit/primitives");
16
18
  var _colors = require("@atlaskit/theme/colors");
17
19
  var _assetsModal = require("../assets-modal");
18
- var _searchCount = _interopRequireDefault(require("../common/modal/search-count"));
20
+ var _searchCount = _interopRequireWildcard(require("../common/modal/search-count"));
19
21
  var _messages = require("./messages");
20
22
  var _poweredByJsmAssets = require("./powered-by-jsm-assets");
21
23
  var _syncInfo = require("./sync-info");
24
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
25
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
26
  /** @jsx jsx */
23
27
 
24
28
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -78,7 +82,11 @@ var TableFooter = exports.TableFooter = function TableFooter(_ref) {
78
82
  // ensure correct positioning since 'justify-content: space-between' is used).
79
83
  return onRefresh || showItemCount ? (0, _react2.jsx)(FooterWrapper, {
80
84
  "data-testid": "table-footer"
81
- }, (0, _react2.jsx)(TopBorderWrapper, null, showItemCount && (0, _react2.jsx)(_primitives.Flex, null, (0, _react2.jsx)(_searchCount.default, {
85
+ }, (0, _react2.jsx)(TopBorderWrapper, null, showItemCount && (0, _react2.jsx)(_primitives.Flex, null, datasourceId === _assetsModal.ASSETS_LIST_OF_LINKS_DATASOURCE_ID && (0, _platformFeatureFlags.fg)('platform.linking-platform.datasource.limit-total-results_8wqcd') ? (0, _react2.jsx)(_searchCount.AssetsItemCount, {
86
+ searchCount: itemCount,
87
+ url: url,
88
+ testId: "item-count"
89
+ }) : (0, _react2.jsx)(_searchCount.default, {
82
90
  searchCount: itemCount,
83
91
  url: url,
84
92
  prefixTextType: "item",
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import { FormattedMessage, FormattedNumber } from 'react-intl-next';
4
4
  import Heading from '@atlaskit/heading';
5
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
6
6
  import { Flex, xcss } from '@atlaskit/primitives';
7
7
  import LinkUrl from '@atlaskit/smart-card/link-url';
8
8
  import { N800 } from '@atlaskit/theme/colors';
@@ -13,6 +13,38 @@ import { searchCountMessages } from './messages';
13
13
  const searchCountStyles = xcss({
14
14
  flex: 1
15
15
  });
16
+ export const AssetsItemCount = ({
17
+ searchCount,
18
+ url,
19
+ testId
20
+ }) => {
21
+ let capCount = searchCount >= 1000;
22
+ let displayCount = capCount ? 1000 : searchCount;
23
+ let countModifier = capCount ? '+' : '';
24
+ return /*#__PURE__*/React.createElement(Flex, {
25
+ testId: testId,
26
+ xcss: searchCountStyles,
27
+ alignItems: "center"
28
+ }, /*#__PURE__*/React.createElement(LinkUrl, {
29
+ href: url,
30
+ target: "_blank",
31
+ testId: "item-count-url"
32
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
33
+ ,
34
+ style: {
35
+ color: `var(--ds-text-accent-gray, ${N800})`,
36
+ textDecoration: !url ? 'none' : ''
37
+ }
38
+ }, /*#__PURE__*/React.createElement(Heading, {
39
+ level: "h200"
40
+ }, /*#__PURE__*/React.createElement(FormattedNumber, {
41
+ value: displayCount
42
+ }), countModifier, ' ', /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, footerMessages.itemText, {
43
+ values: {
44
+ itemCount: searchCount
45
+ }
46
+ })))));
47
+ };
16
48
  const TableSearchCount = ({
17
49
  url,
18
50
  searchCount,
@@ -35,7 +67,7 @@ const TableSearchCount = ({
35
67
  }
36
68
  }, /*#__PURE__*/React.createElement(Heading, {
37
69
  level: "h200"
38
- }, getBooleanFF('platform.linking-platform.datasource.total-count-i18n-single-key') ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, searchCountMessages[`${prefixTextType}CountText`], {
70
+ }, fg('platform.linking-platform.datasource.total-count-i18n-single-key') ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, searchCountMessages[`${prefixTextType}CountText`], {
39
71
  values: {
40
72
  searchCount
41
73
  }
@@ -8,10 +8,11 @@ import styled from '@emotion/styled';
8
8
  import { FormattedMessage, useIntl } from 'react-intl-next';
9
9
  import Button from '@atlaskit/button';
10
10
  import RefreshIcon from '@atlaskit/icon/glyph/refresh';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
11
12
  import { Flex } from '@atlaskit/primitives';
12
13
  import { N0, N40, N90 } from '@atlaskit/theme/colors';
13
14
  import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID } from '../assets-modal';
14
- import TableSearchCount from '../common/modal/search-count';
15
+ import TableSearchCount, { AssetsItemCount } from '../common/modal/search-count';
15
16
  import { footerMessages } from './messages';
16
17
  import { PoweredByJSMAssets } from './powered-by-jsm-assets';
17
18
  import { SyncInfo } from './sync-info';
@@ -66,7 +67,11 @@ export const TableFooter = ({
66
67
  // ensure correct positioning since 'justify-content: space-between' is used).
67
68
  return onRefresh || showItemCount ? jsx(FooterWrapper, {
68
69
  "data-testid": "table-footer"
69
- }, jsx(TopBorderWrapper, null, showItemCount && jsx(Flex, null, jsx(TableSearchCount, {
70
+ }, jsx(TopBorderWrapper, null, showItemCount && jsx(Flex, null, datasourceId === ASSETS_LIST_OF_LINKS_DATASOURCE_ID && fg('platform.linking-platform.datasource.limit-total-results_8wqcd') ? jsx(AssetsItemCount, {
71
+ searchCount: itemCount,
72
+ url: url,
73
+ testId: "item-count"
74
+ }) : jsx(TableSearchCount, {
70
75
  searchCount: itemCount,
71
76
  url: url,
72
77
  prefixTextType: "item",
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import { FormattedMessage, FormattedNumber } from 'react-intl-next';
4
4
  import Heading from '@atlaskit/heading';
5
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
6
6
  import { Flex, xcss } from '@atlaskit/primitives';
7
7
  import LinkUrl from '@atlaskit/smart-card/link-url';
8
8
  import { N800 } from '@atlaskit/theme/colors';
@@ -13,13 +13,13 @@ import { searchCountMessages } from './messages';
13
13
  var searchCountStyles = xcss({
14
14
  flex: 1
15
15
  });
16
- var TableSearchCount = function TableSearchCount(_ref) {
17
- var url = _ref.url,
18
- searchCount = _ref.searchCount,
19
- _ref$testId = _ref.testId,
20
- testId = _ref$testId === void 0 ? 'datasource-table-total-results-count' : _ref$testId,
21
- _ref$prefixTextType = _ref.prefixTextType,
22
- prefixTextType = _ref$prefixTextType === void 0 ? 'issue' : _ref$prefixTextType;
16
+ export var AssetsItemCount = function AssetsItemCount(_ref) {
17
+ var searchCount = _ref.searchCount,
18
+ url = _ref.url,
19
+ testId = _ref.testId;
20
+ var capCount = searchCount >= 1000;
21
+ var displayCount = capCount ? 1000 : searchCount;
22
+ var countModifier = capCount ? '+' : '';
23
23
  return /*#__PURE__*/React.createElement(Flex, {
24
24
  testId: testId,
25
25
  xcss: searchCountStyles,
@@ -36,7 +36,38 @@ var TableSearchCount = function TableSearchCount(_ref) {
36
36
  }
37
37
  }, /*#__PURE__*/React.createElement(Heading, {
38
38
  level: "h200"
39
- }, getBooleanFF('platform.linking-platform.datasource.total-count-i18n-single-key') ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, searchCountMessages["".concat(prefixTextType, "CountText")], {
39
+ }, /*#__PURE__*/React.createElement(FormattedNumber, {
40
+ value: displayCount
41
+ }), countModifier, ' ', /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, footerMessages.itemText, {
42
+ values: {
43
+ itemCount: searchCount
44
+ }
45
+ })))));
46
+ };
47
+ var TableSearchCount = function TableSearchCount(_ref2) {
48
+ var url = _ref2.url,
49
+ searchCount = _ref2.searchCount,
50
+ _ref2$testId = _ref2.testId,
51
+ testId = _ref2$testId === void 0 ? 'datasource-table-total-results-count' : _ref2$testId,
52
+ _ref2$prefixTextType = _ref2.prefixTextType,
53
+ prefixTextType = _ref2$prefixTextType === void 0 ? 'issue' : _ref2$prefixTextType;
54
+ return /*#__PURE__*/React.createElement(Flex, {
55
+ testId: testId,
56
+ xcss: searchCountStyles,
57
+ alignItems: "center"
58
+ }, /*#__PURE__*/React.createElement(LinkUrl, {
59
+ href: url,
60
+ target: "_blank",
61
+ testId: "item-count-url"
62
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
63
+ ,
64
+ style: {
65
+ color: "var(--ds-text-accent-gray, ".concat(N800, ")"),
66
+ textDecoration: !url ? 'none' : ''
67
+ }
68
+ }, /*#__PURE__*/React.createElement(Heading, {
69
+ level: "h200"
70
+ }, fg('platform.linking-platform.datasource.total-count-i18n-single-key') ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, searchCountMessages["".concat(prefixTextType, "CountText")], {
40
71
  values: {
41
72
  searchCount: searchCount
42
73
  }
@@ -9,10 +9,11 @@ import styled from '@emotion/styled';
9
9
  import { FormattedMessage, useIntl } from 'react-intl-next';
10
10
  import Button from '@atlaskit/button';
11
11
  import RefreshIcon from '@atlaskit/icon/glyph/refresh';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { Flex } from '@atlaskit/primitives';
13
14
  import { N0, N40, N90 } from '@atlaskit/theme/colors';
14
15
  import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID } from '../assets-modal';
15
- import TableSearchCount from '../common/modal/search-count';
16
+ import TableSearchCount, { AssetsItemCount } from '../common/modal/search-count';
16
17
  import { footerMessages } from './messages';
17
18
  import { PoweredByJSMAssets } from './powered-by-jsm-assets';
18
19
  import { SyncInfo } from './sync-info';
@@ -69,7 +70,11 @@ export var TableFooter = function TableFooter(_ref) {
69
70
  // ensure correct positioning since 'justify-content: space-between' is used).
70
71
  return onRefresh || showItemCount ? jsx(FooterWrapper, {
71
72
  "data-testid": "table-footer"
72
- }, jsx(TopBorderWrapper, null, showItemCount && jsx(Flex, null, jsx(TableSearchCount, {
73
+ }, jsx(TopBorderWrapper, null, showItemCount && jsx(Flex, null, datasourceId === ASSETS_LIST_OF_LINKS_DATASOURCE_ID && fg('platform.linking-platform.datasource.limit-total-results_8wqcd') ? jsx(AssetsItemCount, {
74
+ searchCount: itemCount,
75
+ url: url,
76
+ testId: "item-count"
77
+ }) : jsx(TableSearchCount, {
73
78
  searchCount: itemCount,
74
79
  url: url,
75
80
  prefixTextType: "item",
@@ -1,4 +1,9 @@
1
1
  /// <reference types="react" />
2
+ export declare const AssetsItemCount: ({ searchCount, url, testId, }: {
3
+ searchCount: number;
4
+ url: string | undefined;
5
+ testId: string;
6
+ }) => JSX.Element;
2
7
  interface TableSearchCountProps {
3
8
  url?: string;
4
9
  prefixTextType: 'issue' | 'result' | 'item';
@@ -1,4 +1,9 @@
1
1
  /// <reference types="react" />
2
+ export declare const AssetsItemCount: ({ searchCount, url, testId, }: {
3
+ searchCount: number;
4
+ url: string | undefined;
5
+ testId: string;
6
+ }) => JSX.Element;
2
7
  interface TableSearchCountProps {
3
8
  url?: string;
4
9
  prefixTextType: 'issue' | 'result' | 'item';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "2.5.6",
3
+ "version": "2.5.7",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -181,6 +181,9 @@
181
181
  },
182
182
  "platform.editor-update-tag-link-and-color_x6hcf": {
183
183
  "type": "boolean"
184
+ },
185
+ "platform.linking-platform.datasource.limit-total-results_8wqcd": {
186
+ "type": "boolean"
184
187
  }
185
188
  }
186
189
  }