@atlaskit/table 0.2.1 → 0.2.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 (80) hide show
  1. package/CHANGELOG.md +12 -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 +9 -21
  13. package/dist/cjs/sortable-column.js +33 -44
  14. package/dist/cjs/table.js +8 -22
  15. package/dist/cjs/thead.js +12 -29
  16. package/dist/cjs/ui/base-cell.js +17 -21
  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 +8 -11
  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 +3 -3
  38. package/dist/es2019/sortable-column.js +24 -26
  39. package/dist/es2019/table.js +0 -2
  40. package/dist/es2019/thead.js +5 -8
  41. package/dist/es2019/ui/base-cell.js +5 -4
  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 +4 -3
  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 +8 -10
  62. package/dist/esm/sortable-column.js +33 -36
  63. package/dist/esm/table.js +8 -12
  64. package/dist/esm/thead.js +12 -18
  65. package/dist/esm/ui/base-cell.js +16 -15
  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 +8 -7
  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/dist/types/ui/base-cell.d.ts +7 -1
  77. package/dist/types/ui/th.d.ts +6 -2
  78. package/package.json +9 -6
  79. package/constellation/index/examples.mdx +0 -19
  80. package/constellation/index/props.mdx +0 -17
@@ -1,21 +1,19 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useCallback, useMemo } from 'react';
5
4
  import { jsx } from '@emotion/react';
6
5
  import Checkbox from '@atlaskit/checkbox';
6
+ import VisuallyHidden from '@atlaskit/visually-hidden';
7
7
  import { useSelection } from './hooks/selection-provider';
8
8
  import { useRowId } from './hooks/use-row-id';
9
9
  import * as Primitives from './ui';
10
-
11
10
  var SelectableCell = function SelectableCell() {
12
11
  var _useSelection = useSelection(),
13
- _useSelection2 = _slicedToArray(_useSelection, 2),
14
- _useSelection2$ = _useSelection2[0],
15
- allChecked = _useSelection2$.allChecked,
16
- checked = _useSelection2$.checked,
17
- toggleSelection = _useSelection2[1].toggleSelection;
18
-
12
+ _useSelection2 = _slicedToArray(_useSelection, 2),
13
+ _useSelection2$ = _useSelection2[0],
14
+ allChecked = _useSelection2$.allChecked,
15
+ checked = _useSelection2$.checked,
16
+ toggleSelection = _useSelection2[1].toggleSelection;
19
17
  var idx = useRowId();
20
18
  var isChecked = useMemo(function () {
21
19
  return allChecked || checked.includes(idx);
@@ -27,8 +25,8 @@ var SelectableCell = function SelectableCell() {
27
25
  as: "td"
28
26
  }, jsx(Checkbox, {
29
27
  isChecked: isChecked,
30
- onChange: onChange
28
+ onChange: onChange,
29
+ label: jsx(VisuallyHidden, null, "Select row ", idx + 1)
31
30
  }));
32
31
  };
33
-
34
32
  export default /*#__PURE__*/memo(SelectableCell);
@@ -1,9 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["name", "testId", "onClick", "children"];
4
-
5
4
  /* eslint-disable no-unused-vars */
6
-
7
5
  /** @jsx jsx */
8
6
  import { useCallback } from 'react';
9
7
  import { css, jsx } from '@emotion/react';
@@ -11,7 +9,6 @@ import Button from '@atlaskit/button';
11
9
  import Tooltip from '@atlaskit/tooltip';
12
10
  import { useTable } from './hooks/use-table';
13
11
  import { SortIcon, TH } from './ui';
14
-
15
12
  /**
16
13
  * TODO these need to be i18n supported
17
14
  */
@@ -36,56 +33,56 @@ var overrideStyles = css({
36
33
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
37
34
  paddingInline: "2px !important"
38
35
  });
36
+
39
37
  /**
40
38
  * __SortableColumn__
41
39
  *
42
40
  * SortableColumn is used in place of the default Column when sorting is desired.
43
41
  */
44
-
45
42
  var SortableColumn = function SortableColumn(_ref) {
46
43
  var name = _ref.name,
47
- testId = _ref.testId,
48
- onClick = _ref.onClick,
49
- children = _ref.children,
50
- other = _objectWithoutProperties(_ref, _excluded);
51
-
44
+ testId = _ref.testId,
45
+ onClick = _ref.onClick,
46
+ children = _ref.children,
47
+ other = _objectWithoutProperties(_ref, _excluded);
52
48
  var _useTable = useTable(),
53
- sortKey = _useTable.sortKey,
54
- sortDirection = _useTable.sortDirection,
55
- setSortState = _useTable.setSortState;
56
-
49
+ sortKey = _useTable.sortKey,
50
+ sortDirection = _useTable.sortDirection,
51
+ setSortState = _useTable.setSortState;
57
52
  var getSortMessage = function getSortMessage() {
58
53
  if (sortKey === name) {
59
54
  // TODO: Change message depending on data type (string/number)
60
55
  return sortingMessages[sortDirection || 'unsorted'].string;
61
56
  }
62
-
63
57
  return sortingMessages.unsorted.string;
64
58
  };
65
-
66
- var updateSortState = useCallback( // @ts-expect-error: TODO: Our `name` typing is off; refer to `SortKey`
59
+ var updateSortState = useCallback(
60
+ // @ts-expect-error: TODO: Our `name` typing is off; refer to `SortKey`
67
61
  function () {
68
62
  return setSortState(name);
69
63
  }, [setSortState, name]);
70
- return (// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
71
- jsx(TH, _extends({
72
- testId: testId
73
- }, other), jsx(Tooltip, {
74
- content: getSortMessage(),
75
- position: "top"
76
- }, function (tooltipProps) {
77
- return jsx(Button, _extends({
78
- spacing: "compact",
79
- appearance: "subtle",
80
- iconAfter: jsx(SortIcon, {
81
- name: name
82
- })
83
- }, tooltipProps, {
84
- onClick: updateSortState,
85
- css: overrideStyles
86
- }), children);
87
- }))
88
- );
64
+ return jsx(TH, _extends({
65
+ testId: testId,
66
+ sortDirection: sortKey === name ? sortDirection : 'none'
67
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
68
+ }, other), jsx(Tooltip, {
69
+ content: getSortMessage(),
70
+ position: "top"
71
+ }, function (tooltipProps) {
72
+ return jsx(Button, _extends({
73
+ testId: "".concat(testId, "--button"),
74
+ spacing: "compact",
75
+ appearance: "subtle",
76
+ iconAfter: jsx(SortIcon, {
77
+ name: name
78
+ })
79
+ }, tooltipProps, {
80
+ onClick: updateSortState,
81
+ css: overrideStyles
82
+ // TODO: i18n support for this attr
83
+ ,
84
+ "aria-roledescription": "Column sort button"
85
+ }), children);
86
+ }));
89
87
  };
90
-
91
88
  export default SortableColumn;
package/dist/esm/table.js CHANGED
@@ -5,7 +5,6 @@ import SelectionProvider from './hooks/selection-provider';
5
5
  import { useSorting } from './hooks/use-sorting';
6
6
  import { TableProvider } from './hooks/use-table';
7
7
  import * as Primitives from './ui';
8
-
9
8
  /**
10
9
  * __Table__
11
10
  *
@@ -15,17 +14,15 @@ import * as Primitives from './ui';
15
14
  */
16
15
  function Table(_ref) {
17
16
  var children = _ref.children,
18
- isSelectable = _ref.isSelectable,
19
- _ref$sortKey = _ref.sortKey,
20
- sortKey = _ref$sortKey === void 0 ? 'unset' : _ref$sortKey,
21
- testId = _ref.testId;
22
-
17
+ isSelectable = _ref.isSelectable,
18
+ _ref$sortKey = _ref.sortKey,
19
+ sortKey = _ref$sortKey === void 0 ? 'unset' : _ref$sortKey,
20
+ testId = _ref.testId;
23
21
  var _useSorting = useSorting(sortKey),
24
- localSortKey = _useSorting.sortKey,
25
- sortDirection = _useSorting.sortDirection,
26
- setSortState = _useSorting.setSortState,
27
- sortFn = _useSorting.sortFn;
28
-
22
+ localSortKey = _useSorting.sortKey,
23
+ sortDirection = _useSorting.sortDirection,
24
+ setSortState = _useSorting.setSortState,
25
+ sortFn = _useSorting.sortFn;
29
26
  var tableProviderState = useMemo(function () {
30
27
  return {
31
28
  isSelectable: isSelectable,
@@ -41,5 +38,4 @@ function Table(_ref) {
41
38
  testId: testId
42
39
  }, isSelectable ? jsx(SelectionProvider, null, children) : children));
43
40
  }
44
-
45
41
  export default Table;
package/dist/esm/thead.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
-
3
2
  /** @jsx jsx */
3
+
4
4
  import { jsx } from '@emotion/react';
5
5
  import Checkbox from '@atlaskit/checkbox';
6
6
  import { UNSAFE_Inline as Inline, UNSAFE_Text as Text } from '@atlaskit/ds-explorations';
@@ -8,45 +8,39 @@ import VisuallyHidden from '@atlaskit/visually-hidden';
8
8
  import { useSelection } from './hooks/selection-provider';
9
9
  import { useTable } from './hooks/use-table';
10
10
  import * as Primitives from './ui';
11
-
12
11
  var THead = function THead(_ref) {
13
12
  var actions = _ref.actions,
14
- children = _ref.children;
15
-
13
+ children = _ref.children;
16
14
  var _useTable = useTable(),
17
- isSelectable = _useTable.isSelectable;
18
-
15
+ isSelectable = _useTable.isSelectable;
19
16
  var _useSelection = useSelection(),
20
- _useSelection2 = _slicedToArray(_useSelection, 2),
21
- state = _useSelection2[0],
22
- _useSelection2$ = _useSelection2[1],
23
- setAll = _useSelection2$.setAll,
24
- removeAll = _useSelection2$.removeAll;
25
-
17
+ _useSelection2 = _slicedToArray(_useSelection, 2),
18
+ state = _useSelection2[0],
19
+ _useSelection2$ = _useSelection2[1],
20
+ setAll = _useSelection2$.setAll,
21
+ removeAll = _useSelection2$.removeAll;
26
22
  if (!isSelectable) {
27
23
  return jsx(Primitives.THead, null, jsx(Primitives.TR, {
28
24
  isBodyRow: false
29
25
  }, children));
30
26
  }
31
-
32
27
  var isChecked = state.allChecked || state.anyChecked;
33
28
  return jsx(Primitives.THead, null, jsx(Primitives.TR, {
34
29
  isBodyRow: false
35
30
  }, jsx(Primitives.SelectableCell, {
36
31
  as: "th"
37
32
  }, jsx(Checkbox, {
38
- "aria-labelledby": "select-all",
33
+ label: jsx(VisuallyHidden, {
34
+ id: "select-all"
35
+ }, "Select all rows"),
39
36
  onChange: isChecked ? removeAll : setAll,
40
37
  isChecked: isChecked,
41
38
  isIndeterminate: state.anyChecked && !state.allChecked
42
- }), jsx(VisuallyHidden, {
43
- id: "select-all"
44
- }, "Select all rows")), children, isChecked && jsx(Primitives.BulkActionOverlay, null, jsx(Text, {
39
+ })), children, isChecked && jsx(Primitives.BulkActionOverlay, null, jsx(Text, {
45
40
  color: "color.text",
46
41
  fontWeight: "medium"
47
42
  }, state.checked.length, " selected"), actions && jsx(Inline, {
48
43
  gap: "space.100"
49
44
  }, actions(state.checked)))));
50
45
  };
51
-
52
46
  export default THead;
@@ -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,21 @@ 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,
44
+ sortDirection = _ref.sortDirection;
45
45
  return jsx(Box, {
46
46
  css: baseResetStyles,
47
47
  ref: ref,
@@ -54,7 +54,8 @@ export var BaseCell = /*#__PURE__*/forwardRef(function (_ref, ref) {
54
54
  className: className,
55
55
  UNSAFE_style: width ? {
56
56
  width: width
57
- } : undefined
57
+ } : undefined,
58
+ "aria-sort": sortDirection
58
59
  }, jsx(Inline, {
59
60
  justifyContent: alignMap[align],
60
61
  gap: "space.0"
@@ -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,12 @@ 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,
17
+ sortDirection = _ref.sortDirection;
18
18
  return (
19
19
  /*#__PURE__*/
20
20
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
@@ -24,7 +24,8 @@ export var TH = function TH(_ref) {
24
24
  align: align,
25
25
  scope: scope,
26
26
  width: width,
27
- backgroundColor: backgroundColor
27
+ backgroundColor: backgroundColor,
28
+ sortDirection: sortDirection
28
29
  }, children)
29
30
  );
30
31
  };
@@ -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.3",
4
4
  "sideEffects": false
5
5
  }
@@ -30,6 +30,10 @@ export declare type BaseCellProps = {
30
30
  */
31
31
  children?: ReactNode;
32
32
  } & Pick<BoxProps, 'paddingBlock' | 'paddingInline' | 'backgroundColor' | 'className'>;
33
+ /**
34
+ * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-sort
35
+ */
36
+ export declare type SortDirection = 'ascending' | 'descending' | 'none' | 'other';
33
37
  declare const alignMap: {
34
38
  readonly text: "flexStart";
35
39
  readonly number: "flexEnd";
@@ -70,5 +74,7 @@ export declare const BaseCell: import("react").ForwardRefExoticComponent<{
70
74
  * Content of the cell.
71
75
  */
72
76
  children?: ReactNode;
73
- } & Pick<BoxProps<"div">, "className" | "backgroundColor" | "paddingBlock" | "paddingInline"> & import("react").RefAttributes<HTMLTableCellElement>>;
77
+ } & Pick<BoxProps<"div">, "className" | "backgroundColor" | "paddingBlock" | "paddingInline"> & {
78
+ sortDirection?: SortDirection | undefined;
79
+ } & import("react").RefAttributes<HTMLTableCellElement>>;
74
80
  export {};
@@ -1,6 +1,9 @@
1
1
  import { FC } from 'react';
2
- import { BaseCellProps } from './base-cell';
2
+ import { BaseCellProps, SortDirection } from './base-cell';
3
3
  export declare type THProps = Omit<BaseCellProps, 'as'>;
4
+ declare type InternalTHProps = THProps & {
5
+ sortDirection?: SortDirection;
6
+ };
4
7
  /**
5
8
  * __Head cell__
6
9
  *
@@ -8,4 +11,5 @@ export declare type THProps = Omit<BaseCellProps, 'as'>;
8
11
  *
9
12
  * @primitive
10
13
  */
11
- export declare const TH: FC<THProps>;
14
+ export declare const TH: FC<InternalTHProps>;
15
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/table",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "A table is used to display data.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,8 +38,8 @@
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",
42
- "@atlaskit/tooltip": "^17.5.16",
41
+ "@atlaskit/tokens": "^1.2.0",
42
+ "@atlaskit/tooltip": "^17.7.0",
43
43
  "@atlaskit/visually-hidden": "^1.0.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@emotion/react": "^11.7.1",
@@ -62,6 +62,7 @@
62
62
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
63
63
  "@testing-library/react": "^12.1.5",
64
64
  "@testing-library/react-hooks": "^8.0.1",
65
+ "jest-axe": "^4.0.0",
65
66
  "react-dom": "^16.8.0",
66
67
  "storybook-addon-designs": "^6.3.1",
67
68
  "typescript": "4.5.5",
@@ -81,15 +82,17 @@
81
82
  "analytics": [
82
83
  "analytics-next"
83
84
  ],
85
+ "design-tokens": [
86
+ "color",
87
+ "spacing"
88
+ ],
84
89
  "theming": [
85
- "react-context",
86
- "tokens"
90
+ "react-context"
87
91
  ],
88
92
  "ui-components": [
89
93
  "lite-mode"
90
94
  ],
91
95
  "design-system": "v1",
92
- "design-tokens": "spacing",
93
96
  "deprecation": [
94
97
  "no-deprecated-imports"
95
98
  ],