@instructure/ui-table 10.16.1-pr-snapshot-1744893671793 → 10.16.1-snapshot-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 +1 -1
- package/es/Table/Body/index.js +21 -23
- package/es/Table/Cell/index.js +5 -7
- package/es/Table/ColHeader/index.js +14 -18
- package/es/Table/Head/index.js +29 -35
- package/es/Table/Row/index.js +17 -19
- package/es/Table/RowHeader/index.js +5 -7
- package/es/Table/__new-tests__/Table.test.js +53 -170
- package/es/Table/index.js +19 -26
- package/lib/Table/Body/index.js +20 -22
- package/lib/Table/Cell/index.js +4 -6
- package/lib/Table/ColHeader/index.js +14 -17
- package/lib/Table/Head/index.js +28 -34
- package/lib/Table/Row/index.js +16 -18
- package/lib/Table/RowHeader/index.js +4 -6
- package/lib/Table/__new-tests__/Table.test.js +54 -170
- package/lib/Table/index.js +18 -25
- package/package.json +17 -17
- package/src/Table/Body/index.tsx +2 -1
- package/src/Table/Cell/index.tsx +2 -1
- package/src/Table/ColHeader/index.tsx +3 -2
- package/src/Table/ColHeader/props.ts +1 -1
- package/src/Table/Head/index.tsx +2 -1
- package/src/Table/README.md +2 -2
- package/src/Table/Row/index.tsx +2 -1
- package/src/Table/RowHeader/index.tsx +2 -1
- package/src/Table/__new-tests__/Table.test.tsx +5 -5
- package/src/Table/index.tsx +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Table/Body/index.d.ts +3 -1
- package/types/Table/Body/index.d.ts.map +1 -1
- package/types/Table/Cell/index.d.ts +3 -1
- package/types/Table/Cell/index.d.ts.map +1 -1
- package/types/Table/ColHeader/index.d.ts +5 -3
- package/types/Table/ColHeader/index.d.ts.map +1 -1
- package/types/Table/ColHeader/props.d.ts +1 -1
- package/types/Table/ColHeader/props.d.ts.map +1 -1
- package/types/Table/Head/index.d.ts +4 -2
- package/types/Table/Head/index.d.ts.map +1 -1
- package/types/Table/Row/index.d.ts +3 -1
- package/types/Table/Row/index.d.ts.map +1 -1
- package/types/Table/RowHeader/index.d.ts +3 -1
- package/types/Table/RowHeader/index.d.ts.map +1 -1
- package/types/Table/index.d.ts +3 -1
- package/types/Table/index.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
-
## [10.16.1-
|
6
|
+
## [10.16.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-snapshot-0) (2025-04-15)
|
7
7
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-table
|
9
9
|
|
package/es/Table/Body/index.js
CHANGED
@@ -23,10 +23,11 @@ var _dec, _class, _Body;
|
|
23
23
|
* SOFTWARE.
|
24
24
|
*/
|
25
25
|
|
26
|
+
/** @jsx jsx */
|
26
27
|
import { Component, Children, isValidElement } from 'react';
|
27
28
|
import { safeCloneElement, omitProps } from '@instructure/ui-react-utils';
|
28
29
|
import { View } from '@instructure/ui-view';
|
29
|
-
import { withStyle } from '@instructure/emotion';
|
30
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
30
31
|
import generateStyle from './styles';
|
31
32
|
import generateComponentTheme from './theme';
|
32
33
|
import { allowedProps, propTypes } from './props';
|
@@ -38,7 +39,6 @@ parent: Table
|
|
38
39
|
id: Table.Body
|
39
40
|
---
|
40
41
|
**/
|
41
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
42
42
|
let Body = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_Body = class Body extends Component {
|
43
43
|
componentDidMount() {
|
44
44
|
var _this$props$makeStyle, _this$props;
|
@@ -56,29 +56,27 @@ let Body = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
56
56
|
isStacked = _this$context.isStacked,
|
57
57
|
hover = _this$context.hover,
|
58
58
|
headers = _this$context.headers;
|
59
|
-
return
|
60
|
-
...View.omitViewProps(omitProps(this.props, Body.allowedProps), Body),
|
59
|
+
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Body.allowedProps), Body), {
|
61
60
|
as: isStacked ? 'div' : 'tbody',
|
62
61
|
css: styles === null || styles === void 0 ? void 0 : styles.body,
|
63
|
-
role: isStacked ? 'rowgroup' : void 0
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
});
|
62
|
+
role: isStacked ? 'rowgroup' : void 0
|
63
|
+
}), Children.map(children, child => {
|
64
|
+
if (/*#__PURE__*/isValidElement(child)) {
|
65
|
+
return safeCloneElement(child, {
|
66
|
+
key: child.props.name,
|
67
|
+
// Sent down for compatibility with custom components
|
68
|
+
// TODO DEPRECATED, remove in v11
|
69
|
+
hover,
|
70
|
+
// Sent down for compatibility with custom components
|
71
|
+
// TODO DEPRECATED, remove in v11
|
72
|
+
isStacked,
|
73
|
+
// Sent down for compatibility with custom components
|
74
|
+
// TODO DEPRECATED, remove in v11
|
75
|
+
headers
|
76
|
+
});
|
77
|
+
}
|
78
|
+
return child;
|
79
|
+
}));
|
82
80
|
}
|
83
81
|
}, _Body.displayName = "Body", _Body.componentId = 'Table.Body', _Body.contextType = TableContext, _Body.allowedProps = allowedProps, _Body.propTypes = propTypes, _Body.defaultProps = {
|
84
82
|
children: null
|
package/es/Table/Cell/index.js
CHANGED
@@ -23,10 +23,11 @@ var _dec, _class, _Cell;
|
|
23
23
|
* SOFTWARE.
|
24
24
|
*/
|
25
25
|
|
26
|
+
/** @jsx jsx */
|
26
27
|
import { Component } from 'react';
|
27
28
|
import { omitProps, callRenderProp } from '@instructure/ui-react-utils';
|
28
29
|
import { View } from '@instructure/ui-view';
|
29
|
-
import { withStyle } from '@instructure/emotion';
|
30
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
30
31
|
import generateStyle from './styles';
|
31
32
|
import generateComponentTheme from './theme';
|
32
33
|
import { allowedProps, propTypes } from './props';
|
@@ -38,7 +39,6 @@ parent: Table
|
|
38
39
|
id: Table.Cell
|
39
40
|
---
|
40
41
|
**/
|
41
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
42
42
|
let Cell = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_Cell = class Cell extends Component {
|
43
43
|
componentDidMount() {
|
44
44
|
var _this$props$makeStyle, _this$props;
|
@@ -54,13 +54,11 @@ let Cell = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
54
54
|
styles = _this$props3.styles,
|
55
55
|
header = _this$props3.header;
|
56
56
|
const isStacked = this.context.isStacked;
|
57
|
-
return
|
58
|
-
...View.omitViewProps(omitProps(this.props, Cell.allowedProps), Cell),
|
57
|
+
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Cell.allowedProps), Cell), {
|
59
58
|
as: isStacked ? 'div' : 'td',
|
60
59
|
css: styles === null || styles === void 0 ? void 0 : styles.cell,
|
61
|
-
role: isStacked ? 'cell' : void 0
|
62
|
-
|
63
|
-
});
|
60
|
+
role: isStacked ? 'cell' : void 0
|
61
|
+
}), header && callRenderProp(header), header && ': ', callRenderProp(children));
|
64
62
|
}
|
65
63
|
}, _Cell.displayName = "Cell", _Cell.componentId = 'Table.Cell', _Cell.contextType = TableContext, _Cell.allowedProps = allowedProps, _Cell.propTypes = propTypes, _Cell.defaultProps = {
|
66
64
|
textAlign: 'start',
|
@@ -23,10 +23,11 @@ var _dec, _class, _ColHeader;
|
|
23
23
|
* SOFTWARE.
|
24
24
|
*/
|
25
25
|
|
26
|
-
|
26
|
+
/** @jsx jsx */
|
27
|
+
import React, { Component } from 'react';
|
27
28
|
import { omitProps, callRenderProp } from '@instructure/ui-react-utils';
|
28
29
|
import { IconMiniArrowUpLine, IconMiniArrowDownLine, IconMiniArrowDoubleLine } from '@instructure/ui-icons';
|
29
|
-
import { withStyle } from '@instructure/emotion';
|
30
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
30
31
|
import generateStyle from './styles';
|
31
32
|
import generateComponentTheme from './theme';
|
32
33
|
import { allowedProps, propTypes } from './props';
|
@@ -37,7 +38,6 @@ parent: Table
|
|
37
38
|
id: Table.ColHeader
|
38
39
|
---
|
39
40
|
**/
|
40
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
41
41
|
let ColHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_ColHeader = class ColHeader extends Component {
|
42
42
|
constructor(...args) {
|
43
43
|
super(...args);
|
@@ -64,17 +64,17 @@ let ColHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_
|
|
64
64
|
onRequestSort = _this$props4.onRequestSort,
|
65
65
|
styles = _this$props4.styles;
|
66
66
|
if (sortDirection === 'ascending') {
|
67
|
-
return
|
67
|
+
return jsx(IconMiniArrowUpLine, {
|
68
68
|
css: styles === null || styles === void 0 ? void 0 : styles.sortedIconColor
|
69
69
|
});
|
70
70
|
}
|
71
71
|
if (sortDirection === 'descending') {
|
72
|
-
return
|
72
|
+
return jsx(IconMiniArrowDownLine, {
|
73
73
|
css: styles === null || styles === void 0 ? void 0 : styles.sortedIconColor
|
74
74
|
});
|
75
75
|
}
|
76
76
|
if (onRequestSort) {
|
77
|
-
return
|
77
|
+
return jsx(IconMiniArrowDoubleLine, {
|
78
78
|
css: styles === null || styles === void 0 ? void 0 : styles.unSortedIconColor
|
79
79
|
});
|
80
80
|
}
|
@@ -88,23 +88,19 @@ let ColHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_
|
|
88
88
|
sortDirection = _this$props5.sortDirection,
|
89
89
|
scope = _this$props5.scope,
|
90
90
|
styles = _this$props5.styles;
|
91
|
-
return
|
92
|
-
...omitProps(this.props, ColHeader.allowedProps),
|
91
|
+
return jsx("th", Object.assign({}, omitProps(this.props, ColHeader.allowedProps), {
|
93
92
|
css: styles === null || styles === void 0 ? void 0 : styles.colHeader,
|
94
93
|
style: {
|
95
94
|
width
|
96
95
|
},
|
97
96
|
scope: scope,
|
98
|
-
"aria-sort": sortDirection
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
})
|
106
|
-
}), !onRequestSort && children, !onRequestSort && this.renderSortArrow()]
|
107
|
-
});
|
97
|
+
"aria-sort": sortDirection
|
98
|
+
}), onRequestSort && jsx("button", {
|
99
|
+
onClick: this.handleClick,
|
100
|
+
css: styles === null || styles === void 0 ? void 0 : styles.button
|
101
|
+
}, jsx("div", {
|
102
|
+
css: styles === null || styles === void 0 ? void 0 : styles.buttonContent
|
103
|
+
}, callRenderProp(children), this.renderSortArrow())), !onRequestSort && children, !onRequestSort && this.renderSortArrow());
|
108
104
|
}
|
109
105
|
}, _ColHeader.displayName = "ColHeader", _ColHeader.componentId = 'Table.ColHeader', _ColHeader.allowedProps = allowedProps, _ColHeader.propTypes = propTypes, _ColHeader.defaultProps = {
|
110
106
|
textAlign: 'start',
|
package/es/Table/Head/index.js
CHANGED
@@ -24,13 +24,14 @@ var _dec, _class, _Head, _ScreenReaderContent;
|
|
24
24
|
* SOFTWARE.
|
25
25
|
*/
|
26
26
|
|
27
|
+
/** @jsx jsx */
|
27
28
|
import { Component, Children } from 'react';
|
28
29
|
import { omitProps, callRenderProp } from '@instructure/ui-react-utils';
|
29
30
|
import { SimpleSelect } from '@instructure/ui-simple-select';
|
30
31
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
31
32
|
import { IconCheckLine } from '@instructure/ui-icons';
|
32
33
|
import { warn } from '@instructure/console';
|
33
|
-
import { withStyle } from '@instructure/emotion';
|
34
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
34
35
|
import generateStyle from './styles';
|
35
36
|
import generateComponentTheme from './theme';
|
36
37
|
import { allowedProps, propTypes } from './props';
|
@@ -42,7 +43,6 @@ parent: Table
|
|
42
43
|
id: Table.Head
|
43
44
|
---
|
44
45
|
**/
|
45
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
46
46
|
let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_Head = class Head extends Component {
|
47
47
|
/**
|
48
48
|
* Returns `true` if the first child's children have a `onRequestSort` prop
|
@@ -127,35 +127,31 @@ let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
127
127
|
});
|
128
128
|
}
|
129
129
|
};
|
130
|
-
return
|
131
|
-
role: "rowgroup"
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
children: label
|
154
|
-
}, id))
|
155
|
-
})
|
156
|
-
})
|
130
|
+
return jsx("div", {
|
131
|
+
role: "rowgroup"
|
132
|
+
}, jsx("div", {
|
133
|
+
role: "row"
|
134
|
+
}, jsx("div", {
|
135
|
+
role: "cell",
|
136
|
+
"aria-colspan": count
|
137
|
+
}, jsx(SimpleSelect, {
|
138
|
+
renderLabel: renderSortLabel ? callRenderProp(renderSortLabel) : _ScreenReaderContent || (_ScreenReaderContent = jsx(ScreenReaderContent, null)),
|
139
|
+
renderBeforeInput: selectedOption && IconCheckLine,
|
140
|
+
value: selectedOption,
|
141
|
+
onChange: handleSelect
|
142
|
+
}, options.map(({
|
143
|
+
id,
|
144
|
+
label
|
145
|
+
}) => jsx(SimpleSelect.Option, {
|
146
|
+
id: id,
|
147
|
+
key: id,
|
148
|
+
value: id,
|
149
|
+
renderBeforeLabel: id === selectedOption ? IconCheckLine : () => jsx(IconCheckLine, {
|
150
|
+
style: {
|
151
|
+
color: 'transparent'
|
152
|
+
}
|
157
153
|
})
|
158
|
-
});
|
154
|
+
}, label))))));
|
159
155
|
}
|
160
156
|
render() {
|
161
157
|
const _this$props4 = this.props,
|
@@ -163,11 +159,9 @@ let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
163
159
|
styles = _this$props4.styles;
|
164
160
|
return this.context.isStacked ? this.renderSelect() :
|
165
161
|
// TODO remove 'hover' exclude in v11, its passed down for compatibility with custom components
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
children: children
|
170
|
-
});
|
162
|
+
jsx("thead", Object.assign({}, omitProps(this.props, Head.allowedProps, ['hover']), {
|
163
|
+
css: styles === null || styles === void 0 ? void 0 : styles.head
|
164
|
+
}), children);
|
171
165
|
}
|
172
166
|
}, _Head.displayName = "Head", _Head.componentId = 'Table.Head', _Head.contextType = TableContext, _Head.allowedProps = allowedProps, _Head.propTypes = propTypes, _Head.defaultProps = {
|
173
167
|
children: null
|
package/es/Table/Row/index.js
CHANGED
@@ -23,10 +23,11 @@ var _dec, _class, _Row;
|
|
23
23
|
* SOFTWARE.
|
24
24
|
*/
|
25
25
|
|
26
|
+
/** @jsx jsx */
|
26
27
|
import { Component, Children, isValidElement } from 'react';
|
27
28
|
import { omitProps, safeCloneElement } from '@instructure/ui-react-utils';
|
28
29
|
import { View } from '@instructure/ui-view';
|
29
|
-
import { withStyle } from '@instructure/emotion';
|
30
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
30
31
|
import generateStyle from './styles';
|
31
32
|
import generateComponentTheme from './theme';
|
32
33
|
import { allowedProps, propTypes } from './props';
|
@@ -38,7 +39,6 @@ parent: Table
|
|
38
39
|
id: Table.Row
|
39
40
|
---
|
40
41
|
**/
|
41
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
42
42
|
let Row = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_Row = class Row extends Component {
|
43
43
|
componentDidMount() {
|
44
44
|
var _this$props$makeStyle, _this$props;
|
@@ -60,25 +60,23 @@ let Row = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
60
60
|
styles = _this$props3.styles;
|
61
61
|
const isStacked = this.context.isStacked;
|
62
62
|
const headers = this.context.headers;
|
63
|
-
return
|
64
|
-
...View.omitViewProps(omitProps(this.props, Row.allowedProps), Row),
|
63
|
+
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Row.allowedProps), Row), {
|
65
64
|
as: isStacked ? 'div' : 'tr',
|
66
65
|
css: styles === null || styles === void 0 ? void 0 : styles.row,
|
67
|
-
role: isStacked ? 'row' : void 0
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
});
|
66
|
+
role: isStacked ? 'row' : void 0
|
67
|
+
}), Children.toArray(children).filter(Boolean).map((child, index) => {
|
68
|
+
if (/*#__PURE__*/isValidElement(child)) {
|
69
|
+
return safeCloneElement(child, {
|
70
|
+
key: child.props.name,
|
71
|
+
// Sent down for compatibility with custom components
|
72
|
+
// TODO DEPRECATED, remove in v11
|
73
|
+
isStacked,
|
74
|
+
// used by `Cell` to render its column title in `stacked` layout
|
75
|
+
header: headers && headers[index]
|
76
|
+
});
|
77
|
+
}
|
78
|
+
return child;
|
79
|
+
}));
|
82
80
|
}
|
83
81
|
}, _Row.displayName = "Row", _Row.componentId = 'Table.Row', _Row.contextType = TableContext, _Row.allowedProps = allowedProps, _Row.propTypes = propTypes, _Row.defaultProps = {
|
84
82
|
children: null
|
@@ -23,10 +23,11 @@ var _dec, _class, _RowHeader;
|
|
23
23
|
* SOFTWARE.
|
24
24
|
*/
|
25
25
|
|
26
|
+
/** @jsx jsx */
|
26
27
|
import { Component } from 'react';
|
27
28
|
import { omitProps, callRenderProp } from '@instructure/ui-react-utils';
|
28
29
|
import { View } from '@instructure/ui-view';
|
29
|
-
import { withStyle } from '@instructure/emotion';
|
30
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
30
31
|
import generateStyle from './styles';
|
31
32
|
import generateComponentTheme from './theme';
|
32
33
|
import { allowedProps, propTypes } from './props';
|
@@ -38,7 +39,6 @@ parent: Table
|
|
38
39
|
id: Table.RowHeader
|
39
40
|
---
|
40
41
|
**/
|
41
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
42
42
|
let RowHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_RowHeader = class RowHeader extends Component {
|
43
43
|
componentDidMount() {
|
44
44
|
var _this$props$makeStyle, _this$props;
|
@@ -53,14 +53,12 @@ let RowHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_
|
|
53
53
|
children = _this$props3.children,
|
54
54
|
styles = _this$props3.styles;
|
55
55
|
const isStacked = this.context.isStacked;
|
56
|
-
return
|
57
|
-
...View.omitViewProps(omitProps(this.props, RowHeader.allowedProps), RowHeader),
|
56
|
+
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, RowHeader.allowedProps), RowHeader), {
|
58
57
|
as: isStacked ? 'div' : 'th',
|
59
58
|
css: styles === null || styles === void 0 ? void 0 : styles.rowHeader,
|
60
59
|
scope: "row",
|
61
|
-
role: isStacked ? 'rowheader' : void 0
|
62
|
-
|
63
|
-
});
|
60
|
+
role: isStacked ? 'rowheader' : void 0
|
61
|
+
}), callRenderProp(children));
|
64
62
|
}
|
65
63
|
}, _RowHeader.displayName = "RowHeader", _RowHeader.componentId = 'Table.RowHeader', _RowHeader.contextType = TableContext, _RowHeader.allowedProps = allowedProps, _RowHeader.propTypes = propTypes, _RowHeader.defaultProps = {
|
66
64
|
textAlign: 'start',
|