@atlaskit/dynamic-table 14.20.3 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/dynamic-table
2
2
 
3
+ ## 15.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#137785](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/137785)
8
+ [`5fee01201ba15`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5fee01201ba15) -
9
+ Removes usage of legacy analytics-next APIs internally in favor of the new APIs which do not
10
+ depend on legacy react context. This should not require any changes to consumers of the package,
11
+ however behaviors of the new APIs may result in different behavior in some cases.
12
+
3
13
  ## 14.20.3
4
14
 
5
15
  ### Patch Changes
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = exports.DynamicTableWithoutAnalytics = void 0;
8
+ exports.default = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -25,8 +25,6 @@ var _tableHead = _interopRequireDefault(require("./table-head"));
25
25
  var _excluded = ["isRankable", "isRanking", "onRankStart", "onRankEnd", "isRankingDisabled"];
26
26
  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); }
27
27
  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; }
28
- var packageName = "@atlaskit/dynamic-table";
29
- var packageVersion = "14.20.3";
30
28
  function toggleSortOrder(currentSortOrder) {
31
29
  switch (currentSortOrder) {
32
30
  case _constants.DESC:
@@ -37,7 +35,7 @@ function toggleSortOrder(currentSortOrder) {
37
35
  return currentSortOrder;
38
36
  }
39
37
  }
40
- var DynamicTable = exports.DynamicTableWithoutAnalytics = function DynamicTable(_ref) {
38
+ var DynamicTable = function DynamicTable(_ref) {
41
39
  var caption = _ref.caption,
42
40
  head = _ref.head,
43
41
  highlightedRowIndex = _ref.highlightedRowIndex,
@@ -58,7 +56,7 @@ var DynamicTable = exports.DynamicTableWithoutAnalytics = function DynamicTable(
58
56
  _ref$onSetPage = _ref.onSetPage,
59
57
  onSetPage = _ref$onSetPage === void 0 ? _noop.default : _ref$onSetPage,
60
58
  _ref$onSort = _ref.onSort,
61
- onSort = _ref$onSort === void 0 ? _noop.default : _ref$onSort,
59
+ providedOnSort = _ref$onSort === void 0 ? _noop.default : _ref$onSort,
62
60
  _ref$page = _ref.page,
63
61
  page = _ref$page === void 0 ? 1 : _ref$page,
64
62
  emptyView = _ref.emptyView,
@@ -69,7 +67,7 @@ var DynamicTable = exports.DynamicTableWithoutAnalytics = function DynamicTable(
69
67
  _ref$onRankStart = _ref.onRankStart,
70
68
  onRankStart = _ref$onRankStart === void 0 ? _noop.default : _ref$onRankStart,
71
69
  _ref$onRankEnd = _ref.onRankEnd,
72
- onRankEnd = _ref$onRankEnd === void 0 ? _noop.default : _ref$onRankEnd,
70
+ providedOnRankEnd = _ref$onRankEnd === void 0 ? _noop.default : _ref$onRankEnd,
73
71
  loadingSpinnerSize = _ref.loadingSpinnerSize,
74
72
  _ref$paginationi18n = _ref.paginationi18n,
75
73
  paginationi18n = _ref$paginationi18n === void 0 ? {
@@ -83,6 +81,20 @@ var DynamicTable = exports.DynamicTableWithoutAnalytics = function DynamicTable(
83
81
  isRanking = _useState2[0],
84
82
  setIsRanking = _useState2[1];
85
83
  var tableBodyRef = (0, _react.useRef)(null);
84
+ var onSort = (0, _analyticsNext.usePlatformLeafEventHandler)({
85
+ fn: providedOnSort,
86
+ action: 'sorted',
87
+ componentName: 'dynamicTable',
88
+ packageName: "@atlaskit/dynamic-table",
89
+ packageVersion: "15.0.0"
90
+ });
91
+ var onRankEnd = (0, _analyticsNext.usePlatformLeafEventHandler)({
92
+ fn: providedOnRankEnd,
93
+ action: 'ranked',
94
+ componentName: 'dynamicTable',
95
+ packageName: "@atlaskit/dynamic-table",
96
+ packageVersion: "15.0.0"
97
+ });
86
98
  (0, _react.useEffect)(function () {
87
99
  (0, _helpers.validateSortKey)(sortKey, head);
88
100
  (0, _helpers.assertIsSortable)(head);
@@ -264,38 +276,6 @@ var TableBody = /*#__PURE__*/(0, _react.forwardRef)(function TableBody(_ref2, re
264
276
  isRankingDisabled: isRankingDisabled
265
277
  })))) : nonRankableBody;
266
278
  });
267
- var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
268
279
 
269
- /**
270
- * __Dynamic table stateless__
271
- *
272
- * A stateless table that requires consumers to manage the sorting, drag and drop, and pagination.
273
- *
274
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/dynamic-table)
275
- * - [Code](https://bitbucket.org/atlassian/atlassian-frontend/packages/design-system/dynamic-table)
276
- */
277
- var DynamicTableStateless = (0, _analyticsNext.withAnalyticsContext)({
278
- componentName: 'dynamicTable',
279
- packageName: packageName,
280
- packageVersion: packageVersion
281
- })((0, _analyticsNext.withAnalyticsEvents)({
282
- onSort: createAndFireEventOnAtlaskit({
283
- action: 'sorted',
284
- actionSubject: 'dynamicTable',
285
- attributes: {
286
- componentName: 'dynamicTable',
287
- packageName: packageName,
288
- packageVersion: packageVersion
289
- }
290
- }),
291
- onRankEnd: createAndFireEventOnAtlaskit({
292
- action: 'ranked',
293
- actionSubject: 'dynamicTable',
294
- attributes: {
295
- componentName: 'dynamicTable',
296
- packageName: packageName,
297
- packageVersion: packageVersion
298
- }
299
- })
300
- })(DynamicTable));
301
- var _default = exports.default = DynamicTableStateless;
280
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
281
+ var _default = exports.default = DynamicTable;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { forwardRef, lazy, Suspense, useEffect, useRef, useState } from 'react';
3
- import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
3
+ import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
4
4
  import noop from '@atlaskit/ds-lib/noop';
5
5
  import { ASC, DESC, LARGE, SMALL } from '../internal/constants';
6
6
  import { assertIsSortable, getPageRows, validateSortKey } from '../internal/helpers';
@@ -12,8 +12,6 @@ import LoadingContainer from './loading-container';
12
12
  import LoadingContainerAdvanced from './loading-container-advanced';
13
13
  import ManagedPagination from './managed-pagination';
14
14
  import TableHead from './table-head';
15
- const packageName = "@atlaskit/dynamic-table";
16
- const packageVersion = "14.20.3";
17
15
  function toggleSortOrder(currentSortOrder) {
18
16
  switch (currentSortOrder) {
19
17
  case DESC:
@@ -40,13 +38,13 @@ const DynamicTable = ({
40
38
  isFixedSize = false,
41
39
  rowsPerPage = Infinity,
42
40
  onSetPage = noop,
43
- onSort = noop,
41
+ onSort: providedOnSort = noop,
44
42
  page = 1,
45
43
  emptyView,
46
44
  isRankable = false,
47
45
  isRankingDisabled = false,
48
46
  onRankStart = noop,
49
- onRankEnd = noop,
47
+ onRankEnd: providedOnRankEnd = noop,
50
48
  loadingSpinnerSize,
51
49
  paginationi18n = {
52
50
  prev: 'Previous',
@@ -57,6 +55,20 @@ const DynamicTable = ({
57
55
  }) => {
58
56
  const [isRanking, setIsRanking] = useState(false);
59
57
  const tableBodyRef = useRef(null);
58
+ const onSort = usePlatformLeafEventHandler({
59
+ fn: providedOnSort,
60
+ action: 'sorted',
61
+ componentName: 'dynamicTable',
62
+ packageName: "@atlaskit/dynamic-table",
63
+ packageVersion: "15.0.0"
64
+ });
65
+ const onRankEnd = usePlatformLeafEventHandler({
66
+ fn: providedOnRankEnd,
67
+ action: 'ranked',
68
+ componentName: 'dynamicTable',
69
+ packageName: "@atlaskit/dynamic-table",
70
+ packageVersion: "15.0.0"
71
+ });
60
72
  useEffect(() => {
61
73
  validateSortKey(sortKey, head);
62
74
  assertIsSortable(head);
@@ -229,39 +241,6 @@ const TableBody = /*#__PURE__*/forwardRef(function TableBody({
229
241
  isRankingDisabled: isRankingDisabled
230
242
  })))) : nonRankableBody;
231
243
  });
232
- export { DynamicTable as DynamicTableWithoutAnalytics };
233
- const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
234
244
 
235
- /**
236
- * __Dynamic table stateless__
237
- *
238
- * A stateless table that requires consumers to manage the sorting, drag and drop, and pagination.
239
- *
240
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/dynamic-table)
241
- * - [Code](https://bitbucket.org/atlassian/atlassian-frontend/packages/design-system/dynamic-table)
242
- */
243
- const DynamicTableStateless = withAnalyticsContext({
244
- componentName: 'dynamicTable',
245
- packageName,
246
- packageVersion
247
- })(withAnalyticsEvents({
248
- onSort: createAndFireEventOnAtlaskit({
249
- action: 'sorted',
250
- actionSubject: 'dynamicTable',
251
- attributes: {
252
- componentName: 'dynamicTable',
253
- packageName,
254
- packageVersion
255
- }
256
- }),
257
- onRankEnd: createAndFireEventOnAtlaskit({
258
- action: 'ranked',
259
- actionSubject: 'dynamicTable',
260
- attributes: {
261
- componentName: 'dynamicTable',
262
- packageName,
263
- packageVersion
264
- }
265
- })
266
- })(DynamicTable));
267
- export default DynamicTableStateless;
245
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
246
+ export default DynamicTable;
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  var _excluded = ["isRankable", "isRanking", "onRankStart", "onRankEnd", "isRankingDisabled"];
5
5
  import React, { forwardRef, lazy, Suspense, useEffect, useRef, useState } from 'react';
6
- import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
6
+ import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
7
7
  import noop from '@atlaskit/ds-lib/noop';
8
8
  import { ASC, DESC, LARGE, SMALL } from '../internal/constants';
9
9
  import { assertIsSortable, getPageRows, validateSortKey } from '../internal/helpers';
@@ -15,8 +15,6 @@ import LoadingContainer from './loading-container';
15
15
  import LoadingContainerAdvanced from './loading-container-advanced';
16
16
  import ManagedPagination from './managed-pagination';
17
17
  import TableHead from './table-head';
18
- var packageName = "@atlaskit/dynamic-table";
19
- var packageVersion = "14.20.3";
20
18
  function toggleSortOrder(currentSortOrder) {
21
19
  switch (currentSortOrder) {
22
20
  case DESC:
@@ -48,7 +46,7 @@ var DynamicTable = function DynamicTable(_ref) {
48
46
  _ref$onSetPage = _ref.onSetPage,
49
47
  onSetPage = _ref$onSetPage === void 0 ? noop : _ref$onSetPage,
50
48
  _ref$onSort = _ref.onSort,
51
- onSort = _ref$onSort === void 0 ? noop : _ref$onSort,
49
+ providedOnSort = _ref$onSort === void 0 ? noop : _ref$onSort,
52
50
  _ref$page = _ref.page,
53
51
  page = _ref$page === void 0 ? 1 : _ref$page,
54
52
  emptyView = _ref.emptyView,
@@ -59,7 +57,7 @@ var DynamicTable = function DynamicTable(_ref) {
59
57
  _ref$onRankStart = _ref.onRankStart,
60
58
  onRankStart = _ref$onRankStart === void 0 ? noop : _ref$onRankStart,
61
59
  _ref$onRankEnd = _ref.onRankEnd,
62
- onRankEnd = _ref$onRankEnd === void 0 ? noop : _ref$onRankEnd,
60
+ providedOnRankEnd = _ref$onRankEnd === void 0 ? noop : _ref$onRankEnd,
63
61
  loadingSpinnerSize = _ref.loadingSpinnerSize,
64
62
  _ref$paginationi18n = _ref.paginationi18n,
65
63
  paginationi18n = _ref$paginationi18n === void 0 ? {
@@ -73,6 +71,20 @@ var DynamicTable = function DynamicTable(_ref) {
73
71
  isRanking = _useState2[0],
74
72
  setIsRanking = _useState2[1];
75
73
  var tableBodyRef = useRef(null);
74
+ var onSort = usePlatformLeafEventHandler({
75
+ fn: providedOnSort,
76
+ action: 'sorted',
77
+ componentName: 'dynamicTable',
78
+ packageName: "@atlaskit/dynamic-table",
79
+ packageVersion: "15.0.0"
80
+ });
81
+ var onRankEnd = usePlatformLeafEventHandler({
82
+ fn: providedOnRankEnd,
83
+ action: 'ranked',
84
+ componentName: 'dynamicTable',
85
+ packageName: "@atlaskit/dynamic-table",
86
+ packageVersion: "15.0.0"
87
+ });
76
88
  useEffect(function () {
77
89
  validateSortKey(sortKey, head);
78
90
  assertIsSortable(head);
@@ -252,39 +264,6 @@ var TableBody = /*#__PURE__*/forwardRef(function TableBody(_ref2, ref) {
252
264
  isRankingDisabled: isRankingDisabled
253
265
  })))) : nonRankableBody;
254
266
  });
255
- export { DynamicTable as DynamicTableWithoutAnalytics };
256
- var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
257
267
 
258
- /**
259
- * __Dynamic table stateless__
260
- *
261
- * A stateless table that requires consumers to manage the sorting, drag and drop, and pagination.
262
- *
263
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/dynamic-table)
264
- * - [Code](https://bitbucket.org/atlassian/atlassian-frontend/packages/design-system/dynamic-table)
265
- */
266
- var DynamicTableStateless = withAnalyticsContext({
267
- componentName: 'dynamicTable',
268
- packageName: packageName,
269
- packageVersion: packageVersion
270
- })(withAnalyticsEvents({
271
- onSort: createAndFireEventOnAtlaskit({
272
- action: 'sorted',
273
- actionSubject: 'dynamicTable',
274
- attributes: {
275
- componentName: 'dynamicTable',
276
- packageName: packageName,
277
- packageVersion: packageVersion
278
- }
279
- }),
280
- onRankEnd: createAndFireEventOnAtlaskit({
281
- action: 'ranked',
282
- actionSubject: 'dynamicTable',
283
- attributes: {
284
- componentName: 'dynamicTable',
285
- packageName: packageName,
286
- packageVersion: packageVersion
287
- }
288
- })
289
- })(DynamicTable));
290
- export default DynamicTableStateless;
268
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
269
+ export default DynamicTable;
@@ -1,14 +1,4 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { type StatelessProps as Props } from '../types';
3
- declare const DynamicTable: ({ caption, head, highlightedRowIndex, rows, sortKey, sortOrder, loadingLabel, onPageRowsUpdate, testId, totalRows: passedDownTotalRows, label, isLoading, isFixedSize, rowsPerPage, onSetPage, onSort, page, emptyView, isRankable, isRankingDisabled, onRankStart, onRankEnd, loadingSpinnerSize, paginationi18n, }: Props) => JSX.Element;
4
- export { DynamicTable as DynamicTableWithoutAnalytics };
5
- /**
6
- * __Dynamic table stateless__
7
- *
8
- * A stateless table that requires consumers to manage the sorting, drag and drop, and pagination.
9
- *
10
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/dynamic-table)
11
- * - [Code](https://bitbucket.org/atlassian/atlassian-frontend/packages/design-system/dynamic-table)
12
- */
13
- declare const DynamicTableStateless: React.ForwardRefExoticComponent<Pick<Omit<Props, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "head" | "caption" | "rows" | "emptyView" | "loadingSpinnerSize" | "isLoading" | "loadingLabel" | "isFixedSize" | "rowsPerPage" | "totalRows" | "onSetPage" | "onSort" | "onPageRowsUpdate" | "page" | "sortKey" | "sortOrder" | "isRankable" | "isRankingDisabled" | "onRankStart" | "onRankEnd" | "paginationi18n" | "highlightedRowIndex" | "testId" | "label" | "key" | "analyticsContext"> & React.RefAttributes<any>>;
14
- export default DynamicTableStateless;
3
+ declare const DynamicTable: ({ caption, head, highlightedRowIndex, rows, sortKey, sortOrder, loadingLabel, onPageRowsUpdate, testId, totalRows: passedDownTotalRows, label, isLoading, isFixedSize, rowsPerPage, onSetPage, onSort: providedOnSort, page, emptyView, isRankable, isRankingDisabled, onRankStart, onRankEnd: providedOnRankEnd, loadingSpinnerSize, paginationi18n, }: Props) => JSX.Element;
4
+ export default DynamicTable;
@@ -1,14 +1,4 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { type StatelessProps as Props } from '../types';
3
- declare const DynamicTable: ({ caption, head, highlightedRowIndex, rows, sortKey, sortOrder, loadingLabel, onPageRowsUpdate, testId, totalRows: passedDownTotalRows, label, isLoading, isFixedSize, rowsPerPage, onSetPage, onSort, page, emptyView, isRankable, isRankingDisabled, onRankStart, onRankEnd, loadingSpinnerSize, paginationi18n, }: Props) => JSX.Element;
4
- export { DynamicTable as DynamicTableWithoutAnalytics };
5
- /**
6
- * __Dynamic table stateless__
7
- *
8
- * A stateless table that requires consumers to manage the sorting, drag and drop, and pagination.
9
- *
10
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/dynamic-table)
11
- * - [Code](https://bitbucket.org/atlassian/atlassian-frontend/packages/design-system/dynamic-table)
12
- */
13
- declare const DynamicTableStateless: React.ForwardRefExoticComponent<Pick<Omit<Props, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "head" | "caption" | "rows" | "emptyView" | "loadingSpinnerSize" | "isLoading" | "loadingLabel" | "isFixedSize" | "rowsPerPage" | "totalRows" | "onSetPage" | "onSort" | "onPageRowsUpdate" | "page" | "sortKey" | "sortOrder" | "isRankable" | "isRankingDisabled" | "onRankStart" | "onRankEnd" | "paginationi18n" | "highlightedRowIndex" | "testId" | "label" | "key" | "analyticsContext"> & React.RefAttributes<any>>;
14
- export default DynamicTableStateless;
3
+ declare const DynamicTable: ({ caption, head, highlightedRowIndex, rows, sortKey, sortOrder, loadingLabel, onPageRowsUpdate, testId, totalRows: passedDownTotalRows, label, isLoading, isFixedSize, rowsPerPage, onSetPage, onSort: providedOnSort, page, emptyView, isRankable, isRankingDisabled, onRankStart, onRankEnd: providedOnRankEnd, loadingSpinnerSize, paginationi18n, }: Props) => JSX.Element;
4
+ export default DynamicTable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dynamic-table",
3
- "version": "14.20.3",
3
+ "version": "15.0.0",
4
4
  "description": "A dynamic table displays rows of data with built-in pagination, sorting, and re-ordering functionality.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -56,7 +56,7 @@
56
56
  "@af/integration-testing": "*",
57
57
  "@af/visual-regression": "*",
58
58
  "@atlaskit/ssr": "*",
59
- "@atlaskit/toggle": "^13.3.0",
59
+ "@atlaskit/toggle": "^13.4.0",
60
60
  "@atlaskit/visual-regression": "*",
61
61
  "@emotion/styled": "^11.0.0",
62
62
  "@testing-library/react": "^12.1.5",