@atlaskit/dynamic-table 14.3.2 → 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 (81) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/components/LoadingContainerAdvanced.js +3 -3
  3. package/dist/cjs/components/Stateless.js +1 -1
  4. package/dist/cjs/components/TableHeadCell.js +18 -48
  5. package/dist/cjs/components/rankable/TableCell.js +4 -4
  6. package/dist/cjs/components/rankable/TableHeadCell.js +2 -4
  7. package/dist/cjs/components/rankable/TableRow.js +3 -3
  8. package/dist/cjs/styled/DynamicTable.js +80 -14
  9. package/dist/cjs/styled/EmptyBody.js +23 -8
  10. package/dist/cjs/styled/LoadingContainer.js +41 -8
  11. package/dist/cjs/styled/LoadingContainerAdvanced.js +42 -8
  12. package/dist/cjs/styled/TableCell.js +21 -7
  13. package/dist/cjs/styled/TableHead.js +161 -25
  14. package/dist/cjs/styled/TableRow.js +36 -18
  15. package/dist/cjs/styled/constants.js +33 -38
  16. package/dist/cjs/styled/rankable/RowPlaceholder.js +11 -4
  17. package/dist/cjs/styled/rankable/TableCell.js +18 -13
  18. package/dist/cjs/styled/rankable/TableRow.js +32 -20
  19. package/dist/cjs/theme.js +20 -18
  20. package/dist/cjs/version.json +1 -1
  21. package/dist/es2019/components/LoadingContainerAdvanced.js +2 -4
  22. package/dist/es2019/components/Stateless.js +1 -1
  23. package/dist/es2019/components/TableHeadCell.js +18 -22
  24. package/dist/es2019/components/rankable/TableCell.js +4 -4
  25. package/dist/es2019/components/rankable/TableHeadCell.js +1 -3
  26. package/dist/es2019/components/rankable/TableRow.js +3 -3
  27. package/dist/es2019/styled/DynamicTable.js +75 -26
  28. package/dist/es2019/styled/EmptyBody.js +21 -10
  29. package/dist/es2019/styled/LoadingContainer.js +39 -18
  30. package/dist/es2019/styled/LoadingContainerAdvanced.js +38 -20
  31. package/dist/es2019/styled/TableCell.js +20 -5
  32. package/dist/es2019/styled/TableHead.js +160 -33
  33. package/dist/es2019/styled/TableRow.js +34 -20
  34. package/dist/es2019/styled/constants.js +30 -115
  35. package/dist/es2019/styled/rankable/RowPlaceholder.js +10 -4
  36. package/dist/es2019/styled/rankable/TableCell.js +16 -9
  37. package/dist/es2019/styled/rankable/TableRow.js +32 -24
  38. package/dist/es2019/theme.js +19 -18
  39. package/dist/es2019/version.json +1 -1
  40. package/dist/esm/components/LoadingContainerAdvanced.js +3 -3
  41. package/dist/esm/components/Stateless.js +1 -1
  42. package/dist/esm/components/TableHeadCell.js +19 -47
  43. package/dist/esm/components/rankable/TableCell.js +4 -4
  44. package/dist/esm/components/rankable/TableHeadCell.js +2 -4
  45. package/dist/esm/components/rankable/TableRow.js +3 -3
  46. package/dist/esm/styled/DynamicTable.js +77 -9
  47. package/dist/esm/styled/EmptyBody.js +23 -7
  48. package/dist/esm/styled/LoadingContainer.js +40 -8
  49. package/dist/esm/styled/LoadingContainerAdvanced.js +41 -7
  50. package/dist/esm/styled/TableCell.js +21 -7
  51. package/dist/esm/styled/TableHead.js +160 -21
  52. package/dist/esm/styled/TableRow.js +36 -12
  53. package/dist/esm/styled/constants.js +28 -29
  54. package/dist/esm/styled/rankable/RowPlaceholder.js +11 -5
  55. package/dist/esm/styled/rankable/TableCell.js +18 -9
  56. package/dist/esm/styled/rankable/TableRow.js +31 -14
  57. package/dist/esm/theme.js +19 -18
  58. package/dist/esm/version.json +1 -1
  59. package/dist/types/components/Body.d.ts +21 -21
  60. package/dist/types/components/LoadingContainerAdvanced.d.ts +2 -2
  61. package/dist/types/components/Stateless.d.ts +3 -3
  62. package/dist/types/components/TableHeadCell.d.ts +4 -9
  63. package/dist/types/components/rankable/Body.d.ts +21 -21
  64. package/dist/types/components/rankable/TableHeadCell.d.ts +1 -1
  65. package/dist/types/components/rankable/TableRow.d.ts +3 -3
  66. package/dist/types/hoc/withDimensions.d.ts +2 -2
  67. package/dist/types/hoc/withSortedPageRows.d.ts +20 -20
  68. package/dist/types/styled/DynamicTable.d.ts +13 -6
  69. package/dist/types/styled/EmptyBody.d.ts +4 -3
  70. package/dist/types/styled/LoadingContainer.d.ts +8 -7
  71. package/dist/types/styled/LoadingContainerAdvanced.d.ts +5 -4
  72. package/dist/types/styled/TableCell.d.ts +3 -2
  73. package/dist/types/styled/TableHead.d.ts +8 -5
  74. package/dist/types/styled/TableRow.d.ts +7 -4
  75. package/dist/types/styled/constants.d.ts +13 -10
  76. package/dist/types/styled/rankable/RowPlaceholder.d.ts +3 -2
  77. package/dist/types/styled/rankable/TableCell.d.ts +8 -6
  78. package/dist/types/styled/rankable/TableRow.d.ts +9 -6
  79. package/dist/types/theme.d.ts +9 -9
  80. package/dist/types/types.d.ts +2 -2
  81. package/package.json +9 -3
@@ -1,10 +1,42 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
 
3
- var _templateObject, _templateObject2, _templateObject3;
4
-
5
- import styled from 'styled-components';
6
- export var Container = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n"])));
7
- export var ContentsContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n pointer-events: none;\n opacity: ", ";\n"])), function (p) {
8
- return p.contentsOpacity;
3
+ /** @jsx jsx */
4
+ import { css, jsx } from '@emotion/core';
5
+ var CSS_VAR_CONTENTS_OPACITY = '--contents-opacity';
6
+ var containerStyles = css({
7
+ position: 'relative'
8
+ });
9
+ export var Container = function Container(_ref) {
10
+ var children = _ref.children;
11
+ return jsx("div", {
12
+ css: containerStyles
13
+ }, children);
14
+ };
15
+ var contentsContainerStyles = css({
16
+ pointerEvents: 'none',
17
+ opacity: "var(".concat(CSS_VAR_CONTENTS_OPACITY, ")")
18
+ });
19
+ export var ContentsContainer = function ContentsContainer(_ref2) {
20
+ var contentsOpacity = _ref2.contentsOpacity,
21
+ children = _ref2.children;
22
+ return jsx("div", {
23
+ style: _defineProperty({}, CSS_VAR_CONTENTS_OPACITY, contentsOpacity),
24
+ css: [contentsContainerStyles]
25
+ }, children);
26
+ };
27
+ var spinnerContainerStyles = css({
28
+ position: 'absolute',
29
+ top: 0,
30
+ right: 0,
31
+ bottom: 0,
32
+ left: 0,
33
+ display: 'flex',
34
+ alignItems: 'center',
35
+ justifyContent: 'center'
9
36
  });
10
- export var SpinnerContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n"])));
37
+ export var SpinnerContainer = function SpinnerContainer(_ref4) {
38
+ var children = _ref4.children;
39
+ return jsx("div", {
40
+ css: spinnerContainerStyles
41
+ }, children);
42
+ };
@@ -1,9 +1,43 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
1
+ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
- var _templateObject, _templateObject2, _templateObject3;
4
-
5
- import styled from 'styled-components';
3
+ /** @jsx jsx */
4
+ import { forwardRef } from 'react';
5
+ import { css, jsx } from '@emotion/core';
6
6
  import { gridSize } from '@atlaskit/theme/constants';
7
- export var Container = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-bottom: ", "px;\n position: relative;\n"])), gridSize() * 3);
8
- export var SpinnerBackdrop = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n pointer-events: none;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n"])));
9
- export var SpinnerContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n top: 0;\n"])));
7
+ var containerStyles = css({
8
+ marginBottom: "".concat(gridSize() * 3, "px"),
9
+ position: 'relative'
10
+ });
11
+ export var Container = function Container(props) {
12
+ return jsx("div", _extends({
13
+ css: containerStyles
14
+ }, props));
15
+ };
16
+ var spinnerBackdropStyles = css({
17
+ pointerEvents: 'none',
18
+ position: 'absolute',
19
+ top: 0,
20
+ right: 0,
21
+ bottom: 0,
22
+ left: 0,
23
+ display: 'flex',
24
+ alignItems: 'center',
25
+ justifyContent: 'center'
26
+ });
27
+ export var SpinnerBackdrop = function SpinnerBackdrop(_ref) {
28
+ var children = _ref.children;
29
+ return jsx("div", {
30
+ css: spinnerBackdropStyles
31
+ }, children);
32
+ };
33
+ var spinnerContainerStyles = css({
34
+ position: 'relative',
35
+ top: 0
36
+ });
37
+ export var SpinnerContainer = /*#__PURE__*/forwardRef(function (_ref2, ref) {
38
+ var children = _ref2.children;
39
+ return jsx("div", {
40
+ css: spinnerContainerStyles,
41
+ ref: ref
42
+ }, children);
43
+ });
@@ -1,9 +1,23 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
3
 
3
- var _templateObject;
4
+ /** @jsx jsx */
5
+ import { jsx } from '@emotion/core';
6
+ import { cellStyles, fixedSizeTruncateStyles, getTruncationStyleVars, overflowTruncateStyles, truncationWidthStyles } from './constants';
7
+ export var TableBodyCell = function TableBodyCell(_ref) {
8
+ var width = _ref.width,
9
+ isFixedSize = _ref.isFixedSize,
10
+ shouldTruncate = _ref.shouldTruncate,
11
+ innerRef = _ref.innerRef,
12
+ props = _objectWithoutProperties(_ref, ["width", "isFixedSize", "shouldTruncate", "innerRef"]);
4
13
 
5
- import styled from 'styled-components';
6
- import { cellStyle, truncateStyle } from './constants';
7
- export var TableBodyCell = styled.td(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", " ", ";\n"])), function (props) {
8
- return truncateStyle(props);
9
- }, cellStyle);
14
+ return jsx("td", _extends({
15
+ style: getTruncationStyleVars({
16
+ width: width
17
+ }),
18
+ css: [truncationWidthStyles, isFixedSize && shouldTruncate && fixedSizeTruncateStyles, isFixedSize && overflowTruncateStyles, cellStyles] // HOC withDimensions complains about the types but it is working fine
19
+ // @ts-ignore
20
+ ,
21
+ ref: innerRef
22
+ }, props));
23
+ };
@@ -1,23 +1,162 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
-
3
- var _templateObject, _templateObject2, _templateObject3;
4
-
5
- import styled, { css } from 'styled-components';
6
- import { B100 } from '@atlaskit/theme/colors';
7
- import { head } from '../theme';
8
- import { arrowsStyle, cellStyle, onClickStyle, truncateStyle } from './constants';
9
- var rankingStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n"])));
10
- export var Head = styled.thead(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border-bottom: 2px solid ", ";\n ", ";\n"])), head.borderColor, function (_ref) {
11
- var isRanking = _ref.isRanking;
12
- return isRanking && rankingStyles;
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6
+
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
+
9
+ /** @jsx jsx */
10
+ import { forwardRef } from 'react';
11
+ import { css, jsx } from '@emotion/core';
12
+ import { B100, N30A } from '@atlaskit/theme/colors';
13
+ import { useGlobalTheme } from '@atlaskit/theme/components';
14
+ import { gridSize as getGridSize } from '@atlaskit/theme/constants';
15
+ import { token } from '@atlaskit/tokens';
16
+ import { ASC, DESC } from '../internal/constants';
17
+ import { arrow, head, MSThemeColors } from '../theme';
18
+ import { cellStyles, fixedSizeTruncateStyles, getTruncationStyleVars, overflowTruncateStyles, truncationWidthStyles } from './constants';
19
+ var gridSize = getGridSize();
20
+ var CSS_VAR_TEXT_COLOR = '--local-dynamic-table-text-color';
21
+ var rankingStyles = css({
22
+ display: 'block'
13
23
  });
14
- export var HeadCell = styled.th(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n ", " \n ", " \n ", " \n border: none;\n color: ", ";\n box-sizing: border-box;\n font-size: 12px;\n font-weight: 600;\n position: relative;\n text-align: left;\n vertical-align: top;\n &:focus {\n outline: solid 2px ", ";\n }\n"])), function (_ref2) {
15
- var onClick = _ref2.onClick;
16
- return onClickStyle({
17
- onClick: Boolean(onClick)
24
+
25
+ var getHeadStyles = function getHeadStyles(theme) {
26
+ return css({
27
+ borderBottom: "2px solid ".concat(token('color.border.neutral', head.borderColor({
28
+ theme: theme
29
+ })))
18
30
  });
19
- }, function (p) {
20
- return truncateStyle(p);
21
- }, function (p) {
22
- return arrowsStyle(p);
23
- }, cellStyle, head.textColor, B100);
31
+ };
32
+
33
+ export var Head = function Head(_ref) {
34
+ var isRanking = _ref.isRanking,
35
+ props = _objectWithoutProperties(_ref, ["isRanking"]);
36
+
37
+ var theme = useGlobalTheme();
38
+ return jsx("thead", _extends({
39
+ css: [getHeadStyles(theme), isRanking && rankingStyles]
40
+ }, props));
41
+ };
42
+ var headCellStyles = css([cellStyles, {
43
+ border: 'none',
44
+ boxSizing: 'border-box',
45
+ fontSize: '12px',
46
+ fontWeight: 600,
47
+ position: 'relative',
48
+ textAlign: 'left',
49
+ verticalAlign: 'top',
50
+ color: token('color.text.lowEmphasis', "var(".concat(CSS_VAR_TEXT_COLOR, ")")),
51
+ '&:focus': {
52
+ outline: "solid 2px ".concat(token('color.border.focus', B100))
53
+ }
54
+ }]); // this needs to be made static: https://product-fabric.atlassian.net/browse/DSP-2011
55
+
56
+ export var getArrowStyles = function getArrowStyles(isSortable, sortOrder, theme) {
57
+ if (!isSortable) {
58
+ return '';
59
+ }
60
+
61
+ var pseudoBaseStyles = {
62
+ border: '3px solid transparent',
63
+ display: 'block',
64
+ height: 0,
65
+ right: "-".concat(gridSize, "px"),
66
+ width: 0,
67
+ '@media (forced-colors: active)': {
68
+ border: "3px solid ".concat(MSThemeColors.Background)
69
+ }
70
+ };
71
+ return css({
72
+ '& > span': {
73
+ position: 'relative',
74
+ '&::before': _objectSpread(_objectSpread({}, pseudoBaseStyles), {}, {
75
+ position: 'absolute',
76
+ borderBottom: "3px solid ".concat(sortOrder === ASC ? arrow.selectedColor({
77
+ theme: theme
78
+ }) : arrow.defaultColor({
79
+ theme: theme
80
+ })),
81
+ bottom: '8px',
82
+ content: '""'
83
+ }),
84
+ '&::after': _objectSpread(_objectSpread({}, pseudoBaseStyles), {}, {
85
+ position: 'absolute',
86
+ borderTop: "3px solid ".concat(sortOrder === DESC ? arrow.selectedColor({
87
+ theme: theme
88
+ }) : arrow.defaultColor({
89
+ theme: theme
90
+ })),
91
+ bottom: 0,
92
+ content: '""'
93
+ })
94
+ },
95
+ '&:hover > span': {
96
+ '&::before': {
97
+ borderBottom: "3px solid\n ".concat(sortOrder === ASC ? arrow.selectedColor({
98
+ theme: theme
99
+ }) : arrow.hoverColor({
100
+ theme: theme
101
+ }))
102
+ },
103
+ '&::after': {
104
+ borderTop: "3px solid\n ".concat(sortOrder === DESC ? arrow.selectedColor({
105
+ theme: theme
106
+ }) : arrow.hoverColor({
107
+ theme: theme
108
+ }))
109
+ }
110
+ },
111
+ '@media (forced-colors: active)': {
112
+ '& > span': {
113
+ '&::before': {
114
+ borderBottom: "3px solid\n ".concat(sortOrder === ASC ? MSThemeColors.SelectedBackground : MSThemeColors.Text)
115
+ },
116
+ '&::after': {
117
+ borderTop: "3px solid\n ".concat(sortOrder === DESC ? MSThemeColors.SelectedBackground : MSThemeColors.Text)
118
+ }
119
+ },
120
+ '&:hover > span': {
121
+ '&::before': {
122
+ borderBottom: "3px solid\n ".concat(sortOrder === ASC ? MSThemeColors.SelectedBackground : MSThemeColors.Text)
123
+ },
124
+ '&::after': {
125
+ borderTop: "3px solid\n ".concat(sortOrder === DESC ? MSThemeColors.SelectedBackground : MSThemeColors.Text)
126
+ }
127
+ }
128
+ }
129
+ });
130
+ };
131
+ var onClickStyles = css({
132
+ '&:hover': {
133
+ cursor: 'pointer',
134
+ backgroundColor: token('color.background.subtleNeutral.hover', N30A)
135
+ }
136
+ });
137
+ export var HeadCell = /*#__PURE__*/forwardRef(function (_ref2, ref) {
138
+ var width = _ref2.width,
139
+ children = _ref2.children,
140
+ isSortable = _ref2.isSortable,
141
+ sortOrder = _ref2.sortOrder,
142
+ isFixedSize = _ref2.isFixedSize,
143
+ shouldTruncate = _ref2.shouldTruncate,
144
+ onClick = _ref2.onClick,
145
+ style = _ref2.style,
146
+ rest = _objectWithoutProperties(_ref2, ["width", "children", "isSortable", "sortOrder", "isFixedSize", "shouldTruncate", "onClick", "style"]);
147
+
148
+ var theme = useGlobalTheme();
149
+
150
+ var mergedStyles = _objectSpread(_objectSpread(_objectSpread({}, style), width && getTruncationStyleVars({
151
+ width: width
152
+ })), {}, _defineProperty({}, CSS_VAR_TEXT_COLOR, head.textColor({
153
+ theme: theme
154
+ })));
155
+
156
+ return jsx("th", _extends({
157
+ style: mergedStyles,
158
+ css: [headCellStyles, onClick && onClickStyles, truncationWidthStyles, isFixedSize && shouldTruncate && fixedSizeTruncateStyles, isFixedSize && overflowTruncateStyles, getArrowStyles(isSortable, sortOrder, theme)],
159
+ onClick: onClick,
160
+ ref: ref
161
+ }, rest), children);
162
+ });
@@ -1,14 +1,38 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
3
 
3
- var _templateObject, _templateObject2, _templateObject3;
4
+ /** @jsx jsx */
5
+ import { forwardRef } from 'react';
6
+ import { css, jsx } from '@emotion/core';
7
+ import { token } from '@atlaskit/tokens';
8
+ import { tableRowCSSVars as cssVars } from './DynamicTable';
9
+ var rowStyles = css({
10
+ '&:focus': {
11
+ outline: "2px solid ".concat(token('color.border.focus', "var(".concat(cssVars.CSS_VAR_HOVER_BACKGROUND, ")"))),
12
+ outlineOffset: "-2px"
13
+ }
14
+ });
15
+ var rowBackgroundStyles = css({
16
+ '&:hover': {
17
+ backgroundColor: token('color.background.transparentNeutral.hover', "var(".concat(cssVars.CSS_VAR_HOVER_BACKGROUND, ")"))
18
+ }
19
+ });
20
+ var rowHighlightedBackgroundStyles = css({
21
+ backgroundColor: token('color.background.selected.resting', "var(".concat(cssVars.CSS_VAR_HIGHLIGHTED_BACKGROUND, ")")),
22
+ '&:hover': {
23
+ backgroundColor: token('color.background.selected.hover', "var(".concat(cssVars.CSS_VAR_HOVER_HIGHLIGHTED_BACKGROUND, ")"))
24
+ }
25
+ });
26
+ export var TableBodyRow = /*#__PURE__*/forwardRef(function (_ref, ref) {
27
+ var isHighlighted = _ref.isHighlighted,
28
+ children = _ref.children,
29
+ style = _ref.style,
30
+ rest = _objectWithoutProperties(_ref, ["isHighlighted", "children", "style"]);
4
31
 
5
- import styled, { css } from 'styled-components';
6
- import { row } from '../theme';
7
- var outlineWidth = '2px';
8
- export var TableBodyRow = styled.tr(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n\n &:hover {\n ", "\n }\n\n &:focus {\n outline: ", " solid ", ";\n outline-offset: -", ";\n }\n"])), function (_ref) {
9
- var isHighlighted = _ref.isHighlighted;
10
- return isHighlighted && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), row.highlightedBackground);
11
- }, function (_ref2) {
12
- var isHighlighted = _ref2.isHighlighted;
13
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), isHighlighted ? row.hoverHighlightedBackground : row.hoverBackground);
14
- }, outlineWidth, row.focusOutline, outlineWidth);
32
+ return jsx("tr", _extends({
33
+ style: style,
34
+ css: [rowStyles, isHighlighted ? rowHighlightedBackgroundStyles : rowBackgroundStyles]
35
+ }, rest, {
36
+ ref: ref
37
+ }), children);
38
+ });
@@ -1,31 +1,30 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
-
3
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
4
-
5
- import { css } from 'styled-components';
6
- import { N30A } from '@atlaskit/theme/colors';
7
- import { gridSize } from '@atlaskit/theme/constants';
8
- import { ASC, DESC } from '../internal/constants';
9
- import { arrow, MSThemeColors } from '../theme';
10
- export var truncateStyle = function truncateStyle(_ref) {
11
- var width = _ref.width,
12
- isFixedSize = _ref.isFixedSize,
13
- shouldTruncate = _ref.shouldTruncate;
14
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", " ", ";\n ", ";\n"])), width ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: ", "%;\n "])), width) : '', isFixedSize ? css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n overflow: hidden;\n "]))) : '', isFixedSize && shouldTruncate ? css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n text-overflow: ellipsis;\n white-space: nowrap;\n "]))) : '');
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { css } from '@emotion/core';
3
+ import { gridSize as getGridSize } from '@atlaskit/theme/constants';
4
+ var CSS_VAR_WIDTH = '--local-dynamic-table-width';
5
+ var gridSize = getGridSize();
6
+ export var truncationWidthStyles = css({
7
+ width: "var(".concat(CSS_VAR_WIDTH, ")")
8
+ });
9
+ export var fixedSizeTruncateStyles = css({
10
+ textOverflow: 'ellipsis',
11
+ whiteSpace: 'nowrap'
12
+ });
13
+ export var overflowTruncateStyles = css({
14
+ overflow: 'hidden'
15
+ });
16
+ export var getTruncationStyleVars = function getTruncationStyleVars(_ref) {
17
+ var width = _ref.width;
18
+ return _defineProperty({}, CSS_VAR_WIDTH, "".concat(width, "%"));
15
19
  };
16
- export var onClickStyle = function onClickStyle(_ref2) {
17
- var onClick = _ref2.onClick;
18
- return onClick && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n &:hover {\n cursor: pointer;\n background-color: ", ";\n }\n "])), N30A);
19
- };
20
- export var arrowsStyle = function arrowsStyle(props) {
21
- var isSortable = props.isSortable,
22
- sortOrder = props.sortOrder;
23
-
24
- if (!isSortable) {
25
- return '';
20
+ export var cellStyles = css({
21
+ border: 'none',
22
+ padding: "".concat(gridSize / 2, "px ").concat(gridSize, "px"),
23
+ textAlign: 'left',
24
+ '&:first-of-type': {
25
+ paddingLeft: 0
26
+ },
27
+ '&:last-child': {
28
+ paddingRight: 0
26
29
  }
27
-
28
- var pseudoBase = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n border: 3px solid transparent;\n display: block;\n height: 0;\n position: absolute;\n right: -", "px;\n width: 0;\n\n @media (forced-colors: active) {\n border: 3px solid ", ";\n }\n "])), gridSize, MSThemeColors.Background);
29
- return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n & > span {\n position: relative;\n &::before {\n ", ";\n border-bottom: 3px solid\n ", ";\n bottom: 8px;\n content: ' ';\n }\n &::after {\n ", ";\n border-top: 3px solid\n ", ";\n bottom: 0;\n content: ' ';\n }\n }\n\n &:hover > span {\n &::before {\n border-bottom: 3px solid\n ", ";\n }\n &::after {\n border-top: 3px solid\n ", ";\n }\n }\n\n @media (forced-colors: active) {\n & > span {\n &::before {\n border-bottom: 3px solid\n ", ";\n }\n &::after {\n border-top: 3px solid\n ", ";\n }\n }\n\n &:hover > span {\n &::before {\n border-bottom: 3px solid\n ", ";\n }\n &::after {\n border-top: 3px solid\n ", ";\n }\n }\n }\n "])), pseudoBase, sortOrder === ASC ? arrow.selectedColor(props) : arrow.defaultColor(props), pseudoBase, sortOrder === DESC ? arrow.selectedColor(props) : arrow.defaultColor(props), sortOrder === ASC ? arrow.selectedColor(props) : arrow.hoverColor(props), sortOrder === DESC ? arrow.selectedColor(props) : arrow.hoverColor(props), sortOrder === ASC ? MSThemeColors.SelectedBackground : MSThemeColors.Text, sortOrder === DESC ? MSThemeColors.SelectedBackground : MSThemeColors.Text, sortOrder === ASC ? MSThemeColors.SelectedBackground : MSThemeColors.Text, sortOrder === DESC ? MSThemeColors.SelectedBackground : MSThemeColors.Text);
30
- };
31
- export var cellStyle = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n border: none;\n padding: ", "px ", "px;\n text-align: left;\n\n &:first-child {\n padding-left: 0;\n }\n &:last-child {\n padding-right: 0;\n }\n"])), gridSize() / 2, gridSize);
30
+ });
@@ -1,6 +1,12 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
1
+ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
- var _templateObject;
4
-
5
- import styled from 'styled-components';
6
- export var RowPlaceholderCell = styled.td(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0;\n"])));
3
+ /** @jsx jsx */
4
+ import { css, jsx } from '@emotion/core';
5
+ var rowPlaceholderStyles = css({
6
+ padding: 0
7
+ });
8
+ export var RowPlaceholderCell = function RowPlaceholderCell(props) {
9
+ return jsx("td", _extends({
10
+ css: rowPlaceholderStyles
11
+ }, props));
12
+ };
@@ -1,11 +1,20 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
3
 
3
- var _templateObject, _templateObject2;
4
-
5
- import styled, { css } from 'styled-components';
4
+ /** @jsx jsx */
5
+ import { css, jsx } from '@emotion/core';
6
6
  import { TableBodyCell } from '../TableCell';
7
- var rankingStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n box-sizing: border-box;\n"])));
8
- export var RankableTableBodyCell = styled(TableBodyCell)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", ";\n"])), function (_ref) {
9
- var isRanking = _ref.isRanking;
10
- return isRanking && rankingStyles;
11
- });
7
+ var rankingStyles = css({
8
+ boxSizing: 'border-box'
9
+ });
10
+ export var RankableTableBodyCell = function RankableTableBodyCell(_ref) {
11
+ var isRanking = _ref.isRanking,
12
+ innerRef = _ref.innerRef,
13
+ props = _objectWithoutProperties(_ref, ["isRanking", "innerRef"]);
14
+
15
+ return jsx(TableBodyCell, _extends({
16
+ css: isRanking && rankingStyles
17
+ }, props, {
18
+ innerRef: innerRef
19
+ }));
20
+ };
@@ -1,23 +1,40 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
3
 
3
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
4
-
5
- import styled, { css } from 'styled-components';
6
- import { B100, N20 } from '@atlaskit/theme/colors';
7
- import { e500 } from '@atlaskit/theme/elevation';
4
+ /** @jsx jsx */
5
+ import { forwardRef } from 'react';
6
+ import { css, jsx } from '@emotion/core';
7
+ import { B100, N20, N50A, N60A } from '@atlaskit/theme/colors';
8
+ import { token } from '@atlaskit/tokens';
8
9
  import { TableBodyRow } from '../TableRow';
9
- var rankingStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n"])));
10
+ var rankingStyles = css({
11
+ display: 'block'
12
+ });
13
+ var elevationStyle = token('shadow.overlay', "0 20px 32px -8px ".concat(N50A, ", 0 0 1px ").concat(N60A));
10
14
  /**
11
15
  * TODO: Pass the props here to get particular theme for the table
12
16
  * Skipping it for now as it may impact migration as util-shared-styles does not support this feature
13
17
  */
14
18
 
15
- var rankingItemStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n ", " border-radius: 2px;\n"])), N20, e500());
16
-
17
- var draggableStyles = function draggableStyles(_ref) {
19
+ var rankingItemStyles = css({
20
+ backgroundColor: token('color.background.subtleNeutral.resting', N20),
21
+ boxShadow: elevationStyle,
22
+ borderRadius: '2px'
23
+ });
24
+ var draggableStyles = css({
25
+ '&:focus': {
26
+ outlineStyle: 'solid',
27
+ outlineColor: token('color.border.focus', B100)
28
+ },
29
+ outlineWidth: '2px'
30
+ });
31
+ export var RankableTableBodyRow = /*#__PURE__*/forwardRef(function (_ref, ref) {
18
32
  var isRanking = _ref.isRanking,
19
- isRankingItem = _ref.isRankingItem;
20
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", " ", " &:focus {\n outline-style: solid;\n outline-color: ", ";\n outline-width: 2px;\n }\n"])), isRanking && rankingStyles, isRankingItem && rankingItemStyles, B100);
21
- };
33
+ isRankingItem = _ref.isRankingItem,
34
+ props = _objectWithoutProperties(_ref, ["isRanking", "isRankingItem"]);
22
35
 
23
- export var RankableTableBodyRow = styled(TableBodyRow)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n"])), draggableStyles);
36
+ return jsx(TableBodyRow, _extends({
37
+ css: [isRanking && rankingStyles, isRankingItem && rankingItemStyles, draggableStyles],
38
+ ref: ref
39
+ }, props));
40
+ });
package/dist/esm/theme.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as colors from '@atlaskit/theme/colors';
2
2
  import { themed } from '@atlaskit/theme/components';
3
+ import { token } from '@atlaskit/tokens';
3
4
  export var MSThemeColors = {
4
5
  Background: 'Canvas',
5
6
  Text: 'CanvasText',
@@ -8,43 +9,43 @@ export var MSThemeColors = {
8
9
  };
9
10
  export var arrow = {
10
11
  defaultColor: themed({
11
- light: colors.N40,
12
- dark: colors.DN40
12
+ light: token('color.background.subtleNeutral.resting', colors.N40),
13
+ dark: token('color.background.subtleNeutral.resting', colors.DN40)
13
14
  }),
14
15
  selectedColor: themed({
15
- light: colors.N300,
16
- dark: colors.DN300
16
+ light: token('color.text.lowEmphasis', colors.N300),
17
+ dark: token('color.text.lowEmphasis', colors.DN300)
17
18
  }),
18
19
  hoverColor: themed({
19
- light: colors.N60,
20
- dark: colors.DN60
20
+ light: token('color.background.subtleNeutral.pressed', colors.N60),
21
+ dark: token('color.background.subtleNeutral.pressed', colors.DN60)
21
22
  })
22
23
  };
23
24
  export var row = {
24
25
  focusOutline: themed({
25
- light: colors.B100,
26
- dark: colors.B100
26
+ light: token('color.border.focus', colors.B100),
27
+ dark: token('color.border.focus', colors.B100)
27
28
  }),
28
29
  highlightedBackground: themed({
29
- light: colors.B50,
30
- dark: colors.DN50
30
+ light: token('color.background.selected.resting', colors.B50),
31
+ dark: token('color.background.selected.resting', colors.DN50)
31
32
  }),
32
33
  hoverBackground: themed({
33
- light: colors.N10,
34
- dark: colors.DN40
34
+ light: token('color.background.subtleBorderedNeutral.resting', colors.N10),
35
+ dark: token('color.background.subtleBorderedNeutral.resting', colors.DN40)
35
36
  }),
36
37
  hoverHighlightedBackground: themed({
37
- light: colors.B75,
38
- dark: colors.DN60
38
+ light: token('color.background.selected.hover', colors.B75),
39
+ dark: token('color.background.selected.hover', colors.DN60)
39
40
  })
40
41
  };
41
42
  export var head = {
42
43
  borderColor: themed({
43
- light: colors.N40,
44
- dark: colors.DN50
44
+ light: token('color.border.neutral', colors.N40),
45
+ dark: token('color.border.neutral', colors.DN50)
45
46
  }),
46
47
  textColor: themed({
47
- light: colors.N300,
48
- dark: colors.DN300
48
+ light: token('color.text.lowEmphasis', colors.N300),
49
+ dark: token('color.text.lowEmphasis', colors.DN300)
49
50
  })
50
51
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dynamic-table",
3
- "version": "14.3.2",
3
+ "version": "14.4.0",
4
4
  "sideEffects": false
5
5
  }