@atlaskit/dynamic-table 14.6.0 → 14.7.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 +27 -0
- package/dist/cjs/components/{Body.js → body.js} +3 -3
- package/dist/cjs/components/{LoadingContainerAdvanced.js → loading-container-advanced.js} +3 -3
- package/dist/cjs/components/{LoadingContainer.js → loading-container.js} +3 -3
- package/dist/cjs/components/rankable/{Body.js → body.js} +3 -3
- package/dist/cjs/components/rankable/{TableCell.js → table-cell.js} +3 -3
- package/dist/cjs/components/rankable/{TableHeadCell.js → table-head-cell.js} +3 -3
- package/dist/cjs/components/rankable/{TableRow.js → table-row.js} +5 -5
- package/dist/cjs/components/{Stateful.js → stateful.js} +6 -4
- package/dist/cjs/components/{Stateless.js → stateless.js} +32 -23
- package/dist/cjs/components/{TableHeadCell.js → table-head-cell.js} +5 -3
- package/dist/cjs/components/{TableHead.js → table-head.js} +7 -6
- package/dist/cjs/components/{TableRow.js → table-row.js} +6 -5
- package/dist/cjs/hoc/{withDimensions.js → with-dimensions.js} +0 -0
- package/dist/cjs/hoc/{withSortedPageRows.js → with-sorted-page-rows.js} +0 -0
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/styled/constants.js +2 -2
- package/dist/cjs/styled/{DynamicTable.js → dynamic-table.js} +19 -25
- package/dist/cjs/styled/{EmptyBody.js → empty-body.js} +4 -2
- package/dist/cjs/styled/{LoadingContainerAdvanced.js → loading-container-advanced.js} +10 -6
- package/dist/cjs/styled/{LoadingContainer.js → loading-container.js} +5 -3
- package/dist/cjs/styled/rankable/{RowPlaceholder.js → row-placeholder.js} +6 -4
- package/dist/cjs/styled/rankable/{TableCell.js → table-cell.js} +5 -4
- package/dist/cjs/styled/rankable/{TableRow.js → table-row.js} +10 -9
- package/dist/cjs/styled/{TableCell.js → table-cell.js} +3 -1
- package/dist/cjs/styled/{TableHead.js → table-head.js} +73 -95
- package/dist/cjs/styled/{TableRow.js → table-row.js} +7 -6
- package/dist/cjs/theme.js +13 -40
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/{Body.js → body.js} +2 -2
- package/dist/es2019/components/{LoadingContainerAdvanced.js → loading-container-advanced.js} +3 -1
- package/dist/es2019/components/{LoadingContainer.js → loading-container.js} +1 -1
- package/dist/es2019/components/rankable/{Body.js → body.js} +2 -2
- package/dist/es2019/components/rankable/{TableCell.js → table-cell.js} +2 -2
- package/dist/es2019/components/rankable/{TableHeadCell.js → table-head-cell.js} +2 -2
- package/dist/es2019/components/rankable/{TableRow.js → table-row.js} +3 -3
- package/dist/es2019/components/{Stateful.js → stateful.js} +4 -3
- package/dist/es2019/components/{Stateless.js → stateless.js} +24 -16
- package/dist/es2019/components/{TableHeadCell.js → table-head-cell.js} +4 -2
- package/dist/es2019/components/{TableHead.js → table-head.js} +5 -4
- package/dist/es2019/components/{TableRow.js → table-row.js} +4 -3
- package/dist/es2019/hoc/{withDimensions.js → with-dimensions.js} +0 -0
- package/dist/es2019/hoc/{withSortedPageRows.js → with-sorted-page-rows.js} +0 -0
- package/dist/es2019/index.js +2 -2
- package/dist/es2019/styled/constants.js +4 -6
- package/dist/es2019/styled/{DynamicTable.js → dynamic-table.js} +24 -27
- package/dist/es2019/styled/{EmptyBody.js → empty-body.js} +4 -2
- package/dist/es2019/styled/{LoadingContainerAdvanced.js → loading-container-advanced.js} +7 -4
- package/dist/es2019/styled/{LoadingContainer.js → loading-container.js} +5 -3
- package/dist/es2019/styled/rankable/row-placeholder.js +12 -0
- package/dist/es2019/styled/rankable/{TableCell.js → table-cell.js} +5 -3
- package/dist/es2019/styled/rankable/{TableRow.js → table-row.js} +9 -8
- package/dist/es2019/styled/{TableCell.js → table-cell.js} +4 -2
- package/dist/es2019/styled/table-head.js +138 -0
- package/dist/es2019/styled/{TableRow.js → table-row.js} +3 -2
- package/dist/es2019/theme.js +10 -37
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/{Body.js → body.js} +2 -2
- package/dist/esm/components/{LoadingContainerAdvanced.js → loading-container-advanced.js} +2 -1
- package/dist/esm/components/{LoadingContainer.js → loading-container.js} +1 -1
- package/dist/esm/components/rankable/{Body.js → body.js} +2 -2
- package/dist/esm/components/rankable/{TableCell.js → table-cell.js} +2 -2
- package/dist/esm/components/rankable/{TableHeadCell.js → table-head-cell.js} +2 -2
- package/dist/esm/components/rankable/{TableRow.js → table-row.js} +3 -3
- package/dist/esm/components/{Stateful.js → stateful.js} +4 -3
- package/dist/esm/components/{Stateless.js → stateless.js} +24 -16
- package/dist/esm/components/{TableHeadCell.js → table-head-cell.js} +4 -2
- package/dist/esm/components/{TableHead.js → table-head.js} +5 -4
- package/dist/esm/components/{TableRow.js → table-row.js} +4 -3
- package/dist/esm/hoc/{withDimensions.js → with-dimensions.js} +0 -0
- package/dist/esm/hoc/{withSortedPageRows.js → with-sorted-page-rows.js} +0 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/styled/constants.js +2 -2
- package/dist/esm/styled/{DynamicTable.js → dynamic-table.js} +22 -25
- package/dist/esm/styled/{EmptyBody.js → empty-body.js} +4 -2
- package/dist/esm/styled/{LoadingContainerAdvanced.js → loading-container-advanced.js} +10 -6
- package/dist/esm/styled/{LoadingContainer.js → loading-container.js} +5 -3
- package/dist/esm/styled/rankable/{RowPlaceholder.js → row-placeholder.js} +7 -4
- package/dist/esm/styled/rankable/{TableCell.js → table-cell.js} +5 -3
- package/dist/esm/styled/rankable/{TableRow.js → table-row.js} +9 -8
- package/dist/esm/styled/{TableCell.js → table-cell.js} +4 -2
- package/dist/esm/styled/{TableHead.js → table-head.js} +75 -94
- package/dist/esm/styled/{TableRow.js → table-row.js} +3 -2
- package/dist/esm/theme.js +10 -37
- package/dist/esm/types.js +1 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/{Body.d.ts → body.d.ts} +23 -23
- package/dist/types/components/{LoadingContainerAdvanced.d.ts → loading-container-advanced.d.ts} +5 -5
- package/dist/types/components/{LoadingContainer.d.ts → loading-container.d.ts} +0 -0
- package/dist/types/components/rankable/body.d.ts +122 -0
- package/dist/types/components/rankable/table-cell.d.ts +14 -0
- package/dist/types/components/rankable/table-head-cell.d.ts +5 -0
- package/dist/types/components/rankable/table-row.d.ts +18 -0
- package/dist/types/components/{Stateful.d.ts → stateful.d.ts} +3 -2
- package/dist/types/components/{Stateless.d.ts → stateless.d.ts} +11 -10
- package/dist/types/components/{TableHeadCell.d.ts → table-head-cell.d.ts} +2 -2
- package/dist/types/components/{TableHead.d.ts → table-head.d.ts} +3 -3
- package/dist/types/components/{TableRow.d.ts → table-row.d.ts} +2 -2
- package/dist/types/hoc/{withDimensions.d.ts → with-dimensions.d.ts} +0 -0
- package/dist/types/hoc/{withSortedPageRows.d.ts → with-sorted-page-rows.d.ts} +23 -23
- package/dist/types/index.d.ts +2 -2
- package/dist/types/styled/constants.d.ts +2 -2
- package/dist/types/styled/{DynamicTable.d.ts → dynamic-table.d.ts} +2 -1
- package/dist/types/styled/{EmptyBody.d.ts → empty-body.d.ts} +0 -0
- package/dist/types/styled/{LoadingContainerAdvanced.d.ts → loading-container-advanced.d.ts} +1 -1
- package/dist/types/styled/{LoadingContainer.d.ts → loading-container.d.ts} +0 -0
- package/dist/types/styled/rankable/{RowPlaceholder.d.ts → row-placeholder.d.ts} +0 -0
- package/dist/types/styled/rankable/{TableCell.d.ts → table-cell.d.ts} +0 -0
- package/dist/types/styled/rankable/{TableRow.d.ts → table-row.d.ts} +1 -1
- package/dist/types/styled/{TableCell.d.ts → table-cell.d.ts} +0 -0
- package/dist/types/styled/{TableHead.d.ts → table-head.d.ts} +1 -3
- package/dist/types/styled/{TableRow.d.ts → table-row.d.ts} +0 -0
- package/dist/types/theme.d.ts +10 -9
- package/dist/types/types.d.ts +37 -33
- package/package.json +9 -5
- package/report.api.md +508 -0
- package/dist/es2019/styled/TableHead.js +0 -160
- package/dist/es2019/styled/rankable/RowPlaceholder.js +0 -10
- package/dist/types/components/rankable/Body.d.ts +0 -122
- package/dist/types/components/rankable/TableCell.d.ts +0 -14
- package/dist/types/components/rankable/TableHeadCell.d.ts +0 -5
- package/dist/types/components/rankable/TableRow.d.ts +0 -18
|
@@ -2,18 +2,19 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
5
6
|
import { ASC, DESC, LARGE, SMALL } from '../internal/constants';
|
|
6
7
|
import { assertIsSortable, getPageRows, validateSortKey } from '../internal/helpers';
|
|
7
|
-
import { Caption, PaginationWrapper, Table } from '../styled/
|
|
8
|
-
import { EmptyViewContainer, EmptyViewWithFixedHeight } from '../styled/
|
|
9
|
-
import Body from './
|
|
10
|
-
import LoadingContainer from './
|
|
11
|
-
import LoadingContainerAdvanced from './
|
|
8
|
+
import { Caption, PaginationWrapper, Table } from '../styled/dynamic-table';
|
|
9
|
+
import { EmptyViewContainer, EmptyViewWithFixedHeight } from '../styled/empty-body';
|
|
10
|
+
import Body from './body';
|
|
11
|
+
import LoadingContainer from './loading-container';
|
|
12
|
+
import LoadingContainerAdvanced from './loading-container-advanced';
|
|
12
13
|
import ManagedPagination from './managed-pagination';
|
|
13
|
-
import RankableTableBody from './rankable/
|
|
14
|
-
import TableHead from './
|
|
14
|
+
import RankableTableBody from './rankable/body';
|
|
15
|
+
import TableHead from './table-head';
|
|
15
16
|
const packageName = "@atlaskit/dynamic-table";
|
|
16
|
-
const packageVersion = "14.
|
|
17
|
+
const packageVersion = "14.7.1";
|
|
17
18
|
|
|
18
19
|
function toggleSortOrder(currentSortOrder) {
|
|
19
20
|
switch (currentSortOrder) {
|
|
@@ -184,6 +185,9 @@ class DynamicTable extends React.Component {
|
|
|
184
185
|
totalPages = rowsLength && rowsPerPage ? Math.ceil(rowsLength / rowsPerPage) : 0;
|
|
185
186
|
}
|
|
186
187
|
|
|
188
|
+
totalPages = totalPages < 1 ? 1 : totalPages;
|
|
189
|
+
const getPageNumber = page > totalPages ? totalPages : page; // page! required, because typescript can't yet see defaultProps to know that this won't be undefined
|
|
190
|
+
|
|
187
191
|
const bodyProps = {
|
|
188
192
|
highlightedRowIndex,
|
|
189
193
|
rows,
|
|
@@ -191,7 +195,7 @@ class DynamicTable extends React.Component {
|
|
|
191
195
|
sortKey,
|
|
192
196
|
sortOrder,
|
|
193
197
|
rowsPerPage,
|
|
194
|
-
page,
|
|
198
|
+
page: getPageNumber,
|
|
195
199
|
isFixedSize: isFixedSize || false,
|
|
196
200
|
onPageRowsUpdate,
|
|
197
201
|
isTotalPagesControlledExternally,
|
|
@@ -212,7 +216,8 @@ class DynamicTable extends React.Component {
|
|
|
212
216
|
}, /*#__PURE__*/React.createElement(Table, {
|
|
213
217
|
isFixedSize: isFixedSize,
|
|
214
218
|
"data-testid": testId && `${testId}--table`,
|
|
215
|
-
"aria-label": label
|
|
219
|
+
"aria-label": label,
|
|
220
|
+
hasDataRow: rowsExist
|
|
216
221
|
}, !!caption && /*#__PURE__*/React.createElement(Caption, null, caption), head && /*#__PURE__*/React.createElement(TableHead, {
|
|
217
222
|
head: head,
|
|
218
223
|
onSort: this.onSort,
|
|
@@ -226,8 +231,11 @@ class DynamicTable extends React.Component {
|
|
|
226
231
|
onRankStart: this.onRankStart,
|
|
227
232
|
onRankEnd: this.onRankEnd,
|
|
228
233
|
isRankingDisabled: isRankingDisabled || isLoading || false
|
|
229
|
-
})) : /*#__PURE__*/React.createElement(Body, bodyProps)))),
|
|
230
|
-
|
|
234
|
+
})) : /*#__PURE__*/React.createElement(Body, bodyProps)))), totalPages <= 1 ? null :
|
|
235
|
+
/*#__PURE__*/
|
|
236
|
+
// only show pagination if there's MORE than 1 page
|
|
237
|
+
React.createElement(PaginationWrapper, null, /*#__PURE__*/React.createElement(ManagedPagination, {
|
|
238
|
+
value: getPageNumber,
|
|
231
239
|
onChange: this.onSetPage,
|
|
232
240
|
total: totalPages,
|
|
233
241
|
i18n: paginationi18n,
|
|
@@ -245,13 +253,13 @@ _defineProperty(DynamicTable, "defaultProps", {
|
|
|
245
253
|
isLoading: false,
|
|
246
254
|
isFixedSize: false,
|
|
247
255
|
rowsPerPage: Infinity,
|
|
248
|
-
onSetPage:
|
|
249
|
-
onSort:
|
|
256
|
+
onSetPage: noop,
|
|
257
|
+
onSort: noop,
|
|
250
258
|
page: 1,
|
|
251
259
|
isRankable: false,
|
|
252
260
|
isRankingDisabled: false,
|
|
253
|
-
onRankStart:
|
|
254
|
-
onRankEnd:
|
|
261
|
+
onRankStart: noop,
|
|
262
|
+
onRankEnd: noop,
|
|
255
263
|
paginationi18n: {
|
|
256
264
|
prev: 'Prev',
|
|
257
265
|
next: 'Next',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { HeadCell } from '../styled/
|
|
3
|
+
import { HeadCell } from '../styled/table-head';
|
|
4
4
|
|
|
5
5
|
const TableHeadCell = ({
|
|
6
6
|
content,
|
|
@@ -15,11 +15,13 @@ const TableHeadCell = ({
|
|
|
15
15
|
style: inlineStyles,
|
|
16
16
|
"data-testid": testId && `${testId}--head--cell`,
|
|
17
17
|
ref: typeof innerRef !== 'string' ? innerRef : null // string refs must be discarded as LegacyRefs are not compatible with FC forwardRefs
|
|
18
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
18
19
|
|
|
19
20
|
}, rest, {
|
|
20
21
|
tabIndex: isSortable ? 0 : undefined,
|
|
21
22
|
isSortable: isSortable
|
|
22
23
|
}), /*#__PURE__*/React.createElement("span", null, content));
|
|
23
|
-
};
|
|
24
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
25
|
+
|
|
24
26
|
|
|
25
27
|
export default TableHeadCell;
|
|
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { validateSortKey } from '../internal/helpers';
|
|
5
|
-
import { Head } from '../styled/
|
|
6
|
-
import RankableHeadCell from './rankable/
|
|
7
|
-
import HeadCell from './
|
|
5
|
+
import { Head } from '../styled/table-head';
|
|
6
|
+
import RankableHeadCell from './rankable/table-head-cell';
|
|
7
|
+
import HeadCell from './table-head-cell';
|
|
8
8
|
|
|
9
9
|
class TableHead extends React.Component {
|
|
10
10
|
constructor(...args) {
|
|
@@ -66,6 +66,7 @@ class TableHead extends React.Component {
|
|
|
66
66
|
})));
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
}
|
|
69
|
+
} // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
70
|
+
|
|
70
71
|
|
|
71
72
|
export default TableHead;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { TableBodyCell } from '../styled/
|
|
4
|
-
import { TableBodyRow } from '../styled/
|
|
3
|
+
import { TableBodyCell } from '../styled/table-cell';
|
|
4
|
+
import { TableBodyRow } from '../styled/table-row';
|
|
5
5
|
|
|
6
6
|
const Row = ({
|
|
7
7
|
row,
|
|
@@ -41,6 +41,7 @@ const Row = ({
|
|
|
41
41
|
width: width
|
|
42
42
|
}), content);
|
|
43
43
|
}));
|
|
44
|
-
};
|
|
44
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
45
|
+
|
|
45
46
|
|
|
46
47
|
export default Row;
|
|
File without changes
|
|
File without changes
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './components/
|
|
2
|
-
export { default as DynamicTableStateless } from './components/
|
|
1
|
+
export { default } from './components/stateful';
|
|
2
|
+
export { default as DynamicTableStateless } from './components/stateless';
|
|
@@ -14,14 +14,12 @@ export const overflowTruncateStyles = css({
|
|
|
14
14
|
});
|
|
15
15
|
export const getTruncationStyleVars = ({
|
|
16
16
|
width
|
|
17
|
-
}) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
};
|
|
17
|
+
}) => typeof width !== 'undefined' ? {
|
|
18
|
+
[CSS_VAR_WIDTH]: `${width}%`
|
|
19
|
+
} : undefined;
|
|
22
20
|
export const cellStyles = css({
|
|
23
|
-
border: 'none',
|
|
24
21
|
padding: `${gridSize / 2}px ${gridSize}px`,
|
|
22
|
+
border: 'none',
|
|
25
23
|
textAlign: 'left',
|
|
26
24
|
'&:first-of-type': {
|
|
27
25
|
paddingLeft: 0
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
|
+
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
4
|
+
|
|
3
5
|
/** @jsx jsx */
|
|
4
6
|
import { forwardRef } from 'react';
|
|
5
7
|
import { css, jsx } from '@emotion/core';
|
|
6
|
-
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
7
8
|
import { gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
8
|
-
import { row } from '../theme';
|
|
9
|
+
import { row, tableBorder } from '../theme';
|
|
9
10
|
const gridSize = getGridSize();
|
|
10
11
|
// CSS vars for table row
|
|
11
12
|
// these are declared here to avoid being re-declared in each table row
|
|
@@ -19,49 +20,45 @@ const fixedSizeTableStyles = css({
|
|
|
19
20
|
tableLayout: 'fixed'
|
|
20
21
|
});
|
|
21
22
|
const tableStyles = css({
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
width: '100%',
|
|
24
|
+
borderCollapse: 'separate',
|
|
25
|
+
borderSpacing: '0px'
|
|
26
|
+
});
|
|
27
|
+
const bodyBorder = css({
|
|
28
|
+
borderBottom: `2px solid ${tableBorder.borderColor}`
|
|
24
29
|
});
|
|
25
30
|
export const Table = /*#__PURE__*/forwardRef(({
|
|
26
31
|
isFixedSize,
|
|
32
|
+
hasDataRow,
|
|
27
33
|
children,
|
|
28
34
|
...rest
|
|
29
35
|
}, ref) => {
|
|
30
|
-
const theme = useGlobalTheme();
|
|
31
36
|
return jsx("table", _extends({
|
|
32
37
|
style: {
|
|
33
|
-
[tableRowCSSVars.CSS_VAR_HOVER_BACKGROUND]: row.hoverBackground
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
[tableRowCSSVars.
|
|
37
|
-
theme
|
|
38
|
-
}),
|
|
39
|
-
[tableRowCSSVars.CSS_VAR_HOVER_HIGHLIGHTED_BACKGROUND]: row.hoverHighlightedBackground({
|
|
40
|
-
theme
|
|
41
|
-
}),
|
|
42
|
-
[tableRowCSSVars.CSS_VAR_ROW_FOCUS_OUTLINE]: row.focusOutline({
|
|
43
|
-
theme
|
|
44
|
-
})
|
|
38
|
+
[tableRowCSSVars.CSS_VAR_HOVER_BACKGROUND]: row.hoverBackground,
|
|
39
|
+
[tableRowCSSVars.CSS_VAR_HIGHLIGHTED_BACKGROUND]: row.highlightedBackground,
|
|
40
|
+
[tableRowCSSVars.CSS_VAR_HOVER_HIGHLIGHTED_BACKGROUND]: row.hoverHighlightedBackground,
|
|
41
|
+
[tableRowCSSVars.CSS_VAR_ROW_FOCUS_OUTLINE]: row.focusOutline
|
|
45
42
|
},
|
|
46
|
-
css: [tableStyles, isFixedSize && fixedSizeTableStyles],
|
|
43
|
+
css: [tableStyles, isFixedSize && fixedSizeTableStyles, hasDataRow && bodyBorder],
|
|
47
44
|
ref: ref
|
|
48
45
|
}, rest), children);
|
|
49
46
|
});
|
|
50
47
|
const captionStyles = css({
|
|
48
|
+
marginTop: `${gridSize * 3.5}px`,
|
|
49
|
+
marginBottom: `${gridSize}px`,
|
|
51
50
|
fontSize: '1.42857143em',
|
|
52
|
-
|
|
53
|
-
/* there is a bug in Safari: if element which creates a new stacking context
|
|
54
|
-
is a child of a table, table caption re-renders in bad wrong position
|
|
55
|
-
https://stackoverflow.com/questions/44009186/safari-bug-translating-table-row-group-using-gsap-make-caption-jump-to-bottom
|
|
56
|
-
*/
|
|
57
|
-
willChange: 'transform',
|
|
58
51
|
fontStyle: 'inherit',
|
|
59
52
|
fontWeight: 500,
|
|
60
53
|
letterSpacing: '-0.008em',
|
|
61
54
|
lineHeight: 1.2,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
textAlign: 'left',
|
|
56
|
+
|
|
57
|
+
/* there is a bug in Safari: if element which creates a new stacking context
|
|
58
|
+
is a child of a table, table caption re-renders in bad wrong position
|
|
59
|
+
https://stackoverflow.com/questions/44009186/safari-bug-translating-table-row-group-using-gsap-make-caption-jump-to-bottom
|
|
60
|
+
*/
|
|
61
|
+
willChange: 'transform'
|
|
65
62
|
});
|
|
66
63
|
export const Caption = ({
|
|
67
64
|
children
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
|
+
|
|
1
3
|
/** @jsx jsx */
|
|
2
4
|
import { css, jsx } from '@emotion/core';
|
|
3
5
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
@@ -10,10 +12,10 @@ export const EmptyViewWithFixedHeight = ({
|
|
|
10
12
|
css: fixedHeightStyles
|
|
11
13
|
}, children);
|
|
12
14
|
const emptyViewContainerStyles = css({
|
|
15
|
+
width: '50%',
|
|
13
16
|
margin: 'auto',
|
|
14
17
|
padding: '10px',
|
|
15
|
-
textAlign: 'center'
|
|
16
|
-
width: '50%'
|
|
18
|
+
textAlign: 'center'
|
|
17
19
|
});
|
|
18
20
|
export const EmptyViewContainer = ({
|
|
19
21
|
children
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
|
+
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
4
|
+
|
|
3
5
|
/** @jsx jsx */
|
|
4
6
|
import { forwardRef } from 'react';
|
|
5
7
|
import { css, jsx } from '@emotion/core';
|
|
@@ -8,19 +10,20 @@ const containerStyles = css({
|
|
|
8
10
|
marginBottom: `${gridSize() * 3}px`,
|
|
9
11
|
position: 'relative'
|
|
10
12
|
});
|
|
11
|
-
export const Container = props =>
|
|
13
|
+
export const Container = props => // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
14
|
+
jsx("div", _extends({
|
|
12
15
|
css: containerStyles
|
|
13
16
|
}, props));
|
|
14
17
|
const spinnerBackdropStyles = css({
|
|
15
|
-
|
|
18
|
+
display: 'flex',
|
|
16
19
|
position: 'absolute',
|
|
17
20
|
top: 0,
|
|
18
21
|
right: 0,
|
|
19
22
|
bottom: 0,
|
|
20
23
|
left: 0,
|
|
21
|
-
display: 'flex',
|
|
22
24
|
alignItems: 'center',
|
|
23
|
-
justifyContent: 'center'
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
pointerEvents: 'none'
|
|
24
27
|
});
|
|
25
28
|
export const SpinnerBackdrop = ({
|
|
26
29
|
children
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
|
+
|
|
1
3
|
/** @jsx jsx */
|
|
2
4
|
import { css, jsx } from '@emotion/core';
|
|
3
5
|
const CSS_VAR_CONTENTS_OPACITY = '--contents-opacity';
|
|
@@ -10,8 +12,8 @@ export const Container = ({
|
|
|
10
12
|
css: containerStyles
|
|
11
13
|
}, children);
|
|
12
14
|
const contentsContainerStyles = css({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
opacity: `var(${CSS_VAR_CONTENTS_OPACITY})`,
|
|
16
|
+
pointerEvents: 'none'
|
|
15
17
|
});
|
|
16
18
|
export const ContentsContainer = ({
|
|
17
19
|
contentsOpacity,
|
|
@@ -23,12 +25,12 @@ export const ContentsContainer = ({
|
|
|
23
25
|
css: [contentsContainerStyles]
|
|
24
26
|
}, children);
|
|
25
27
|
const spinnerContainerStyles = css({
|
|
28
|
+
display: 'flex',
|
|
26
29
|
position: 'absolute',
|
|
27
30
|
top: 0,
|
|
28
31
|
right: 0,
|
|
29
32
|
bottom: 0,
|
|
30
33
|
left: 0,
|
|
31
|
-
display: 'flex',
|
|
32
34
|
alignItems: 'center',
|
|
33
35
|
justifyContent: 'center'
|
|
34
36
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { css, jsx } from '@emotion/core';
|
|
5
|
+
const rowPlaceholderStyles = css({
|
|
6
|
+
padding: 0
|
|
7
|
+
}); // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
8
|
+
|
|
9
|
+
export const RowPlaceholderCell = props => // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
10
|
+
jsx("td", _extends({
|
|
11
|
+
css: rowPlaceholderStyles
|
|
12
|
+
}, props));
|
|
@@ -2,16 +2,18 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { css, jsx } from '@emotion/core';
|
|
5
|
-
import { TableBodyCell } from '../
|
|
5
|
+
import { TableBodyCell } from '../table-cell';
|
|
6
6
|
const rankingStyles = css({
|
|
7
7
|
boxSizing: 'border-box'
|
|
8
|
-
});
|
|
8
|
+
}); // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
9
|
+
|
|
9
10
|
export const RankableTableBodyCell = ({
|
|
10
11
|
isRanking,
|
|
11
12
|
innerRef,
|
|
12
13
|
...props
|
|
13
14
|
}) => jsx(TableBodyCell, _extends({
|
|
14
|
-
css: isRanking && rankingStyles
|
|
15
|
+
css: isRanking && rankingStyles // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
16
|
+
|
|
15
17
|
}, props, {
|
|
16
18
|
innerRef: innerRef
|
|
17
19
|
}));
|
|
@@ -4,7 +4,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/core';
|
|
6
6
|
import { B100, N20, N50A, N60A } from '@atlaskit/theme/colors';
|
|
7
|
-
import { TableBodyRow } from '../
|
|
7
|
+
import { TableBodyRow } from '../table-row';
|
|
8
8
|
const rankingStyles = css({
|
|
9
9
|
display: 'block'
|
|
10
10
|
});
|
|
@@ -16,16 +16,17 @@ const elevationStyle = `var(--ds-shadow-overlay, ${`0 20px 32px -8px ${N50A}, 0
|
|
|
16
16
|
|
|
17
17
|
const rankingItemStyles = css({
|
|
18
18
|
backgroundColor: `var(--ds-background-neutral, ${N20})`,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
borderRadius: '2px',
|
|
20
|
+
boxShadow: elevationStyle
|
|
21
21
|
});
|
|
22
22
|
const draggableStyles = css({
|
|
23
|
+
outlineWidth: '2px',
|
|
23
24
|
'&:focus': {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
outlineColor: `var(--ds-border-focused, ${B100})`,
|
|
26
|
+
outlineStyle: 'solid'
|
|
27
|
+
}
|
|
28
|
+
}); // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
29
|
+
|
|
29
30
|
export const RankableTableBodyRow = /*#__PURE__*/forwardRef(({
|
|
30
31
|
isRanking,
|
|
31
32
|
isRankingItem,
|
|
@@ -2,7 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { jsx } from '@emotion/core';
|
|
5
|
-
import { cellStyles, fixedSizeTruncateStyles, getTruncationStyleVars, overflowTruncateStyles, truncationWidthStyles } from './constants';
|
|
5
|
+
import { cellStyles, fixedSizeTruncateStyles, getTruncationStyleVars, overflowTruncateStyles, truncationWidthStyles } from './constants'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
6
|
+
|
|
6
7
|
export const TableBodyCell = ({
|
|
7
8
|
width,
|
|
8
9
|
isFixedSize,
|
|
@@ -16,5 +17,6 @@ export const TableBodyCell = ({
|
|
|
16
17
|
css: [truncationWidthStyles, isFixedSize && shouldTruncate && fixedSizeTruncateStyles, isFixedSize && overflowTruncateStyles, cellStyles] // HOC withDimensions complains about the types but it is working fine
|
|
17
18
|
// @ts-ignore
|
|
18
19
|
,
|
|
19
|
-
ref: innerRef
|
|
20
|
+
ref: innerRef // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
21
|
+
|
|
20
22
|
}, props));
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
4
|
+
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import { forwardRef } from 'react';
|
|
7
|
+
import { css, jsx } from '@emotion/core';
|
|
8
|
+
import { B100, N30A } from '@atlaskit/theme/colors';
|
|
9
|
+
import { gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
10
|
+
import { ASC, DESC } from '../internal/constants';
|
|
11
|
+
import { arrow, head, MSThemeColors, tableBorder } from '../theme';
|
|
12
|
+
import { cellStyles, fixedSizeTruncateStyles, getTruncationStyleVars, overflowTruncateStyles, truncationWidthStyles } from './constants';
|
|
13
|
+
const gridSize = getGridSize();
|
|
14
|
+
const CSS_VAR_TEXT_COLOR = '--local-dynamic-table-text-color';
|
|
15
|
+
const rankingStyles = css({
|
|
16
|
+
display: 'block'
|
|
17
|
+
});
|
|
18
|
+
const headStyles = css({
|
|
19
|
+
borderBottom: `none`
|
|
20
|
+
});
|
|
21
|
+
export const Head = ({
|
|
22
|
+
isRanking,
|
|
23
|
+
...props
|
|
24
|
+
}) => {
|
|
25
|
+
return jsx("thead", _extends({
|
|
26
|
+
css: [headStyles, isRanking && rankingStyles] // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
27
|
+
|
|
28
|
+
}, props));
|
|
29
|
+
};
|
|
30
|
+
const headCellStyles = css([cellStyles, {
|
|
31
|
+
boxSizing: 'border-box',
|
|
32
|
+
position: 'relative',
|
|
33
|
+
border: 'none',
|
|
34
|
+
borderBottom: `2px solid ${tableBorder.borderColor}`,
|
|
35
|
+
color: `var(--ds-text-subtlest, ${`var(${CSS_VAR_TEXT_COLOR})`})`,
|
|
36
|
+
fontSize: '12px',
|
|
37
|
+
fontWeight: 600,
|
|
38
|
+
textAlign: 'left',
|
|
39
|
+
verticalAlign: 'top',
|
|
40
|
+
'&:focus': {
|
|
41
|
+
outline: `solid 2px ${`var(--ds-border-focused, ${B100})`}`
|
|
42
|
+
}
|
|
43
|
+
}]);
|
|
44
|
+
const onClickStyles = css({
|
|
45
|
+
'&:hover': {
|
|
46
|
+
backgroundColor: `var(--ds-background-neutral-hovered, ${N30A})`,
|
|
47
|
+
cursor: 'pointer'
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const baseStyles = css({
|
|
51
|
+
'& > span': {
|
|
52
|
+
position: 'relative',
|
|
53
|
+
'&::before, &::after': {
|
|
54
|
+
display: 'block',
|
|
55
|
+
width: 0,
|
|
56
|
+
height: 0,
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
right: `-${gridSize}px`,
|
|
59
|
+
border: '3px solid transparent',
|
|
60
|
+
content: '""'
|
|
61
|
+
},
|
|
62
|
+
'&::before': {
|
|
63
|
+
bottom: '8px',
|
|
64
|
+
borderBottom: `3px solid ${arrow.defaultColor}`
|
|
65
|
+
},
|
|
66
|
+
'&::after': {
|
|
67
|
+
bottom: 0,
|
|
68
|
+
borderTop: `3px solid ${arrow.defaultColor}`
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
'@media (forced-colors: active)': {
|
|
72
|
+
'& > span': {
|
|
73
|
+
'&::before, &::after': {
|
|
74
|
+
border: `3px solid ${MSThemeColors.Background}`
|
|
75
|
+
},
|
|
76
|
+
'&::before': {
|
|
77
|
+
borderBottom: `3px solid ${MSThemeColors.Text}`
|
|
78
|
+
},
|
|
79
|
+
'&::after': {
|
|
80
|
+
borderTop: `3px solid ${MSThemeColors.Text}`
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const ascendingStyles = css({
|
|
86
|
+
'& > span': {
|
|
87
|
+
'&::before': {
|
|
88
|
+
borderBottom: `3px solid ${arrow.selectedColor}`
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
'@media (forced-colors: active)': {
|
|
92
|
+
'& > span': {
|
|
93
|
+
'&::before': {
|
|
94
|
+
borderBottom: `3px solid ${MSThemeColors.SelectedBackground}`
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
const descendingStyles = css({
|
|
100
|
+
'& > span': {
|
|
101
|
+
'&::after': {
|
|
102
|
+
borderTop: `3px solid ${arrow.selectedColor}`
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
'@media (forced-colors: active)': {
|
|
106
|
+
'& > span': {
|
|
107
|
+
'&::after': {
|
|
108
|
+
borderTop: `3px solid ${MSThemeColors.SelectedBackground}`
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
export const HeadCell = /*#__PURE__*/forwardRef(({
|
|
114
|
+
width,
|
|
115
|
+
children,
|
|
116
|
+
isSortable,
|
|
117
|
+
sortOrder,
|
|
118
|
+
isFixedSize,
|
|
119
|
+
shouldTruncate,
|
|
120
|
+
onClick,
|
|
121
|
+
style,
|
|
122
|
+
...rest
|
|
123
|
+
}, ref) => {
|
|
124
|
+
const mergedStyles = { ...style,
|
|
125
|
+
...(width && getTruncationStyleVars({
|
|
126
|
+
width
|
|
127
|
+
})),
|
|
128
|
+
[CSS_VAR_TEXT_COLOR]: head.textColor
|
|
129
|
+
};
|
|
130
|
+
const isASC = sortOrder === ASC;
|
|
131
|
+
const isDESC = sortOrder === DESC;
|
|
132
|
+
return jsx("th", _extends({
|
|
133
|
+
style: mergedStyles,
|
|
134
|
+
css: [headCellStyles, onClick && onClickStyles, truncationWidthStyles, isFixedSize && shouldTruncate && fixedSizeTruncateStyles, isFixedSize && overflowTruncateStyles, isSortable && baseStyles, isASC && ascendingStyles, isDESC && descendingStyles],
|
|
135
|
+
onClick: onClick,
|
|
136
|
+
ref: ref
|
|
137
|
+
}, rest), children);
|
|
138
|
+
});
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/core';
|
|
6
|
-
import { tableRowCSSVars as cssVars } from './
|
|
6
|
+
import { tableRowCSSVars as cssVars } from './dynamic-table';
|
|
7
7
|
const rowStyles = css({
|
|
8
8
|
'&:focus': {
|
|
9
9
|
outline: `2px solid ${`var(--ds-border-focused, ${`var(${cssVars.CSS_VAR_HOVER_BACKGROUND})`})`}`,
|
|
@@ -20,7 +20,8 @@ const rowHighlightedBackgroundStyles = css({
|
|
|
20
20
|
'&:hover': {
|
|
21
21
|
backgroundColor: `var(--ds-background-selected-hovered, ${`var(${cssVars.CSS_VAR_HOVER_HIGHLIGHTED_BACKGROUND})`})`
|
|
22
22
|
}
|
|
23
|
-
});
|
|
23
|
+
}); // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
24
|
+
|
|
24
25
|
export const TableBodyRow = /*#__PURE__*/forwardRef(({
|
|
25
26
|
isHighlighted,
|
|
26
27
|
children,
|
package/dist/es2019/theme.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as colors from '@atlaskit/theme/colors';
|
|
2
|
-
import { themed } from '@atlaskit/theme/components';
|
|
3
2
|
export const MSThemeColors = {
|
|
4
3
|
Background: 'Canvas',
|
|
5
4
|
Text: 'CanvasText',
|
|
@@ -7,44 +6,18 @@ export const MSThemeColors = {
|
|
|
7
6
|
SelectedText: 'HighlightText'
|
|
8
7
|
};
|
|
9
8
|
export const arrow = {
|
|
10
|
-
defaultColor:
|
|
11
|
-
|
|
12
|
-
dark: `var(--ds-icon-disabled, ${colors.DN40})`
|
|
13
|
-
}),
|
|
14
|
-
selectedColor: themed({
|
|
15
|
-
light: `var(--ds-icon-subtle, ${colors.N300})`,
|
|
16
|
-
dark: `var(--ds-icon-subtle, ${colors.DN300})`
|
|
17
|
-
}),
|
|
18
|
-
hoverColor: themed({
|
|
19
|
-
light: `var(--ds-icon-disabled, ${colors.N60})`,
|
|
20
|
-
dark: `var(--ds-icon-disabled, ${colors.DN60})`
|
|
21
|
-
})
|
|
9
|
+
defaultColor: `var(--ds-icon-disabled, ${colors.N40})`,
|
|
10
|
+
selectedColor: `var(--ds-icon-subtle, ${colors.N300})`
|
|
22
11
|
};
|
|
23
12
|
export const row = {
|
|
24
|
-
focusOutline:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})
|
|
28
|
-
highlightedBackground: themed({
|
|
29
|
-
light: `var(--ds-background-selected, ${colors.B50})`,
|
|
30
|
-
dark: `var(--ds-background-selected, ${colors.DN50})`
|
|
31
|
-
}),
|
|
32
|
-
hoverBackground: themed({
|
|
33
|
-
light: `var(--ds-background-neutral-subtle-hovered, ${colors.N10})`,
|
|
34
|
-
dark: `var(--ds-background-neutral-subtle-hovered, ${colors.DN40})`
|
|
35
|
-
}),
|
|
36
|
-
hoverHighlightedBackground: themed({
|
|
37
|
-
light: `var(--ds-background-selected-hovered, ${colors.B75})`,
|
|
38
|
-
dark: `var(--ds-background-selected-hovered, ${colors.DN60})`
|
|
39
|
-
})
|
|
13
|
+
focusOutline: `var(--ds-border-focused, ${colors.B100})`,
|
|
14
|
+
highlightedBackground: `var(--ds-background-selected, ${colors.B50})`,
|
|
15
|
+
hoverBackground: `var(--ds-background-neutral-subtle-hovered, ${colors.N10})`,
|
|
16
|
+
hoverHighlightedBackground: `var(--ds-background-selected-hovered, ${colors.B75})`
|
|
40
17
|
};
|
|
41
18
|
export const head = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
})
|
|
46
|
-
textColor: themed({
|
|
47
|
-
light: `var(--ds-text-subtlest, ${colors.N300})`,
|
|
48
|
-
dark: `var(--ds-text-subtlest, ${colors.DN300})`
|
|
49
|
-
})
|
|
19
|
+
textColor: `var(--ds-text-subtlest, ${colors.N300})`
|
|
20
|
+
};
|
|
21
|
+
export const tableBorder = {
|
|
22
|
+
borderColor: `var(--ds-border, ${colors.N40})`
|
|
50
23
|
};
|
package/dist/es2019/types.js
CHANGED