@atlaskit/table 0.2.2 → 0.2.4
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/selectable-cell.js +3 -1
- package/dist/cjs/sortable-column.js +22 -19
- package/dist/cjs/thead.js +7 -6
- package/dist/cjs/ui/base-cell.js +9 -7
- package/dist/cjs/ui/bulk-action-overlay.js +5 -3
- package/dist/cjs/ui/th.js +4 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/selectable-cell.js +3 -1
- package/dist/es2019/sortable-column.js +20 -17
- package/dist/es2019/thead.js +7 -6
- package/dist/es2019/ui/base-cell.js +9 -7
- package/dist/es2019/ui/bulk-action-overlay.js +4 -3
- package/dist/es2019/ui/th.js +4 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/selectable-cell.js +3 -1
- package/dist/esm/sortable-column.js +22 -19
- package/dist/esm/thead.js +7 -6
- package/dist/esm/ui/base-cell.js +9 -7
- package/dist/esm/ui/bulk-action-overlay.js +4 -3
- package/dist/esm/ui/th.js +4 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/ui/base-cell.d.ts +9 -3
- package/dist/types/ui/th.d.ts +6 -2
- package/package.json +10 -6
- package/report.api.md +2 -2
- package/tmp/api-report-tmp.d.ts +2 -2
- package/constellation/index/examples.mdx +0 -19
- package/constellation/index/props.mdx +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/table
|
|
2
2
|
|
|
3
|
+
## 0.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`cfe48bb7ece`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cfe48bb7ece) - Internal change only. Replace usages of Inline/Stack with stable version from `@atlaskit/primitives`.
|
|
8
|
+
|
|
9
|
+
## 0.2.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`8fb961ffa76`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8fb961ffa76) - [ux] Fixed some accessibility bugs. Now checkboxes in selectable cells are labelled for assistive technology users, sortable columns have their sorting state programmatically associated through the `aria-sort` attribute, and the sort button has an `aria-roledescription` to ensure that assistive technology users are informed that the column headers are sortable in nature.
|
|
14
|
+
|
|
3
15
|
## 0.2.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _checkbox = _interopRequireDefault(require("@atlaskit/checkbox"));
|
|
13
|
+
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
13
14
|
var _selectionProvider = require("./hooks/selection-provider");
|
|
14
15
|
var _useRowId = require("./hooks/use-row-id");
|
|
15
16
|
var Primitives = _interopRequireWildcard(require("./ui"));
|
|
@@ -35,7 +36,8 @@ var SelectableCell = function SelectableCell() {
|
|
|
35
36
|
as: "td"
|
|
36
37
|
}, (0, _react2.jsx)(_checkbox.default, {
|
|
37
38
|
isChecked: isChecked,
|
|
38
|
-
onChange: onChange
|
|
39
|
+
onChange: onChange,
|
|
40
|
+
label: (0, _react2.jsx)(_visuallyHidden.default, null, "Select row ", idx + 1)
|
|
39
41
|
}));
|
|
40
42
|
};
|
|
41
43
|
var _default = /*#__PURE__*/(0, _react.memo)(SelectableCell);
|
|
@@ -66,26 +66,29 @@ var SortableColumn = function SortableColumn(_ref) {
|
|
|
66
66
|
function () {
|
|
67
67
|
return setSortState(name);
|
|
68
68
|
}, [setSortState, name]);
|
|
69
|
-
return (
|
|
69
|
+
return (0, _react2.jsx)(_ui.TH, (0, _extends2.default)({
|
|
70
|
+
testId: testId,
|
|
71
|
+
sortDirection: sortKey === name ? sortDirection : 'none'
|
|
70
72
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
73
|
+
}, other), (0, _react2.jsx)(_tooltip.default, {
|
|
74
|
+
content: getSortMessage(),
|
|
75
|
+
position: "top"
|
|
76
|
+
}, function (tooltipProps) {
|
|
77
|
+
return (0, _react2.jsx)(_button.default, (0, _extends2.default)({
|
|
78
|
+
testId: "".concat(testId, "--button"),
|
|
79
|
+
spacing: "compact",
|
|
80
|
+
appearance: "subtle",
|
|
81
|
+
iconAfter: (0, _react2.jsx)(_ui.SortIcon, {
|
|
82
|
+
name: name
|
|
83
|
+
})
|
|
84
|
+
}, tooltipProps, {
|
|
85
|
+
onClick: updateSortState,
|
|
86
|
+
css: overrideStyles
|
|
87
|
+
// TODO: i18n support for this attr
|
|
88
|
+
,
|
|
89
|
+
"aria-roledescription": "Column sort button"
|
|
90
|
+
}), children);
|
|
91
|
+
}));
|
|
89
92
|
};
|
|
90
93
|
var _default = SortableColumn;
|
|
91
94
|
exports.default = _default;
|
package/dist/cjs/thead.js
CHANGED
|
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = require("@emotion/react");
|
|
11
11
|
var _checkbox = _interopRequireDefault(require("@atlaskit/checkbox"));
|
|
12
12
|
var _dsExplorations = require("@atlaskit/ds-explorations");
|
|
13
|
+
var _inline = _interopRequireDefault(require("@atlaskit/primitives/inline"));
|
|
13
14
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
14
15
|
var _selectionProvider = require("./hooks/selection-provider");
|
|
15
16
|
var _useTable2 = require("./hooks/use-table");
|
|
@@ -40,17 +41,17 @@ var THead = function THead(_ref) {
|
|
|
40
41
|
}, (0, _react.jsx)(Primitives.SelectableCell, {
|
|
41
42
|
as: "th"
|
|
42
43
|
}, (0, _react.jsx)(_checkbox.default, {
|
|
43
|
-
|
|
44
|
+
label: (0, _react.jsx)(_visuallyHidden.default, {
|
|
45
|
+
id: "select-all"
|
|
46
|
+
}, "Select all rows"),
|
|
44
47
|
onChange: isChecked ? removeAll : setAll,
|
|
45
48
|
isChecked: isChecked,
|
|
46
49
|
isIndeterminate: state.anyChecked && !state.allChecked
|
|
47
|
-
}), (0, _react.jsx)(
|
|
48
|
-
id: "select-all"
|
|
49
|
-
}, "Select all rows")), children, isChecked && (0, _react.jsx)(Primitives.BulkActionOverlay, null, (0, _react.jsx)(_dsExplorations.UNSAFE_Text, {
|
|
50
|
+
})), children, isChecked && (0, _react.jsx)(Primitives.BulkActionOverlay, null, (0, _react.jsx)(_dsExplorations.UNSAFE_Text, {
|
|
50
51
|
color: "color.text",
|
|
51
52
|
fontWeight: "medium"
|
|
52
|
-
}, state.checked.length, " selected"), actions && (0, _react.jsx)(
|
|
53
|
-
|
|
53
|
+
}, state.checked.length, " selected"), actions && (0, _react.jsx)(_inline.default, {
|
|
54
|
+
space: "100"
|
|
54
55
|
}, actions(state.checked)))));
|
|
55
56
|
};
|
|
56
57
|
var _default = THead;
|
package/dist/cjs/ui/base-cell.js
CHANGED
|
@@ -8,13 +8,13 @@ exports.BaseCell = void 0;
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _react2 = require("@emotion/react");
|
|
10
10
|
var _box = _interopRequireDefault(require("@atlaskit/ds-explorations/box"));
|
|
11
|
-
var _inline = _interopRequireDefault(require("@atlaskit/
|
|
11
|
+
var _inline = _interopRequireDefault(require("@atlaskit/primitives/inline"));
|
|
12
12
|
/* eslint-disable @atlassian/tangerine/import/entry-points */
|
|
13
13
|
/** @jsx jsx */
|
|
14
14
|
|
|
15
15
|
var alignMap = {
|
|
16
|
-
text: '
|
|
17
|
-
number: '
|
|
16
|
+
text: 'start',
|
|
17
|
+
number: 'end',
|
|
18
18
|
icon: 'center'
|
|
19
19
|
};
|
|
20
20
|
var baseResetStyles = (0, _react2.css)({
|
|
@@ -48,7 +48,8 @@ var BaseCell = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
48
48
|
backgroundColor = _ref.backgroundColor,
|
|
49
49
|
scope = _ref.scope,
|
|
50
50
|
width = _ref.width,
|
|
51
|
-
className = _ref.className
|
|
51
|
+
className = _ref.className,
|
|
52
|
+
sortDirection = _ref.sortDirection;
|
|
52
53
|
return (0, _react2.jsx)(_box.default, {
|
|
53
54
|
css: baseResetStyles,
|
|
54
55
|
ref: ref,
|
|
@@ -61,10 +62,11 @@ var BaseCell = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
61
62
|
className: className,
|
|
62
63
|
UNSAFE_style: width ? {
|
|
63
64
|
width: width
|
|
64
|
-
} : undefined
|
|
65
|
+
} : undefined,
|
|
66
|
+
"aria-sort": sortDirection
|
|
65
67
|
}, (0, _react2.jsx)(_inline.default, {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
alignInline: alignMap[align],
|
|
69
|
+
space: "0"
|
|
68
70
|
}, children));
|
|
69
71
|
});
|
|
70
72
|
exports.BaseCell = BaseCell;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.BulkActionOverlay = void 0;
|
|
7
8
|
var _react = require("@emotion/react");
|
|
8
9
|
var _dsExplorations = require("@atlaskit/ds-explorations");
|
|
10
|
+
var _inline = _interopRequireDefault(require("@atlaskit/primitives/inline"));
|
|
9
11
|
/** @jsx jsx */
|
|
10
12
|
|
|
11
13
|
var overlayStyles = (0, _react.css)({
|
|
@@ -28,9 +30,9 @@ var BulkActionOverlay = function BulkActionOverlay(_ref) {
|
|
|
28
30
|
paddingInline: "space.100",
|
|
29
31
|
backgroundColor: "elevation.surface",
|
|
30
32
|
css: overlayStyles
|
|
31
|
-
}, (0, _react.jsx)(
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
}, (0, _react.jsx)(_inline.default, {
|
|
34
|
+
space: "300",
|
|
35
|
+
alignBlock: "center"
|
|
34
36
|
}, children));
|
|
35
37
|
};
|
|
36
38
|
exports.BulkActionOverlay = BulkActionOverlay;
|
package/dist/cjs/ui/th.js
CHANGED
|
@@ -20,7 +20,8 @@ var TH = function TH(_ref) {
|
|
|
20
20
|
align = _ref.align,
|
|
21
21
|
scope = _ref.scope,
|
|
22
22
|
backgroundColor = _ref.backgroundColor,
|
|
23
|
-
width = _ref.width
|
|
23
|
+
width = _ref.width,
|
|
24
|
+
sortDirection = _ref.sortDirection;
|
|
24
25
|
return (
|
|
25
26
|
/*#__PURE__*/
|
|
26
27
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
@@ -30,7 +31,8 @@ var TH = function TH(_ref) {
|
|
|
30
31
|
align: align,
|
|
31
32
|
scope: scope,
|
|
32
33
|
width: width,
|
|
33
|
-
backgroundColor: backgroundColor
|
|
34
|
+
backgroundColor: backgroundColor,
|
|
35
|
+
sortDirection: sortDirection
|
|
34
36
|
}, children)
|
|
35
37
|
);
|
|
36
38
|
};
|
package/dist/cjs/version.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { memo, useCallback, useMemo } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import Checkbox from '@atlaskit/checkbox';
|
|
5
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
5
6
|
import { useSelection } from './hooks/selection-provider';
|
|
6
7
|
import { useRowId } from './hooks/use-row-id';
|
|
7
8
|
import * as Primitives from './ui';
|
|
@@ -19,7 +20,8 @@ const SelectableCell = () => {
|
|
|
19
20
|
as: "td"
|
|
20
21
|
}, jsx(Checkbox, {
|
|
21
22
|
isChecked: isChecked,
|
|
22
|
-
onChange: onChange
|
|
23
|
+
onChange: onChange,
|
|
24
|
+
label: jsx(VisuallyHidden, null, "Select row ", idx + 1)
|
|
23
25
|
}));
|
|
24
26
|
};
|
|
25
27
|
export default /*#__PURE__*/memo(SelectableCell);
|
|
@@ -59,23 +59,26 @@ const SortableColumn = ({
|
|
|
59
59
|
const updateSortState = useCallback(
|
|
60
60
|
// @ts-expect-error: TODO: Our `name` typing is off; refer to `SortKey`
|
|
61
61
|
() => setSortState(name), [setSortState, name]);
|
|
62
|
-
return (
|
|
62
|
+
return jsx(TH, _extends({
|
|
63
|
+
testId: testId,
|
|
64
|
+
sortDirection: sortKey === name ? sortDirection : 'none'
|
|
63
65
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
}, other), jsx(Tooltip, {
|
|
67
|
+
content: getSortMessage(),
|
|
68
|
+
position: "top"
|
|
69
|
+
}, tooltipProps => jsx(Button, _extends({
|
|
70
|
+
testId: `${testId}--button`,
|
|
71
|
+
spacing: "compact",
|
|
72
|
+
appearance: "subtle",
|
|
73
|
+
iconAfter: jsx(SortIcon, {
|
|
74
|
+
name: name
|
|
75
|
+
})
|
|
76
|
+
}, tooltipProps, {
|
|
77
|
+
onClick: updateSortState,
|
|
78
|
+
css: overrideStyles
|
|
79
|
+
// TODO: i18n support for this attr
|
|
80
|
+
,
|
|
81
|
+
"aria-roledescription": "Column sort button"
|
|
82
|
+
}), children)));
|
|
80
83
|
};
|
|
81
84
|
export default SortableColumn;
|
package/dist/es2019/thead.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import Checkbox from '@atlaskit/checkbox';
|
|
5
|
-
import {
|
|
5
|
+
import { UNSAFE_Text as Text } from '@atlaskit/ds-explorations';
|
|
6
|
+
import Inline from '@atlaskit/primitives/inline';
|
|
6
7
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
7
8
|
import { useSelection } from './hooks/selection-provider';
|
|
8
9
|
import { useTable } from './hooks/use-table';
|
|
@@ -29,17 +30,17 @@ const THead = ({
|
|
|
29
30
|
}, jsx(Primitives.SelectableCell, {
|
|
30
31
|
as: "th"
|
|
31
32
|
}, jsx(Checkbox, {
|
|
32
|
-
|
|
33
|
+
label: jsx(VisuallyHidden, {
|
|
34
|
+
id: "select-all"
|
|
35
|
+
}, "Select all rows"),
|
|
33
36
|
onChange: isChecked ? removeAll : setAll,
|
|
34
37
|
isChecked: isChecked,
|
|
35
38
|
isIndeterminate: state.anyChecked && !state.allChecked
|
|
36
|
-
}), jsx(
|
|
37
|
-
id: "select-all"
|
|
38
|
-
}, "Select all rows")), children, isChecked && jsx(Primitives.BulkActionOverlay, null, jsx(Text, {
|
|
39
|
+
})), children, isChecked && jsx(Primitives.BulkActionOverlay, null, jsx(Text, {
|
|
39
40
|
color: "color.text",
|
|
40
41
|
fontWeight: "medium"
|
|
41
42
|
}, state.checked.length, " selected"), actions && jsx(Inline, {
|
|
42
|
-
|
|
43
|
+
space: "100"
|
|
43
44
|
}, actions(state.checked)))));
|
|
44
45
|
};
|
|
45
46
|
export default THead;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import Box from '@atlaskit/ds-explorations/box';
|
|
6
|
-
import Inline from '@atlaskit/
|
|
6
|
+
import Inline from '@atlaskit/primitives/inline';
|
|
7
7
|
const alignMap = {
|
|
8
|
-
text: '
|
|
9
|
-
number: '
|
|
8
|
+
text: 'start',
|
|
9
|
+
number: 'end',
|
|
10
10
|
icon: 'center'
|
|
11
11
|
};
|
|
12
12
|
const baseResetStyles = css({
|
|
@@ -37,7 +37,8 @@ export const BaseCell = /*#__PURE__*/forwardRef(({
|
|
|
37
37
|
backgroundColor,
|
|
38
38
|
scope,
|
|
39
39
|
width,
|
|
40
|
-
className
|
|
40
|
+
className,
|
|
41
|
+
sortDirection
|
|
41
42
|
}, ref) => jsx(Box, {
|
|
42
43
|
css: baseResetStyles,
|
|
43
44
|
ref: ref,
|
|
@@ -50,8 +51,9 @@ export const BaseCell = /*#__PURE__*/forwardRef(({
|
|
|
50
51
|
className: className,
|
|
51
52
|
UNSAFE_style: width ? {
|
|
52
53
|
width
|
|
53
|
-
} : undefined
|
|
54
|
+
} : undefined,
|
|
55
|
+
"aria-sort": sortDirection
|
|
54
56
|
}, jsx(Inline, {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
alignInline: alignMap[align],
|
|
58
|
+
space: "0"
|
|
57
59
|
}, children)));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import { UNSAFE_Box as Box
|
|
4
|
+
import { UNSAFE_Box as Box } from '@atlaskit/ds-explorations';
|
|
5
|
+
import Inline from '@atlaskit/primitives/inline';
|
|
5
6
|
const overlayStyles = css({
|
|
6
7
|
top: 0,
|
|
7
8
|
right: 0,
|
|
@@ -23,6 +24,6 @@ export const BulkActionOverlay = ({
|
|
|
23
24
|
backgroundColor: "elevation.surface",
|
|
24
25
|
css: overlayStyles
|
|
25
26
|
}, jsx(Inline, {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
space: "300",
|
|
28
|
+
alignBlock: "center"
|
|
28
29
|
}, children));
|
package/dist/es2019/ui/th.js
CHANGED
|
@@ -13,7 +13,8 @@ export const TH = ({
|
|
|
13
13
|
align,
|
|
14
14
|
scope,
|
|
15
15
|
backgroundColor,
|
|
16
|
-
width
|
|
16
|
+
width,
|
|
17
|
+
sortDirection
|
|
17
18
|
}) =>
|
|
18
19
|
/*#__PURE__*/
|
|
19
20
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
@@ -23,5 +24,6 @@ React.createElement(BaseCell, {
|
|
|
23
24
|
align: align,
|
|
24
25
|
scope: scope,
|
|
25
26
|
width: width,
|
|
26
|
-
backgroundColor: backgroundColor
|
|
27
|
+
backgroundColor: backgroundColor,
|
|
28
|
+
sortDirection: sortDirection
|
|
27
29
|
}, children);
|
package/dist/es2019/version.json
CHANGED
|
@@ -3,6 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import { memo, useCallback, useMemo } from 'react';
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import Checkbox from '@atlaskit/checkbox';
|
|
6
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
6
7
|
import { useSelection } from './hooks/selection-provider';
|
|
7
8
|
import { useRowId } from './hooks/use-row-id';
|
|
8
9
|
import * as Primitives from './ui';
|
|
@@ -24,7 +25,8 @@ var SelectableCell = function SelectableCell() {
|
|
|
24
25
|
as: "td"
|
|
25
26
|
}, jsx(Checkbox, {
|
|
26
27
|
isChecked: isChecked,
|
|
27
|
-
onChange: onChange
|
|
28
|
+
onChange: onChange,
|
|
29
|
+
label: jsx(VisuallyHidden, null, "Select row ", idx + 1)
|
|
28
30
|
}));
|
|
29
31
|
};
|
|
30
32
|
export default /*#__PURE__*/memo(SelectableCell);
|
|
@@ -61,25 +61,28 @@ var SortableColumn = function SortableColumn(_ref) {
|
|
|
61
61
|
function () {
|
|
62
62
|
return setSortState(name);
|
|
63
63
|
}, [setSortState, name]);
|
|
64
|
-
return (
|
|
64
|
+
return jsx(TH, _extends({
|
|
65
|
+
testId: testId,
|
|
66
|
+
sortDirection: sortKey === name ? sortDirection : 'none'
|
|
65
67
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
+
}));
|
|
84
87
|
};
|
|
85
88
|
export default SortableColumn;
|
package/dist/esm/thead.js
CHANGED
|
@@ -3,7 +3,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import Checkbox from '@atlaskit/checkbox';
|
|
6
|
-
import {
|
|
6
|
+
import { UNSAFE_Text as Text } from '@atlaskit/ds-explorations';
|
|
7
|
+
import Inline from '@atlaskit/primitives/inline';
|
|
7
8
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
8
9
|
import { useSelection } from './hooks/selection-provider';
|
|
9
10
|
import { useTable } from './hooks/use-table';
|
|
@@ -30,17 +31,17 @@ var THead = function THead(_ref) {
|
|
|
30
31
|
}, jsx(Primitives.SelectableCell, {
|
|
31
32
|
as: "th"
|
|
32
33
|
}, jsx(Checkbox, {
|
|
33
|
-
|
|
34
|
+
label: jsx(VisuallyHidden, {
|
|
35
|
+
id: "select-all"
|
|
36
|
+
}, "Select all rows"),
|
|
34
37
|
onChange: isChecked ? removeAll : setAll,
|
|
35
38
|
isChecked: isChecked,
|
|
36
39
|
isIndeterminate: state.anyChecked && !state.allChecked
|
|
37
|
-
}), jsx(
|
|
38
|
-
id: "select-all"
|
|
39
|
-
}, "Select all rows")), children, isChecked && jsx(Primitives.BulkActionOverlay, null, jsx(Text, {
|
|
40
|
+
})), children, isChecked && jsx(Primitives.BulkActionOverlay, null, jsx(Text, {
|
|
40
41
|
color: "color.text",
|
|
41
42
|
fontWeight: "medium"
|
|
42
43
|
}, state.checked.length, " selected"), actions && jsx(Inline, {
|
|
43
|
-
|
|
44
|
+
space: "100"
|
|
44
45
|
}, actions(state.checked)))));
|
|
45
46
|
};
|
|
46
47
|
export default THead;
|
package/dist/esm/ui/base-cell.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import Box from '@atlaskit/ds-explorations/box';
|
|
6
|
-
import Inline from '@atlaskit/
|
|
6
|
+
import Inline from '@atlaskit/primitives/inline';
|
|
7
7
|
var alignMap = {
|
|
8
|
-
text: '
|
|
9
|
-
number: '
|
|
8
|
+
text: 'start',
|
|
9
|
+
number: 'end',
|
|
10
10
|
icon: 'center'
|
|
11
11
|
};
|
|
12
12
|
var baseResetStyles = css({
|
|
@@ -40,7 +40,8 @@ export var BaseCell = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
40
40
|
backgroundColor = _ref.backgroundColor,
|
|
41
41
|
scope = _ref.scope,
|
|
42
42
|
width = _ref.width,
|
|
43
|
-
className = _ref.className
|
|
43
|
+
className = _ref.className,
|
|
44
|
+
sortDirection = _ref.sortDirection;
|
|
44
45
|
return jsx(Box, {
|
|
45
46
|
css: baseResetStyles,
|
|
46
47
|
ref: ref,
|
|
@@ -53,9 +54,10 @@ export var BaseCell = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
53
54
|
className: className,
|
|
54
55
|
UNSAFE_style: width ? {
|
|
55
56
|
width: width
|
|
56
|
-
} : undefined
|
|
57
|
+
} : undefined,
|
|
58
|
+
"aria-sort": sortDirection
|
|
57
59
|
}, jsx(Inline, {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
alignInline: alignMap[align],
|
|
61
|
+
space: "0"
|
|
60
62
|
}, children));
|
|
61
63
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import { UNSAFE_Box as Box
|
|
4
|
+
import { UNSAFE_Box as Box } from '@atlaskit/ds-explorations';
|
|
5
|
+
import Inline from '@atlaskit/primitives/inline';
|
|
5
6
|
var overlayStyles = css({
|
|
6
7
|
top: 0,
|
|
7
8
|
right: 0,
|
|
@@ -23,7 +24,7 @@ export var BulkActionOverlay = function BulkActionOverlay(_ref) {
|
|
|
23
24
|
backgroundColor: "elevation.surface",
|
|
24
25
|
css: overlayStyles
|
|
25
26
|
}, jsx(Inline, {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
space: "300",
|
|
28
|
+
alignBlock: "center"
|
|
28
29
|
}, children));
|
|
29
30
|
};
|
package/dist/esm/ui/th.js
CHANGED
|
@@ -13,7 +13,8 @@ export var TH = function TH(_ref) {
|
|
|
13
13
|
align = _ref.align,
|
|
14
14
|
scope = _ref.scope,
|
|
15
15
|
backgroundColor = _ref.backgroundColor,
|
|
16
|
-
width = _ref.width
|
|
16
|
+
width = _ref.width,
|
|
17
|
+
sortDirection = _ref.sortDirection;
|
|
17
18
|
return (
|
|
18
19
|
/*#__PURE__*/
|
|
19
20
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
@@ -23,7 +24,8 @@ export var TH = function TH(_ref) {
|
|
|
23
24
|
align: align,
|
|
24
25
|
scope: scope,
|
|
25
26
|
width: width,
|
|
26
|
-
backgroundColor: backgroundColor
|
|
27
|
+
backgroundColor: backgroundColor,
|
|
28
|
+
sortDirection: sortDirection
|
|
27
29
|
}, children)
|
|
28
30
|
);
|
|
29
31
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -30,9 +30,13 @@ 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
|
-
readonly text: "
|
|
35
|
-
readonly number: "
|
|
38
|
+
readonly text: "start";
|
|
39
|
+
readonly number: "end";
|
|
36
40
|
readonly icon: "center";
|
|
37
41
|
};
|
|
38
42
|
/**
|
|
@@ -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.4",
|
|
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,9 @@
|
|
|
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/
|
|
42
|
-
"@atlaskit/
|
|
41
|
+
"@atlaskit/primitives": "^0.3.0",
|
|
42
|
+
"@atlaskit/tokens": "^1.2.0",
|
|
43
|
+
"@atlaskit/tooltip": "^17.7.0",
|
|
43
44
|
"@atlaskit/visually-hidden": "^1.0.0",
|
|
44
45
|
"@babel/runtime": "^7.0.0",
|
|
45
46
|
"@emotion/react": "^11.7.1",
|
|
@@ -62,6 +63,7 @@
|
|
|
62
63
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
63
64
|
"@testing-library/react": "^12.1.5",
|
|
64
65
|
"@testing-library/react-hooks": "^8.0.1",
|
|
66
|
+
"jest-axe": "^4.0.0",
|
|
65
67
|
"react-dom": "^16.8.0",
|
|
66
68
|
"storybook-addon-designs": "^6.3.1",
|
|
67
69
|
"typescript": "4.5.5",
|
|
@@ -81,15 +83,17 @@
|
|
|
81
83
|
"analytics": [
|
|
82
84
|
"analytics-next"
|
|
83
85
|
],
|
|
86
|
+
"design-tokens": [
|
|
87
|
+
"color",
|
|
88
|
+
"spacing"
|
|
89
|
+
],
|
|
84
90
|
"theming": [
|
|
85
|
-
"react-context"
|
|
86
|
-
"tokens"
|
|
91
|
+
"react-context"
|
|
87
92
|
],
|
|
88
93
|
"ui-components": [
|
|
89
94
|
"lite-mode"
|
|
90
95
|
],
|
|
91
96
|
"design-system": "v1",
|
|
92
|
-
"design-tokens": "spacing",
|
|
93
97
|
"deprecation": [
|
|
94
98
|
"no-deprecated-imports"
|
|
95
99
|
],
|
package/report.api.md
CHANGED
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
order: 0
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
import BasicAKTableExample from '../../examples/composed';
|
|
6
|
-
import AKTableExample from '../../examples/basic';
|
|
7
|
-
|
|
8
|
-
## Basic
|
|
9
|
-
|
|
10
|
-
A table is composed of simple composable elements. In its base form these UI elements are purely presentational.
|
|
11
|
-
|
|
12
|
-
<Example Component={BasicAKTableExample} packageName="@atlaskit/table" />
|
|
13
|
-
|
|
14
|
-
## Basic data table
|
|
15
|
-
|
|
16
|
-
A data table is used to display dynamic data.
|
|
17
|
-
|
|
18
|
-
<Example Component={AKTableExample} packageName="@atlaskit/table" />
|
|
19
|
-
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import TableProps from '!!extract-react-types-loader!../../extract-react-types/table.tsx';
|
|
2
|
-
import RowProps from '!!extract-react-types-loader!../../extract-react-types/row.tsx';
|
|
3
|
-
import CellProps from '!!extract-react-types-loader!../../extract-react-types/cell.tsx';
|
|
4
|
-
|
|
5
|
-
## Props
|
|
6
|
-
|
|
7
|
-
### Table props
|
|
8
|
-
|
|
9
|
-
<PropsTable heading="" props={TableProps} />
|
|
10
|
-
|
|
11
|
-
### Row props
|
|
12
|
-
|
|
13
|
-
<PropsTable heading="Row props" props={RowProps} />
|
|
14
|
-
|
|
15
|
-
### Cell props
|
|
16
|
-
|
|
17
|
-
<PropsTable heading="Cell props" props={CellProps} />
|