@atlaskit/table 0.8.6 → 0.9.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,13 @@
1
1
  # @atlaskit/table
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#171035](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/171035)
8
+ [`c96a116f5cbc9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c96a116f5cbc9) -
9
+ Improve React 18 compatibility and typesafety.
10
+
3
11
  ## 0.8.6
4
12
 
5
13
  ### Patch Changes
package/dist/cjs/body.js CHANGED
@@ -55,22 +55,29 @@ function TBody(_ref) {
55
55
  });
56
56
  }).sort(sortFn);
57
57
  }, [rows, sortFn]);
58
+ var renderedChildren = function () {
59
+ if (typeof children === 'function') {
60
+ return sortedRows === null || sortedRows === void 0 ? void 0 : sortedRows.map(function (_ref2) {
61
+ var idx = _ref2.idx,
62
+ row = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
63
+ return (0, _react2.jsx)(_useRowId.RowProvider, {
64
+ key: idx,
65
+ value: idx
66
+ },
67
+ // @ts-expect-error
68
+ children(row));
69
+ });
70
+ }
71
+ var childrenArray = Array.isArray(children) ? children : [children];
72
+ return childrenArray.map(function (row, idx) {
73
+ return (0, _react2.jsx)(_useRowId.RowProvider, {
74
+ key: idx,
75
+ value: idx
76
+ }, row);
77
+ });
78
+ }();
58
79
  return (0, _react2.jsx)(_useTableBody.TableBodyProvider, {
59
80
  value: true
60
- }, (0, _react2.jsx)(_ui.TBody, null, typeof children === 'function' && sortedRows ? sortedRows.map(function (_ref2) {
61
- var idx = _ref2.idx,
62
- row = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
63
- return (0, _react2.jsx)(_useRowId.RowProvider, {
64
- key: idx,
65
- value: idx
66
- },
67
- // @ts-expect-error
68
- children(row));
69
- }) : _react.Children.map(children, function (row, idx) {
70
- return (0, _react2.jsx)(_useRowId.RowProvider, {
71
- key: idx,
72
- value: idx
73
- }, row);
74
- })));
81
+ }, (0, _react2.jsx)(_ui.TBody, null, renderedChildren));
75
82
  }
76
83
  var _default = exports.default = TBody;
@@ -43,19 +43,26 @@ function TBody({
43
43
  ...row,
44
44
  idx
45
45
  })).sort(sortFn), [rows, sortFn]);
46
+ const renderedChildren = (() => {
47
+ if (typeof children === 'function') {
48
+ return sortedRows === null || sortedRows === void 0 ? void 0 : sortedRows.map(({
49
+ idx,
50
+ ...row
51
+ }) => jsx(RowProvider, {
52
+ key: idx,
53
+ value: idx
54
+ },
55
+ // @ts-expect-error
56
+ children(row)));
57
+ }
58
+ const childrenArray = Array.isArray(children) ? children : [children];
59
+ return childrenArray.map((row, idx) => jsx(RowProvider, {
60
+ key: idx,
61
+ value: idx
62
+ }, row));
63
+ })();
46
64
  return jsx(TableBodyProvider, {
47
65
  value: true
48
- }, jsx(TBodyPrimitive, null, typeof children === 'function' && sortedRows ? sortedRows.map(({
49
- idx,
50
- ...row
51
- }) => jsx(RowProvider, {
52
- key: idx,
53
- value: idx
54
- },
55
- // @ts-expect-error
56
- children(row))) : Children.map(children, (row, idx) => jsx(RowProvider, {
57
- key: idx,
58
- value: idx
59
- }, row))));
66
+ }, jsx(TBodyPrimitive, null, renderedChildren));
60
67
  }
61
68
  export default TBody;
package/dist/esm/body.js CHANGED
@@ -52,22 +52,29 @@ function TBody(_ref) {
52
52
  });
53
53
  }).sort(sortFn);
54
54
  }, [rows, sortFn]);
55
+ var renderedChildren = function () {
56
+ if (typeof children === 'function') {
57
+ return sortedRows === null || sortedRows === void 0 ? void 0 : sortedRows.map(function (_ref2) {
58
+ var idx = _ref2.idx,
59
+ row = _objectWithoutProperties(_ref2, _excluded);
60
+ return jsx(RowProvider, {
61
+ key: idx,
62
+ value: idx
63
+ },
64
+ // @ts-expect-error
65
+ children(row));
66
+ });
67
+ }
68
+ var childrenArray = Array.isArray(children) ? children : [children];
69
+ return childrenArray.map(function (row, idx) {
70
+ return jsx(RowProvider, {
71
+ key: idx,
72
+ value: idx
73
+ }, row);
74
+ });
75
+ }();
55
76
  return jsx(TableBodyProvider, {
56
77
  value: true
57
- }, jsx(TBodyPrimitive, null, typeof children === 'function' && sortedRows ? sortedRows.map(function (_ref2) {
58
- var idx = _ref2.idx,
59
- row = _objectWithoutProperties(_ref2, _excluded);
60
- return jsx(RowProvider, {
61
- key: idx,
62
- value: idx
63
- },
64
- // @ts-expect-error
65
- children(row));
66
- }) : Children.map(children, function (row, idx) {
67
- return jsx(RowProvider, {
68
- key: idx,
69
- value: idx
70
- }, row);
71
- })));
78
+ }, jsx(TBodyPrimitive, null, renderedChildren));
72
79
  }
73
80
  export default TBody;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/table",
3
- "version": "0.8.6",
3
+ "version": "0.9.0",
4
4
  "description": "A table is used to display data.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -43,11 +43,11 @@
43
43
  "dependencies": {
44
44
  "@atlaskit/button": "^20.3.0",
45
45
  "@atlaskit/checkbox": "^15.2.0",
46
- "@atlaskit/ds-lib": "^3.2.0",
46
+ "@atlaskit/ds-lib": "^3.3.0",
47
47
  "@atlaskit/focus-ring": "^2.0.0",
48
- "@atlaskit/icon": "^22.26.0",
48
+ "@atlaskit/icon": "^22.27.0",
49
49
  "@atlaskit/primitives": "^13.3.0",
50
- "@atlaskit/tokens": "^2.3.0",
50
+ "@atlaskit/tokens": "^2.4.0",
51
51
  "@atlaskit/tooltip": "^18.9.0",
52
52
  "@atlaskit/visually-hidden": "^1.5.0",
53
53
  "@babel/runtime": "^7.0.0",