@atlaskit/table 0.2.1 → 0.2.2

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 (76) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/body.js +16 -35
  3. package/dist/cjs/head-cell.js +5 -11
  4. package/dist/cjs/hooks/selection-provider.js +1 -9
  5. package/dist/cjs/hooks/use-row-id.js +2 -5
  6. package/dist/cjs/hooks/use-selectable.js +13 -29
  7. package/dist/cjs/hooks/use-sorting.js +6 -17
  8. package/dist/cjs/hooks/use-table-body.js +1 -7
  9. package/dist/cjs/hooks/use-table.js +4 -13
  10. package/dist/cjs/index.js +0 -8
  11. package/dist/cjs/row.js +8 -25
  12. package/dist/cjs/selectable-cell.js +6 -20
  13. package/dist/cjs/sortable-column.js +12 -26
  14. package/dist/cjs/table.js +8 -22
  15. package/dist/cjs/thead.js +8 -25
  16. package/dist/cjs/ui/base-cell.js +14 -20
  17. package/dist/cjs/ui/bulk-action-overlay.js +2 -5
  18. package/dist/cjs/ui/index.js +0 -9
  19. package/dist/cjs/ui/selectable-cell.js +4 -7
  20. package/dist/cjs/ui/sort-icon.js +2 -14
  21. package/dist/cjs/ui/table.js +2 -5
  22. package/dist/cjs/ui/tbody.js +2 -5
  23. package/dist/cjs/ui/td.js +3 -10
  24. package/dist/cjs/ui/th.js +5 -10
  25. package/dist/cjs/ui/thead.js +2 -4
  26. package/dist/cjs/ui/tr.js +6 -11
  27. package/dist/cjs/version.json +1 -1
  28. package/dist/es2019/body.js +11 -8
  29. package/dist/es2019/head-cell.js +2 -3
  30. package/dist/es2019/hooks/selection-provider.js +1 -2
  31. package/dist/es2019/hooks/use-row-id.js +2 -2
  32. package/dist/es2019/hooks/use-selectable.js +4 -13
  33. package/dist/es2019/hooks/use-sorting.js +0 -4
  34. package/dist/es2019/hooks/use-table-body.js +1 -1
  35. package/dist/es2019/hooks/use-table.js +3 -4
  36. package/dist/es2019/row.js +2 -4
  37. package/dist/es2019/selectable-cell.js +0 -2
  38. package/dist/es2019/sortable-column.js +5 -10
  39. package/dist/es2019/table.js +0 -2
  40. package/dist/es2019/thead.js +1 -4
  41. package/dist/es2019/ui/base-cell.js +1 -2
  42. package/dist/es2019/ui/bulk-action-overlay.js +2 -1
  43. package/dist/es2019/ui/selectable-cell.js +2 -1
  44. package/dist/es2019/ui/sort-icon.js +1 -5
  45. package/dist/es2019/ui/table.js +1 -1
  46. package/dist/es2019/ui/tbody.js +2 -2
  47. package/dist/es2019/ui/td.js +4 -3
  48. package/dist/es2019/ui/th.js +0 -1
  49. package/dist/es2019/ui/thead.js +2 -1
  50. package/dist/es2019/ui/tr.js +2 -2
  51. package/dist/es2019/version.json +1 -1
  52. package/dist/esm/body.js +16 -21
  53. package/dist/esm/head-cell.js +7 -8
  54. package/dist/esm/hooks/selection-provider.js +1 -2
  55. package/dist/esm/hooks/use-row-id.js +2 -2
  56. package/dist/esm/hooks/use-selectable.js +13 -25
  57. package/dist/esm/hooks/use-sorting.js +6 -12
  58. package/dist/esm/hooks/use-table-body.js +1 -1
  59. package/dist/esm/hooks/use-table.js +4 -5
  60. package/dist/esm/row.js +8 -13
  61. package/dist/esm/selectable-cell.js +5 -9
  62. package/dist/esm/sortable-column.js +12 -18
  63. package/dist/esm/table.js +8 -12
  64. package/dist/esm/thead.js +8 -14
  65. package/dist/esm/ui/base-cell.js +13 -14
  66. package/dist/esm/ui/bulk-action-overlay.js +2 -1
  67. package/dist/esm/ui/selectable-cell.js +4 -3
  68. package/dist/esm/ui/sort-icon.js +3 -8
  69. package/dist/esm/ui/table.js +3 -3
  70. package/dist/esm/ui/tbody.js +2 -2
  71. package/dist/esm/ui/td.js +5 -5
  72. package/dist/esm/ui/th.js +5 -6
  73. package/dist/esm/ui/thead.js +2 -1
  74. package/dist/esm/ui/tr.js +6 -6
  75. package/dist/esm/version.json +1 -1
  76. package/package.json +2 -2
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable @atlassian/tangerine/import/entry-points */
2
-
3
2
  /** @jsx jsx */
4
3
  import { forwardRef } from 'react';
5
4
  import { css, jsx } from '@emotion/react';
@@ -20,6 +19,7 @@ var baseResetStyles = css({
20
19
  paddingRight: "var(--ds-space-100, 8px)"
21
20
  }
22
21
  });
22
+
23
23
  /**
24
24
  * __BaseCell__
25
25
  *
@@ -27,21 +27,20 @@ var baseResetStyles = css({
27
27
  *
28
28
  * Basic cell element.
29
29
  */
30
-
31
30
  export var BaseCell = /*#__PURE__*/forwardRef(function (_ref, ref) {
32
31
  var testId = _ref.testId,
33
- as = _ref.as,
34
- children = _ref.children,
35
- _ref$align = _ref.align,
36
- align = _ref$align === void 0 ? 'text' : _ref$align,
37
- _ref$paddingBlock = _ref.paddingBlock,
38
- paddingBlock = _ref$paddingBlock === void 0 ? 'space.100' : _ref$paddingBlock,
39
- _ref$paddingInline = _ref.paddingInline,
40
- paddingInline = _ref$paddingInline === void 0 ? 'space.200' : _ref$paddingInline,
41
- backgroundColor = _ref.backgroundColor,
42
- scope = _ref.scope,
43
- width = _ref.width,
44
- className = _ref.className;
32
+ as = _ref.as,
33
+ children = _ref.children,
34
+ _ref$align = _ref.align,
35
+ align = _ref$align === void 0 ? 'text' : _ref$align,
36
+ _ref$paddingBlock = _ref.paddingBlock,
37
+ paddingBlock = _ref$paddingBlock === void 0 ? 'space.100' : _ref$paddingBlock,
38
+ _ref$paddingInline = _ref.paddingInline,
39
+ paddingInline = _ref$paddingInline === void 0 ? 'space.200' : _ref$paddingInline,
40
+ backgroundColor = _ref.backgroundColor,
41
+ scope = _ref.scope,
42
+ width = _ref.width,
43
+ className = _ref.className;
45
44
  return jsx(Box, {
46
45
  css: baseResetStyles,
47
46
  ref: ref,
@@ -1,4 +1,5 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { UNSAFE_Box as Box, UNSAFE_Inline as Inline } from '@atlaskit/ds-explorations';
4
5
  var overlayStyles = css({
@@ -7,12 +8,12 @@ var overlayStyles = css({
7
8
  bottom: 0,
8
9
  left: 32
9
10
  });
11
+
10
12
  /**
11
13
  * __Bulk action overlay__
12
14
  *
13
15
  * A bulk action overlay is used to conditionally render when a user makes a row selection
14
16
  */
15
-
16
17
  export var BulkActionOverlay = function BulkActionOverlay(_ref) {
17
18
  var children = _ref.children;
18
19
  return jsx(Box, {
@@ -1,4 +1,5 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { BaseCell } from './base-cell';
4
5
  var spacingStyles = css({
@@ -11,16 +12,16 @@ var spacingStyles = css({
11
12
  paddingLeft: '8px !important'
12
13
  }
13
14
  });
15
+
14
16
  /**
15
17
  * __Selectable cell__
16
18
  *
17
19
  * A selectable cell primitive designed to be used for light weight composition.
18
20
  */
19
-
20
21
  export var SelectableCell = function SelectableCell(_ref) {
21
22
  var children = _ref.children,
22
- _ref$as = _ref.as,
23
- as = _ref$as === void 0 ? 'td' : _ref$as;
23
+ _ref$as = _ref.as,
24
+ as = _ref$as === void 0 ? 'td' : _ref$as;
24
25
  return jsx(BaseCell, {
25
26
  as: as,
26
27
  css: spacingStyles
@@ -1,24 +1,21 @@
1
1
  /* eslint-disable no-unused-vars */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo } from 'react';
5
4
  import { jsx } from '@emotion/react';
6
5
  import ArrowDownIcon from '@atlaskit/icon/glyph/arrow-down';
7
6
  import ArrowUpIcon from '@atlaskit/icon/glyph/arrow-up';
8
7
  import { useTable } from '../hooks/use-table';
8
+
9
9
  /**
10
10
  * __SortIcon__
11
11
  *
12
12
  * SortIcon is used to display the sort state in our SortableColumn.
13
13
  */
14
-
15
14
  export var SortIcon = /*#__PURE__*/memo(function (_ref) {
16
15
  var name = _ref.name;
17
-
18
16
  var _useTable = useTable(),
19
- sortKey = _useTable.sortKey,
20
- sortDirection = _useTable.sortDirection;
21
-
17
+ sortKey = _useTable.sortKey,
18
+ sortDirection = _useTable.sortDirection;
22
19
  if (sortKey === name) {
23
20
  switch (sortDirection) {
24
21
  case 'ascending':
@@ -27,7 +24,6 @@ export var SortIcon = /*#__PURE__*/memo(function (_ref) {
27
24
  label: "",
28
25
  primaryColor: "inherit"
29
26
  });
30
-
31
27
  case 'descending':
32
28
  return jsx(ArrowDownIcon, {
33
29
  size: "small",
@@ -36,6 +32,5 @@ export var SortIcon = /*#__PURE__*/memo(function (_ref) {
36
32
  });
37
33
  }
38
34
  }
39
-
40
35
  return null;
41
36
  });
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
- import { jsx } from '@emotion/react';
3
2
 
3
+ import { jsx } from '@emotion/react';
4
4
  /**
5
5
  * __Table__
6
6
  *
@@ -13,8 +13,8 @@ import { jsx } from '@emotion/react';
13
13
  */
14
14
  export var Table = function Table(_ref) {
15
15
  var children = _ref.children,
16
- testId = _ref.testId,
17
- summary = _ref.summary;
16
+ testId = _ref.testId,
17
+ summary = _ref.summary;
18
18
  return jsx("table", {
19
19
  "data-testid": testId
20
20
  }, summary && jsx("caption", null, summary), children);
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @repo/internal/react/no-clone-element */
2
-
3
2
  /** @jsx jsx */
3
+
4
4
  import { css, jsx } from '@emotion/react';
5
5
  var bodyStyles = css({
6
6
  position: 'relative',
@@ -13,11 +13,11 @@ var bodyStyles = css({
13
13
  pointerEvents: 'none'
14
14
  }
15
15
  });
16
+
16
17
  /**
17
18
  * __TBody__
18
19
  * @primitive
19
20
  */
20
-
21
21
  export var TBody = function TBody(_ref) {
22
22
  var children = _ref.children;
23
23
  return jsx("tbody", {
package/dist/esm/ui/td.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["testId"];
4
-
5
4
  /** @jsx jsx */
5
+
6
6
  import { jsx } from '@emotion/react';
7
7
  import { BaseCell } from './base-cell';
8
+
8
9
  /**
9
10
  * __Cell__
10
11
  *
@@ -12,12 +13,11 @@ import { BaseCell } from './base-cell';
12
13
  *
13
14
  * @primitive
14
15
  */
15
-
16
16
  export var TD = function TD(_ref) {
17
17
  var testId = _ref.testId,
18
- props = _objectWithoutProperties(_ref, _excluded);
19
-
20
- return (// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
18
+ props = _objectWithoutProperties(_ref, _excluded);
19
+ return (
20
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
21
21
  jsx(BaseCell, _extends({
22
22
  as: "td",
23
23
  testId: testId
package/dist/esm/ui/th.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { BaseCell } from './base-cell';
3
-
4
3
  /**
5
4
  * __Head cell__
6
5
  *
@@ -10,11 +9,11 @@ import { BaseCell } from './base-cell';
10
9
  */
11
10
  export var TH = function TH(_ref) {
12
11
  var children = _ref.children,
13
- testId = _ref.testId,
14
- align = _ref.align,
15
- scope = _ref.scope,
16
- backgroundColor = _ref.backgroundColor,
17
- width = _ref.width;
12
+ testId = _ref.testId,
13
+ align = _ref.align,
14
+ scope = _ref.scope,
15
+ backgroundColor = _ref.backgroundColor,
16
+ width = _ref.width;
18
17
  return (
19
18
  /*#__PURE__*/
20
19
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
@@ -1,4 +1,5 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
3
4
  var baseStyles = css({
4
5
  position: 'sticky',
@@ -9,6 +10,7 @@ var baseStyles = css({
9
10
  borderTop: '2px solid transparent',
10
11
  inset: 0
11
12
  });
13
+
12
14
  /**
13
15
  * __THead__
14
16
  *
@@ -16,7 +18,6 @@ var baseStyles = css({
16
18
  *
17
19
  * @primitive
18
20
  */
19
-
20
21
  export var THead = function THead(_ref) {
21
22
  var children = _ref.children;
22
23
  return jsx("thead", {
package/dist/esm/ui/tr.js CHANGED
@@ -1,4 +1,5 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import FocusRing from '@atlaskit/focus-ring';
4
5
  var baseStyles = css({
@@ -12,9 +13,9 @@ var selectedStyles = css({
12
13
  backgroundColor: "var(--ds-background-selected, #DEEBFF88)",
13
14
  '&:hover': {
14
15
  backgroundColor: "var(--ds-background-selected-hovered, #DEEBFF)" // B50
15
-
16
16
  }
17
17
  });
18
+
18
19
  var bodyRowStyles = css({
19
20
  borderBottom: "1px solid ".concat("var(--ds-border, #eee)"),
20
21
  '&:hover': {
@@ -24,7 +25,6 @@ var bodyRowStyles = css({
24
25
  boxShadow: 'none'
25
26
  }
26
27
  });
27
-
28
28
  /**
29
29
  * __Row__
30
30
  *
@@ -34,10 +34,10 @@ var bodyRowStyles = css({
34
34
  */
35
35
  export var TR = function TR(_ref) {
36
36
  var children = _ref.children,
37
- testId = _ref.testId,
38
- isSelected = _ref.isSelected,
39
- _ref$isBodyRow = _ref.isBodyRow,
40
- isBodyRow = _ref$isBodyRow === void 0 ? true : _ref$isBodyRow;
37
+ testId = _ref.testId,
38
+ isSelected = _ref.isSelected,
39
+ _ref$isBodyRow = _ref.isBodyRow,
40
+ isBodyRow = _ref$isBodyRow === void 0 ? true : _ref$isBodyRow;
41
41
  return jsx(FocusRing, {
42
42
  isInset: true
43
43
  }, jsx("tr", {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/table",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/table",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "A table is used to display data.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/ds-lib": "^2.1.2",
39
39
  "@atlaskit/focus-ring": "^1.2.1",
40
40
  "@atlaskit/icon": "^21.11.2",
41
- "@atlaskit/tokens": "^0.13.0",
41
+ "@atlaskit/tokens": "^1.0.0",
42
42
  "@atlaskit/tooltip": "^17.5.16",
43
43
  "@atlaskit/visually-hidden": "^1.0.0",
44
44
  "@babel/runtime": "^7.0.0",