@instructure/ui-table 8.9.2-snapshot.3 → 8.10.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 +4 -0
- package/es/Table/Body/index.js +1 -1
- package/es/Table/Cell/index.js +1 -1
- package/es/Table/ColHeader/index.js +1 -1
- package/es/Table/Head/index.js +1 -1
- package/es/Table/Row/index.js +1 -1
- package/es/Table/RowHeader/index.js +1 -1
- package/es/Table/index.js +1 -1
- package/lib/Table/Body/index.js +1 -1
- package/lib/Table/Cell/index.js +1 -1
- package/lib/Table/ColHeader/index.js +1 -1
- package/lib/Table/Head/index.js +1 -1
- package/lib/Table/Row/index.js +1 -1
- package/lib/Table/RowHeader/index.js +1 -1
- package/lib/Table/index.js +1 -1
- package/package.json +17 -18
- package/src/Table/Body/index.tsx +1 -1
- package/src/Table/Body/props.ts +7 -4
- package/src/Table/Body/styles.ts +3 -2
- package/src/Table/Cell/index.tsx +1 -1
- package/src/Table/Cell/props.ts +7 -4
- package/src/Table/Cell/styles.ts +3 -3
- package/src/Table/ColHeader/index.tsx +1 -1
- package/src/Table/ColHeader/props.ts +10 -4
- package/src/Table/ColHeader/styles.ts +3 -3
- package/src/Table/Head/index.tsx +1 -1
- package/src/Table/Head/props.ts +7 -4
- package/src/Table/Head/styles.ts +3 -2
- package/src/Table/Row/index.tsx +1 -1
- package/src/Table/Row/props.ts +7 -4
- package/src/Table/Row/styles.ts +6 -3
- package/src/Table/RowHeader/index.tsx +1 -1
- package/src/Table/RowHeader/props.ts +10 -4
- package/src/Table/RowHeader/styles.ts +3 -3
- package/src/Table/index.tsx +4 -1
- package/src/Table/props.ts +10 -4
- package/src/Table/styles.ts +6 -3
- package/types/Table/Body/props.d.ts +5 -4
- package/types/Table/Body/props.d.ts.map +1 -1
- package/types/Table/Body/styles.d.ts +3 -11
- package/types/Table/Body/styles.d.ts.map +1 -1
- package/types/Table/Cell/props.d.ts +5 -4
- package/types/Table/Cell/props.d.ts.map +1 -1
- package/types/Table/Cell/styles.d.ts +3 -17
- package/types/Table/Cell/styles.d.ts.map +1 -1
- package/types/Table/ColHeader/props.d.ts +5 -4
- package/types/Table/ColHeader/props.d.ts.map +1 -1
- package/types/Table/ColHeader/styles.d.ts +3 -90
- package/types/Table/ColHeader/styles.d.ts.map +1 -1
- package/types/Table/Head/props.d.ts +5 -4
- package/types/Table/Head/props.d.ts.map +1 -1
- package/types/Table/Head/styles.d.ts +3 -11
- package/types/Table/Head/styles.d.ts.map +1 -1
- package/types/Table/Row/props.d.ts +5 -4
- package/types/Table/Row/props.d.ts.map +1 -1
- package/types/Table/Row/styles.d.ts +3 -23
- package/types/Table/Row/styles.d.ts.map +1 -1
- package/types/Table/RowHeader/props.d.ts +5 -4
- package/types/Table/RowHeader/props.d.ts.map +1 -1
- package/types/Table/RowHeader/styles.d.ts +3 -17
- package/types/Table/RowHeader/styles.d.ts.map +1 -1
- package/types/Table/index.d.ts.map +1 -1
- package/types/Table/props.d.ts +5 -4
- package/types/Table/props.d.ts.map +1 -1
- package/types/Table/styles.d.ts +3 -20
- package/types/Table/styles.d.ts.map +1 -1
- package/LICENSE.md +0 -27
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
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
|
+
# [8.10.0](https://github.com/instructure/instructure-ui/compare/v8.9.1...v8.10.0) (2021-09-28)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @instructure/ui-table
|
9
|
+
|
6
10
|
## [8.9.1](https://github.com/instructure/instructure-ui/compare/v8.9.0...v8.9.1) (2021-09-16)
|
7
11
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-table
|
package/es/Table/Body/index.js
CHANGED
@@ -60,7 +60,7 @@ let Body = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
60
60
|
isStacked = _this$props3.isStacked,
|
61
61
|
headers = _this$props3.headers,
|
62
62
|
styles = _this$props3.styles;
|
63
|
-
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Body.
|
63
|
+
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Body.allowedProps), Body), {
|
64
64
|
as: isStacked ? 'div' : 'tbody',
|
65
65
|
css: styles === null || styles === void 0 ? void 0 : styles.body,
|
66
66
|
role: isStacked ? 'rowgroup' : void 0
|
package/es/Table/Cell/index.js
CHANGED
@@ -58,7 +58,7 @@ let Cell = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
58
58
|
styles = _this$props3.styles,
|
59
59
|
isStacked = _this$props3.isStacked,
|
60
60
|
header = _this$props3.header;
|
61
|
-
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Cell.
|
61
|
+
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Cell.allowedProps), Cell), {
|
62
62
|
as: isStacked ? 'div' : 'td',
|
63
63
|
css: styles === null || styles === void 0 ? void 0 : styles.cell,
|
64
64
|
role: isStacked ? 'cell' : void 0
|
@@ -98,7 +98,7 @@ let ColHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_
|
|
98
98
|
sortDirection = _this$props5.sortDirection,
|
99
99
|
scope = _this$props5.scope,
|
100
100
|
styles = _this$props5.styles;
|
101
|
-
return jsx("th", Object.assign({}, omitProps(this.props, ColHeader.
|
101
|
+
return jsx("th", Object.assign({}, omitProps(this.props, ColHeader.allowedProps), {
|
102
102
|
css: styles === null || styles === void 0 ? void 0 : styles.colHeader,
|
103
103
|
style: {
|
104
104
|
width
|
package/es/Table/Head/index.js
CHANGED
@@ -167,7 +167,7 @@ let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
167
167
|
children = _this$props4.children,
|
168
168
|
isStacked = _this$props4.isStacked,
|
169
169
|
styles = _this$props4.styles;
|
170
|
-
return isStacked ? this.renderSelect() : jsx("thead", Object.assign({}, omitProps(this.props, Head.
|
170
|
+
return isStacked ? this.renderSelect() : jsx("thead", Object.assign({}, omitProps(this.props, Head.allowedProps), {
|
171
171
|
css: styles === null || styles === void 0 ? void 0 : styles.head
|
172
172
|
}), Children.map(children, child => matchComponentTypes(child, [Row]) ? child : null));
|
173
173
|
}
|
package/es/Table/Row/index.js
CHANGED
@@ -61,7 +61,7 @@ let Row = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
61
61
|
styles = _this$props3.styles,
|
62
62
|
isStacked = _this$props3.isStacked,
|
63
63
|
headers = _this$props3.headers;
|
64
|
-
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Row.
|
64
|
+
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Row.allowedProps), Row), {
|
65
65
|
as: isStacked ? 'div' : 'tr',
|
66
66
|
css: styles === null || styles === void 0 ? void 0 : styles.row,
|
67
67
|
role: isStacked ? 'row' : void 0
|
@@ -57,7 +57,7 @@ let RowHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_
|
|
57
57
|
children = _this$props3.children,
|
58
58
|
isStacked = _this$props3.isStacked,
|
59
59
|
styles = _this$props3.styles;
|
60
|
-
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, RowHeader.
|
60
|
+
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, RowHeader.allowedProps), RowHeader), {
|
61
61
|
as: isStacked ? 'div' : 'th',
|
62
62
|
css: styles === null || styles === void 0 ? void 0 : styles.rowHeader,
|
63
63
|
scope: "row",
|
package/es/Table/index.js
CHANGED
@@ -93,7 +93,7 @@ let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
|
|
93
93
|
styles = _this$props3.styles;
|
94
94
|
const isStacked = layout === 'stacked';
|
95
95
|
const headers = isStacked ? this.getHeaders() : null;
|
96
|
-
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Table.
|
96
|
+
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Table.allowedProps), Table), {
|
97
97
|
as: isStacked ? 'div' : 'table',
|
98
98
|
margin: margin,
|
99
99
|
elementRef: elementRef,
|
package/lib/Table/Body/index.js
CHANGED
@@ -55,7 +55,7 @@ let Body = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
55
55
|
isStacked = _this$props3.isStacked,
|
56
56
|
headers = _this$props3.headers,
|
57
57
|
styles = _this$props3.styles;
|
58
|
-
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Body.
|
58
|
+
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Body.allowedProps), Body), {
|
59
59
|
as: isStacked ? 'div' : 'tbody',
|
60
60
|
css: styles === null || styles === void 0 ? void 0 : styles.body,
|
61
61
|
role: isStacked ? 'rowgroup' : void 0
|
package/lib/Table/Cell/index.js
CHANGED
@@ -50,7 +50,7 @@ let Cell = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
50
50
|
styles = _this$props3.styles,
|
51
51
|
isStacked = _this$props3.isStacked,
|
52
52
|
header = _this$props3.header;
|
53
|
-
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Cell.
|
53
|
+
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Cell.allowedProps), Cell), {
|
54
54
|
as: isStacked ? 'div' : 'td',
|
55
55
|
css: styles === null || styles === void 0 ? void 0 : styles.cell,
|
56
56
|
role: isStacked ? 'cell' : void 0
|
@@ -92,7 +92,7 @@ let ColHeader = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
92
92
|
sortDirection = _this$props5.sortDirection,
|
93
93
|
scope = _this$props5.scope,
|
94
94
|
styles = _this$props5.styles;
|
95
|
-
return (0, _emotion.jsx)("th", Object.assign({}, (0, _omitProps.omitProps)(this.props, ColHeader.
|
95
|
+
return (0, _emotion.jsx)("th", Object.assign({}, (0, _omitProps.omitProps)(this.props, ColHeader.allowedProps), {
|
96
96
|
css: styles === null || styles === void 0 ? void 0 : styles.colHeader,
|
97
97
|
style: {
|
98
98
|
width
|
package/lib/Table/Head/index.js
CHANGED
@@ -167,7 +167,7 @@ let Head = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
167
167
|
children = _this$props4.children,
|
168
168
|
isStacked = _this$props4.isStacked,
|
169
169
|
styles = _this$props4.styles;
|
170
|
-
return isStacked ? this.renderSelect() : (0, _emotion.jsx)("thead", Object.assign({}, (0, _omitProps.omitProps)(this.props, Head.
|
170
|
+
return isStacked ? this.renderSelect() : (0, _emotion.jsx)("thead", Object.assign({}, (0, _omitProps.omitProps)(this.props, Head.allowedProps), {
|
171
171
|
css: styles === null || styles === void 0 ? void 0 : styles.head
|
172
172
|
}), _react.Children.map(children, child => (0, _matchComponentTypes.matchComponentTypes)(child, [_Row.Row]) ? child : null));
|
173
173
|
}
|
package/lib/Table/Row/index.js
CHANGED
@@ -58,7 +58,7 @@ let Row = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec
|
|
58
58
|
styles = _this$props3.styles,
|
59
59
|
isStacked = _this$props3.isStacked,
|
60
60
|
headers = _this$props3.headers;
|
61
|
-
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Row.
|
61
|
+
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Row.allowedProps), Row), {
|
62
62
|
as: isStacked ? 'div' : 'tr',
|
63
63
|
css: styles === null || styles === void 0 ? void 0 : styles.row,
|
64
64
|
role: isStacked ? 'row' : void 0
|
@@ -49,7 +49,7 @@ let RowHeader = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
49
49
|
children = _this$props3.children,
|
50
50
|
isStacked = _this$props3.isStacked,
|
51
51
|
styles = _this$props3.styles;
|
52
|
-
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, RowHeader.
|
52
|
+
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, RowHeader.allowedProps), RowHeader), {
|
53
53
|
as: isStacked ? 'div' : 'th',
|
54
54
|
css: styles === null || styles === void 0 ? void 0 : styles.rowHeader,
|
55
55
|
scope: "row",
|
package/lib/Table/index.js
CHANGED
@@ -94,7 +94,7 @@ let Table = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
|
|
94
94
|
styles = _this$props3.styles;
|
95
95
|
const isStacked = layout === 'stacked';
|
96
96
|
const headers = isStacked ? this.getHeaders() : null;
|
97
|
-
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Table.
|
97
|
+
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Table.allowedProps), Table), {
|
98
98
|
as: isStacked ? 'div' : 'table',
|
99
99
|
margin: margin,
|
100
100
|
elementRef: elementRef,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@instructure/ui-table",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.10.0",
|
4
4
|
"description": "A styled HTML table component",
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
6
6
|
"type": "commonjs",
|
@@ -24,24 +24,24 @@
|
|
24
24
|
},
|
25
25
|
"license": "MIT",
|
26
26
|
"devDependencies": {
|
27
|
-
"@instructure/ui-babel-preset": "8.
|
28
|
-
"@instructure/ui-color-utils": "8.
|
29
|
-
"@instructure/ui-test-utils": "8.
|
30
|
-
"@instructure/ui-themes": "8.
|
27
|
+
"@instructure/ui-babel-preset": "8.10.0",
|
28
|
+
"@instructure/ui-color-utils": "8.10.0",
|
29
|
+
"@instructure/ui-test-utils": "8.10.0",
|
30
|
+
"@instructure/ui-themes": "8.10.0"
|
31
31
|
},
|
32
32
|
"dependencies": {
|
33
33
|
"@babel/runtime": "^7.13.10",
|
34
|
-
"@instructure/console": "8.
|
35
|
-
"@instructure/emotion": "8.
|
36
|
-
"@instructure/shared-types": "8.
|
37
|
-
"@instructure/ui-a11y-content": "8.
|
38
|
-
"@instructure/ui-icons": "8.
|
39
|
-
"@instructure/ui-prop-types": "8.
|
40
|
-
"@instructure/ui-react-utils": "8.
|
41
|
-
"@instructure/ui-simple-select": "8.
|
42
|
-
"@instructure/ui-testable": "8.
|
43
|
-
"@instructure/ui-utils": "8.
|
44
|
-
"@instructure/ui-view": "8.
|
34
|
+
"@instructure/console": "8.10.0",
|
35
|
+
"@instructure/emotion": "8.10.0",
|
36
|
+
"@instructure/shared-types": "8.10.0",
|
37
|
+
"@instructure/ui-a11y-content": "8.10.0",
|
38
|
+
"@instructure/ui-icons": "8.10.0",
|
39
|
+
"@instructure/ui-prop-types": "8.10.0",
|
40
|
+
"@instructure/ui-react-utils": "8.10.0",
|
41
|
+
"@instructure/ui-simple-select": "8.10.0",
|
42
|
+
"@instructure/ui-testable": "8.10.0",
|
43
|
+
"@instructure/ui-utils": "8.10.0",
|
44
|
+
"@instructure/ui-view": "8.10.0",
|
45
45
|
"prop-types": "^15"
|
46
46
|
},
|
47
47
|
"peerDependencies": {
|
@@ -50,6 +50,5 @@
|
|
50
50
|
"publishConfig": {
|
51
51
|
"access": "public"
|
52
52
|
},
|
53
|
-
"sideEffects": false
|
54
|
-
"gitHead": "ddc7880d5a2f7d4d0596332e8d49cb9b1de68024"
|
53
|
+
"sideEffects": false
|
55
54
|
}
|
package/src/Table/Body/index.tsx
CHANGED
@@ -70,7 +70,7 @@ class Body extends Component<TableBodyProps> {
|
|
70
70
|
|
71
71
|
return (
|
72
72
|
<View
|
73
|
-
{...View.omitViewProps(omitProps(this.props, Body.
|
73
|
+
{...View.omitViewProps(omitProps(this.props, Body.allowedProps), Body)}
|
74
74
|
as={isStacked ? 'div' : 'tbody'}
|
75
75
|
css={styles?.body}
|
76
76
|
role={isStacked ? 'rowgroup' : undefined}
|
package/src/Table/Body/props.ts
CHANGED
@@ -28,8 +28,8 @@ import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
|
|
28
28
|
|
29
29
|
import { Row } from '../Row'
|
30
30
|
|
31
|
-
import type { PropValidators } from '@instructure/shared-types'
|
32
|
-
import type { WithStyleProps } from '@instructure/emotion'
|
31
|
+
import type { PropValidators, TableBodyTheme } from '@instructure/shared-types'
|
32
|
+
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
33
33
|
|
34
34
|
type TableBodyOwnProps = {
|
35
35
|
hover?: boolean
|
@@ -42,7 +42,10 @@ type PropKeys = keyof TableBodyOwnProps
|
|
42
42
|
|
43
43
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
44
44
|
|
45
|
-
type TableBodyProps = TableBodyOwnProps &
|
45
|
+
type TableBodyProps = TableBodyOwnProps &
|
46
|
+
WithStyleProps<TableBodyTheme, TableBodyStyle>
|
47
|
+
|
48
|
+
type TableBodyStyle = ComponentStyle<'body'>
|
46
49
|
|
47
50
|
const propTypes: PropValidators<PropKeys> = {
|
48
51
|
/**
|
@@ -63,5 +66,5 @@ const allowedProps: AllowedPropKeys = [
|
|
63
66
|
'headers'
|
64
67
|
]
|
65
68
|
|
66
|
-
export type { TableBodyProps }
|
69
|
+
export type { TableBodyProps, TableBodyStyle }
|
67
70
|
export { propTypes, allowedProps }
|
package/src/Table/Body/styles.ts
CHANGED
@@ -22,7 +22,8 @@
|
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
24
|
|
25
|
-
import { TableBodyTheme } from '@instructure/shared-types'
|
25
|
+
import type { TableBodyTheme } from '@instructure/shared-types'
|
26
|
+
import type { TableBodyStyle } from './props'
|
26
27
|
|
27
28
|
/**
|
28
29
|
* ---
|
@@ -34,7 +35,7 @@ import { TableBodyTheme } from '@instructure/shared-types'
|
|
34
35
|
* @param {Object} state the state of the component, the style is applied to
|
35
36
|
* @return {Object} The final style object, which will be used in the component
|
36
37
|
*/
|
37
|
-
const generateStyle = (componentTheme: TableBodyTheme) => {
|
38
|
+
const generateStyle = (componentTheme: TableBodyTheme): TableBodyStyle => {
|
38
39
|
return {
|
39
40
|
body: {
|
40
41
|
label: 'body',
|
package/src/Table/Cell/index.tsx
CHANGED
@@ -66,7 +66,7 @@ class Cell extends Component<TableCellProps> {
|
|
66
66
|
|
67
67
|
return (
|
68
68
|
<View
|
69
|
-
{...View.omitViewProps(omitProps(this.props, Cell.
|
69
|
+
{...View.omitViewProps(omitProps(this.props, Cell.allowedProps), Cell)}
|
70
70
|
as={isStacked ? 'div' : 'td'}
|
71
71
|
css={styles?.cell}
|
72
72
|
role={isStacked ? 'cell' : undefined}
|
package/src/Table/Cell/props.ts
CHANGED
@@ -25,8 +25,8 @@
|
|
25
25
|
import React from 'react'
|
26
26
|
import PropTypes from 'prop-types'
|
27
27
|
|
28
|
-
import type { WithStyleProps } from '@instructure/emotion'
|
29
|
-
import type { PropValidators } from '@instructure/shared-types'
|
28
|
+
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
29
|
+
import type { PropValidators, TableCellTheme } from '@instructure/shared-types'
|
30
30
|
|
31
31
|
type TableCellOwnProps = {
|
32
32
|
isStacked?: boolean
|
@@ -39,7 +39,10 @@ type PropKeys = keyof TableCellOwnProps
|
|
39
39
|
|
40
40
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
41
41
|
|
42
|
-
type TableCellProps = TableCellOwnProps &
|
42
|
+
type TableCellProps = TableCellOwnProps &
|
43
|
+
WithStyleProps<TableCellTheme, TableCellStyle>
|
44
|
+
|
45
|
+
type TableCellStyle = ComponentStyle<'cell'>
|
43
46
|
|
44
47
|
const propTypes: PropValidators<PropKeys> = {
|
45
48
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
@@ -58,5 +61,5 @@ const allowedProps: AllowedPropKeys = [
|
|
58
61
|
'textAlign'
|
59
62
|
]
|
60
63
|
|
61
|
-
export type { TableCellProps }
|
64
|
+
export type { TableCellProps, TableCellStyle }
|
62
65
|
export { propTypes, allowedProps }
|
package/src/Table/Cell/styles.ts
CHANGED
@@ -22,8 +22,8 @@
|
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
24
|
|
25
|
-
import { TableCellTheme } from '@instructure/shared-types'
|
26
|
-
import { TableCellProps } from './props'
|
25
|
+
import type { TableCellTheme } from '@instructure/shared-types'
|
26
|
+
import type { TableCellProps, TableCellStyle } from './props'
|
27
27
|
|
28
28
|
/**
|
29
29
|
* ---
|
@@ -38,7 +38,7 @@ import { TableCellProps } from './props'
|
|
38
38
|
const generateStyle = (
|
39
39
|
componentTheme: TableCellTheme,
|
40
40
|
props: TableCellProps
|
41
|
-
) => {
|
41
|
+
): TableCellStyle => {
|
42
42
|
const { textAlign } = props
|
43
43
|
|
44
44
|
return {
|
@@ -24,8 +24,11 @@
|
|
24
24
|
import React from 'react'
|
25
25
|
import PropTypes from 'prop-types'
|
26
26
|
|
27
|
-
import type {
|
28
|
-
|
27
|
+
import type {
|
28
|
+
PropValidators,
|
29
|
+
TableColHeaderTheme
|
30
|
+
} from '@instructure/shared-types'
|
31
|
+
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
29
32
|
|
30
33
|
type TableColHeaderOwnProps = {
|
31
34
|
id: string
|
@@ -42,7 +45,10 @@ type PropKeys = keyof TableColHeaderOwnProps
|
|
42
45
|
|
43
46
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
44
47
|
|
45
|
-
type TableColHeaderProps = TableColHeaderOwnProps &
|
48
|
+
type TableColHeaderProps = TableColHeaderOwnProps &
|
49
|
+
WithStyleProps<TableColHeaderTheme, TableColHeaderStyle>
|
50
|
+
|
51
|
+
type TableColHeaderStyle = ComponentStyle<'colHeader' | 'button'>
|
46
52
|
|
47
53
|
const propTypes: PropValidators<PropKeys> = {
|
48
54
|
/**
|
@@ -90,5 +96,5 @@ const allowedProps: AllowedPropKeys = [
|
|
90
96
|
'scope'
|
91
97
|
]
|
92
98
|
|
93
|
-
export type { TableColHeaderProps }
|
99
|
+
export type { TableColHeaderProps, TableColHeaderStyle }
|
94
100
|
export { propTypes, allowedProps }
|
@@ -22,8 +22,8 @@
|
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
24
|
|
25
|
-
import { TableColHeaderTheme } from '@instructure/shared-types'
|
26
|
-
import { TableColHeaderProps } from './props'
|
25
|
+
import type { TableColHeaderTheme } from '@instructure/shared-types'
|
26
|
+
import type { TableColHeaderProps, TableColHeaderStyle } from './props'
|
27
27
|
|
28
28
|
/**
|
29
29
|
* ---
|
@@ -38,7 +38,7 @@ import { TableColHeaderProps } from './props'
|
|
38
38
|
const generateStyle = (
|
39
39
|
componentTheme: TableColHeaderTheme,
|
40
40
|
props: TableColHeaderProps
|
41
|
-
) => {
|
41
|
+
): TableColHeaderStyle => {
|
42
42
|
const { onRequestSort, textAlign } = props
|
43
43
|
|
44
44
|
const headerStyle = {
|
package/src/Table/Head/index.tsx
CHANGED
@@ -182,7 +182,7 @@ class Head extends Component<TableHeadProps> {
|
|
182
182
|
return isStacked ? (
|
183
183
|
this.renderSelect()
|
184
184
|
) : (
|
185
|
-
<thead {...omitProps(this.props, Head.
|
185
|
+
<thead {...omitProps(this.props, Head.allowedProps)} css={styles?.head}>
|
186
186
|
{Children.map(children, (child) =>
|
187
187
|
matchComponentTypes(child, [Row]) ? child : null
|
188
188
|
)}
|
package/src/Table/Head/props.ts
CHANGED
@@ -29,8 +29,8 @@ import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
|
|
29
29
|
|
30
30
|
import { Row } from '../Row'
|
31
31
|
|
32
|
-
import type { PropValidators } from '@instructure/shared-types'
|
33
|
-
import type { WithStyleProps } from '@instructure/emotion'
|
32
|
+
import type { PropValidators, TableHeadTheme } from '@instructure/shared-types'
|
33
|
+
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
34
34
|
|
35
35
|
type TableHeadOwnProps = {
|
36
36
|
isStacked?: boolean
|
@@ -41,7 +41,10 @@ type PropKeys = keyof TableHeadOwnProps
|
|
41
41
|
|
42
42
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
43
43
|
|
44
|
-
type TableHeadProps = TableHeadOwnProps &
|
44
|
+
type TableHeadProps = TableHeadOwnProps &
|
45
|
+
WithStyleProps<TableHeadTheme, TableHeadStyle>
|
46
|
+
|
47
|
+
type TableHeadStyle = ComponentStyle<'head'>
|
45
48
|
|
46
49
|
const propTypes: PropValidators<PropKeys> = {
|
47
50
|
/**
|
@@ -58,5 +61,5 @@ const allowedProps: AllowedPropKeys = [
|
|
58
61
|
'renderSortLabel'
|
59
62
|
]
|
60
63
|
|
61
|
-
export type { TableHeadProps }
|
64
|
+
export type { TableHeadProps, TableHeadStyle }
|
62
65
|
export { propTypes, allowedProps }
|
package/src/Table/Head/styles.ts
CHANGED
@@ -22,7 +22,8 @@
|
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
24
|
|
25
|
-
import { TableHeadTheme } from '@instructure/shared-types'
|
25
|
+
import type { TableHeadTheme } from '@instructure/shared-types'
|
26
|
+
import type { TableHeadStyle } from './props'
|
26
27
|
|
27
28
|
/**
|
28
29
|
* ---
|
@@ -34,7 +35,7 @@ import { TableHeadTheme } from '@instructure/shared-types'
|
|
34
35
|
* @param {Object} state the state of the component, the style is applied to
|
35
36
|
* @return {Object} The final style object, which will be used in the component
|
36
37
|
*/
|
37
|
-
const generateStyle = (componentTheme: TableHeadTheme) => {
|
38
|
+
const generateStyle = (componentTheme: TableHeadTheme): TableHeadStyle => {
|
38
39
|
return {
|
39
40
|
head: {
|
40
41
|
label: 'head',
|
package/src/Table/Row/index.tsx
CHANGED
@@ -73,7 +73,7 @@ class Row extends Component<TableRowProps> {
|
|
73
73
|
|
74
74
|
return (
|
75
75
|
<View
|
76
|
-
{...View.omitViewProps(omitProps(this.props, Row.
|
76
|
+
{...View.omitViewProps(omitProps(this.props, Row.allowedProps), Row)}
|
77
77
|
as={isStacked ? 'div' : 'tr'}
|
78
78
|
css={styles?.row}
|
79
79
|
role={isStacked ? 'row' : undefined}
|
package/src/Table/Row/props.ts
CHANGED
@@ -31,8 +31,8 @@ import { ColHeader } from '../ColHeader'
|
|
31
31
|
import { RowHeader } from '../RowHeader'
|
32
32
|
import { Cell } from '../Cell'
|
33
33
|
|
34
|
-
import type { PropValidators } from '@instructure/shared-types'
|
35
|
-
import type { WithStyleProps } from '@instructure/emotion'
|
34
|
+
import type { PropValidators, TableRowTheme } from '@instructure/shared-types'
|
35
|
+
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
36
36
|
|
37
37
|
type TableRowOwnProps = {
|
38
38
|
hover?: boolean
|
@@ -45,7 +45,10 @@ type PropKeys = keyof TableRowOwnProps
|
|
45
45
|
|
46
46
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
47
47
|
|
48
|
-
type TableRowProps = TableRowOwnProps &
|
48
|
+
type TableRowProps = TableRowOwnProps &
|
49
|
+
WithStyleProps<TableRowTheme, TableRowStyle>
|
50
|
+
|
51
|
+
type TableRowStyle = ComponentStyle<'row'>
|
49
52
|
|
50
53
|
const propTypes: PropValidators<PropKeys> = {
|
51
54
|
/**
|
@@ -66,5 +69,5 @@ const allowedProps: AllowedPropKeys = [
|
|
66
69
|
'headers'
|
67
70
|
]
|
68
71
|
|
69
|
-
export type { TableRowProps }
|
72
|
+
export type { TableRowProps, TableRowStyle }
|
70
73
|
export { propTypes, allowedProps }
|
package/src/Table/Row/styles.ts
CHANGED
@@ -22,8 +22,8 @@
|
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
24
|
|
25
|
-
import { TableRowTheme } from '@instructure/shared-types'
|
26
|
-
import { TableRowProps } from './props'
|
25
|
+
import type { TableRowTheme } from '@instructure/shared-types'
|
26
|
+
import type { TableRowProps, TableRowStyle } from './props'
|
27
27
|
|
28
28
|
/**
|
29
29
|
* ---
|
@@ -35,7 +35,10 @@ import { TableRowProps } from './props'
|
|
35
35
|
* @param {Object} state the state of the component, the style is applied to
|
36
36
|
* @return {Object} The final style object, which will be used in the component
|
37
37
|
*/
|
38
|
-
const generateStyle = (
|
38
|
+
const generateStyle = (
|
39
|
+
componentTheme: TableRowTheme,
|
40
|
+
props: TableRowProps
|
41
|
+
): TableRowStyle => {
|
39
42
|
const { hover, isStacked } = props
|
40
43
|
|
41
44
|
return {
|
@@ -25,8 +25,11 @@
|
|
25
25
|
import React from 'react'
|
26
26
|
import PropTypes from 'prop-types'
|
27
27
|
|
28
|
-
import type {
|
29
|
-
|
28
|
+
import type {
|
29
|
+
PropValidators,
|
30
|
+
TableRowHeaderTheme
|
31
|
+
} from '@instructure/shared-types'
|
32
|
+
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
30
33
|
|
31
34
|
type TableRowHeaderOwnProps = {
|
32
35
|
isStacked?: boolean
|
@@ -38,7 +41,10 @@ type PropKeys = keyof TableRowHeaderOwnProps
|
|
38
41
|
|
39
42
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
40
43
|
|
41
|
-
type TableRowHeaderProps = TableRowHeaderOwnProps &
|
44
|
+
type TableRowHeaderProps = TableRowHeaderOwnProps &
|
45
|
+
WithStyleProps<TableRowHeaderTheme, TableRowHeaderStyle>
|
46
|
+
|
47
|
+
type TableRowHeaderStyle = ComponentStyle<'rowHeader'>
|
42
48
|
|
43
49
|
const propTypes: PropValidators<PropKeys> = {
|
44
50
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
@@ -51,5 +57,5 @@ const propTypes: PropValidators<PropKeys> = {
|
|
51
57
|
|
52
58
|
const allowedProps: AllowedPropKeys = ['children', 'isStacked', 'textAlign']
|
53
59
|
|
54
|
-
export type { TableRowHeaderProps }
|
60
|
+
export type { TableRowHeaderProps, TableRowHeaderStyle }
|
55
61
|
export { propTypes, allowedProps }
|
@@ -22,8 +22,8 @@
|
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
24
|
|
25
|
-
import { TableRowHeaderTheme } from '@instructure/shared-types'
|
26
|
-
import { TableRowHeaderProps } from './props'
|
25
|
+
import type { TableRowHeaderTheme } from '@instructure/shared-types'
|
26
|
+
import type { TableRowHeaderProps, TableRowHeaderStyle } from './props'
|
27
27
|
|
28
28
|
/**
|
29
29
|
* ---
|
@@ -38,7 +38,7 @@ import { TableRowHeaderProps } from './props'
|
|
38
38
|
const generateStyle = (
|
39
39
|
componentTheme: TableRowHeaderTheme,
|
40
40
|
props: TableRowHeaderProps
|
41
|
-
) => {
|
41
|
+
): TableRowHeaderStyle => {
|
42
42
|
const { textAlign } = props
|
43
43
|
|
44
44
|
return {
|
package/src/Table/index.tsx
CHANGED
@@ -115,7 +115,10 @@ class Table extends Component<TableProps> {
|
|
115
115
|
|
116
116
|
return (
|
117
117
|
<View
|
118
|
-
{...View.omitViewProps(
|
118
|
+
{...View.omitViewProps(
|
119
|
+
omitProps(this.props, Table.allowedProps),
|
120
|
+
Table
|
121
|
+
)}
|
119
122
|
as={isStacked ? 'div' : 'table'}
|
120
123
|
margin={margin}
|
121
124
|
elementRef={elementRef}
|
package/src/Table/props.ts
CHANGED
@@ -30,8 +30,12 @@ import { ThemeablePropTypes } from '@instructure/emotion'
|
|
30
30
|
import { Head } from './Head'
|
31
31
|
import { Body } from './Body'
|
32
32
|
|
33
|
-
import type {
|
34
|
-
|
33
|
+
import type {
|
34
|
+
Spacing,
|
35
|
+
WithStyleProps,
|
36
|
+
ComponentStyle
|
37
|
+
} from '@instructure/emotion'
|
38
|
+
import type { PropValidators, TableTheme } from '@instructure/shared-types'
|
35
39
|
|
36
40
|
type TableOwnProps = {
|
37
41
|
caption: React.ReactNode
|
@@ -46,7 +50,9 @@ type PropKeys = keyof TableOwnProps
|
|
46
50
|
|
47
51
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
48
52
|
|
49
|
-
type TableProps = TableOwnProps & WithStyleProps
|
53
|
+
type TableProps = TableOwnProps & WithStyleProps<TableTheme, TableStyle>
|
54
|
+
|
55
|
+
type TableStyle = ComponentStyle<'table'>
|
50
56
|
|
51
57
|
const propTypes: PropValidators<PropKeys> = {
|
52
58
|
/**
|
@@ -89,5 +95,5 @@ const allowedProps: AllowedPropKeys = [
|
|
89
95
|
'layout'
|
90
96
|
]
|
91
97
|
|
92
|
-
export type { TableProps }
|
98
|
+
export type { TableProps, TableStyle }
|
93
99
|
export { propTypes, allowedProps }
|