@atlaskit/table-tree 9.7.1 → 9.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +670 -437
- package/dist/cjs/components/row.js +1 -1
- package/dist/cjs/components/table-tree.js +5 -1
- package/dist/es2019/components/row.js +1 -1
- package/dist/es2019/components/table-tree.js +5 -1
- package/dist/esm/components/row.js +1 -1
- package/dist/esm/components/table-tree.js +5 -1
- package/dist/types/components/cell.d.ts +5 -5
- package/dist/types-ts4.5/components/cell.d.ts +5 -5
- package/extract-react-types/table-tree-row.tsx +15 -15
- package/extract-react-types/table-tree-rows.tsx +2 -2
- package/extract-react-types/table-tree.tsx +23 -14
- package/package.json +12 -11
|
@@ -28,7 +28,7 @@ var treeRowClickableStyles = (0, _react2.css)({
|
|
|
28
28
|
cursor: 'pointer'
|
|
29
29
|
});
|
|
30
30
|
var packageName = "@atlaskit/table-tree";
|
|
31
|
-
var packageVersion = "9.
|
|
31
|
+
var packageVersion = "9.9.0";
|
|
32
32
|
var Row = exports.RowWithoutAnalytics = /*#__PURE__*/function (_Component) {
|
|
33
33
|
(0, _inherits2.default)(Row, _Component);
|
|
34
34
|
var _super = _createSuper(Row);
|
|
@@ -67,6 +67,8 @@ var TableTree = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
67
67
|
value: function render() {
|
|
68
68
|
var _this$props = this.props,
|
|
69
69
|
items = _this$props.items,
|
|
70
|
+
label = _this$props.label,
|
|
71
|
+
referencedLabel = _this$props.referencedLabel,
|
|
70
72
|
shouldExpandOnClick = _this$props.shouldExpandOnClick,
|
|
71
73
|
headers = _this$props.headers,
|
|
72
74
|
columns = _this$props.columns,
|
|
@@ -118,7 +120,9 @@ var TableTree = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
118
120
|
}
|
|
119
121
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
120
122
|
role: "treegrid",
|
|
121
|
-
"aria-readonly": true
|
|
123
|
+
"aria-readonly": true,
|
|
124
|
+
"aria-label": label,
|
|
125
|
+
"aria-labelledby": referencedLabel
|
|
122
126
|
}, heads, rows, this.props.children));
|
|
123
127
|
}
|
|
124
128
|
}]);
|
|
@@ -40,6 +40,8 @@ export default class TableTree extends Component {
|
|
|
40
40
|
render() {
|
|
41
41
|
const {
|
|
42
42
|
items,
|
|
43
|
+
label,
|
|
44
|
+
referencedLabel,
|
|
43
45
|
shouldExpandOnClick,
|
|
44
46
|
headers,
|
|
45
47
|
columns,
|
|
@@ -87,7 +89,9 @@ export default class TableTree extends Component {
|
|
|
87
89
|
}
|
|
88
90
|
}, /*#__PURE__*/React.createElement("div", {
|
|
89
91
|
role: "treegrid",
|
|
90
|
-
"aria-readonly": true
|
|
92
|
+
"aria-readonly": true,
|
|
93
|
+
"aria-label": label,
|
|
94
|
+
"aria-labelledby": referencedLabel
|
|
91
95
|
}, heads, rows, this.props.children));
|
|
92
96
|
}
|
|
93
97
|
}
|
|
@@ -20,7 +20,7 @@ var treeRowClickableStyles = css({
|
|
|
20
20
|
cursor: 'pointer'
|
|
21
21
|
});
|
|
22
22
|
var packageName = "@atlaskit/table-tree";
|
|
23
|
-
var packageVersion = "9.
|
|
23
|
+
var packageVersion = "9.9.0";
|
|
24
24
|
var Row = /*#__PURE__*/function (_Component) {
|
|
25
25
|
_inherits(Row, _Component);
|
|
26
26
|
var _super = _createSuper(Row);
|
|
@@ -58,6 +58,8 @@ var TableTree = /*#__PURE__*/function (_Component) {
|
|
|
58
58
|
value: function render() {
|
|
59
59
|
var _this$props = this.props,
|
|
60
60
|
items = _this$props.items,
|
|
61
|
+
label = _this$props.label,
|
|
62
|
+
referencedLabel = _this$props.referencedLabel,
|
|
61
63
|
shouldExpandOnClick = _this$props.shouldExpandOnClick,
|
|
62
64
|
headers = _this$props.headers,
|
|
63
65
|
columns = _this$props.columns,
|
|
@@ -109,7 +111,9 @@ var TableTree = /*#__PURE__*/function (_Component) {
|
|
|
109
111
|
}
|
|
110
112
|
}, /*#__PURE__*/React.createElement("div", {
|
|
111
113
|
role: "treegrid",
|
|
112
|
-
"aria-readonly": true
|
|
114
|
+
"aria-readonly": true,
|
|
115
|
+
"aria-label": label,
|
|
116
|
+
"aria-labelledby": referencedLabel
|
|
113
117
|
}, heads, rows, this.props.children));
|
|
114
118
|
}
|
|
115
119
|
}]);
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export interface CellProps {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Sets whether the cell contents should wrap or display on a single line and be truncated. For accessibility reasons, wrapping the content is strongly recommended.
|
|
5
5
|
*/
|
|
6
6
|
singleLine?: boolean;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Sets the indent level for the cell. Each indent level adds `25px` to the left padding.
|
|
9
9
|
*/
|
|
10
10
|
indentLevel?: number;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* The width of the header item. Takes a string, or a number representing the width in pixels.
|
|
13
13
|
*/
|
|
14
14
|
width?: number | string;
|
|
15
15
|
/**
|
|
16
|
-
* Class name to apply to cell.
|
|
16
|
+
* Class name to apply to the cell.
|
|
17
17
|
*/
|
|
18
18
|
className?: string;
|
|
19
19
|
/**
|
|
20
|
-
* Children content, used when composing table
|
|
20
|
+
* Children content, used when composing a table tree from internal components
|
|
21
21
|
*/
|
|
22
22
|
children?: ReactNode;
|
|
23
23
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export interface CellProps {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Sets whether the cell contents should wrap or display on a single line and be truncated. For accessibility reasons, wrapping the content is strongly recommended.
|
|
5
5
|
*/
|
|
6
6
|
singleLine?: boolean;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Sets the indent level for the cell. Each indent level adds `25px` to the left padding.
|
|
9
9
|
*/
|
|
10
10
|
indentLevel?: number;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* The width of the header item. Takes a string, or a number representing the width in pixels.
|
|
13
13
|
*/
|
|
14
14
|
width?: number | string;
|
|
15
15
|
/**
|
|
16
|
-
* Class name to apply to cell.
|
|
16
|
+
* Class name to apply to the cell.
|
|
17
17
|
*/
|
|
18
18
|
className?: string;
|
|
19
19
|
/**
|
|
20
|
-
* Children content, used when composing table
|
|
20
|
+
* Children content, used when composing a table tree from internal components
|
|
21
21
|
*/
|
|
22
22
|
children?: ReactNode;
|
|
23
23
|
}
|
|
@@ -16,7 +16,7 @@ type RowProps = {
|
|
|
16
16
|
*/
|
|
17
17
|
hasChildren?: boolean;
|
|
18
18
|
/**
|
|
19
|
-
* Children contained in the row. Should be one or more
|
|
19
|
+
* Children contained in the row. Should be one or more cell components.
|
|
20
20
|
*/
|
|
21
21
|
children?: React.ReactNode;
|
|
22
22
|
/**
|
|
@@ -41,49 +41,49 @@ type RowProps = {
|
|
|
41
41
|
*/
|
|
42
42
|
isDefaultExpanded?: ReactNode;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* This is the accessible name for the expand chevron button, used to tell assistive technology what the button is for.
|
|
45
45
|
*/
|
|
46
46
|
expandLabel?: string;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* This is the accessible name for the collapse chevron button, used to tell assistive technology what the button is for.
|
|
49
49
|
*/
|
|
50
50
|
collapseLabel?: string;
|
|
51
51
|
/**
|
|
52
|
-
* Callback called when row collapses.
|
|
52
|
+
* Callback called when the row collapses.
|
|
53
53
|
*/
|
|
54
54
|
onCollapse?: (data: Item) => void;
|
|
55
55
|
/**
|
|
56
|
-
* Callback called when row expands.
|
|
56
|
+
* Callback called when the row expands.
|
|
57
57
|
*/
|
|
58
58
|
onExpand?: (data: Item) => void;
|
|
59
59
|
/**
|
|
60
|
-
* Children to render under row.
|
|
61
|
-
*
|
|
60
|
+
* Children to render under the row.
|
|
61
|
+
* This is normally set by the parent item component, and doesn't need to be configured.
|
|
62
62
|
*/
|
|
63
63
|
renderChildren?: () => React.ReactNode;
|
|
64
64
|
/**
|
|
65
|
-
|
|
65
|
+
Use this to set whether a row with children should expand when clicked anywhere within the row. If `false` or unset, a row with children will only expand when the chevron is clicked.
|
|
66
66
|
|
|
67
|
-
If your cells contain interactive elements, this
|
|
67
|
+
If your cells contain interactive elements, always set this to `false` to avoid unexpected expanding or collapsing.
|
|
68
68
|
*/
|
|
69
69
|
shouldExpandOnClick?: boolean;
|
|
70
70
|
/**
|
|
71
|
-
* Data to render. Passed down by
|
|
72
|
-
*
|
|
71
|
+
* Data to render. Passed down by `item` and passed into `onExpand` and `onCollapse` callbacks.
|
|
72
|
+
* This is normally set by the parent `item` component, and doesn't need to be configured.
|
|
73
73
|
*/
|
|
74
74
|
// eslint-disable-next-line @repo/internal/react/consistent-props-definitions
|
|
75
75
|
data?: Item;
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
77
|
+
* The depth used for rendering an indent.
|
|
78
|
+
* This is normally set by parent `item` component, and doesn't need to be configured.
|
|
79
79
|
*/
|
|
80
80
|
depth?: number;
|
|
81
81
|
/**
|
|
82
82
|
Adds detail to the expand and collapse row button's aria label by appending the value from the given column. If you don't set this prop, the aria label will read out "Expand `itemId` row".
|
|
83
83
|
|
|
84
|
-
Should be a string when we pass data via `items` property in
|
|
84
|
+
Should be a string when we pass data via `items` property in the table tree. The value should be one of the property `columns` names in the table tree.
|
|
85
85
|
|
|
86
|
-
Should be a number when we pass data via
|
|
86
|
+
Should be a number when we pass data via the `Rows` component as children in the table tree.
|
|
87
87
|
*/
|
|
88
88
|
mainColumnForExpandCollapseLabel?: string | number;
|
|
89
89
|
};
|
|
@@ -20,8 +20,8 @@ type RowsProps = {
|
|
|
20
20
|
items?: Item[] | null;
|
|
21
21
|
/* eslint-enable jsdoc/require-asterisk-prefix, jsdoc/check-alignment */
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* This is an accessible name for the loading state's spinner.
|
|
24
|
+
* The default text is "Loading".
|
|
25
25
|
*/
|
|
26
26
|
loadingLabel?: string | null;
|
|
27
27
|
/**
|
|
@@ -18,9 +18,9 @@ export type Item = {
|
|
|
18
18
|
*/
|
|
19
19
|
type TableTreeProps = {
|
|
20
20
|
/**
|
|
21
|
-
* The contents of the table
|
|
22
|
-
*
|
|
23
|
-
* For basic usage,
|
|
21
|
+
* The contents of the table.
|
|
22
|
+
* Use this when composing `Cell`, `Header`, `Headers`, `Row`, and `Rows` components.
|
|
23
|
+
* For basic usage, it's simpler to specify table contents with the `items` prop instead.
|
|
24
24
|
*/
|
|
25
25
|
children?: ReactNode;
|
|
26
26
|
/**
|
|
@@ -29,38 +29,47 @@ type TableTreeProps = {
|
|
|
29
29
|
*/
|
|
30
30
|
columns?: ElementType<Content>[];
|
|
31
31
|
/**
|
|
32
|
-
* The widths of the
|
|
32
|
+
* The widths of the columns in the table.
|
|
33
33
|
*/
|
|
34
34
|
columnWidths?: (string | number)[];
|
|
35
35
|
/**
|
|
36
|
-
* The header text of the
|
|
36
|
+
* The header text of the columns of the table.
|
|
37
37
|
*/
|
|
38
38
|
headers?: string[];
|
|
39
39
|
/* eslint-disable jsdoc/require-asterisk-prefix, jsdoc/check-alignment */
|
|
40
40
|
/**
|
|
41
|
-
|
|
41
|
+
Use this to set whether a row with children should expand when clicked anywhere within the row. If `false` or unset, a row with children will only expand when the chevron is clicked.
|
|
42
42
|
|
|
43
|
-
If your cells contain interactive elements, this
|
|
43
|
+
If your cells contain interactive elements, always set this to `false` to avoid unexpected expanding or collapsing.
|
|
44
44
|
|
|
45
|
-
If
|
|
45
|
+
If you aren’t using the `items` prop, `shouldExpandOnClick` should be used on the row component instead.
|
|
46
46
|
*/
|
|
47
47
|
shouldExpandOnClick?: boolean;
|
|
48
48
|
/**
|
|
49
|
-
The data used to render the table.
|
|
49
|
+
The data used to render the table. If you’re creating a basic table, use this prop instead of composing cell, header, headers, row, and rows components.
|
|
50
50
|
|
|
51
|
-
In addition to
|
|
51
|
+
In addition to the `items` props, any other data can be added, and it will
|
|
52
52
|
be provided as props when rendering each cell.
|
|
53
53
|
*/
|
|
54
54
|
// eslint-disable-next-line @repo/internal/react/consistent-props-definitions
|
|
55
55
|
items?: Item[] | null;
|
|
56
56
|
/* eslint-enable jsdoc/require-asterisk-prefix, jsdoc/check-alignment */
|
|
57
57
|
/**
|
|
58
|
-
* The value used to extend the expand or collapse button label in cases where `
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* Should be a number when we pass data via `<Rows />` component as children in `<TableTree />`.
|
|
58
|
+
* The value used to extend the expand or collapse button label in cases where `row` has child rows.
|
|
59
|
+
* It should be a string when we pass data via the `items` property, the value should be one of the `columns` names.
|
|
60
|
+
* It should be a number when we pass data via the `rows` component as children in the table tree.
|
|
62
61
|
*/
|
|
63
62
|
mainColumnForExpandCollapseLabel?: string | number;
|
|
63
|
+
/**
|
|
64
|
+
* This is an `aria-label` attribute. Use the label to describe the table for assistive technologies.
|
|
65
|
+
* Usage of either this, or the `labelId` attribute is strongly recommended.
|
|
66
|
+
*/
|
|
67
|
+
label?: string;
|
|
68
|
+
/**
|
|
69
|
+
* This is an `aria-labelledby` attribute. Pass an ID for the element which should define an accessible name for the table.
|
|
70
|
+
* Usage of either this, or the `label` attribute is strongly recommended.
|
|
71
|
+
*/
|
|
72
|
+
referencedLabel?: string;
|
|
64
73
|
};
|
|
65
74
|
|
|
66
75
|
export default function (props: TableTreeProps) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/table-tree",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.9.0",
|
|
4
4
|
"description": "A table tree is an expandable table for showing nested hierarchies of information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -23,29 +23,30 @@
|
|
|
23
23
|
"website": {
|
|
24
24
|
"name": "Table tree",
|
|
25
25
|
"category": "Components"
|
|
26
|
-
}
|
|
26
|
+
},
|
|
27
|
+
"runReact18": true
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@atlaskit/analytics-next": "^9.
|
|
30
|
-
"@atlaskit/button": "^17.
|
|
31
|
-
"@atlaskit/icon": "^22.
|
|
32
|
-
"@atlaskit/spinner": "^16.
|
|
33
|
-
"@atlaskit/theme": "^12.
|
|
34
|
-
"@atlaskit/tokens": "^1.
|
|
30
|
+
"@atlaskit/analytics-next": "^9.3.0",
|
|
31
|
+
"@atlaskit/button": "^17.14.0",
|
|
32
|
+
"@atlaskit/icon": "^22.2.0",
|
|
33
|
+
"@atlaskit/spinner": "^16.1.0",
|
|
34
|
+
"@atlaskit/theme": "^12.8.0",
|
|
35
|
+
"@atlaskit/tokens": "^1.48.0",
|
|
35
36
|
"@babel/runtime": "^7.0.0",
|
|
36
37
|
"@emotion/react": "^11.7.1",
|
|
37
38
|
"lodash": "^4.17.21"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
|
-
"react": "^16.8.0"
|
|
41
|
+
"react": "^16.8.0 || ^17.0.0 || ~18.2.0"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@af/accessibility-testing": "*",
|
|
44
45
|
"@af/visual-regression": "*",
|
|
45
|
-
"@atlaskit/ds-lib": "^2.
|
|
46
|
+
"@atlaskit/ds-lib": "^2.3.0",
|
|
46
47
|
"@atlaskit/ssr": "*",
|
|
47
48
|
"@atlaskit/visual-regression": "*",
|
|
48
|
-
"@atlaskit/visually-hidden": "^1.
|
|
49
|
+
"@atlaskit/visually-hidden": "^1.3.0",
|
|
49
50
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
50
51
|
"@emotion/styled": "^11.0.0",
|
|
51
52
|
"@testing-library/react": "^12.1.5",
|