@instructure/ui-table 8.8.1-snapshot.8 → 8.9.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 (113) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/es/Table/Body/index.js +16 -28
  3. package/{src/Table/Cell/types.ts → es/Table/Body/props.js} +14 -8
  4. package/es/Table/Cell/index.js +16 -28
  5. package/{src/Table/types.ts → es/Table/Cell/props.js} +12 -11
  6. package/es/Table/ColHeader/index.js +22 -63
  7. package/es/Table/ColHeader/props.js +66 -0
  8. package/es/Table/Head/index.js +18 -29
  9. package/{src/Table/Body/types.ts → es/Table/Head/props.js} +13 -8
  10. package/es/Table/Row/index.js +16 -28
  11. package/{src/Table/ColHeader/types.ts → es/Table/Row/props.js} +16 -12
  12. package/es/Table/RowHeader/index.js +15 -26
  13. package/{src/Table/Head/types.ts → es/Table/RowHeader/props.js} +11 -6
  14. package/es/Table/index.js +21 -60
  15. package/es/Table/props.js +66 -0
  16. package/lib/Table/Body/index.js +16 -29
  17. package/lib/Table/Body/props.js +50 -0
  18. package/lib/Table/Cell/index.js +16 -28
  19. package/lib/Table/Cell/props.js +47 -0
  20. package/lib/Table/ColHeader/index.js +22 -63
  21. package/lib/Table/ColHeader/props.js +77 -0
  22. package/lib/Table/Head/index.js +18 -30
  23. package/lib/Table/Head/props.js +49 -0
  24. package/lib/Table/Row/index.js +16 -29
  25. package/lib/Table/Row/props.js +54 -0
  26. package/lib/Table/RowHeader/index.js +15 -26
  27. package/lib/Table/RowHeader/props.js +46 -0
  28. package/lib/Table/index.js +20 -60
  29. package/lib/Table/props.js +81 -0
  30. package/package.json +17 -18
  31. package/src/Table/Body/index.tsx +7 -25
  32. package/src/Table/{Row/types.ts → Body/props.ts} +39 -3
  33. package/src/Table/Cell/index.tsx +8 -24
  34. package/src/Table/Cell/props.ts +62 -0
  35. package/src/Table/Cell/styles.ts +1 -1
  36. package/src/Table/ColHeader/index.tsx +9 -51
  37. package/src/Table/ColHeader/props.ts +94 -0
  38. package/src/Table/ColHeader/styles.ts +1 -1
  39. package/src/Table/Head/index.tsx +8 -24
  40. package/src/Table/Head/props.ts +62 -0
  41. package/src/Table/Row/index.tsx +8 -27
  42. package/src/Table/Row/props.ts +70 -0
  43. package/src/Table/Row/styles.ts +1 -1
  44. package/src/Table/RowHeader/index.tsx +8 -23
  45. package/src/Table/RowHeader/{types.ts → props.ts} +28 -3
  46. package/src/Table/RowHeader/styles.ts +1 -1
  47. package/src/Table/index.tsx +10 -49
  48. package/src/Table/props.ts +93 -0
  49. package/src/Table/styles.ts +1 -1
  50. package/src/index.ts +7 -7
  51. package/types/Table/Body/index.d.ts +13 -16
  52. package/types/Table/Body/index.d.ts.map +1 -1
  53. package/types/Table/Body/props.d.ts +17 -0
  54. package/types/Table/Body/props.d.ts.map +1 -0
  55. package/types/Table/Cell/index.d.ts +14 -14
  56. package/types/Table/Cell/index.d.ts.map +1 -1
  57. package/types/Table/Cell/props.d.ts +17 -0
  58. package/types/Table/Cell/props.d.ts.map +1 -0
  59. package/types/Table/Cell/styles.d.ts +1 -1
  60. package/types/Table/ColHeader/index.d.ts +22 -40
  61. package/types/Table/ColHeader/index.d.ts.map +1 -1
  62. package/types/Table/ColHeader/props.d.ts +21 -0
  63. package/types/Table/ColHeader/props.d.ts.map +1 -0
  64. package/types/Table/ColHeader/styles.d.ts +1 -1
  65. package/types/Table/Head/index.d.ts +11 -15
  66. package/types/Table/Head/index.d.ts.map +1 -1
  67. package/types/Table/Head/props.d.ts +16 -0
  68. package/types/Table/Head/props.d.ts.map +1 -0
  69. package/types/Table/Row/index.d.ts +14 -17
  70. package/types/Table/Row/index.d.ts.map +1 -1
  71. package/types/Table/Row/props.d.ts +17 -0
  72. package/types/Table/Row/props.d.ts.map +1 -0
  73. package/types/Table/Row/styles.d.ts +1 -1
  74. package/types/Table/RowHeader/index.d.ts +12 -13
  75. package/types/Table/RowHeader/index.d.ts.map +1 -1
  76. package/types/Table/RowHeader/props.d.ts +16 -0
  77. package/types/Table/RowHeader/props.d.ts.map +1 -0
  78. package/types/Table/RowHeader/styles.d.ts +1 -1
  79. package/types/Table/index.d.ts +18 -41
  80. package/types/Table/index.d.ts.map +1 -1
  81. package/types/Table/props.d.ts +19 -0
  82. package/types/Table/props.d.ts.map +1 -0
  83. package/types/Table/styles.d.ts +1 -1
  84. package/types/index.d.ts +7 -7
  85. package/LICENSE.md +0 -27
  86. package/es/Table/Body/types.js +0 -1
  87. package/es/Table/Cell/types.js +0 -1
  88. package/es/Table/ColHeader/types.js +0 -1
  89. package/es/Table/Head/types.js +0 -1
  90. package/es/Table/Row/types.js +0 -1
  91. package/es/Table/RowHeader/types.js +0 -1
  92. package/es/Table/types.js +0 -1
  93. package/lib/Table/Body/types.js +0 -1
  94. package/lib/Table/Cell/types.js +0 -1
  95. package/lib/Table/ColHeader/types.js +0 -1
  96. package/lib/Table/Head/types.js +0 -1
  97. package/lib/Table/Row/types.js +0 -1
  98. package/lib/Table/RowHeader/types.js +0 -1
  99. package/lib/Table/types.js +0 -1
  100. package/types/Table/Body/types.d.ts +0 -9
  101. package/types/Table/Body/types.d.ts.map +0 -1
  102. package/types/Table/Cell/types.d.ts +0 -9
  103. package/types/Table/Cell/types.d.ts.map +0 -1
  104. package/types/Table/ColHeader/types.d.ts +0 -12
  105. package/types/Table/ColHeader/types.d.ts.map +0 -1
  106. package/types/Table/Head/types.d.ts +0 -8
  107. package/types/Table/Head/types.d.ts.map +0 -1
  108. package/types/Table/Row/types.d.ts +0 -9
  109. package/types/Table/Row/types.d.ts.map +0 -1
  110. package/types/Table/RowHeader/types.d.ts +0 -7
  111. package/types/Table/RowHeader/types.d.ts.map +0 -1
  112. package/types/Table/types.d.ts +0 -12
  113. package/types/Table/types.d.ts.map +0 -1
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.allowedProps = exports.propTypes = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _Children = require("@instructure/ui-prop-types/lib/Children.js");
13
+
14
+ var _Row = require("../Row");
15
+
16
+ /*
17
+ * The MIT License (MIT)
18
+ *
19
+ * Copyright (c) 2015 - present Instructure, Inc.
20
+ *
21
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
22
+ * of this software and associated documentation files (the "Software"), to deal
23
+ * in the Software without restriction, including without limitation the rights
24
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
+ * copies of the Software, and to permit persons to whom the Software is
26
+ * furnished to do so, subject to the following conditions:
27
+ *
28
+ * The above copyright notice and this permission notice shall be included in all
29
+ * copies or substantial portions of the Software.
30
+ *
31
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ * SOFTWARE.
38
+ */
39
+ const propTypes = {
40
+ /**
41
+ * `Table.Row`
42
+ */
43
+ children: _Children.Children.oneOf([_Row.Row]),
44
+ hover: _propTypes.default.bool,
45
+ isStacked: _propTypes.default.bool,
46
+ headers: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]))
47
+ };
48
+ exports.propTypes = propTypes;
49
+ const allowedProps = ['children', 'hover', 'isStacked', 'headers'];
50
+ exports.allowedProps = allowedProps;
@@ -9,8 +9,6 @@ exports.Cell = exports.default = void 0;
9
9
 
10
10
  var _react = require("react");
11
11
 
12
- var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
12
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
15
13
 
16
14
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
@@ -23,6 +21,8 @@ var _styles = _interopRequireDefault(require("./styles"));
23
21
 
24
22
  var _theme = _interopRequireDefault(require("./theme"));
25
23
 
24
+ var _props = require("./props");
25
+
26
26
  var _dec, _class, _class2, _temp;
27
27
 
28
28
  /**
@@ -32,44 +32,32 @@ id: Table.Cell
32
32
  ---
33
33
  **/
34
34
  let Cell = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Cell extends _react.Component {
35
- /* eslint-disable react/require-default-props */
36
-
37
- /* eslint-enable react/require-default-props */
38
35
  componentDidMount() {
39
- this.props.makeStyles();
36
+ var _this$props$makeStyle, _this$props;
37
+
38
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
40
39
  }
41
40
 
42
- componentDidUpdate(prevProps, prevState, snapshot) {
43
- this.props.makeStyles();
41
+ componentDidUpdate() {
42
+ var _this$props$makeStyle2, _this$props2;
43
+
44
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
44
45
  }
45
46
 
46
47
  render() {
47
- const _this$props = this.props,
48
- children = _this$props.children,
49
- styles = _this$props.styles,
50
- isStacked = _this$props.isStacked,
51
- header = _this$props.header;
48
+ const _this$props3 = this.props,
49
+ children = _this$props3.children,
50
+ styles = _this$props3.styles,
51
+ isStacked = _this$props3.isStacked,
52
+ header = _this$props3.header;
52
53
  return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Cell.propTypes), Cell), {
53
54
  as: isStacked ? 'div' : 'td',
54
- css: styles.cell,
55
+ css: styles === null || styles === void 0 ? void 0 : styles.cell,
55
56
  role: isStacked ? 'cell' : void 0
56
57
  }), header && (0, _callRenderProp.callRenderProp)(header), header && ': ', (0, _callRenderProp.callRenderProp)(children));
57
58
  }
58
59
 
59
- }, _class2.displayName = "Cell", _class2.componentId = 'Table.Cell', _class2.propTypes = {
60
- // eslint-disable-next-line react/require-default-props
61
- makeStyles: _propTypes.default.func,
62
- // eslint-disable-next-line react/require-default-props
63
- styles: _propTypes.default.object,
64
- children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
65
- isStacked: _propTypes.default.bool,
66
- header: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
67
-
68
- /**
69
- * Control the text alignment in cell
70
- */
71
- textAlign: _propTypes.default.oneOf(['start', 'center', 'end'])
72
- }, _class2.defaultProps = {
60
+ }, _class2.displayName = "Cell", _class2.componentId = 'Table.Cell', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
73
61
  textAlign: 'start',
74
62
  children: null
75
63
  }, _temp)) || _class);
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.allowedProps = exports.propTypes = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ /*
13
+ * The MIT License (MIT)
14
+ *
15
+ * Copyright (c) 2015 - present Instructure, Inc.
16
+ *
17
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ * of this software and associated documentation files (the "Software"), to deal
19
+ * in the Software without restriction, including without limitation the rights
20
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ * copies of the Software, and to permit persons to whom the Software is
22
+ * furnished to do so, subject to the following conditions:
23
+ *
24
+ * The above copyright notice and this permission notice shall be included in all
25
+ * copies or substantial portions of the Software.
26
+ *
27
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ * SOFTWARE.
34
+ */
35
+ const propTypes = {
36
+ children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
37
+ isStacked: _propTypes.default.bool,
38
+ header: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
39
+
40
+ /**
41
+ * Control the text alignment in cell
42
+ */
43
+ textAlign: _propTypes.default.oneOf(['start', 'center', 'end'])
44
+ };
45
+ exports.propTypes = propTypes;
46
+ const allowedProps = ['children', 'isStacked', 'header', 'textAlign'];
47
+ exports.allowedProps = allowedProps;
@@ -9,8 +9,6 @@ exports.ColHeader = exports.default = void 0;
9
9
 
10
10
  var _react = require("react");
11
11
 
12
- var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
12
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
15
13
 
16
14
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
@@ -25,6 +23,8 @@ var _styles = _interopRequireDefault(require("./styles"));
25
23
 
26
24
  var _theme = _interopRequireDefault(require("./theme"));
27
25
 
26
+ var _props = require("./props");
27
+
28
28
  var _dec, _class, _class2, _temp, _IconMiniArrowUpLine, _IconMiniArrowDownLin;
29
29
 
30
30
  /**
@@ -48,17 +48,21 @@ let ColHeader = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
48
48
  }
49
49
 
50
50
  componentDidMount() {
51
- this.props.makeStyles();
51
+ var _this$props$makeStyle, _this$props2;
52
+
53
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
52
54
  }
53
55
 
54
- componentDidUpdate(prevProps, prevState, snapshot) {
55
- this.props.makeStyles();
56
+ componentDidUpdate() {
57
+ var _this$props$makeStyle2, _this$props3;
58
+
59
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
56
60
  }
57
61
 
58
62
  renderSortArrow() {
59
- const _this$props2 = this.props,
60
- sortDirection = _this$props2.sortDirection,
61
- onRequestSort = _this$props2.onRequestSort;
63
+ const _this$props4 = this.props,
64
+ sortDirection = _this$props4.sortDirection,
65
+ onRequestSort = _this$props4.onRequestSort;
62
66
 
63
67
  if (sortDirection === 'ascending') {
64
68
  return _IconMiniArrowUpLine || (_IconMiniArrowUpLine = (0, _emotion.jsx)(_IconMiniArrowUpLine2.IconMiniArrowUpLine, null));
@@ -81,15 +85,15 @@ let ColHeader = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
81
85
  }
82
86
 
83
87
  render() {
84
- const _this$props3 = this.props,
85
- onRequestSort = _this$props3.onRequestSort,
86
- width = _this$props3.width,
87
- children = _this$props3.children,
88
- sortDirection = _this$props3.sortDirection,
89
- scope = _this$props3.scope,
90
- styles = _this$props3.styles;
88
+ const _this$props5 = this.props,
89
+ onRequestSort = _this$props5.onRequestSort,
90
+ width = _this$props5.width,
91
+ children = _this$props5.children,
92
+ sortDirection = _this$props5.sortDirection,
93
+ scope = _this$props5.scope,
94
+ styles = _this$props5.styles;
91
95
  return (0, _emotion.jsx)("th", Object.assign({}, (0, _omitProps.omitProps)(this.props, ColHeader.propTypes), {
92
- css: styles.colHeader,
96
+ css: styles === null || styles === void 0 ? void 0 : styles.colHeader,
93
97
  style: {
94
98
  width
95
99
  },
@@ -97,58 +101,13 @@ let ColHeader = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
97
101
  "aria-sort": sortDirection
98
102
  }), onRequestSort && (0, _emotion.jsx)("button", {
99
103
  onClick: this.handleClick,
100
- css: styles.button
104
+ css: styles === null || styles === void 0 ? void 0 : styles.button
101
105
  }, (0, _emotion.jsx)("div", null, (0, _callRenderProp.callRenderProp)(children), this.renderSortArrow())), !onRequestSort && children, !onRequestSort && this.renderSortArrow());
102
106
  }
103
107
 
104
- }, _class2.displayName = "ColHeader", _class2.componentId = 'Table.ColHeader', _class2.propTypes = {
105
- // eslint-disable-next-line react/require-default-props
106
- makeStyles: _propTypes.default.func,
107
- // eslint-disable-next-line react/require-default-props
108
- styles: _propTypes.default.object,
109
-
110
- /**
111
- * A unique id for this column. The `id` is also used as option in combobox,
112
- * when sortable table is in stacked layout,
113
- * and no `stackedSortByLabel` is provided.
114
- */
115
- id: _propTypes.default.string.isRequired,
116
-
117
- /**
118
- * A custom string to display as option text in the combobox (instead of
119
- * using the `id` prop), when sortable table is in stacked layout.
120
- */
121
- stackedSortByLabel: _propTypes.default.string,
122
- children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
123
-
124
- /**
125
- * Control the width of column.
126
- */
127
- width: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
128
-
129
- /**
130
- * Control the text alignment in column header
131
- */
132
- textAlign: _propTypes.default.oneOf(['start', 'center', 'end']),
133
-
134
- /**
135
- * The string of sorting direction
136
- */
137
- sortDirection: _propTypes.default.oneOf(['none', 'ascending', 'descending']),
138
-
139
- /**
140
- * Callback fired when column header is clicked. Parameters: `(event, { id })`
141
- */
142
- onRequestSort: _propTypes.default.func,
143
-
144
- /**
145
- * The column header scope attribute. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope
146
- */
147
- scope: _propTypes.default.oneOf(['row', 'col', 'rowgroup', 'colgroup', 'auto'])
148
- }, _class2.defaultProps = {
108
+ }, _class2.displayName = "ColHeader", _class2.componentId = 'Table.ColHeader', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
149
109
  textAlign: 'start',
150
110
  sortDirection: 'none',
151
- stackedSortByLabel: void 0,
152
111
  children: null,
153
112
  scope: 'col'
154
113
  }, _temp)) || _class);
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.allowedProps = exports.propTypes = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ /*
13
+ * The MIT License (MIT)
14
+ *
15
+ * Copyright (c) 2015 - present Instructure, Inc.
16
+ *
17
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ * of this software and associated documentation files (the "Software"), to deal
19
+ * in the Software without restriction, including without limitation the rights
20
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ * copies of the Software, and to permit persons to whom the Software is
22
+ * furnished to do so, subject to the following conditions:
23
+ *
24
+ * The above copyright notice and this permission notice shall be included in all
25
+ * copies or substantial portions of the Software.
26
+ *
27
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ * SOFTWARE.
34
+ */
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
+ 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
+ stackedSortByLabel: _propTypes.default.string,
48
+ children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
49
+
50
+ /**
51
+ * Control the width of column.
52
+ */
53
+ width: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
54
+
55
+ /**
56
+ * Control the text alignment in column header
57
+ */
58
+ textAlign: _propTypes.default.oneOf(['start', 'center', 'end']),
59
+
60
+ /**
61
+ * The string of sorting direction
62
+ */
63
+ sortDirection: _propTypes.default.oneOf(['none', 'ascending', 'descending']),
64
+
65
+ /**
66
+ * Callback fired when column header is clicked. Parameters: `(event, { id })`
67
+ */
68
+ 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
+ scope: _propTypes.default.oneOf(['row', 'col', 'rowgroup', 'colgroup', 'auto'])
74
+ };
75
+ exports.propTypes = propTypes;
76
+ const allowedProps = ['id', 'stackedSortByLabel', 'children', 'width', 'textAlign', 'sortDirection', 'onRequestSort', 'scope'];
77
+ exports.allowedProps = allowedProps;
@@ -11,16 +11,12 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
11
11
 
12
12
  var _react = require("react");
13
13
 
14
- var _propTypes = _interopRequireDefault(require("prop-types"));
15
-
16
14
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
17
15
 
18
16
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
19
17
 
20
18
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
21
19
 
22
- var _Children = require("@instructure/ui-prop-types/lib/Children.js");
23
-
24
20
  var _SimpleSelect = require("@instructure/ui-simple-select/lib/SimpleSelect");
25
21
 
26
22
  var _ScreenReaderContent2 = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
@@ -39,6 +35,8 @@ var _Row = require("../Row");
39
35
 
40
36
  var _ColHeader = require("../ColHeader");
41
37
 
38
+ var _props = require("./props");
39
+
42
40
  var _dec, _class, _class2, _temp, _ScreenReaderContent;
43
41
 
44
42
  /**
@@ -48,9 +46,6 @@ id: Table.Head
48
46
  ---
49
47
  **/
50
48
  let Head = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Head extends _react.Component {
51
- /* eslint-disable react/require-default-props */
52
-
53
- /* eslint-enable react/require-default-props */
54
49
  get isSortable() {
55
50
  const _Children$toArray = _react.Children.toArray(this.props.children),
56
51
  _Children$toArray2 = (0, _slicedToArray2.default)(_Children$toArray, 1),
@@ -70,21 +65,25 @@ let Head = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
70
65
  }
71
66
 
72
67
  componentDidMount() {
73
- this.props.makeStyles();
68
+ var _this$props$makeStyle, _this$props;
69
+
70
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
74
71
  }
75
72
 
76
73
  componentDidUpdate() {
74
+ var _this$props$makeStyle2, _this$props2;
75
+
77
76
  if (this.isSortable && typeof this.props.renderSortLabel === 'undefined') {
78
77
  (0, _console.warn)(false, '[Table.Head] The `renderSortLabel` prop should be provided when Table is sortable.');
79
78
  }
80
79
 
81
- this.props.makeStyles();
80
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
82
81
  }
83
82
 
84
83
  renderSelect() {
85
- const _this$props = this.props,
86
- children = _this$props.children,
87
- renderSortLabel = _this$props.renderSortLabel;
84
+ const _this$props3 = this.props,
85
+ children = _this$props3.children,
86
+ renderSortLabel = _this$props3.renderSortLabel;
88
87
 
89
88
  const _Children$toArray3 = _react.Children.toArray(children),
90
89
  _Children$toArray4 = (0, _slicedToArray2.default)(_Children$toArray3, 1),
@@ -96,7 +95,7 @@ let Head = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
96
95
 
97
96
  const options = [];
98
97
  const clickHandlers = {};
99
- let selectedOption = null;
98
+ let selectedOption = void 0;
100
99
  let count = 0;
101
100
 
102
101
  _react.Children.forEach(row.props.children, colHeader => {
@@ -164,27 +163,16 @@ let Head = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
164
163
  }
165
164
 
166
165
  render() {
167
- const _this$props2 = this.props,
168
- children = _this$props2.children,
169
- isStacked = _this$props2.isStacked,
170
- styles = _this$props2.styles;
166
+ const _this$props4 = this.props,
167
+ children = _this$props4.children,
168
+ isStacked = _this$props4.isStacked,
169
+ styles = _this$props4.styles;
171
170
  return isStacked ? this.renderSelect() : (0, _emotion.jsx)("thead", Object.assign({}, (0, _omitProps.omitProps)(this.props, Head.propTypes), {
172
- css: styles.head
171
+ css: styles === null || styles === void 0 ? void 0 : styles.head
173
172
  }), _react.Children.map(children, child => (0, _matchComponentTypes.matchComponentTypes)(child, [_Row.Row]) ? child : null));
174
173
  }
175
174
 
176
- }, _class2.displayName = "Head", _class2.componentId = 'Table.Head', _class2.propTypes = {
177
- /**
178
- * `Table.Row`
179
- */
180
- // eslint-disable-next-line react/require-default-props
181
- makeStyles: _propTypes.default.func,
182
- // eslint-disable-next-line react/require-default-props
183
- styles: _propTypes.default.object,
184
- children: _Children.Children.oneOf([_Row.Row]),
185
- isStacked: _propTypes.default.bool,
186
- renderSortLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func])
187
- }, _class2.defaultProps = {
175
+ }, _class2.displayName = "Head", _class2.componentId = 'Table.Head', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
188
176
  children: null
189
177
  }, _temp)) || _class);
190
178
  exports.Head = Head;