@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.
Files changed (67) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/es/Table/Body/index.js +1 -1
  3. package/es/Table/Cell/index.js +1 -1
  4. package/es/Table/ColHeader/index.js +1 -1
  5. package/es/Table/Head/index.js +1 -1
  6. package/es/Table/Row/index.js +1 -1
  7. package/es/Table/RowHeader/index.js +1 -1
  8. package/es/Table/index.js +1 -1
  9. package/lib/Table/Body/index.js +1 -1
  10. package/lib/Table/Cell/index.js +1 -1
  11. package/lib/Table/ColHeader/index.js +1 -1
  12. package/lib/Table/Head/index.js +1 -1
  13. package/lib/Table/Row/index.js +1 -1
  14. package/lib/Table/RowHeader/index.js +1 -1
  15. package/lib/Table/index.js +1 -1
  16. package/package.json +17 -18
  17. package/src/Table/Body/index.tsx +1 -1
  18. package/src/Table/Body/props.ts +7 -4
  19. package/src/Table/Body/styles.ts +3 -2
  20. package/src/Table/Cell/index.tsx +1 -1
  21. package/src/Table/Cell/props.ts +7 -4
  22. package/src/Table/Cell/styles.ts +3 -3
  23. package/src/Table/ColHeader/index.tsx +1 -1
  24. package/src/Table/ColHeader/props.ts +10 -4
  25. package/src/Table/ColHeader/styles.ts +3 -3
  26. package/src/Table/Head/index.tsx +1 -1
  27. package/src/Table/Head/props.ts +7 -4
  28. package/src/Table/Head/styles.ts +3 -2
  29. package/src/Table/Row/index.tsx +1 -1
  30. package/src/Table/Row/props.ts +7 -4
  31. package/src/Table/Row/styles.ts +6 -3
  32. package/src/Table/RowHeader/index.tsx +1 -1
  33. package/src/Table/RowHeader/props.ts +10 -4
  34. package/src/Table/RowHeader/styles.ts +3 -3
  35. package/src/Table/index.tsx +4 -1
  36. package/src/Table/props.ts +10 -4
  37. package/src/Table/styles.ts +6 -3
  38. package/types/Table/Body/props.d.ts +5 -4
  39. package/types/Table/Body/props.d.ts.map +1 -1
  40. package/types/Table/Body/styles.d.ts +3 -11
  41. package/types/Table/Body/styles.d.ts.map +1 -1
  42. package/types/Table/Cell/props.d.ts +5 -4
  43. package/types/Table/Cell/props.d.ts.map +1 -1
  44. package/types/Table/Cell/styles.d.ts +3 -17
  45. package/types/Table/Cell/styles.d.ts.map +1 -1
  46. package/types/Table/ColHeader/props.d.ts +5 -4
  47. package/types/Table/ColHeader/props.d.ts.map +1 -1
  48. package/types/Table/ColHeader/styles.d.ts +3 -90
  49. package/types/Table/ColHeader/styles.d.ts.map +1 -1
  50. package/types/Table/Head/props.d.ts +5 -4
  51. package/types/Table/Head/props.d.ts.map +1 -1
  52. package/types/Table/Head/styles.d.ts +3 -11
  53. package/types/Table/Head/styles.d.ts.map +1 -1
  54. package/types/Table/Row/props.d.ts +5 -4
  55. package/types/Table/Row/props.d.ts.map +1 -1
  56. package/types/Table/Row/styles.d.ts +3 -23
  57. package/types/Table/Row/styles.d.ts.map +1 -1
  58. package/types/Table/RowHeader/props.d.ts +5 -4
  59. package/types/Table/RowHeader/props.d.ts.map +1 -1
  60. package/types/Table/RowHeader/styles.d.ts +3 -17
  61. package/types/Table/RowHeader/styles.d.ts.map +1 -1
  62. package/types/Table/index.d.ts.map +1 -1
  63. package/types/Table/props.d.ts +5 -4
  64. package/types/Table/props.d.ts.map +1 -1
  65. package/types/Table/styles.d.ts +3 -20
  66. package/types/Table/styles.d.ts.map +1 -1
  67. 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
@@ -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.propTypes), 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
@@ -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.propTypes), 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.propTypes), {
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
@@ -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.propTypes), {
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
  }
@@ -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.propTypes), 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.propTypes), 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.propTypes), 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,
@@ -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.propTypes), 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
@@ -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.propTypes), 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.propTypes), {
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
@@ -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.propTypes), {
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
  }
@@ -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.propTypes), 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.propTypes), 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",
@@ -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.propTypes), 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.9.2-snapshot.3+ddc7880d5",
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.9.2-snapshot.3+ddc7880d5",
28
- "@instructure/ui-color-utils": "8.9.2-snapshot.3+ddc7880d5",
29
- "@instructure/ui-test-utils": "8.9.2-snapshot.3+ddc7880d5",
30
- "@instructure/ui-themes": "8.9.2-snapshot.3+ddc7880d5"
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.9.2-snapshot.3+ddc7880d5",
35
- "@instructure/emotion": "8.9.2-snapshot.3+ddc7880d5",
36
- "@instructure/shared-types": "8.9.2-snapshot.3+ddc7880d5",
37
- "@instructure/ui-a11y-content": "8.9.2-snapshot.3+ddc7880d5",
38
- "@instructure/ui-icons": "8.9.2-snapshot.3+ddc7880d5",
39
- "@instructure/ui-prop-types": "8.9.2-snapshot.3+ddc7880d5",
40
- "@instructure/ui-react-utils": "8.9.2-snapshot.3+ddc7880d5",
41
- "@instructure/ui-simple-select": "8.9.2-snapshot.3+ddc7880d5",
42
- "@instructure/ui-testable": "8.9.2-snapshot.3+ddc7880d5",
43
- "@instructure/ui-utils": "8.9.2-snapshot.3+ddc7880d5",
44
- "@instructure/ui-view": "8.9.2-snapshot.3+ddc7880d5",
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
  }
@@ -70,7 +70,7 @@ class Body extends Component<TableBodyProps> {
70
70
 
71
71
  return (
72
72
  <View
73
- {...View.omitViewProps(omitProps(this.props, Body.propTypes), 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}
@@ -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 & WithStyleProps
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 }
@@ -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',
@@ -66,7 +66,7 @@ class Cell extends Component<TableCellProps> {
66
66
 
67
67
  return (
68
68
  <View
69
- {...View.omitViewProps(omitProps(this.props, Cell.propTypes), 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}
@@ -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 & WithStyleProps
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 }
@@ -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 {
@@ -104,7 +104,7 @@ class ColHeader extends Component<TableColHeaderProps> {
104
104
 
105
105
  return (
106
106
  <th
107
- {...omitProps(this.props, ColHeader.propTypes)}
107
+ {...omitProps(this.props, ColHeader.allowedProps)}
108
108
  css={styles?.colHeader}
109
109
  style={{
110
110
  width
@@ -24,8 +24,11 @@
24
24
  import React from 'react'
25
25
  import PropTypes from 'prop-types'
26
26
 
27
- import type { PropValidators } from '@instructure/shared-types'
28
- import type { WithStyleProps } from '@instructure/emotion'
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 & WithStyleProps
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 = {
@@ -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.propTypes)} css={styles?.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
  )}
@@ -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 & WithStyleProps
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 }
@@ -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',
@@ -73,7 +73,7 @@ class Row extends Component<TableRowProps> {
73
73
 
74
74
  return (
75
75
  <View
76
- {...View.omitViewProps(omitProps(this.props, Row.propTypes), 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}
@@ -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 & WithStyleProps
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 }
@@ -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 = (componentTheme: TableRowTheme, props: TableRowProps) => {
38
+ const generateStyle = (
39
+ componentTheme: TableRowTheme,
40
+ props: TableRowProps
41
+ ): TableRowStyle => {
39
42
  const { hover, isStacked } = props
40
43
 
41
44
  return {
@@ -67,7 +67,7 @@ class RowHeader extends Component<TableRowHeaderProps> {
67
67
  return (
68
68
  <View
69
69
  {...View.omitViewProps(
70
- omitProps(this.props, RowHeader.propTypes),
70
+ omitProps(this.props, RowHeader.allowedProps),
71
71
  RowHeader
72
72
  )}
73
73
  as={isStacked ? 'div' : 'th'}
@@ -25,8 +25,11 @@
25
25
  import React from 'react'
26
26
  import PropTypes from 'prop-types'
27
27
 
28
- import type { PropValidators } from '@instructure/shared-types'
29
- import type { WithStyleProps } from '@instructure/emotion'
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 & WithStyleProps
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 {
@@ -115,7 +115,10 @@ class Table extends Component<TableProps> {
115
115
 
116
116
  return (
117
117
  <View
118
- {...View.omitViewProps(omitProps(this.props, Table.propTypes), Table)}
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}
@@ -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 { Spacing, WithStyleProps } from '@instructure/emotion'
34
- import type { PropValidators } from '@instructure/shared-types'
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 }