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