@atlaskit/dynamic-table 14.6.1 → 14.8.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/cjs/components/{Body.js → body.js} +3 -3
  3. package/dist/cjs/components/{LoadingContainerAdvanced.js → loading-container-advanced.js} +3 -3
  4. package/dist/cjs/components/{LoadingContainer.js → loading-container.js} +3 -3
  5. package/dist/cjs/components/rankable/{Body.js → body.js} +3 -3
  6. package/dist/cjs/components/rankable/{TableCell.js → table-cell.js} +3 -3
  7. package/dist/cjs/components/rankable/{TableHeadCell.js → table-head-cell.js} +3 -3
  8. package/dist/cjs/components/rankable/{TableRow.js → table-row.js} +5 -5
  9. package/dist/cjs/components/{Stateful.js → stateful.js} +6 -4
  10. package/dist/cjs/components/{Stateless.js → stateless.js} +32 -23
  11. package/dist/cjs/components/{TableHeadCell.js → table-head-cell.js} +5 -3
  12. package/dist/cjs/components/{TableHead.js → table-head.js} +7 -6
  13. package/dist/cjs/components/{TableRow.js → table-row.js} +6 -5
  14. package/dist/cjs/hoc/{withDimensions.js → with-dimensions.js} +0 -0
  15. package/dist/cjs/hoc/{withSortedPageRows.js → with-sorted-page-rows.js} +0 -0
  16. package/dist/cjs/index.js +4 -4
  17. package/dist/cjs/styled/constants.js +7 -7
  18. package/dist/cjs/styled/{DynamicTable.js → dynamic-table.js} +27 -33
  19. package/dist/cjs/styled/{EmptyBody.js → empty-body.js} +9 -7
  20. package/dist/cjs/styled/{LoadingContainerAdvanced.js → loading-container-advanced.js} +16 -12
  21. package/dist/cjs/styled/{LoadingContainer.js → loading-container.js} +12 -10
  22. package/dist/cjs/styled/rankable/{RowPlaceholder.js → row-placeholder.js} +8 -6
  23. package/dist/cjs/styled/rankable/{TableCell.js → table-cell.js} +7 -6
  24. package/dist/cjs/styled/rankable/{TableRow.js → table-row.js} +14 -13
  25. package/dist/cjs/styled/{TableCell.js → table-cell.js} +5 -3
  26. package/dist/cjs/styled/{TableHead.js → table-head.js} +78 -100
  27. package/dist/cjs/styled/{TableRow.js → table-row.js} +12 -11
  28. package/dist/cjs/theme.js +13 -40
  29. package/dist/cjs/version.json +1 -1
  30. package/dist/es2019/components/{Body.js → body.js} +2 -2
  31. package/dist/es2019/components/{LoadingContainerAdvanced.js → loading-container-advanced.js} +1 -1
  32. package/dist/es2019/components/{LoadingContainer.js → loading-container.js} +1 -1
  33. package/dist/es2019/components/rankable/{Body.js → body.js} +2 -2
  34. package/dist/es2019/components/rankable/{TableCell.js → table-cell.js} +2 -2
  35. package/dist/es2019/components/rankable/{TableHeadCell.js → table-head-cell.js} +2 -2
  36. package/dist/es2019/components/rankable/{TableRow.js → table-row.js} +3 -3
  37. package/dist/es2019/components/{Stateful.js → stateful.js} +4 -3
  38. package/dist/es2019/components/{Stateless.js → stateless.js} +24 -16
  39. package/dist/es2019/components/{TableHeadCell.js → table-head-cell.js} +4 -2
  40. package/dist/es2019/components/{TableHead.js → table-head.js} +5 -4
  41. package/dist/es2019/components/{TableRow.js → table-row.js} +4 -3
  42. package/dist/es2019/hoc/{withDimensions.js → with-dimensions.js} +0 -0
  43. package/dist/es2019/hoc/{withSortedPageRows.js → with-sorted-page-rows.js} +0 -0
  44. package/dist/es2019/index.js +2 -2
  45. package/dist/es2019/styled/constants.js +5 -7
  46. package/dist/es2019/styled/{DynamicTable.js → dynamic-table.js} +25 -28
  47. package/dist/es2019/styled/{EmptyBody.js → empty-body.js} +5 -3
  48. package/dist/es2019/styled/{LoadingContainerAdvanced.js → loading-container-advanced.js} +8 -5
  49. package/dist/es2019/styled/{LoadingContainer.js → loading-container.js} +6 -4
  50. package/dist/es2019/styled/rankable/row-placeholder.js +12 -0
  51. package/dist/es2019/styled/rankable/{TableCell.js → table-cell.js} +6 -4
  52. package/dist/es2019/styled/rankable/{TableRow.js → table-row.js} +10 -9
  53. package/dist/es2019/styled/{TableCell.js → table-cell.js} +5 -3
  54. package/dist/es2019/styled/table-head.js +138 -0
  55. package/dist/es2019/styled/{TableRow.js → table-row.js} +4 -3
  56. package/dist/es2019/theme.js +10 -37
  57. package/dist/es2019/types.js +1 -0
  58. package/dist/es2019/version.json +1 -1
  59. package/dist/esm/components/{Body.js → body.js} +2 -2
  60. package/dist/esm/components/{LoadingContainerAdvanced.js → loading-container-advanced.js} +1 -1
  61. package/dist/esm/components/{LoadingContainer.js → loading-container.js} +1 -1
  62. package/dist/esm/components/rankable/{Body.js → body.js} +2 -2
  63. package/dist/esm/components/rankable/{TableCell.js → table-cell.js} +2 -2
  64. package/dist/esm/components/rankable/{TableHeadCell.js → table-head-cell.js} +2 -2
  65. package/dist/esm/components/rankable/{TableRow.js → table-row.js} +3 -3
  66. package/dist/esm/components/{Stateful.js → stateful.js} +4 -3
  67. package/dist/esm/components/{Stateless.js → stateless.js} +24 -16
  68. package/dist/esm/components/{TableHeadCell.js → table-head-cell.js} +4 -2
  69. package/dist/esm/components/{TableHead.js → table-head.js} +5 -4
  70. package/dist/esm/components/{TableRow.js → table-row.js} +4 -3
  71. package/dist/esm/hoc/{withDimensions.js → with-dimensions.js} +0 -0
  72. package/dist/esm/hoc/{withSortedPageRows.js → with-sorted-page-rows.js} +0 -0
  73. package/dist/esm/index.js +2 -2
  74. package/dist/esm/styled/constants.js +3 -3
  75. package/dist/esm/styled/{DynamicTable.js → dynamic-table.js} +23 -26
  76. package/dist/esm/styled/{EmptyBody.js → empty-body.js} +5 -3
  77. package/dist/esm/styled/{LoadingContainerAdvanced.js → loading-container-advanced.js} +11 -7
  78. package/dist/esm/styled/{LoadingContainer.js → loading-container.js} +6 -4
  79. package/dist/esm/styled/rankable/row-placeholder.js +15 -0
  80. package/dist/esm/styled/rankable/{TableCell.js → table-cell.js} +6 -4
  81. package/dist/esm/styled/rankable/{TableRow.js → table-row.js} +10 -9
  82. package/dist/esm/styled/{TableCell.js → table-cell.js} +5 -3
  83. package/dist/esm/styled/{TableHead.js → table-head.js} +76 -95
  84. package/dist/esm/styled/{TableRow.js → table-row.js} +4 -3
  85. package/dist/esm/theme.js +10 -37
  86. package/dist/esm/types.js +1 -0
  87. package/dist/esm/version.json +1 -1
  88. package/dist/types/components/{Body.d.ts → body.d.ts} +23 -23
  89. package/dist/types/components/{LoadingContainerAdvanced.d.ts → loading-container-advanced.d.ts} +5 -5
  90. package/dist/types/components/{LoadingContainer.d.ts → loading-container.d.ts} +0 -0
  91. package/dist/types/components/rankable/body.d.ts +122 -0
  92. package/dist/types/components/rankable/table-cell.d.ts +14 -0
  93. package/dist/types/components/rankable/table-head-cell.d.ts +5 -0
  94. package/dist/types/components/rankable/table-row.d.ts +18 -0
  95. package/dist/types/components/{Stateful.d.ts → stateful.d.ts} +3 -2
  96. package/dist/types/components/{Stateless.d.ts → stateless.d.ts} +11 -10
  97. package/dist/types/components/{TableHeadCell.d.ts → table-head-cell.d.ts} +2 -2
  98. package/dist/types/components/{TableHead.d.ts → table-head.d.ts} +3 -3
  99. package/dist/types/components/{TableRow.d.ts → table-row.d.ts} +2 -2
  100. package/dist/types/hoc/{withDimensions.d.ts → with-dimensions.d.ts} +0 -0
  101. package/dist/types/hoc/{withSortedPageRows.d.ts → with-sorted-page-rows.d.ts} +23 -23
  102. package/dist/types/index.d.ts +2 -2
  103. package/dist/types/styled/constants.d.ts +7 -6
  104. package/dist/types/styled/{DynamicTable.d.ts → dynamic-table.d.ts} +2 -1
  105. package/dist/types/styled/{EmptyBody.d.ts → empty-body.d.ts} +0 -0
  106. package/dist/types/styled/{LoadingContainerAdvanced.d.ts → loading-container-advanced.d.ts} +3 -2
  107. package/dist/types/styled/{LoadingContainer.d.ts → loading-container.d.ts} +0 -0
  108. package/dist/types/styled/rankable/{RowPlaceholder.d.ts → row-placeholder.d.ts} +0 -0
  109. package/dist/types/styled/rankable/{TableCell.d.ts → table-cell.d.ts} +0 -0
  110. package/dist/types/styled/rankable/{TableRow.d.ts → table-row.d.ts} +1 -1
  111. package/dist/types/styled/{TableCell.d.ts → table-cell.d.ts} +0 -0
  112. package/dist/types/styled/{TableHead.d.ts → table-head.d.ts} +1 -3
  113. package/dist/types/styled/{TableRow.d.ts → table-row.d.ts} +1 -0
  114. package/dist/types/theme.d.ts +10 -9
  115. package/dist/types/types.d.ts +37 -33
  116. package/package.json +11 -10
  117. package/dist/es2019/styled/TableHead.js +0 -160
  118. package/dist/es2019/styled/rankable/RowPlaceholder.js +0 -10
  119. package/dist/esm/styled/rankable/RowPlaceholder.js +0 -12
  120. package/dist/types/components/rankable/Body.d.ts +0 -122
  121. package/dist/types/components/rankable/TableCell.d.ts +0 -14
  122. package/dist/types/components/rankable/TableHeadCell.d.ts +0 -5
  123. package/dist/types/components/rankable/TableRow.d.ts +0 -18
@@ -1,4 +1,4 @@
1
- import { css } from '@emotion/core';
1
+ import { css } from '@emotion/react';
2
2
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
3
3
  const CSS_VAR_WIDTH = '--local-dynamic-table-width';
4
4
  const gridSize = getGridSize();
@@ -14,14 +14,12 @@ export const overflowTruncateStyles = css({
14
14
  });
15
15
  export const getTruncationStyleVars = ({
16
16
  width
17
- }) => {
18
- return {
19
- [CSS_VAR_WIDTH]: typeof width !== 'undefined' ? `${width}%` : undefined
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
- import { css, jsx } from '@emotion/core';
6
- import { useGlobalTheme } from '@atlaskit/theme/components';
7
+ import { css, jsx } from '@emotion/react';
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
- borderCollapse: 'collapse',
23
- width: '100%'
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
- theme
35
- }),
36
- [tableRowCSSVars.CSS_VAR_HIGHLIGHTED_BACKGROUND]: row.highlightedBackground({
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
- marginBottom: `${gridSize}px`,
63
- marginTop: `${gridSize * 3.5}px`,
64
- textAlign: 'left'
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,5 +1,7 @@
1
+ /* eslint-disable @repo/internal/react/require-jsdoc */
2
+
1
3
  /** @jsx jsx */
2
- import { css, jsx } from '@emotion/core';
4
+ import { css, jsx } from '@emotion/react';
3
5
  import { gridSize } from '@atlaskit/theme/constants';
4
6
  const fixedHeightStyles = css({
5
7
  height: `${gridSize() * 18}px`
@@ -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,26 +1,29 @@
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
- import { css, jsx } from '@emotion/core';
7
+ import { css, jsx } from '@emotion/react';
6
8
  import { gridSize } from '@atlaskit/theme/constants';
7
9
  const containerStyles = css({
8
10
  marginBottom: `${gridSize() * 3}px`,
9
11
  position: 'relative'
10
12
  });
11
- export const Container = props => jsx("div", _extends({
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
- pointerEvents: 'none',
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,5 +1,7 @@
1
+ /* eslint-disable @repo/internal/react/require-jsdoc */
2
+
1
3
  /** @jsx jsx */
2
- import { css, jsx } from '@emotion/core';
4
+ import { css, jsx } from '@emotion/react';
3
5
  const CSS_VAR_CONTENTS_OPACITY = '--contents-opacity';
4
6
  const containerStyles = css({
5
7
  position: 'relative'
@@ -10,8 +12,8 @@ export const Container = ({
10
12
  css: containerStyles
11
13
  }, children);
12
14
  const contentsContainerStyles = css({
13
- pointerEvents: 'none',
14
- opacity: `var(${CSS_VAR_CONTENTS_OPACITY})`
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/react';
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));
@@ -1,17 +1,19 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
- import { css, jsx } from '@emotion/core';
5
- import { TableBodyCell } from '../TableCell';
4
+ import { css, jsx } from '@emotion/react';
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
  }));
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import { forwardRef } from 'react';
5
- import { css, jsx } from '@emotion/core';
5
+ import { css, jsx } from '@emotion/react';
6
6
  import { B100, N20, N50A, N60A } from '@atlaskit/theme/colors';
7
- import { TableBodyRow } from '../TableRow';
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
- boxShadow: elevationStyle,
20
- borderRadius: '2px'
19
+ borderRadius: '2px',
20
+ boxShadow: elevationStyle
21
21
  });
22
22
  const draggableStyles = css({
23
+ outlineWidth: '2px',
23
24
  '&:focus': {
24
- outlineStyle: 'solid',
25
- outlineColor: `var(--ds-border-focused, ${B100})`
26
- },
27
- outlineWidth: '2px'
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,
@@ -1,8 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
- import { jsx } from '@emotion/core';
5
- import { cellStyles, fixedSizeTruncateStyles, getTruncationStyleVars, overflowTruncateStyles, truncationWidthStyles } from './constants';
4
+ import { jsx } from '@emotion/react';
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/react';
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
+ });
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import { forwardRef } from 'react';
5
- import { css, jsx } from '@emotion/core';
6
- import { tableRowCSSVars as cssVars } from './DynamicTable';
5
+ import { css, jsx } from '@emotion/react';
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,
@@ -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: themed({
11
- light: `var(--ds-icon-disabled, ${colors.N40})`,
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: themed({
25
- light: `var(--ds-border-focused, ${colors.B100})`,
26
- dark: `var(--ds-border-focused, ${colors.B100})`
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
- borderColor: themed({
43
- light: `var(--ds-border, ${colors.N40})`,
44
- dark: `var(--ds-border, ${colors.DN50})`
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
  };
@@ -1 +1,2 @@
1
+ /* eslint-disable @repo/internal/react/consistent-types-definitions */
1
2
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dynamic-table",
3
- "version": "14.6.1",
3
+ "version": "14.8.0",
4
4
  "sideEffects": false
5
5
  }
@@ -9,8 +9,8 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
9
9
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
10
10
 
11
11
  import React from 'react';
12
- import withSortedPageRows from '../hoc/withSortedPageRows';
13
- import TableRow from './TableRow';
12
+ import withSortedPageRows from '../hoc/with-sorted-page-rows';
13
+ import TableRow from './table-row';
14
14
 
15
15
  var Body = /*#__PURE__*/function (_React$Component) {
16
16
  _inherits(Body, _React$Component);
@@ -16,7 +16,7 @@ import React from 'react';
16
16
  import { findDOMNode } from 'react-dom';
17
17
  import Spinner from '@atlaskit/spinner';
18
18
  import { LARGE, LOADING_CONTENTS_OPACITY } from '../internal/constants';
19
- import { Container, SpinnerBackdrop, SpinnerContainer } from '../styled/LoadingContainerAdvanced';
19
+ import { Container, SpinnerBackdrop, SpinnerContainer } from '../styled/loading-container-advanced';
20
20
 
21
21
  // there is a bug with findDOMNode and Suspense in React < 16.9: https://github.com/facebook/react/issues/14188
22
22
  var safeFindDOMNode = function safeFindDOMNode(component) {
@@ -12,7 +12,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
12
12
  import React from 'react';
13
13
  import Spinner from '@atlaskit/spinner';
14
14
  import { LARGE, LOADING_CONTENTS_OPACITY } from '../internal/constants';
15
- import { Container, ContentsContainer, SpinnerContainer } from '../styled/LoadingContainer';
15
+ import { Container, ContentsContainer, SpinnerContainer } from '../styled/loading-container';
16
16
 
17
17
  var LoadingContainer = /*#__PURE__*/function (_React$Component) {
18
18
  _inherits(LoadingContainer, _React$Component);
@@ -13,8 +13,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
13
13
 
14
14
  import React from 'react';
15
15
  import { DragDropContext, Droppable } from 'react-beautiful-dnd';
16
- import withSortedPageRows from '../../hoc/withSortedPageRows';
17
- import TableRow from './TableRow';
16
+ import withSortedPageRows from '../../hoc/with-sorted-page-rows';
17
+ import TableRow from './table-row';
18
18
 
19
19
  // computes destination of ranking
20
20
  // - if drag was cancelled returns undefined
@@ -12,9 +12,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
12
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
13
 
14
14
  import React from 'react';
15
- import withDimensions from '../../hoc/withDimensions';
15
+ import withDimensions from '../../hoc/with-dimensions';
16
16
  import { inlineStylesIfRanking } from '../../internal/helpers';
17
- import { RankableTableBodyCell } from '../../styled/rankable/TableCell';
17
+ import { RankableTableBodyCell } from '../../styled/rankable/table-cell';
18
18
  export var RankableTableCell = /*#__PURE__*/function (_React$Component) {
19
19
  _inherits(RankableTableCell, _React$Component);
20
20
 
@@ -12,9 +12,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
12
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
13
 
14
14
  import React from 'react';
15
- import withDimensions from '../../hoc/withDimensions';
15
+ import withDimensions from '../../hoc/with-dimensions';
16
16
  import { inlineStylesIfRanking } from '../../internal/helpers';
17
- import HeadCell from '../TableHeadCell';
17
+ import HeadCell from '../table-head-cell';
18
18
 
19
19
  var RankableTableHeadCell = /*#__PURE__*/function (_React$Component) {
20
20
  _inherits(RankableTableHeadCell, _React$Component);
@@ -19,10 +19,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
19
19
 
20
20
  import React from 'react';
21
21
  import { Draggable } from 'react-beautiful-dnd';
22
- import withDimensions from '../../hoc/withDimensions';
22
+ import withDimensions from '../../hoc/with-dimensions';
23
23
  import { inlineStylesIfRanking } from '../../internal/helpers';
24
- import { RankableTableBodyRow } from '../../styled/rankable/TableRow';
25
- import TableCell from './TableCell';
24
+ import { RankableTableBodyRow } from '../../styled/rankable/table-row';
25
+ import TableCell from './table-cell';
26
26
  export var RankableTableRow = /*#__PURE__*/function (_React$Component) {
27
27
  _inherits(RankableTableRow, _React$Component);
28
28
 
@@ -11,8 +11,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
 
13
13
  import React from 'react';
14
+ import noop from '@atlaskit/ds-lib/noop';
14
15
  import { reorderRows } from '../internal/helpers';
15
- import DynamicTableStateless from './Stateless';
16
+ import DynamicTableStateless from './stateless';
16
17
 
17
18
  /**
18
19
  * __Dynamic Table__
@@ -198,8 +199,8 @@ _defineProperty(DynamicTable, "defaultProps", {
198
199
  isLoading: false,
199
200
  isFixedSize: false,
200
201
  isRankable: false,
201
- onSetPage: function onSetPage() {},
202
- onSort: function onSort() {},
202
+ onSetPage: noop,
203
+ onSort: noop,
203
204
  rowsPerPage: Infinity
204
205
  });
205
206