@atlaskit/dynamic-table 14.3.2 → 14.4.3

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 (95) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +2 -2
  3. package/dist/cjs/components/LoadingContainerAdvanced.js +3 -3
  4. package/dist/cjs/components/Stateful.js +26 -0
  5. package/dist/cjs/components/Stateless.js +2 -2
  6. package/dist/cjs/components/TableHeadCell.js +18 -48
  7. package/dist/cjs/components/{managedPagination.js → managed-pagination.js} +0 -0
  8. package/dist/cjs/components/rankable/TableCell.js +4 -4
  9. package/dist/cjs/components/rankable/TableHeadCell.js +2 -4
  10. package/dist/cjs/components/rankable/TableRow.js +3 -3
  11. package/dist/cjs/internal/constants.js +1 -5
  12. package/dist/cjs/styled/DynamicTable.js +80 -14
  13. package/dist/cjs/styled/EmptyBody.js +23 -8
  14. package/dist/cjs/styled/LoadingContainer.js +41 -8
  15. package/dist/cjs/styled/LoadingContainerAdvanced.js +42 -8
  16. package/dist/cjs/styled/TableCell.js +21 -7
  17. package/dist/cjs/styled/TableHead.js +159 -25
  18. package/dist/cjs/styled/TableRow.js +35 -19
  19. package/dist/cjs/styled/constants.js +33 -38
  20. package/dist/cjs/styled/rankable/RowPlaceholder.js +11 -4
  21. package/dist/cjs/styled/rankable/TableCell.js +18 -13
  22. package/dist/cjs/styled/rankable/TableRow.js +31 -21
  23. package/dist/cjs/theme.js +18 -18
  24. package/dist/cjs/version.json +1 -1
  25. package/dist/es2019/components/LoadingContainerAdvanced.js +2 -4
  26. package/dist/es2019/components/Stateful.js +27 -0
  27. package/dist/es2019/components/Stateless.js +2 -2
  28. package/dist/es2019/components/TableHeadCell.js +18 -22
  29. package/dist/es2019/components/{managedPagination.js → managed-pagination.js} +0 -0
  30. package/dist/es2019/components/rankable/TableCell.js +4 -4
  31. package/dist/es2019/components/rankable/TableHeadCell.js +1 -3
  32. package/dist/es2019/components/rankable/TableRow.js +3 -3
  33. package/dist/es2019/internal/constants.js +0 -2
  34. package/dist/es2019/styled/DynamicTable.js +75 -26
  35. package/dist/es2019/styled/EmptyBody.js +21 -10
  36. package/dist/es2019/styled/LoadingContainer.js +39 -18
  37. package/dist/es2019/styled/LoadingContainerAdvanced.js +38 -20
  38. package/dist/es2019/styled/TableCell.js +20 -5
  39. package/dist/es2019/styled/TableHead.js +159 -33
  40. package/dist/es2019/styled/TableRow.js +33 -20
  41. package/dist/es2019/styled/constants.js +30 -115
  42. package/dist/es2019/styled/rankable/RowPlaceholder.js +10 -4
  43. package/dist/es2019/styled/rankable/TableCell.js +16 -9
  44. package/dist/es2019/styled/rankable/TableRow.js +31 -24
  45. package/dist/es2019/theme.js +18 -18
  46. package/dist/es2019/version.json +1 -1
  47. package/dist/esm/components/LoadingContainerAdvanced.js +3 -3
  48. package/dist/esm/components/Stateful.js +26 -0
  49. package/dist/esm/components/Stateless.js +2 -2
  50. package/dist/esm/components/TableHeadCell.js +19 -47
  51. package/dist/esm/components/{managedPagination.js → managed-pagination.js} +0 -0
  52. package/dist/esm/components/rankable/TableCell.js +4 -4
  53. package/dist/esm/components/rankable/TableHeadCell.js +2 -4
  54. package/dist/esm/components/rankable/TableRow.js +3 -3
  55. package/dist/esm/internal/constants.js +0 -2
  56. package/dist/esm/styled/DynamicTable.js +77 -9
  57. package/dist/esm/styled/EmptyBody.js +23 -7
  58. package/dist/esm/styled/LoadingContainer.js +40 -8
  59. package/dist/esm/styled/LoadingContainerAdvanced.js +41 -7
  60. package/dist/esm/styled/TableCell.js +21 -7
  61. package/dist/esm/styled/TableHead.js +159 -21
  62. package/dist/esm/styled/TableRow.js +35 -12
  63. package/dist/esm/styled/constants.js +28 -29
  64. package/dist/esm/styled/rankable/RowPlaceholder.js +11 -5
  65. package/dist/esm/styled/rankable/TableCell.js +18 -9
  66. package/dist/esm/styled/rankable/TableRow.js +30 -14
  67. package/dist/esm/theme.js +18 -18
  68. package/dist/esm/version.json +1 -1
  69. package/dist/types/components/Body.d.ts +21 -21
  70. package/dist/types/components/LoadingContainer.d.ts +3 -3
  71. package/dist/types/components/LoadingContainerAdvanced.d.ts +3 -3
  72. package/dist/types/components/Stateful.d.ts +26 -0
  73. package/dist/types/components/Stateless.d.ts +3 -3
  74. package/dist/types/components/TableHeadCell.d.ts +4 -9
  75. package/dist/types/components/{managedPagination.d.ts → managed-pagination.d.ts} +4 -7
  76. package/dist/types/components/rankable/Body.d.ts +21 -21
  77. package/dist/types/components/rankable/TableHeadCell.d.ts +1 -1
  78. package/dist/types/components/rankable/TableRow.d.ts +3 -3
  79. package/dist/types/hoc/withDimensions.d.ts +2 -2
  80. package/dist/types/hoc/withSortedPageRows.d.ts +20 -20
  81. package/dist/types/internal/constants.d.ts +0 -2
  82. package/dist/types/styled/DynamicTable.d.ts +13 -6
  83. package/dist/types/styled/EmptyBody.d.ts +4 -3
  84. package/dist/types/styled/LoadingContainer.d.ts +8 -7
  85. package/dist/types/styled/LoadingContainerAdvanced.d.ts +5 -4
  86. package/dist/types/styled/TableCell.d.ts +3 -2
  87. package/dist/types/styled/TableHead.d.ts +8 -5
  88. package/dist/types/styled/TableRow.d.ts +7 -4
  89. package/dist/types/styled/constants.d.ts +13 -10
  90. package/dist/types/styled/rankable/RowPlaceholder.d.ts +3 -2
  91. package/dist/types/styled/rankable/TableCell.d.ts +8 -6
  92. package/dist/types/styled/rankable/TableRow.d.ts +9 -6
  93. package/dist/types/theme.d.ts +9 -9
  94. package/dist/types/types.d.ts +76 -37
  95. package/package.json +18 -7
@@ -1,23 +1,36 @@
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 { tableRowCSSVars as cssVars } from './DynamicTable';
7
+ const rowStyles = css({
8
+ '&:focus': {
9
+ outline: `2px solid ${`var(--ds-border-focus, ${`var(${cssVars.CSS_VAR_HOVER_BACKGROUND})`})`}`,
10
+ outlineOffset: `-2px`
17
11
  }
18
-
19
- &:focus {
20
- outline: ${outlineWidth} solid ${row.focusOutline};
21
- outline-offset: -${outlineWidth};
12
+ });
13
+ const rowBackgroundStyles = css({
14
+ '&:hover': {
15
+ backgroundColor: `var(--ds-background-transparentNeutral-hover, ${`var(${cssVars.CSS_VAR_HOVER_BACKGROUND})`})`
16
+ }
17
+ });
18
+ const rowHighlightedBackgroundStyles = css({
19
+ backgroundColor: `var(--ds-background-selected-resting, ${`var(${cssVars.CSS_VAR_HIGHLIGHTED_BACKGROUND})`})`,
20
+ '&:hover': {
21
+ backgroundColor: `var(--ds-background-selected-hover, ${`var(${cssVars.CSS_VAR_HOVER_HIGHLIGHTED_BACKGROUND})`})`
22
22
  }
23
- `;
23
+ });
24
+ export const TableBodyRow = /*#__PURE__*/forwardRef(({
25
+ isHighlighted,
26
+ children,
27
+ style,
28
+ ...rest
29
+ }, ref) => {
30
+ return jsx("tr", _extends({
31
+ style: style,
32
+ css: [rowStyles, isHighlighted ? rowHighlightedBackgroundStyles : rowBackgroundStyles]
33
+ }, rest, {
34
+ ref: ref
35
+ }), children);
36
+ });
@@ -1,117 +1,32 @@
1
- import { css } from 'styled-components';
2
- import { N30A } from '@atlaskit/theme/colors';
3
- import { gridSize } from '@atlaskit/theme/constants';
4
- import { ASC, DESC } from '../internal/constants';
5
- import { arrow, MSThemeColors } from '../theme';
6
- export const truncateStyle = ({
7
- width,
8
- isFixedSize,
9
- shouldTruncate
10
- }) => css`
11
- ${width ? css`
12
- width: ${width}%;
13
- ` : ''} ${isFixedSize ? css`
14
- overflow: hidden;
15
- ` : ''};
16
- ${isFixedSize && shouldTruncate ? css`
17
- text-overflow: ellipsis;
18
- white-space: nowrap;
19
- ` : ''};
20
- `;
21
- export const onClickStyle = ({
22
- onClick
23
- }) => onClick && css`
24
- &:hover {
25
- cursor: pointer;
26
- background-color: ${N30A};
27
- }
28
- `;
29
- export const arrowsStyle = props => {
30
- const {
31
- isSortable,
32
- sortOrder
33
- } = props;
34
-
35
- if (!isSortable) {
36
- return '';
37
- }
38
-
39
- const pseudoBase = css`
40
- border: 3px solid transparent;
41
- display: block;
42
- height: 0;
43
- position: absolute;
44
- right: -${gridSize}px;
45
- width: 0;
46
-
47
- @media (forced-colors: active) {
48
- border: 3px solid ${MSThemeColors.Background};
49
- }
50
- `;
51
- return css`
52
- & > span {
53
- position: relative;
54
- &::before {
55
- ${pseudoBase};
56
- border-bottom: 3px solid
57
- ${sortOrder === ASC ? arrow.selectedColor(props) : arrow.defaultColor(props)};
58
- bottom: 8px;
59
- content: ' ';
60
- }
61
- &::after {
62
- ${pseudoBase};
63
- border-top: 3px solid
64
- ${sortOrder === DESC ? arrow.selectedColor(props) : arrow.defaultColor(props)};
65
- bottom: 0;
66
- content: ' ';
67
- }
68
- }
69
-
70
- &:hover > span {
71
- &::before {
72
- border-bottom: 3px solid
73
- ${sortOrder === ASC ? arrow.selectedColor(props) : arrow.hoverColor(props)};
74
- }
75
- &::after {
76
- border-top: 3px solid
77
- ${sortOrder === DESC ? arrow.selectedColor(props) : arrow.hoverColor(props)};
78
- }
79
- }
80
-
81
- @media (forced-colors: active) {
82
- & > span {
83
- &::before {
84
- border-bottom: 3px solid
85
- ${sortOrder === ASC ? MSThemeColors.SelectedBackground : MSThemeColors.Text};
86
- }
87
- &::after {
88
- border-top: 3px solid
89
- ${sortOrder === DESC ? MSThemeColors.SelectedBackground : MSThemeColors.Text};
90
- }
91
- }
92
-
93
- &:hover > span {
94
- &::before {
95
- border-bottom: 3px solid
96
- ${sortOrder === ASC ? MSThemeColors.SelectedBackground : MSThemeColors.Text};
97
- }
98
- &::after {
99
- border-top: 3px solid
100
- ${sortOrder === DESC ? MSThemeColors.SelectedBackground : MSThemeColors.Text};
101
- }
102
- }
103
- }
104
- `;
1
+ import { css } from '@emotion/core';
2
+ import { gridSize as getGridSize } from '@atlaskit/theme/constants';
3
+ const CSS_VAR_WIDTH = '--local-dynamic-table-width';
4
+ const gridSize = getGridSize();
5
+ export const truncationWidthStyles = css({
6
+ width: `var(${CSS_VAR_WIDTH})`
7
+ });
8
+ export const fixedSizeTruncateStyles = css({
9
+ textOverflow: 'ellipsis',
10
+ whiteSpace: 'nowrap'
11
+ });
12
+ export const overflowTruncateStyles = css({
13
+ overflow: 'hidden'
14
+ });
15
+ export const getTruncationStyleVars = ({
16
+ width
17
+ }) => {
18
+ return {
19
+ [CSS_VAR_WIDTH]: typeof width !== 'undefined' ? `${width}%` : undefined
20
+ };
105
21
  };
106
- export const cellStyle = css`
107
- border: none;
108
- padding: ${gridSize() / 2}px ${gridSize}px;
109
- text-align: left;
110
-
111
- &:first-child {
112
- padding-left: 0;
113
- }
114
- &:last-child {
115
- padding-right: 0;
22
+ export const cellStyles = css({
23
+ border: 'none',
24
+ padding: `${gridSize / 2}px ${gridSize}px`,
25
+ textAlign: 'left',
26
+ '&:first-of-type': {
27
+ paddingLeft: 0
28
+ },
29
+ '&:last-child': {
30
+ paddingRight: 0
116
31
  }
117
- `;
32
+ });
@@ -1,4 +1,10 @@
1
- import styled from 'styled-components';
2
- export const RowPlaceholderCell = styled.td`
3
- padding: 0;
4
- `;
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
+ });
8
+ export const RowPlaceholderCell = props => jsx("td", _extends({
9
+ css: rowPlaceholderStyles
10
+ }, props));
@@ -1,10 +1,17 @@
1
- import styled, { css } from 'styled-components';
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+
3
+ /** @jsx jsx */
4
+ import { css, jsx } from '@emotion/core';
2
5
  import { TableBodyCell } from '../TableCell';
3
- const rankingStyles = css`
4
- box-sizing: border-box;
5
- `;
6
- export const RankableTableBodyCell = styled(TableBodyCell)`
7
- ${({
8
- isRanking
9
- }) => isRanking && rankingStyles};
10
- `;
6
+ const rankingStyles = css({
7
+ boxSizing: 'border-box'
8
+ });
9
+ export const RankableTableBodyCell = ({
10
+ isRanking,
11
+ innerRef,
12
+ ...props
13
+ }) => jsx(TableBodyCell, _extends({
14
+ css: isRanking && rankingStyles
15
+ }, props, {
16
+ innerRef: innerRef
17
+ }));
@@ -1,31 +1,38 @@
1
- import styled, { css } from 'styled-components';
2
- import { B100, N20 } from '@atlaskit/theme/colors';
3
- import { e500 } from '@atlaskit/theme/elevation';
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, N20, N50A, N60A } from '@atlaskit/theme/colors';
4
7
  import { TableBodyRow } from '../TableRow';
5
- const rankingStyles = css`
6
- display: block;
7
- `;
8
+ const rankingStyles = css({
9
+ display: 'block'
10
+ });
11
+ const elevationStyle = `var(--ds-overlay, ${`0 20px 32px -8px ${N50A}, 0 0 1px ${N60A}`})`;
8
12
  /**
9
13
  * TODO: Pass the props here to get particular theme for the table
10
14
  * Skipping it for now as it may impact migration as util-shared-styles does not support this feature
11
15
  */
12
16
 
13
- const rankingItemStyles = css`
14
- background-color: ${N20};
15
- ${e500()} border-radius: 2px;
16
- `;
17
-
18
- const draggableStyles = ({
17
+ const rankingItemStyles = css({
18
+ backgroundColor: `var(--ds-background-subtleNeutral-resting, ${N20})`,
19
+ boxShadow: elevationStyle,
20
+ borderRadius: '2px'
21
+ });
22
+ const draggableStyles = css({
23
+ '&:focus': {
24
+ outlineStyle: 'solid',
25
+ outlineColor: `var(--ds-border-focus, ${B100})`
26
+ },
27
+ outlineWidth: '2px'
28
+ });
29
+ export const RankableTableBodyRow = /*#__PURE__*/forwardRef(({
19
30
  isRanking,
20
- isRankingItem
21
- }) => css`
22
- ${isRanking && rankingStyles} ${isRankingItem && rankingItemStyles} &:focus {
23
- outline-style: solid;
24
- outline-color: ${B100};
25
- outline-width: 2px;
26
- }
27
- `;
28
-
29
- export const RankableTableBodyRow = styled(TableBodyRow)`
30
- ${draggableStyles};
31
- `;
31
+ isRankingItem,
32
+ ...props
33
+ }, ref) => {
34
+ return jsx(TableBodyRow, _extends({
35
+ css: [isRanking && rankingStyles, isRankingItem && rankingItemStyles, draggableStyles],
36
+ ref: ref
37
+ }, props));
38
+ });
@@ -8,43 +8,43 @@ export const MSThemeColors = {
8
8
  };
9
9
  export const arrow = {
10
10
  defaultColor: themed({
11
- light: colors.N40,
12
- dark: colors.DN40
11
+ light: `var(--ds-background-subtleNeutral-resting, ${colors.N40})`,
12
+ dark: `var(--ds-background-subtleNeutral-resting, ${colors.DN40})`
13
13
  }),
14
14
  selectedColor: themed({
15
- light: colors.N300,
16
- dark: colors.DN300
15
+ light: `var(--ds-text-lowEmphasis, ${colors.N300})`,
16
+ dark: `var(--ds-text-lowEmphasis, ${colors.DN300})`
17
17
  }),
18
18
  hoverColor: themed({
19
- light: colors.N60,
20
- dark: colors.DN60
19
+ light: `var(--ds-background-subtleNeutral-pressed, ${colors.N60})`,
20
+ dark: `var(--ds-background-subtleNeutral-pressed, ${colors.DN60})`
21
21
  })
22
22
  };
23
23
  export const row = {
24
24
  focusOutline: themed({
25
- light: colors.B100,
26
- dark: colors.B100
25
+ light: `var(--ds-border-focus, ${colors.B100})`,
26
+ dark: `var(--ds-border-focus, ${colors.B100})`
27
27
  }),
28
28
  highlightedBackground: themed({
29
- light: colors.B50,
30
- dark: colors.DN50
29
+ light: `var(--ds-background-selected-resting, ${colors.B50})`,
30
+ dark: `var(--ds-background-selected-resting, ${colors.DN50})`
31
31
  }),
32
32
  hoverBackground: themed({
33
- light: colors.N10,
34
- dark: colors.DN40
33
+ light: `var(--ds-background-subtleBorderedNeutral-resting, ${colors.N10})`,
34
+ dark: `var(--ds-background-subtleBorderedNeutral-resting, ${colors.DN40})`
35
35
  }),
36
36
  hoverHighlightedBackground: themed({
37
- light: colors.B75,
38
- dark: colors.DN60
37
+ light: `var(--ds-background-selected-hover, ${colors.B75})`,
38
+ dark: `var(--ds-background-selected-hover, ${colors.DN60})`
39
39
  })
40
40
  };
41
41
  export const head = {
42
42
  borderColor: themed({
43
- light: colors.N40,
44
- dark: colors.DN50
43
+ light: `var(--ds-border-neutral, ${colors.N40})`,
44
+ dark: `var(--ds-border-neutral, ${colors.DN50})`
45
45
  }),
46
46
  textColor: themed({
47
- light: colors.N300,
48
- dark: colors.DN300
47
+ light: `var(--ds-text-lowEmphasis, ${colors.N300})`,
48
+ dark: `var(--ds-text-lowEmphasis, ${colors.DN300})`
49
49
  })
50
50
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dynamic-table",
3
- "version": "14.3.2",
3
+ "version": "14.4.3",
4
4
  "sideEffects": false
5
5
  }
@@ -89,7 +89,7 @@ var LoadingContainerAdvanced = /*#__PURE__*/function (_React$Component) {
89
89
  });
90
90
 
91
91
  _defineProperty(_assertThisInitialized(_this), "getSpinnerNode", function () {
92
- return safeFindDOMNode(_this.spinner);
92
+ return safeFindDOMNode(_this.spinnerRef);
93
93
  });
94
94
 
95
95
  _defineProperty(_assertThisInitialized(_this), "hasTargetNode", function (nextProps) {
@@ -237,8 +237,8 @@ var LoadingContainerAdvanced = /*#__PURE__*/function (_React$Component) {
237
237
  _this2.children = el;
238
238
  }
239
239
  }), isLoading && /*#__PURE__*/React.createElement(SpinnerBackdrop, null, /*#__PURE__*/React.createElement(SpinnerContainer, {
240
- innerRef: function innerRef(el) {
241
- _this2.spinner = el;
240
+ ref: function ref(el) {
241
+ return _this2.spinnerRef = el;
242
242
  }
243
243
  }, /*#__PURE__*/React.createElement(Spinner, {
244
244
  size: spinnerSize,
@@ -14,6 +14,32 @@ import React from 'react';
14
14
  import { reorderRows } from '../internal/helpers';
15
15
  import DynamicTableStateless from './Stateless';
16
16
 
17
+ /**
18
+ * __Dynamic Table__
19
+ *
20
+ * A table displays rows of data with built-in pagination, sorting, and re-ordering functionality.
21
+ *
22
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/dynamic-table)
23
+ * - [Code](https://bitbucket.org/atlassian/atlassian-frontend/packages/design-system/dynamic-table)
24
+ *
25
+ * @example
26
+ * ```jsx
27
+ * import DynamicTable from '@atlaskit/dynamic-table';
28
+ *
29
+ * export default function TableUncontrolled() {
30
+ * return (
31
+ * <DynamicTable
32
+ * head={head}
33
+ * rows={rows}
34
+ * rowsPerPage={10}
35
+ * defaultPage={1}
36
+ * loadingSpinnerSize="large"
37
+ * isLoading={false}
38
+ * />
39
+ * );
40
+ * }
41
+ * ```
42
+ */
17
43
  var DynamicTable = /*#__PURE__*/function (_React$Component) {
18
44
  _inherits(DynamicTable, _React$Component);
19
45
 
@@ -20,11 +20,11 @@ import { EmptyViewContainer, EmptyViewWithFixedHeight } from '../styled/EmptyBod
20
20
  import Body from './Body';
21
21
  import LoadingContainer from './LoadingContainer';
22
22
  import LoadingContainerAdvanced from './LoadingContainerAdvanced';
23
- import ManagedPagination from './managedPagination';
23
+ import ManagedPagination from './managed-pagination';
24
24
  import RankableTableBody from './rankable/Body';
25
25
  import TableHead from './TableHead';
26
26
  var packageName = "@atlaskit/dynamic-table";
27
- var packageVersion = "14.3.2";
27
+ var packageVersion = "14.4.3";
28
28
 
29
29
  function toggleSortOrder(currentSortOrder) {
30
30
  switch (currentSortOrder) {
@@ -1,54 +1,26 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/createClass";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
-
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
-
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
-
14
3
  import React from 'react';
15
4
  import { HeadCell } from '../styled/TableHead';
16
5
 
17
- var TableHeadCell = /*#__PURE__*/function (_React$Component) {
18
- _inherits(TableHeadCell, _React$Component);
19
-
20
- var _super = _createSuper(TableHeadCell);
21
-
22
- function TableHeadCell() {
23
- _classCallCheck(this, TableHeadCell);
24
-
25
- return _super.apply(this, arguments);
26
- }
27
-
28
- _createClass(TableHeadCell, [{
29
- key: "render",
30
- value: function render() {
31
- var _this$props = this.props,
32
- content = _this$props.content,
33
- inlineStyles = _this$props.inlineStyles,
34
- testId = _this$props.testId,
35
- rest = _objectWithoutProperties(_this$props, ["content", "inlineStyles", "testId"]);
36
-
37
- return /*#__PURE__*/React.createElement(HeadCell, _extends({
38
- style: inlineStyles,
39
- "data-testid": testId && "".concat(testId, "--head--cell")
40
- }, rest, {
41
- tabIndex: rest.isSortable ? 0 : undefined
42
- }), /*#__PURE__*/React.createElement("span", null, content));
43
- }
44
- }]);
45
-
46
- return TableHeadCell;
47
- }(React.Component);
48
-
49
- _defineProperty(TableHeadCell, "defaultProps", {
50
- innerRef: function innerRef() {},
51
- inlineStyles: {}
52
- });
6
+ var TableHeadCell = function TableHeadCell(_ref) {
7
+ var content = _ref.content,
8
+ inlineStyles = _ref.inlineStyles,
9
+ testId = _ref.testId,
10
+ isRanking = _ref.isRanking,
11
+ innerRef = _ref.innerRef,
12
+ isSortable = _ref.isSortable,
13
+ rest = _objectWithoutProperties(_ref, ["content", "inlineStyles", "testId", "isRanking", "innerRef", "isSortable"]);
14
+
15
+ return /*#__PURE__*/React.createElement(HeadCell, _extends({
16
+ style: inlineStyles,
17
+ "data-testid": testId && "".concat(testId, "--head--cell"),
18
+ ref: typeof innerRef !== 'string' ? innerRef : null // string refs must be discarded as LegacyRefs are not compatible with FC forwardRefs
19
+
20
+ }, rest, {
21
+ tabIndex: isSortable ? 0 : undefined,
22
+ isSortable: isSortable
23
+ }), /*#__PURE__*/React.createElement("span", null, content));
24
+ };
53
25
 
54
26
  export default TableHeadCell;
@@ -33,8 +33,8 @@ export var RankableTableCell = /*#__PURE__*/function (_React$Component) {
33
33
  head = _this$props.head,
34
34
  isFixedSize = _this$props.isFixedSize,
35
35
  isRanking = _this$props.isRanking,
36
- innerRef = _this$props.innerRef,
37
- refWidth = _this$props.refWidth;
36
+ refWidth = _this$props.refWidth,
37
+ innerRef = _this$props.innerRef;
38
38
 
39
39
  var content = cell.content,
40
40
  restCellProps = _objectWithoutProperties(cell, ["content"]);
@@ -50,10 +50,10 @@ export var RankableTableCell = /*#__PURE__*/function (_React$Component) {
50
50
  width: width,
51
51
  isRanking: isRanking,
52
52
  style: inlineStyles,
53
- innerRef: innerRef,
54
53
  onKeyDown: function onKeyDown(e) {
55
54
  return e.stopPropagation();
56
- }
55
+ },
56
+ innerRef: innerRef
57
57
  }), content);
58
58
  }
59
59
  }]);
@@ -33,13 +33,11 @@ var RankableTableHeadCell = /*#__PURE__*/function (_React$Component) {
33
33
  isRanking = _this$props.isRanking,
34
34
  refHeight = _this$props.refHeight,
35
35
  refWidth = _this$props.refWidth,
36
- innerRef = _this$props.innerRef,
37
- restProps = _objectWithoutProperties(_this$props, ["isRanking", "refHeight", "refWidth", "innerRef"]);
36
+ restProps = _objectWithoutProperties(_this$props, ["isRanking", "refHeight", "refWidth"]);
38
37
 
39
38
  var inlineStyles = inlineStylesIfRanking(isRanking, refWidth);
40
39
  return /*#__PURE__*/React.createElement(HeadCell, _extends({
41
- inlineStyles: inlineStyles,
42
- innerRef: innerRef
40
+ inlineStyles: inlineStyles
43
41
  }, restProps));
44
42
  }
45
43
  }]);
@@ -42,7 +42,7 @@ export var RankableTableRow = /*#__PURE__*/function (_React$Component) {
42
42
  return function (ref) {
43
43
  innerRefFn(ref);
44
44
 
45
- if (_this.props.innerRef) {
45
+ if (typeof _this.props.innerRef === 'function') {
46
46
  _this.props.innerRef(ref);
47
47
  }
48
48
  };
@@ -78,12 +78,12 @@ export var RankableTableRow = /*#__PURE__*/function (_React$Component) {
78
78
  }
79
79
 
80
80
  return /*#__PURE__*/React.createElement(Draggable, {
81
- draggableId: key || "".concat(rowIndex),
81
+ draggableId: key || rowIndex.toString(),
82
82
  index: rowIndex,
83
83
  isDragDisabled: isRankingDisabled
84
84
  }, function (provided, snapshot) {
85
85
  return /*#__PURE__*/React.createElement(RankableTableBodyRow, _extends({}, restRowProps, provided.dragHandleProps, provided.draggableProps, {
86
- innerRef: _this2.innerRef(provided.innerRef),
86
+ ref: _this2.innerRef(provided.innerRef),
87
87
  style: _objectSpread(_objectSpread({}, provided.draggableProps.style), inlineStyles),
88
88
  isHighlighted: isHighlighted,
89
89
  isRanking: isRanking,
@@ -1,7 +1,5 @@
1
1
  export var ASC = 'ASC';
2
2
  export var DESC = 'DESC';
3
3
  export var SMALL = 'small';
4
- export var MEDIUM = 'medium';
5
4
  export var LARGE = 'large';
6
- export var XLARGE = 'xlarge';
7
5
  export var LOADING_CONTENTS_OPACITY = 0.22;