@instructure/ui-table 8.14.1-snapshot.7 → 8.15.1-snapshot.2

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 (73) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/es/Table/Body/index.js +2 -1
  3. package/es/Table/Body/props.js +0 -3
  4. package/es/Table/Cell/index.js +1 -0
  5. package/es/Table/Cell/props.js +0 -4
  6. package/es/Table/ColHeader/index.js +3 -2
  7. package/es/Table/ColHeader/props.js +0 -30
  8. package/es/Table/Head/index.js +19 -15
  9. package/es/Table/Head/props.js +0 -3
  10. package/es/Table/Row/index.js +1 -0
  11. package/es/Table/Row/props.js +0 -3
  12. package/es/Table/RowHeader/index.js +1 -0
  13. package/es/Table/RowHeader/props.js +0 -4
  14. package/es/Table/index.js +10 -9
  15. package/es/Table/props.js +0 -28
  16. package/lib/Table/Body/index.js +2 -1
  17. package/lib/Table/Body/props.js +0 -3
  18. package/lib/Table/Cell/index.js +1 -0
  19. package/lib/Table/Cell/props.js +0 -4
  20. package/lib/Table/ColHeader/index.js +5 -2
  21. package/lib/Table/ColHeader/props.js +0 -30
  22. package/lib/Table/Head/index.js +19 -15
  23. package/lib/Table/Head/props.js +0 -3
  24. package/lib/Table/Row/index.js +1 -0
  25. package/lib/Table/Row/props.js +0 -3
  26. package/lib/Table/RowHeader/index.js +1 -0
  27. package/lib/Table/RowHeader/props.js +0 -4
  28. package/lib/Table/index.js +10 -9
  29. package/lib/Table/props.js +0 -28
  30. package/package.json +17 -17
  31. package/src/Table/Body/index.tsx +6 -6
  32. package/src/Table/Body/props.ts +5 -4
  33. package/src/Table/Cell/index.tsx +1 -0
  34. package/src/Table/Cell/props.ts +5 -5
  35. package/src/Table/ColHeader/index.tsx +6 -15
  36. package/src/Table/ColHeader/props.ts +29 -26
  37. package/src/Table/Head/index.tsx +34 -29
  38. package/src/Table/Head/props.ts +4 -4
  39. package/src/Table/Row/index.tsx +15 -9
  40. package/src/Table/Row/props.ts +5 -4
  41. package/src/Table/RowHeader/index.tsx +1 -0
  42. package/src/Table/RowHeader/props.ts +4 -4
  43. package/src/Table/index.tsx +30 -20
  44. package/src/Table/props.ts +55 -28
  45. package/tsconfig.build.tsbuildinfo +1 -1
  46. package/types/Table/Body/index.d.ts +4 -3
  47. package/types/Table/Body/index.d.ts.map +1 -1
  48. package/types/Table/Body/props.d.ts +5 -1
  49. package/types/Table/Body/props.d.ts.map +1 -1
  50. package/types/Table/Cell/index.d.ts +5 -4
  51. package/types/Table/Cell/index.d.ts.map +1 -1
  52. package/types/Table/Cell/props.d.ts +5 -2
  53. package/types/Table/Cell/props.d.ts.map +1 -1
  54. package/types/Table/ColHeader/index.d.ts +11 -6
  55. package/types/Table/ColHeader/index.d.ts.map +1 -1
  56. package/types/Table/ColHeader/props.d.ts +28 -2
  57. package/types/Table/ColHeader/props.d.ts.map +1 -1
  58. package/types/Table/Head/index.d.ts +3 -2
  59. package/types/Table/Head/index.d.ts.map +1 -1
  60. package/types/Table/Head/props.d.ts +4 -1
  61. package/types/Table/Head/props.d.ts.map +1 -1
  62. package/types/Table/Row/index.d.ts +3 -2
  63. package/types/Table/Row/index.d.ts.map +1 -1
  64. package/types/Table/Row/props.d.ts +5 -1
  65. package/types/Table/Row/props.d.ts.map +1 -1
  66. package/types/Table/RowHeader/index.d.ts +3 -2
  67. package/types/Table/RowHeader/index.d.ts.map +1 -1
  68. package/types/Table/RowHeader/props.d.ts +4 -1
  69. package/types/Table/RowHeader/props.d.ts.map +1 -1
  70. package/types/Table/index.d.ts +4 -3
  71. package/types/Table/index.d.ts.map +1 -1
  72. package/types/Table/props.d.ts +43 -2
  73. package/types/Table/props.d.ts.map +1 -1
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.15.0](https://github.com/instructure/instructure-ui/compare/v8.14.0...v8.15.0) (2022-01-26)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-table
9
+
6
10
  # [8.14.0](https://github.com/instructure/instructure-ui/compare/v8.13.0...v8.14.0) (2021-12-16)
7
11
 
8
12
  **Note:** Version bump only for package @instructure/ui-table
@@ -38,6 +38,7 @@ import { allowedProps, propTypes } from './props';
38
38
  parent: Table
39
39
  id: Table.Body
40
40
  ---
41
+ @tsProps
41
42
  **/
42
43
 
43
44
  let Body = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Body extends Component {
@@ -47,7 +48,7 @@ let Body = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
47
48
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
48
49
  }
49
50
 
50
- componentDidUpdate(prevProps, prevState, snapshot) {
51
+ componentDidUpdate() {
51
52
  var _this$props$makeStyle2, _this$props2;
52
53
 
53
54
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
@@ -25,9 +25,6 @@ import PropTypes from 'prop-types';
25
25
  import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
26
26
  import { Row } from '../Row';
27
27
  const propTypes = {
28
- /**
29
- * `Table.Row`
30
- */
31
28
  children: ChildrenPropTypes.oneOf([Row]),
32
29
  hover: PropTypes.bool,
33
30
  isStacked: PropTypes.bool,
@@ -37,6 +37,7 @@ import { allowedProps, propTypes } from './props';
37
37
  parent: Table
38
38
  id: Table.Cell
39
39
  ---
40
+ @tsProps
40
41
  **/
41
42
 
42
43
  let Cell = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Cell extends Component {
@@ -26,10 +26,6 @@ const propTypes = {
26
26
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
27
27
  isStacked: PropTypes.bool,
28
28
  header: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
29
-
30
- /**
31
- * Control the text alignment in cell
32
- */
33
29
  textAlign: PropTypes.oneOf(['start', 'center', 'end'])
34
30
  };
35
31
  const allowedProps = ['children', 'isStacked', 'header', 'textAlign'];
@@ -25,7 +25,7 @@ var _dec, _class, _class2, _temp, _IconMiniArrowUpLine, _IconMiniArrowDownLin;
25
25
  */
26
26
 
27
27
  /** @jsx jsx */
28
- import { Component } from 'react';
28
+ import React, { Component } from 'react';
29
29
  import { omitProps, callRenderProp } from '@instructure/ui-react-utils';
30
30
  import { IconMiniArrowUpLine, IconMiniArrowDownLine } from '@instructure/ui-icons';
31
31
  import { withStyle, jsx } from '@instructure/emotion';
@@ -37,6 +37,7 @@ import { allowedProps, propTypes } from './props';
37
37
  parent: Table
38
38
  id: Table.ColHeader
39
39
  ---
40
+ @tsProps
40
41
  **/
41
42
 
42
43
  let ColHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class ColHeader extends Component {
@@ -47,7 +48,7 @@ let ColHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_
47
48
  const _this$props = this.props,
48
49
  id = _this$props.id,
49
50
  onRequestSort = _this$props.onRequestSort;
50
- onRequestSort(event, {
51
+ onRequestSort && onRequestSort(event, {
51
52
  id
52
53
  });
53
54
  };
@@ -23,43 +23,13 @@
23
23
  */
24
24
  import PropTypes from 'prop-types';
25
25
  const propTypes = {
26
- /**
27
- * A unique id for this column. The `id` is also used as option in combobox,
28
- * when sortable table is in stacked layout,
29
- * and no `stackedSortByLabel` is provided.
30
- */
31
26
  id: PropTypes.string.isRequired,
32
-
33
- /**
34
- * A custom string to display as option text in the combobox (instead of
35
- * using the `id` prop), when sortable table is in stacked layout.
36
- */
37
27
  stackedSortByLabel: PropTypes.string,
38
28
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
39
-
40
- /**
41
- * Control the width of column.
42
- */
43
29
  width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
44
-
45
- /**
46
- * Control the text alignment in column header
47
- */
48
30
  textAlign: PropTypes.oneOf(['start', 'center', 'end']),
49
-
50
- /**
51
- * The string of sorting direction
52
- */
53
31
  sortDirection: PropTypes.oneOf(['none', 'ascending', 'descending']),
54
-
55
- /**
56
- * Callback fired when column header is clicked. Parameters: `(event, { id })`
57
- */
58
32
  onRequestSort: PropTypes.func,
59
-
60
- /**
61
- * The column header scope attribute. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope
62
- */
63
33
  scope: PropTypes.oneOf(['row', 'col', 'rowgroup', 'colgroup', 'auto'])
64
34
  };
65
35
  const allowedProps = ['id', 'stackedSortByLabel', 'children', 'width', 'textAlign', 'sortDirection', 'onRequestSort', 'scope'];
@@ -44,13 +44,14 @@ import { allowedProps, propTypes } from './props';
44
44
  parent: Table
45
45
  id: Table.Head
46
46
  ---
47
+ @tsProps
47
48
  **/
48
49
 
49
50
  let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Head extends Component {
50
51
  get isSortable() {
51
- const _Children$toArray = Children.toArray(this.props.children),
52
- _Children$toArray2 = _slicedToArray(_Children$toArray, 1),
53
- row = _Children$toArray2[0];
52
+ const _ref = Children.toArray(this.props.children),
53
+ _ref2 = _slicedToArray(_ref, 1),
54
+ row = _ref2[0];
54
55
 
55
56
  let sortable = false;
56
57
 
@@ -86,9 +87,9 @@ let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
86
87
  children = _this$props3.children,
87
88
  renderSortLabel = _this$props3.renderSortLabel;
88
89
 
89
- const _Children$toArray3 = Children.toArray(children),
90
- _Children$toArray4 = _slicedToArray(_Children$toArray3, 1),
91
- row = _Children$toArray4[0];
90
+ const _ref3 = Children.toArray(children),
91
+ _ref4 = _slicedToArray(_ref3, 1),
92
+ row = _ref4[0];
92
93
 
93
94
  if (!matchComponentTypes(row, [Row])) {
94
95
  return null;
@@ -96,7 +97,7 @@ let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
96
97
 
97
98
  const options = [];
98
99
  const clickHandlers = {};
99
- let selectedOption = void 0;
100
+ let selectedOption;
100
101
  let count = 0;
101
102
  Children.forEach(row.props.children, colHeader => {
102
103
  count += 1;
@@ -127,11 +128,14 @@ let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
127
128
  return null;
128
129
  }
129
130
 
130
- const handleSelect = (event, _ref) => {
131
- let value = _ref.value;
132
- clickHandlers[value](event, {
133
- id: value
134
- });
131
+ const handleSelect = (event, _ref5) => {
132
+ let value = _ref5.value;
133
+
134
+ if (value && typeof clickHandlers[value] === 'function') {
135
+ clickHandlers[value](event, {
136
+ id: `${value}`
137
+ });
138
+ }
135
139
  };
136
140
 
137
141
  return jsx("div", {
@@ -146,9 +150,9 @@ let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
146
150
  renderBeforeInput: selectedOption && IconCheckLine,
147
151
  value: selectedOption,
148
152
  onChange: handleSelect
149
- }, options.map(_ref2 => {
150
- let id = _ref2.id,
151
- label = _ref2.label;
153
+ }, options.map(_ref6 => {
154
+ let id = _ref6.id,
155
+ label = _ref6.label;
152
156
  return jsx(SimpleSelect.Option, {
153
157
  id: id,
154
158
  key: id,
@@ -25,9 +25,6 @@ import PropTypes from 'prop-types';
25
25
  import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
26
26
  import { Row } from '../Row';
27
27
  const propTypes = {
28
- /**
29
- * `Table.Row`
30
- */
31
28
  children: ChildrenPropTypes.oneOf([Row]),
32
29
  isStacked: PropTypes.bool,
33
30
  renderSortLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
@@ -40,6 +40,7 @@ import { allowedProps, propTypes } from './props';
40
40
  parent: Table
41
41
  id: Table.Row
42
42
  ---
43
+ @tsProps
43
44
  **/
44
45
 
45
46
  let Row = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Row extends Component {
@@ -27,9 +27,6 @@ import { ColHeader } from '../ColHeader';
27
27
  import { RowHeader } from '../RowHeader';
28
28
  import { Cell } from '../Cell';
29
29
  const propTypes = {
30
- /**
31
- * `Table.ColHeader`, `Table.RowHeader` or `Table.Cell`
32
- */
33
30
  children: ChildrenPropTypes.oneOf([ColHeader, RowHeader, Cell]),
34
31
  hover: PropTypes.bool,
35
32
  isStacked: PropTypes.bool,
@@ -37,6 +37,7 @@ import { allowedProps, propTypes } from './props';
37
37
  parent: Table
38
38
  id: Table.RowHeader
39
39
  ---
40
+ @tsProps
40
41
  **/
41
42
 
42
43
  let RowHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class RowHeader extends Component {
@@ -25,10 +25,6 @@ import PropTypes from 'prop-types';
25
25
  const propTypes = {
26
26
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
27
27
  isStacked: PropTypes.bool,
28
-
29
- /**
30
- * Control the text alignment in row header
31
- */
32
28
  textAlign: PropTypes.oneOf(['start', 'center', 'end'])
33
29
  };
34
30
  const allowedProps = ['children', 'isStacked', 'textAlign'];
package/es/Table/index.js CHANGED
@@ -45,6 +45,7 @@ import { allowedProps, propTypes } from './props';
45
45
  ---
46
46
  category: components
47
47
  ---
48
+ @tsProps
48
49
  **/
49
50
 
50
51
  let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Table extends Component {
@@ -77,23 +78,23 @@ let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
77
78
  getHeaders() {
78
79
  const children = this.props.children;
79
80
 
80
- const _Children$toArray = Children.toArray(children),
81
- _Children$toArray2 = _slicedToArray(_Children$toArray, 1),
82
- head = _Children$toArray2[0];
81
+ const _ref = Children.toArray(children),
82
+ _ref2 = _slicedToArray(_ref, 1),
83
+ head = _ref2[0];
83
84
 
84
85
  if (matchComponentTypes(head, [Head])) {
85
- const _Children$toArray3 = Children.toArray(head.props.children),
86
- _Children$toArray4 = _slicedToArray(_Children$toArray3, 1),
87
- row = _Children$toArray4[0];
86
+ const _Children$toArray = Children.toArray(head.props.children),
87
+ _Children$toArray2 = _slicedToArray(_Children$toArray, 1),
88
+ row = _Children$toArray2[0];
88
89
 
89
90
  if (matchComponentTypes(row, [Row])) {
90
91
  return Children.map(row.props.children, colHeader => {
91
- return matchComponentTypes(colHeader, [ColHeader]) ? colHeader.props.children : null;
92
+ return matchComponentTypes(colHeader, [ColHeader]) ? colHeader.props.children : void 0;
92
93
  });
93
94
  }
94
95
  }
95
96
 
96
- return null;
97
+ return void 0;
97
98
  }
98
99
 
99
100
  render() {
@@ -105,7 +106,7 @@ let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
105
106
  hover = _this$props3.hover,
106
107
  styles = _this$props3.styles;
107
108
  const isStacked = layout === 'stacked';
108
- const headers = isStacked ? this.getHeaders() : null;
109
+ const headers = isStacked ? this.getHeaders() : void 0;
109
110
  return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Table.allowedProps), Table), {
110
111
  as: isStacked ? 'div' : 'table',
111
112
  margin: margin,
package/es/Table/props.js CHANGED
@@ -27,39 +27,11 @@ import { ThemeablePropTypes } from '@instructure/emotion';
27
27
  import { Head } from './Head';
28
28
  import { Body } from './Body';
29
29
  const propTypes = {
30
- /**
31
- * Provide a screen reader friendly description. Anything passed to this
32
- * prop will be wrapped by `<ScreenReaderContent>` when it is rendered.
33
- */
34
30
  caption: PropTypes.node.isRequired,
35
-
36
- /**
37
- * Build table via `Table.Head` and `Table.Body`
38
- */
39
31
  children: ChildrenPropTypes.oneOf([Head, Body]),
40
-
41
- /**
42
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
43
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
44
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
45
- */
46
32
  margin: ThemeablePropTypes.spacing,
47
-
48
- /**
49
- * Provide a reference to the underlying html element
50
- */
51
33
  elementRef: PropTypes.func,
52
-
53
- /**
54
- * Highlight each row on hover
55
- */
56
34
  hover: PropTypes.bool,
57
-
58
- /**
59
- * `auto` lets the browser determine table column widths based on cell content,
60
- * while `fixed` forces columns of equal width. `stacked` renders table in one
61
- * column to be more readable on narrow screens
62
- */
63
35
  layout: PropTypes.oneOf(['auto', 'fixed', 'stacked'])
64
36
  };
65
37
  const allowedProps = ['caption', 'children', 'margin', 'elementRef', 'hover', 'layout'];
@@ -34,6 +34,7 @@ var _dec, _class, _class2, _temp;
34
34
  parent: Table
35
35
  id: Table.Body
36
36
  ---
37
+ @tsProps
37
38
  **/
38
39
  let Body = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Body extends _react.Component {
39
40
  componentDidMount() {
@@ -42,7 +43,7 @@ let Body = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
42
43
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
43
44
  }
44
45
 
45
- componentDidUpdate(prevProps, prevState, snapshot) {
46
+ componentDidUpdate() {
46
47
  var _this$props$makeStyle2, _this$props2;
47
48
 
48
49
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
@@ -37,9 +37,6 @@ var _Row = require("../Row");
37
37
  * SOFTWARE.
38
38
  */
39
39
  const propTypes = {
40
- /**
41
- * `Table.Row`
42
- */
43
40
  children: _Children.Children.oneOf([_Row.Row]),
44
41
  hover: _propTypes.default.bool,
45
42
  isStacked: _propTypes.default.bool,
@@ -30,6 +30,7 @@ var _dec, _class, _class2, _temp;
30
30
  parent: Table
31
31
  id: Table.Cell
32
32
  ---
33
+ @tsProps
33
34
  **/
34
35
  let Cell = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Cell extends _react.Component {
35
36
  componentDidMount() {
@@ -36,10 +36,6 @@ const propTypes = {
36
36
  children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
37
37
  isStacked: _propTypes.default.bool,
38
38
  header: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
39
-
40
- /**
41
- * Control the text alignment in cell
42
- */
43
39
  textAlign: _propTypes.default.oneOf(['start', 'center', 'end'])
44
40
  };
45
41
  exports.propTypes = propTypes;
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
3
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
6
 
5
7
  Object.defineProperty(exports, "__esModule", {
@@ -7,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
7
9
  });
8
10
  exports.default = exports.ColHeader = void 0;
9
11
 
10
- var _react = require("react");
12
+ var _react = _interopRequireWildcard(require("react"));
11
13
 
12
14
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
13
15
 
@@ -32,6 +34,7 @@ var _dec, _class, _class2, _temp, _IconMiniArrowUpLine, _IconMiniArrowDownLin;
32
34
  parent: Table
33
35
  id: Table.ColHeader
34
36
  ---
37
+ @tsProps
35
38
  **/
36
39
  let ColHeader = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class ColHeader extends _react.Component {
37
40
  constructor() {
@@ -41,7 +44,7 @@ let ColHeader = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
41
44
  const _this$props = this.props,
42
45
  id = _this$props.id,
43
46
  onRequestSort = _this$props.onRequestSort;
44
- onRequestSort(event, {
47
+ onRequestSort && onRequestSort(event, {
45
48
  id
46
49
  });
47
50
  };
@@ -33,43 +33,13 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
33
33
  * SOFTWARE.
34
34
  */
35
35
  const propTypes = {
36
- /**
37
- * A unique id for this column. The `id` is also used as option in combobox,
38
- * when sortable table is in stacked layout,
39
- * and no `stackedSortByLabel` is provided.
40
- */
41
36
  id: _propTypes.default.string.isRequired,
42
-
43
- /**
44
- * A custom string to display as option text in the combobox (instead of
45
- * using the `id` prop), when sortable table is in stacked layout.
46
- */
47
37
  stackedSortByLabel: _propTypes.default.string,
48
38
  children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
49
-
50
- /**
51
- * Control the width of column.
52
- */
53
39
  width: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
54
-
55
- /**
56
- * Control the text alignment in column header
57
- */
58
40
  textAlign: _propTypes.default.oneOf(['start', 'center', 'end']),
59
-
60
- /**
61
- * The string of sorting direction
62
- */
63
41
  sortDirection: _propTypes.default.oneOf(['none', 'ascending', 'descending']),
64
-
65
- /**
66
- * Callback fired when column header is clicked. Parameters: `(event, { id })`
67
- */
68
42
  onRequestSort: _propTypes.default.func,
69
-
70
- /**
71
- * The column header scope attribute. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope
72
- */
73
43
  scope: _propTypes.default.oneOf(['row', 'col', 'rowgroup', 'colgroup', 'auto'])
74
44
  };
75
45
  exports.propTypes = propTypes;
@@ -44,12 +44,13 @@ var _dec, _class, _class2, _temp, _ScreenReaderContent;
44
44
  parent: Table
45
45
  id: Table.Head
46
46
  ---
47
+ @tsProps
47
48
  **/
48
49
  let Head = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Head extends _react.Component {
49
50
  get isSortable() {
50
- const _Children$toArray = _react.Children.toArray(this.props.children),
51
- _Children$toArray2 = (0, _slicedToArray2.default)(_Children$toArray, 1),
52
- row = _Children$toArray2[0];
51
+ const _ref = _react.Children.toArray(this.props.children),
52
+ _ref2 = (0, _slicedToArray2.default)(_ref, 1),
53
+ row = _ref2[0];
53
54
 
54
55
  let sortable = false;
55
56
 
@@ -85,9 +86,9 @@ let Head = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
85
86
  children = _this$props3.children,
86
87
  renderSortLabel = _this$props3.renderSortLabel;
87
88
 
88
- const _Children$toArray3 = _react.Children.toArray(children),
89
- _Children$toArray4 = (0, _slicedToArray2.default)(_Children$toArray3, 1),
90
- row = _Children$toArray4[0];
89
+ const _ref3 = _react.Children.toArray(children),
90
+ _ref4 = (0, _slicedToArray2.default)(_ref3, 1),
91
+ row = _ref4[0];
91
92
 
92
93
  if (!(0, _matchComponentTypes.matchComponentTypes)(row, [_Row.Row])) {
93
94
  return null;
@@ -95,7 +96,7 @@ let Head = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
95
96
 
96
97
  const options = [];
97
98
  const clickHandlers = {};
98
- let selectedOption = void 0;
99
+ let selectedOption;
99
100
  let count = 0;
100
101
 
101
102
  _react.Children.forEach(row.props.children, colHeader => {
@@ -127,11 +128,14 @@ let Head = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
127
128
  return null;
128
129
  }
129
130
 
130
- const handleSelect = (event, _ref) => {
131
- let value = _ref.value;
132
- clickHandlers[value](event, {
133
- id: value
134
- });
131
+ const handleSelect = (event, _ref5) => {
132
+ let value = _ref5.value;
133
+
134
+ if (value && typeof clickHandlers[value] === 'function') {
135
+ clickHandlers[value](event, {
136
+ id: `${value}`
137
+ });
138
+ }
135
139
  };
136
140
 
137
141
  return (0, _emotion.jsx)("div", {
@@ -146,9 +150,9 @@ let Head = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
146
150
  renderBeforeInput: selectedOption && _IconCheckLine.IconCheckLine,
147
151
  value: selectedOption,
148
152
  onChange: handleSelect
149
- }, options.map(_ref2 => {
150
- let id = _ref2.id,
151
- label = _ref2.label;
153
+ }, options.map(_ref6 => {
154
+ let id = _ref6.id,
155
+ label = _ref6.label;
152
156
  return (0, _emotion.jsx)(_SimpleSelect.SimpleSelect.Option, {
153
157
  id: id,
154
158
  key: id,
@@ -37,9 +37,6 @@ var _Row = require("../Row");
37
37
  * SOFTWARE.
38
38
  */
39
39
  const propTypes = {
40
- /**
41
- * `Table.Row`
42
- */
43
40
  children: _Children.Children.oneOf([_Row.Row]),
44
41
  isStacked: _propTypes.default.bool,
45
42
  renderSortLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func])
@@ -38,6 +38,7 @@ var _dec, _class, _class2, _temp;
38
38
  parent: Table
39
39
  id: Table.Row
40
40
  ---
41
+ @tsProps
41
42
  **/
42
43
  let Row = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Row extends _react.Component {
43
44
  componentDidMount() {
@@ -41,9 +41,6 @@ var _Cell = require("../Cell");
41
41
  * SOFTWARE.
42
42
  */
43
43
  const propTypes = {
44
- /**
45
- * `Table.ColHeader`, `Table.RowHeader` or `Table.Cell`
46
- */
47
44
  children: _Children.Children.oneOf([_ColHeader.ColHeader, _RowHeader.RowHeader, _Cell.Cell]),
48
45
  hover: _propTypes.default.bool,
49
46
  isStacked: _propTypes.default.bool,
@@ -30,6 +30,7 @@ var _dec, _class, _class2, _temp;
30
30
  parent: Table
31
31
  id: Table.RowHeader
32
32
  ---
33
+ @tsProps
33
34
  **/
34
35
  let RowHeader = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class RowHeader extends _react.Component {
35
36
  componentDidMount() {
@@ -35,10 +35,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
35
35
  const propTypes = {
36
36
  children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
37
37
  isStacked: _propTypes.default.bool,
38
-
39
- /**
40
- * Control the text alignment in row header
41
- */
42
38
  textAlign: _propTypes.default.oneOf(['start', 'center', 'end'])
43
39
  };
44
40
  exports.propTypes = propTypes;
@@ -47,6 +47,7 @@ var _dec, _class, _class2, _temp;
47
47
  ---
48
48
  category: components
49
49
  ---
50
+ @tsProps
50
51
  **/
51
52
  let Table = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Table extends _react.Component {
52
53
  constructor() {
@@ -78,23 +79,23 @@ let Table = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
78
79
  getHeaders() {
79
80
  const children = this.props.children;
80
81
 
81
- const _Children$toArray = _react.Children.toArray(children),
82
- _Children$toArray2 = (0, _slicedToArray2.default)(_Children$toArray, 1),
83
- head = _Children$toArray2[0];
82
+ const _ref = _react.Children.toArray(children),
83
+ _ref2 = (0, _slicedToArray2.default)(_ref, 1),
84
+ head = _ref2[0];
84
85
 
85
86
  if ((0, _matchComponentTypes.matchComponentTypes)(head, [_Head.Head])) {
86
- const _Children$toArray3 = _react.Children.toArray(head.props.children),
87
- _Children$toArray4 = (0, _slicedToArray2.default)(_Children$toArray3, 1),
88
- row = _Children$toArray4[0];
87
+ const _Children$toArray = _react.Children.toArray(head.props.children),
88
+ _Children$toArray2 = (0, _slicedToArray2.default)(_Children$toArray, 1),
89
+ row = _Children$toArray2[0];
89
90
 
90
91
  if ((0, _matchComponentTypes.matchComponentTypes)(row, [_Row.Row])) {
91
92
  return _react.Children.map(row.props.children, colHeader => {
92
- return (0, _matchComponentTypes.matchComponentTypes)(colHeader, [_ColHeader.ColHeader]) ? colHeader.props.children : null;
93
+ return (0, _matchComponentTypes.matchComponentTypes)(colHeader, [_ColHeader.ColHeader]) ? colHeader.props.children : void 0;
93
94
  });
94
95
  }
95
96
  }
96
97
 
97
- return null;
98
+ return void 0;
98
99
  }
99
100
 
100
101
  render() {
@@ -106,7 +107,7 @@ let Table = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
106
107
  hover = _this$props3.hover,
107
108
  styles = _this$props3.styles;
108
109
  const isStacked = layout === 'stacked';
109
- const headers = isStacked ? this.getHeaders() : null;
110
+ const headers = isStacked ? this.getHeaders() : void 0;
110
111
  return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Table.allowedProps), Table), {
111
112
  as: isStacked ? 'div' : 'table',
112
113
  margin: margin,