@atlaskit/dynamic-table 14.2.3 → 14.4.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 (105) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/cjs/components/Body.js +2 -2
  3. package/dist/cjs/components/LoadingContainer.js +1 -1
  4. package/dist/cjs/components/LoadingContainerAdvanced.js +4 -4
  5. package/dist/cjs/components/Stateful.js +5 -3
  6. package/dist/cjs/components/Stateless.js +6 -4
  7. package/dist/cjs/components/TableHead.js +1 -1
  8. package/dist/cjs/components/TableHeadCell.js +18 -48
  9. package/dist/cjs/components/TableRow.js +4 -1
  10. package/dist/cjs/components/managedPagination.js +1 -1
  11. package/dist/cjs/components/rankable/Body.js +2 -2
  12. package/dist/cjs/components/rankable/TableCell.js +5 -5
  13. package/dist/cjs/components/rankable/TableHeadCell.js +3 -5
  14. package/dist/cjs/components/rankable/TableRow.js +5 -5
  15. package/dist/cjs/hoc/withDimensions.js +3 -5
  16. package/dist/cjs/hoc/withSortedPageRows.js +4 -6
  17. package/dist/cjs/styled/DynamicTable.js +80 -50
  18. package/dist/cjs/styled/EmptyBody.js +23 -28
  19. package/dist/cjs/styled/LoadingContainer.js +41 -36
  20. package/dist/cjs/styled/LoadingContainerAdvanced.js +42 -36
  21. package/dist/cjs/styled/TableCell.js +21 -15
  22. package/dist/cjs/styled/TableHead.js +157 -45
  23. package/dist/cjs/styled/TableRow.js +36 -42
  24. package/dist/cjs/styled/constants.js +33 -118
  25. package/dist/cjs/styled/rankable/RowPlaceholder.js +11 -12
  26. package/dist/cjs/styled/rankable/TableCell.js +18 -27
  27. package/dist/cjs/styled/rankable/TableRow.js +32 -54
  28. package/dist/cjs/theme.js +33 -20
  29. package/dist/cjs/version.json +1 -1
  30. package/dist/es2019/components/Body.js +1 -1
  31. package/dist/es2019/components/LoadingContainerAdvanced.js +2 -4
  32. package/dist/es2019/components/Stateful.js +4 -2
  33. package/dist/es2019/components/Stateless.js +5 -3
  34. package/dist/es2019/components/TableHeadCell.js +18 -22
  35. package/dist/es2019/components/TableRow.js +4 -1
  36. package/dist/es2019/components/rankable/Body.js +1 -1
  37. package/dist/es2019/components/rankable/TableCell.js +4 -4
  38. package/dist/es2019/components/rankable/TableHeadCell.js +1 -3
  39. package/dist/es2019/components/rankable/TableRow.js +3 -3
  40. package/dist/es2019/hoc/withDimensions.js +2 -4
  41. package/dist/es2019/hoc/withSortedPageRows.js +2 -4
  42. package/dist/es2019/styled/DynamicTable.js +75 -27
  43. package/dist/es2019/styled/EmptyBody.js +21 -11
  44. package/dist/es2019/styled/LoadingContainer.js +39 -18
  45. package/dist/es2019/styled/LoadingContainerAdvanced.js +38 -20
  46. package/dist/es2019/styled/TableCell.js +20 -5
  47. package/dist/es2019/styled/TableHead.js +160 -33
  48. package/dist/es2019/styled/TableRow.js +34 -20
  49. package/dist/es2019/styled/constants.js +30 -88
  50. package/dist/es2019/styled/rankable/RowPlaceholder.js +10 -4
  51. package/dist/es2019/styled/rankable/TableCell.js +16 -9
  52. package/dist/es2019/styled/rankable/TableRow.js +32 -24
  53. package/dist/es2019/theme.js +25 -18
  54. package/dist/es2019/version.json +1 -1
  55. package/dist/esm/components/Body.js +2 -2
  56. package/dist/esm/components/LoadingContainer.js +1 -1
  57. package/dist/esm/components/LoadingContainerAdvanced.js +4 -4
  58. package/dist/esm/components/Stateful.js +5 -3
  59. package/dist/esm/components/Stateless.js +6 -4
  60. package/dist/esm/components/TableHead.js +1 -1
  61. package/dist/esm/components/TableHeadCell.js +19 -47
  62. package/dist/esm/components/TableRow.js +4 -1
  63. package/dist/esm/components/managedPagination.js +1 -1
  64. package/dist/esm/components/rankable/Body.js +2 -2
  65. package/dist/esm/components/rankable/TableCell.js +5 -5
  66. package/dist/esm/components/rankable/TableHeadCell.js +3 -5
  67. package/dist/esm/components/rankable/TableRow.js +5 -5
  68. package/dist/esm/hoc/withDimensions.js +3 -5
  69. package/dist/esm/hoc/withSortedPageRows.js +4 -6
  70. package/dist/esm/styled/DynamicTable.js +75 -46
  71. package/dist/esm/styled/EmptyBody.js +23 -26
  72. package/dist/esm/styled/LoadingContainer.js +40 -36
  73. package/dist/esm/styled/LoadingContainerAdvanced.js +41 -35
  74. package/dist/esm/styled/TableCell.js +21 -15
  75. package/dist/esm/styled/TableHead.js +152 -41
  76. package/dist/esm/styled/TableRow.js +38 -42
  77. package/dist/esm/styled/constants.js +28 -108
  78. package/dist/esm/styled/rankable/RowPlaceholder.js +12 -14
  79. package/dist/esm/styled/rankable/TableCell.js +18 -27
  80. package/dist/esm/styled/rankable/TableRow.js +33 -54
  81. package/dist/esm/theme.js +25 -18
  82. package/dist/esm/version.json +1 -1
  83. package/dist/types/components/Body.d.ts +22 -22
  84. package/dist/types/components/LoadingContainerAdvanced.d.ts +2 -2
  85. package/dist/types/components/Stateless.d.ts +3 -3
  86. package/dist/types/components/TableHeadCell.d.ts +4 -9
  87. package/dist/types/components/rankable/Body.d.ts +22 -22
  88. package/dist/types/components/rankable/TableHeadCell.d.ts +1 -1
  89. package/dist/types/components/rankable/TableRow.d.ts +3 -3
  90. package/dist/types/hoc/withDimensions.d.ts +2 -2
  91. package/dist/types/hoc/withSortedPageRows.d.ts +20 -20
  92. package/dist/types/styled/DynamicTable.d.ts +13 -6
  93. package/dist/types/styled/EmptyBody.d.ts +4 -3
  94. package/dist/types/styled/LoadingContainer.d.ts +8 -7
  95. package/dist/types/styled/LoadingContainerAdvanced.d.ts +5 -4
  96. package/dist/types/styled/TableCell.d.ts +3 -2
  97. package/dist/types/styled/TableHead.d.ts +8 -5
  98. package/dist/types/styled/TableRow.d.ts +7 -4
  99. package/dist/types/styled/constants.d.ts +13 -10
  100. package/dist/types/styled/rankable/RowPlaceholder.d.ts +3 -2
  101. package/dist/types/styled/rankable/TableCell.d.ts +8 -6
  102. package/dist/types/styled/rankable/TableRow.d.ts +9 -6
  103. package/dist/types/theme.d.ts +15 -9
  104. package/dist/types/types.d.ts +18 -6
  105. package/package.json +15 -9
@@ -13,7 +13,7 @@ export class RankableTableRow extends React.Component {
13
13
  _defineProperty(this, "innerRef", innerRefFn => ref => {
14
14
  innerRefFn(ref);
15
15
 
16
- if (this.props.innerRef) {
16
+ if (typeof this.props.innerRef === 'function') {
17
17
  this.props.innerRef(ref);
18
18
  }
19
19
  });
@@ -43,11 +43,11 @@ export class RankableTableRow extends React.Component {
43
43
  }
44
44
 
45
45
  return /*#__PURE__*/React.createElement(Draggable, {
46
- draggableId: key || `${rowIndex}`,
46
+ draggableId: key || rowIndex.toString(),
47
47
  index: rowIndex,
48
48
  isDragDisabled: isRankingDisabled
49
49
  }, (provided, snapshot) => /*#__PURE__*/React.createElement(RankableTableBodyRow, _extends({}, restRowProps, provided.dragHandleProps, provided.draggableProps, {
50
- innerRef: this.innerRef(provided.innerRef),
50
+ ref: this.innerRef(provided.innerRef),
51
51
  style: { ...provided.draggableProps.style,
52
52
  ...inlineStyles
53
53
  },
@@ -3,9 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React from 'react';
4
4
  // Compute height and width of wrapped component before ranking
5
5
  export default function withDimensions(WrappedComponent) {
6
- var _temp;
7
-
8
- return _temp = class WithDimensions extends React.Component {
6
+ return class WithDimensions extends React.Component {
9
7
  constructor(...args) {
10
8
  super(...args);
11
9
 
@@ -65,5 +63,5 @@ export default function withDimensions(WrappedComponent) {
65
63
  }, this.props));
66
64
  }
67
65
 
68
- }, _temp;
66
+ };
69
67
  }
@@ -85,9 +85,7 @@ const getSortedRows = (head, rows, sortKey, sortOrder) => {
85
85
 
86
86
  // get one page of data in table, sorting all rows previously
87
87
  export default function withSortedPageRows(WrappedComponent) {
88
- var _temp;
89
-
90
- return _temp = class WithSortedPageRows extends React.Component {
88
+ return class WithSortedPageRows extends React.Component {
91
89
  constructor(...args) {
92
90
  super(...args);
93
91
 
@@ -151,5 +149,5 @@ export default function withSortedPageRows(WrappedComponent) {
151
149
  }, restProps));
152
150
  }
153
151
 
154
- }, _temp;
152
+ };
155
153
  }
@@ -1,31 +1,79 @@
1
- import styled, { css } from 'styled-components';
2
- import { gridSize } from '@atlaskit/theme/constants';
3
- import { multiply } from '@atlaskit/theme/math';
4
- export const Table = styled.table`
5
- ${({
6
- isFixedSize
7
- }) => isFixedSize && css`
8
- table-layout: fixed;
9
- `};
10
- border-collapse: collapse;
11
- width: 100%;
12
- `;
13
- export const Caption = styled.caption`
14
- font-size: 1.42857143em;
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+
3
+ /** @jsx jsx */
4
+ import { forwardRef } from 'react';
5
+ import { css, jsx } from '@emotion/core';
6
+ import { useGlobalTheme } from '@atlaskit/theme/components';
7
+ import { gridSize as getGridSize } from '@atlaskit/theme/constants';
8
+ import { row } from '../theme';
9
+ const gridSize = getGridSize();
10
+ // CSS vars for table row
11
+ // these are declared here to avoid being re-declared in each table row
12
+ export const tableRowCSSVars = {
13
+ CSS_VAR_HOVER_BACKGROUND: '--local-dynamic-table-hover-bg',
14
+ CSS_VAR_HIGHLIGHTED_BACKGROUND: '--local-dynamic-table-highlighted-bg',
15
+ CSS_VAR_HOVER_HIGHLIGHTED_BACKGROUND: '--local-dynamic-table-hover-highlighted-bg',
16
+ CSS_VAR_ROW_FOCUS_OUTLINE: '--local-dynamic-table-row-focus-outline'
17
+ };
18
+ const fixedSizeTableStyles = css({
19
+ tableLayout: 'fixed'
20
+ });
21
+ const tableStyles = css({
22
+ borderCollapse: 'collapse',
23
+ width: '100%'
24
+ });
25
+ export const Table = /*#__PURE__*/forwardRef(({
26
+ isFixedSize,
27
+ children,
28
+ ...rest
29
+ }, ref) => {
30
+ const theme = useGlobalTheme();
31
+ return jsx("table", _extends({
32
+ 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
+ })
45
+ },
46
+ css: [tableStyles, isFixedSize && fixedSizeTableStyles],
47
+ ref: ref
48
+ }, rest), children);
49
+ });
50
+ const captionStyles = css({
51
+ fontSize: '1.42857143em',
52
+
15
53
  /* there is a bug in Safari: if element which creates a new stacking context
16
54
  is a child of a table, table caption re-renders in bad wrong position
17
55
  https://stackoverflow.com/questions/44009186/safari-bug-translating-table-row-group-using-gsap-make-caption-jump-to-bottom
18
56
  */
19
- will-change: transform;
20
- font-style: inherit;
21
- font-weight: 500;
22
- letter-spacing: -0.008em;
23
- line-height: 1.2;
24
- margin-bottom: ${gridSize}px;
25
- margin-top: ${multiply(gridSize, 3.5)}px;
26
- text-align: left;
27
- `;
28
- export const PaginationWrapper = styled.div`
29
- display: flex;
30
- justify-content: center;
31
- `;
57
+ willChange: 'transform',
58
+ fontStyle: 'inherit',
59
+ fontWeight: 500,
60
+ letterSpacing: '-0.008em',
61
+ lineHeight: 1.2,
62
+ marginBottom: `${gridSize}px`,
63
+ marginTop: `${gridSize * 3.5}px`,
64
+ textAlign: 'left'
65
+ });
66
+ export const Caption = ({
67
+ children
68
+ }) => jsx("caption", {
69
+ css: captionStyles
70
+ }, children);
71
+ const paginationWrapperStyles = css({
72
+ display: 'flex',
73
+ justifyContent: 'center'
74
+ });
75
+ export const PaginationWrapper = ({
76
+ children
77
+ }) => jsx("div", {
78
+ css: paginationWrapperStyles
79
+ }, children);
@@ -1,12 +1,22 @@
1
- import styled from 'styled-components';
1
+ /** @jsx jsx */
2
+ import { css, jsx } from '@emotion/core';
2
3
  import { gridSize } from '@atlaskit/theme/constants';
3
- import { multiply } from '@atlaskit/theme/math';
4
- export const EmptyViewWithFixedHeight = styled.div`
5
- height: ${multiply(gridSize, 18)}px;
6
- `;
7
- export const EmptyViewContainer = styled.div`
8
- margin: auto;
9
- padding: 10px;
10
- text-align: center;
11
- width: 50%;
12
- `;
4
+ const fixedHeightStyles = css({
5
+ height: `${gridSize() * 18}px`
6
+ });
7
+ export const EmptyViewWithFixedHeight = ({
8
+ children
9
+ }) => jsx("div", {
10
+ css: fixedHeightStyles
11
+ }, children);
12
+ const emptyViewContainerStyles = css({
13
+ margin: 'auto',
14
+ padding: '10px',
15
+ textAlign: 'center',
16
+ width: '50%'
17
+ });
18
+ export const EmptyViewContainer = ({
19
+ children
20
+ }) => jsx("div", {
21
+ css: emptyViewContainerStyles
22
+ }, children);
@@ -1,18 +1,39 @@
1
- import styled from 'styled-components';
2
- export const Container = styled.div`
3
- position: relative;
4
- `;
5
- export const ContentsContainer = styled.div`
6
- pointer-events: none;
7
- opacity: ${p => p.contentsOpacity};
8
- `;
9
- export const SpinnerContainer = styled.div`
10
- position: absolute;
11
- top: 0;
12
- right: 0;
13
- bottom: 0;
14
- left: 0;
15
- display: flex;
16
- align-items: center;
17
- justify-content: center;
18
- `;
1
+ /** @jsx jsx */
2
+ import { css, jsx } from '@emotion/core';
3
+ const CSS_VAR_CONTENTS_OPACITY = '--contents-opacity';
4
+ const containerStyles = css({
5
+ position: 'relative'
6
+ });
7
+ export const Container = ({
8
+ children
9
+ }) => jsx("div", {
10
+ css: containerStyles
11
+ }, children);
12
+ const contentsContainerStyles = css({
13
+ pointerEvents: 'none',
14
+ opacity: `var(${CSS_VAR_CONTENTS_OPACITY})`
15
+ });
16
+ export const ContentsContainer = ({
17
+ contentsOpacity,
18
+ children
19
+ }) => jsx("div", {
20
+ style: {
21
+ [CSS_VAR_CONTENTS_OPACITY]: contentsOpacity
22
+ },
23
+ css: [contentsContainerStyles]
24
+ }, children);
25
+ const spinnerContainerStyles = css({
26
+ position: 'absolute',
27
+ top: 0,
28
+ right: 0,
29
+ bottom: 0,
30
+ left: 0,
31
+ display: 'flex',
32
+ alignItems: 'center',
33
+ justifyContent: 'center'
34
+ });
35
+ export const SpinnerContainer = ({
36
+ children
37
+ }) => jsx("div", {
38
+ css: spinnerContainerStyles
39
+ }, children);
@@ -1,21 +1,39 @@
1
- import styled from 'styled-components';
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+
3
+ /** @jsx jsx */
4
+ import { forwardRef } from 'react';
5
+ import { css, jsx } from '@emotion/core';
2
6
  import { gridSize } from '@atlaskit/theme/constants';
3
- export const Container = styled.div`
4
- margin-bottom: ${gridSize() * 3}px;
5
- position: relative;
6
- `;
7
- export const SpinnerBackdrop = styled.div`
8
- pointer-events: none;
9
- position: absolute;
10
- top: 0;
11
- right: 0;
12
- bottom: 0;
13
- left: 0;
14
- display: flex;
15
- align-items: center;
16
- justify-content: center;
17
- `;
18
- export const SpinnerContainer = styled.div`
19
- position: relative;
20
- top: 0;
21
- `;
7
+ const containerStyles = css({
8
+ marginBottom: `${gridSize() * 3}px`,
9
+ position: 'relative'
10
+ });
11
+ export const Container = props => jsx("div", _extends({
12
+ css: containerStyles
13
+ }, props));
14
+ const spinnerBackdropStyles = css({
15
+ pointerEvents: 'none',
16
+ position: 'absolute',
17
+ top: 0,
18
+ right: 0,
19
+ bottom: 0,
20
+ left: 0,
21
+ display: 'flex',
22
+ alignItems: 'center',
23
+ justifyContent: 'center'
24
+ });
25
+ export const SpinnerBackdrop = ({
26
+ children
27
+ }) => jsx("div", {
28
+ css: spinnerBackdropStyles
29
+ }, children);
30
+ const spinnerContainerStyles = css({
31
+ position: 'relative',
32
+ top: 0
33
+ });
34
+ export const SpinnerContainer = /*#__PURE__*/forwardRef(({
35
+ children
36
+ }, ref) => jsx("div", {
37
+ css: spinnerContainerStyles,
38
+ ref: ref
39
+ }, children));
@@ -1,5 +1,20 @@
1
- import styled from 'styled-components';
2
- import { cellStyle, truncateStyle } from './constants';
3
- export const TableBodyCell = styled.td`
4
- ${props => truncateStyle(props)} ${cellStyle};
5
- `;
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+
3
+ /** @jsx jsx */
4
+ import { jsx } from '@emotion/core';
5
+ import { cellStyles, fixedSizeTruncateStyles, getTruncationStyleVars, overflowTruncateStyles, truncationWidthStyles } from './constants';
6
+ export const TableBodyCell = ({
7
+ width,
8
+ isFixedSize,
9
+ shouldTruncate,
10
+ innerRef,
11
+ ...props
12
+ }) => jsx("td", _extends({
13
+ style: getTruncationStyleVars({
14
+ width
15
+ }),
16
+ css: [truncationWidthStyles, isFixedSize && shouldTruncate && fixedSizeTruncateStyles, isFixedSize && overflowTruncateStyles, cellStyles] // HOC withDimensions complains about the types but it is working fine
17
+ // @ts-ignore
18
+ ,
19
+ ref: innerRef
20
+ }, props));
@@ -1,34 +1,161 @@
1
- import styled, { css } from 'styled-components';
2
- import { B100 } from '@atlaskit/theme/colors';
3
- import { head } from '../theme';
4
- import { arrowsStyle, cellStyle, onClickStyle, truncateStyle } from './constants';
5
- const rankingStyles = css`
6
- display: block;
7
- `;
8
- export const Head = styled.thead`
9
- border-bottom: 2px solid ${head.borderColor};
10
- ${({
11
- isRanking
12
- }) => isRanking && rankingStyles};
13
- `;
14
- export const HeadCell = styled.th`
15
- ${({
16
- onClick
17
- }) => onClickStyle({
18
- onClick: Boolean(onClick)
19
- })}
20
- ${p => truncateStyle(p)}
21
- ${p => arrowsStyle(p)}
22
- ${cellStyle}
23
- border: none;
24
- color: ${head.textColor};
25
- box-sizing: border-box;
26
- font-size: 12px;
27
- font-weight: 600;
28
- position: relative;
29
- text-align: left;
30
- vertical-align: top;
31
- &:focus {
32
- outline: solid 2px ${B100};
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+
3
+ /** @jsx jsx */
4
+ import { forwardRef } from 'react';
5
+ import { css, jsx } from '@emotion/core';
6
+ import { B100, N30A } from '@atlaskit/theme/colors';
7
+ import { useGlobalTheme } from '@atlaskit/theme/components';
8
+ import { gridSize as getGridSize } from '@atlaskit/theme/constants';
9
+ import { token } from '@atlaskit/tokens';
10
+ import { ASC, DESC } from '../internal/constants';
11
+ import { arrow, head, MSThemeColors } 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
+
19
+ const getHeadStyles = theme => css({
20
+ borderBottom: `2px solid ${token('color.border.neutral', head.borderColor({
21
+ theme
22
+ }))}`
23
+ });
24
+
25
+ export const Head = ({
26
+ isRanking,
27
+ ...props
28
+ }) => {
29
+ const theme = useGlobalTheme();
30
+ return jsx("thead", _extends({
31
+ css: [getHeadStyles(theme), isRanking && rankingStyles]
32
+ }, props));
33
+ };
34
+ const headCellStyles = css([cellStyles, {
35
+ border: 'none',
36
+ boxSizing: 'border-box',
37
+ fontSize: '12px',
38
+ fontWeight: 600,
39
+ position: 'relative',
40
+ textAlign: 'left',
41
+ verticalAlign: 'top',
42
+ color: token('color.text.lowEmphasis', `var(${CSS_VAR_TEXT_COLOR})`),
43
+ '&:focus': {
44
+ outline: `solid 2px ${token('color.border.focus', B100)}`
33
45
  }
34
- `;
46
+ }]); // this needs to be made static: https://product-fabric.atlassian.net/browse/DSP-2011
47
+
48
+ export const getArrowStyles = (isSortable, sortOrder, theme) => {
49
+ if (!isSortable) {
50
+ return '';
51
+ }
52
+
53
+ const pseudoBaseStyles = {
54
+ border: '3px solid transparent',
55
+ display: 'block',
56
+ height: 0,
57
+ right: `-${gridSize}px`,
58
+ width: 0,
59
+ '@media (forced-colors: active)': {
60
+ border: `3px solid ${MSThemeColors.Background}`
61
+ }
62
+ };
63
+ return css({
64
+ '& > span': {
65
+ position: 'relative',
66
+ '&::before': { ...pseudoBaseStyles,
67
+ position: 'absolute',
68
+ borderBottom: `3px solid ${sortOrder === ASC ? arrow.selectedColor({
69
+ theme
70
+ }) : arrow.defaultColor({
71
+ theme
72
+ })}`,
73
+ bottom: '8px',
74
+ content: '""'
75
+ },
76
+ '&::after': { ...pseudoBaseStyles,
77
+ position: 'absolute',
78
+ borderTop: `3px solid ${sortOrder === DESC ? arrow.selectedColor({
79
+ theme
80
+ }) : arrow.defaultColor({
81
+ theme
82
+ })}`,
83
+ bottom: 0,
84
+ content: '""'
85
+ }
86
+ },
87
+ '&:hover > span': {
88
+ '&::before': {
89
+ borderBottom: `3px solid
90
+ ${sortOrder === ASC ? arrow.selectedColor({
91
+ theme
92
+ }) : arrow.hoverColor({
93
+ theme
94
+ })}`
95
+ },
96
+ '&::after': {
97
+ borderTop: `3px solid
98
+ ${sortOrder === DESC ? arrow.selectedColor({
99
+ theme
100
+ }) : arrow.hoverColor({
101
+ theme
102
+ })}`
103
+ }
104
+ },
105
+ '@media (forced-colors: active)': {
106
+ '& > span': {
107
+ '&::before': {
108
+ borderBottom: `3px solid
109
+ ${sortOrder === ASC ? MSThemeColors.SelectedBackground : MSThemeColors.Text}`
110
+ },
111
+ '&::after': {
112
+ borderTop: `3px solid
113
+ ${sortOrder === DESC ? MSThemeColors.SelectedBackground : MSThemeColors.Text}`
114
+ }
115
+ },
116
+ '&:hover > span': {
117
+ '&::before': {
118
+ borderBottom: `3px solid
119
+ ${sortOrder === ASC ? MSThemeColors.SelectedBackground : MSThemeColors.Text}`
120
+ },
121
+ '&::after': {
122
+ borderTop: `3px solid
123
+ ${sortOrder === DESC ? MSThemeColors.SelectedBackground : MSThemeColors.Text}`
124
+ }
125
+ }
126
+ }
127
+ });
128
+ };
129
+ const onClickStyles = css({
130
+ '&:hover': {
131
+ cursor: 'pointer',
132
+ backgroundColor: token('color.background.subtleNeutral.hover', N30A)
133
+ }
134
+ });
135
+ export const HeadCell = /*#__PURE__*/forwardRef(({
136
+ width,
137
+ children,
138
+ isSortable,
139
+ sortOrder,
140
+ isFixedSize,
141
+ shouldTruncate,
142
+ onClick,
143
+ style,
144
+ ...rest
145
+ }, ref) => {
146
+ const theme = useGlobalTheme();
147
+ const mergedStyles = { ...style,
148
+ ...(width && getTruncationStyleVars({
149
+ width
150
+ })),
151
+ [CSS_VAR_TEXT_COLOR]: head.textColor({
152
+ theme
153
+ })
154
+ };
155
+ return jsx("th", _extends({
156
+ style: mergedStyles,
157
+ css: [headCellStyles, onClick && onClickStyles, truncationWidthStyles, isFixedSize && shouldTruncate && fixedSizeTruncateStyles, isFixedSize && overflowTruncateStyles, getArrowStyles(isSortable, sortOrder, theme)],
158
+ onClick: onClick,
159
+ ref: ref
160
+ }, rest), children);
161
+ });
@@ -1,23 +1,37 @@
1
- import styled, { css } from 'styled-components';
2
- import { row } from '../theme';
3
- const outlineWidth = '2px';
4
- export const TableBodyRow = styled.tr`
5
- ${({
6
- isHighlighted
7
- }) => isHighlighted && css`
8
- background-color: ${row.highlightedBackground};
9
- `}
1
+ import _extends from "@babel/runtime/helpers/extends";
10
2
 
11
- &:hover {
12
- ${({
13
- isHighlighted
14
- }) => css`
15
- background-color: ${isHighlighted ? row.hoverHighlightedBackground : row.hoverBackground};
16
- `}
3
+ /** @jsx jsx */
4
+ import { forwardRef } from 'react';
5
+ import { css, jsx } from '@emotion/core';
6
+ import { token } from '@atlaskit/tokens';
7
+ import { tableRowCSSVars as cssVars } from './DynamicTable';
8
+ const rowStyles = css({
9
+ '&:focus': {
10
+ outline: `2px solid ${token('color.border.focus', `var(${cssVars.CSS_VAR_HOVER_BACKGROUND})`)}`,
11
+ outlineOffset: `-2px`
17
12
  }
18
-
19
- &:focus {
20
- outline: ${outlineWidth} solid ${row.focusOutline};
21
- outline-offset: -${outlineWidth};
13
+ });
14
+ const rowBackgroundStyles = css({
15
+ '&:hover': {
16
+ backgroundColor: token('color.background.transparentNeutral.hover', `var(${cssVars.CSS_VAR_HOVER_BACKGROUND})`)
17
+ }
18
+ });
19
+ const rowHighlightedBackgroundStyles = css({
20
+ backgroundColor: token('color.background.selected.resting', `var(${cssVars.CSS_VAR_HIGHLIGHTED_BACKGROUND})`),
21
+ '&:hover': {
22
+ backgroundColor: token('color.background.selected.hover', `var(${cssVars.CSS_VAR_HOVER_HIGHLIGHTED_BACKGROUND})`)
22
23
  }
23
- `;
24
+ });
25
+ export const TableBodyRow = /*#__PURE__*/forwardRef(({
26
+ isHighlighted,
27
+ children,
28
+ style,
29
+ ...rest
30
+ }, ref) => {
31
+ return jsx("tr", _extends({
32
+ style: style,
33
+ css: [rowStyles, isHighlighted ? rowHighlightedBackgroundStyles : rowBackgroundStyles]
34
+ }, rest, {
35
+ ref: ref
36
+ }), children);
37
+ });