@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.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/body.js +16 -35
- package/dist/cjs/head-cell.js +5 -11
- package/dist/cjs/hooks/selection-provider.js +1 -9
- package/dist/cjs/hooks/use-row-id.js +2 -5
- package/dist/cjs/hooks/use-selectable.js +13 -29
- package/dist/cjs/hooks/use-sorting.js +6 -17
- package/dist/cjs/hooks/use-table-body.js +1 -7
- package/dist/cjs/hooks/use-table.js +4 -13
- package/dist/cjs/index.js +0 -8
- package/dist/cjs/row.js +8 -25
- package/dist/cjs/selectable-cell.js +9 -21
- package/dist/cjs/sortable-column.js +33 -44
- package/dist/cjs/table.js +8 -22
- package/dist/cjs/thead.js +12 -29
- package/dist/cjs/ui/base-cell.js +17 -21
- package/dist/cjs/ui/bulk-action-overlay.js +2 -5
- package/dist/cjs/ui/index.js +0 -9
- package/dist/cjs/ui/selectable-cell.js +4 -7
- package/dist/cjs/ui/sort-icon.js +2 -14
- package/dist/cjs/ui/table.js +2 -5
- package/dist/cjs/ui/tbody.js +2 -5
- package/dist/cjs/ui/td.js +3 -10
- package/dist/cjs/ui/th.js +8 -11
- package/dist/cjs/ui/thead.js +2 -4
- package/dist/cjs/ui/tr.js +6 -11
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/body.js +11 -8
- package/dist/es2019/head-cell.js +2 -3
- package/dist/es2019/hooks/selection-provider.js +1 -2
- package/dist/es2019/hooks/use-row-id.js +2 -2
- package/dist/es2019/hooks/use-selectable.js +4 -13
- package/dist/es2019/hooks/use-sorting.js +0 -4
- package/dist/es2019/hooks/use-table-body.js +1 -1
- package/dist/es2019/hooks/use-table.js +3 -4
- package/dist/es2019/row.js +2 -4
- package/dist/es2019/selectable-cell.js +3 -3
- package/dist/es2019/sortable-column.js +24 -26
- package/dist/es2019/table.js +0 -2
- package/dist/es2019/thead.js +5 -8
- package/dist/es2019/ui/base-cell.js +5 -4
- package/dist/es2019/ui/bulk-action-overlay.js +2 -1
- package/dist/es2019/ui/selectable-cell.js +2 -1
- package/dist/es2019/ui/sort-icon.js +1 -5
- package/dist/es2019/ui/table.js +1 -1
- package/dist/es2019/ui/tbody.js +2 -2
- package/dist/es2019/ui/td.js +4 -3
- package/dist/es2019/ui/th.js +4 -3
- package/dist/es2019/ui/thead.js +2 -1
- package/dist/es2019/ui/tr.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/body.js +16 -21
- package/dist/esm/head-cell.js +7 -8
- package/dist/esm/hooks/selection-provider.js +1 -2
- package/dist/esm/hooks/use-row-id.js +2 -2
- package/dist/esm/hooks/use-selectable.js +13 -25
- package/dist/esm/hooks/use-sorting.js +6 -12
- package/dist/esm/hooks/use-table-body.js +1 -1
- package/dist/esm/hooks/use-table.js +4 -5
- package/dist/esm/row.js +8 -13
- package/dist/esm/selectable-cell.js +8 -10
- package/dist/esm/sortable-column.js +33 -36
- package/dist/esm/table.js +8 -12
- package/dist/esm/thead.js +12 -18
- package/dist/esm/ui/base-cell.js +16 -15
- package/dist/esm/ui/bulk-action-overlay.js +2 -1
- package/dist/esm/ui/selectable-cell.js +4 -3
- package/dist/esm/ui/sort-icon.js +3 -8
- package/dist/esm/ui/table.js +3 -3
- package/dist/esm/ui/tbody.js +2 -2
- package/dist/esm/ui/td.js +5 -5
- package/dist/esm/ui/th.js +8 -7
- package/dist/esm/ui/thead.js +2 -1
- package/dist/esm/ui/tr.js +6 -6
- package/dist/esm/version.json +1 -1
- package/dist/types/ui/base-cell.d.ts +7 -1
- package/dist/types/ui/th.d.ts +6 -2
- package/package.json +9 -6
- package/constellation/index/examples.mdx +0 -19
- 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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
testId = _ref.testId,
|
|
45
|
+
onClick = _ref.onClick,
|
|
46
|
+
children = _ref.children,
|
|
47
|
+
other = _objectWithoutProperties(_ref, _excluded);
|
|
52
48
|
var _useTable = useTable(),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
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 (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
15
|
-
|
|
13
|
+
children = _ref.children;
|
|
16
14
|
var _useTable = useTable(),
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
isSelectable = _useTable.isSelectable;
|
|
19
16
|
var _useSelection = useSelection(),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
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(
|
|
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;
|
package/dist/esm/ui/base-cell.js
CHANGED
|
@@ -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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
23
|
-
|
|
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
|
package/dist/esm/ui/sort-icon.js
CHANGED
|
@@ -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
|
-
|
|
20
|
-
|
|
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
|
});
|
package/dist/esm/ui/table.js
CHANGED
|
@@ -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
|
-
|
|
17
|
-
|
|
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);
|
package/dist/esm/ui/tbody.js
CHANGED
|
@@ -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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
};
|
package/dist/esm/ui/thead.js
CHANGED
|
@@ -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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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", {
|
package/dist/esm/version.json
CHANGED
|
@@ -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"> &
|
|
77
|
+
} & Pick<BoxProps<"div">, "className" | "backgroundColor" | "paddingBlock" | "paddingInline"> & {
|
|
78
|
+
sortDirection?: SortDirection | undefined;
|
|
79
|
+
} & import("react").RefAttributes<HTMLTableCellElement>>;
|
|
74
80
|
export {};
|
package/dist/types/ui/th.d.ts
CHANGED
|
@@ -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<
|
|
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.
|
|
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": "^
|
|
42
|
-
"@atlaskit/tooltip": "^17.
|
|
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
|
],
|