@instructure/ui-table 8.56.3 → 8.56.5-pr-snapshot-1728655013879
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 +16 -0
- package/lib/Table/Body/index.js +4 -6
- package/lib/Table/Body/props.js +2 -2
- package/lib/Table/Cell/index.js +4 -5
- package/lib/Table/ColHeader/index.js +7 -10
- package/lib/Table/Head/index.js +14 -16
- package/lib/Table/Head/props.js +2 -2
- package/lib/Table/Row/index.js +8 -10
- package/lib/Table/Row/props.js +2 -2
- package/lib/Table/RowHeader/index.js +4 -5
- package/lib/Table/index.js +12 -14
- package/lib/Table/props.js +2 -2
- package/package.json +16 -16
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,22 @@
|
|
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.56.5-pr-snapshot-1728655013879](https://github.com/instructure/instructure-ui/compare/v8.56.4...v8.56.5-pr-snapshot-1728655013879) (2024-10-11)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @instructure/ui-table
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
## [8.56.4](https://github.com/instructure/instructure-ui/compare/v8.56.3...v8.56.4) (2024-10-02)
|
15
|
+
|
16
|
+
**Note:** Version bump only for package @instructure/ui-table
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
6
22
|
## [8.56.3](https://github.com/instructure/instructure-ui/compare/v8.56.2...v8.56.3) (2024-09-18)
|
7
23
|
|
8
24
|
**Note:** Version bump only for package @instructure/ui-table
|
package/lib/Table/Body/index.js
CHANGED
@@ -6,10 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.default = exports.Body = void 0;
|
8
8
|
var _react = require("react");
|
9
|
-
var
|
10
|
-
var
|
11
|
-
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
12
|
-
var _View = require("@instructure/ui-view/lib/View");
|
9
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
10
|
+
var _uiView = require("@instructure/ui-view");
|
13
11
|
var _emotion = require("@instructure/emotion");
|
14
12
|
var _styles = _interopRequireDefault(require("./styles"));
|
15
13
|
var _theme = _interopRequireDefault(require("./theme"));
|
@@ -62,11 +60,11 @@ let Body = exports.Body = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
62
60
|
isStacked = _this$props3.isStacked,
|
63
61
|
headers = _this$props3.headers,
|
64
62
|
styles = _this$props3.styles;
|
65
|
-
return (0, _emotion.jsx)(
|
63
|
+
return (0, _emotion.jsx)(_uiView.View, Object.assign({}, _uiView.View.omitViewProps((0, _uiReactUtils.omitProps)(this.props, Body.allowedProps), Body), {
|
66
64
|
as: isStacked ? 'div' : 'tbody',
|
67
65
|
css: styles === null || styles === void 0 ? void 0 : styles.body,
|
68
66
|
role: isStacked ? 'rowgroup' : void 0
|
69
|
-
}), _react.Children.map(children, child => (0,
|
67
|
+
}), _react.Children.map(children, child => (0, _uiReactUtils.matchComponentTypes)(child, [_Row.Row]) ? (0, _uiReactUtils.safeCloneElement)(child, {
|
70
68
|
key: child.props.name,
|
71
69
|
hover,
|
72
70
|
isStacked,
|
package/lib/Table/Body/props.js
CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
|
-
var
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
10
10
|
var _Row = require("../Row");
|
11
11
|
/*
|
12
12
|
* The MIT License (MIT)
|
@@ -33,7 +33,7 @@ var _Row = require("../Row");
|
|
33
33
|
*/
|
34
34
|
|
35
35
|
const propTypes = exports.propTypes = {
|
36
|
-
children:
|
36
|
+
children: _uiPropTypes.Children.oneOf([_Row.Row]),
|
37
37
|
hover: _propTypes.default.bool,
|
38
38
|
isStacked: _propTypes.default.bool,
|
39
39
|
headers: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]))
|
package/lib/Table/Cell/index.js
CHANGED
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.default = exports.Cell = void 0;
|
8
8
|
var _react = require("react");
|
9
|
-
var
|
10
|
-
var
|
11
|
-
var _View = require("@instructure/ui-view/lib/View");
|
9
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
10
|
+
var _uiView = require("@instructure/ui-view");
|
12
11
|
var _emotion = require("@instructure/emotion");
|
13
12
|
var _styles = _interopRequireDefault(require("./styles"));
|
14
13
|
var _theme = _interopRequireDefault(require("./theme"));
|
@@ -59,11 +58,11 @@ let Cell = exports.Cell = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
59
58
|
styles = _this$props3.styles,
|
60
59
|
isStacked = _this$props3.isStacked,
|
61
60
|
header = _this$props3.header;
|
62
|
-
return (0, _emotion.jsx)(
|
61
|
+
return (0, _emotion.jsx)(_uiView.View, Object.assign({}, _uiView.View.omitViewProps((0, _uiReactUtils.omitProps)(this.props, Cell.allowedProps), Cell), {
|
63
62
|
as: isStacked ? 'div' : 'td',
|
64
63
|
css: styles === null || styles === void 0 ? void 0 : styles.cell,
|
65
64
|
role: isStacked ? 'cell' : void 0
|
66
|
-
}), header && (0,
|
65
|
+
}), header && (0, _uiReactUtils.callRenderProp)(header), header && ': ', (0, _uiReactUtils.callRenderProp)(children));
|
67
66
|
}
|
68
67
|
}, _class2.displayName = "Cell", _class2.componentId = 'Table.Cell', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
69
68
|
textAlign: 'start',
|
@@ -7,11 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports.default = exports.ColHeader = void 0;
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
10
|
-
var
|
11
|
-
var
|
12
|
-
var _IconMiniArrowUpLine2 = require("@instructure/ui-icons/lib/IconMiniArrowUpLine.js");
|
13
|
-
var _IconMiniArrowDownLine = require("@instructure/ui-icons/lib/IconMiniArrowDownLine.js");
|
14
|
-
var _IconMiniArrowDoubleLine = require("@instructure/ui-icons/lib/IconMiniArrowDoubleLine.js");
|
10
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
11
|
+
var _uiIcons = require("@instructure/ui-icons");
|
15
12
|
var _emotion = require("@instructure/emotion");
|
16
13
|
var _styles = _interopRequireDefault(require("./styles"));
|
17
14
|
var _theme = _interopRequireDefault(require("./theme"));
|
@@ -72,13 +69,13 @@ let ColHeader = exports.ColHeader = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
72
69
|
sortDirection = _this$props4.sortDirection,
|
73
70
|
onRequestSort = _this$props4.onRequestSort;
|
74
71
|
if (sortDirection === 'ascending') {
|
75
|
-
return _IconMiniArrowUpLine || (_IconMiniArrowUpLine = (0, _emotion.jsx)(
|
72
|
+
return _IconMiniArrowUpLine || (_IconMiniArrowUpLine = (0, _emotion.jsx)(_uiIcons.IconMiniArrowUpLine, null));
|
76
73
|
}
|
77
74
|
if (sortDirection === 'descending') {
|
78
|
-
return _IconMiniArrowDownLin || (_IconMiniArrowDownLin = (0, _emotion.jsx)(
|
75
|
+
return _IconMiniArrowDownLin || (_IconMiniArrowDownLin = (0, _emotion.jsx)(_uiIcons.IconMiniArrowDownLine, null));
|
79
76
|
}
|
80
77
|
if (onRequestSort) {
|
81
|
-
return (0, _emotion.jsx)(
|
78
|
+
return (0, _emotion.jsx)(_uiIcons.IconMiniArrowDoubleLine, {
|
82
79
|
css: {
|
83
80
|
opacity: '30%'
|
84
81
|
}
|
@@ -94,7 +91,7 @@ let ColHeader = exports.ColHeader = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
94
91
|
sortDirection = _this$props5.sortDirection,
|
95
92
|
scope = _this$props5.scope,
|
96
93
|
styles = _this$props5.styles;
|
97
|
-
return (0, _emotion.jsx)("th", Object.assign({}, (0,
|
94
|
+
return (0, _emotion.jsx)("th", Object.assign({}, (0, _uiReactUtils.omitProps)(this.props, ColHeader.allowedProps), {
|
98
95
|
css: styles === null || styles === void 0 ? void 0 : styles.colHeader,
|
99
96
|
style: {
|
100
97
|
width
|
@@ -106,7 +103,7 @@ let ColHeader = exports.ColHeader = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
106
103
|
css: styles === null || styles === void 0 ? void 0 : styles.button
|
107
104
|
}, (0, _emotion.jsx)("div", {
|
108
105
|
css: styles === null || styles === void 0 ? void 0 : styles.buttonContent
|
109
|
-
}, (0,
|
106
|
+
}, (0, _uiReactUtils.callRenderProp)(children), this.renderSortArrow())), !onRequestSort && children, !onRequestSort && this.renderSortArrow());
|
110
107
|
}
|
111
108
|
}, _class2.displayName = "ColHeader", _class2.componentId = 'Table.ColHeader', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
112
109
|
textAlign: 'start',
|
package/lib/Table/Head/index.js
CHANGED
@@ -7,12 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.default = exports.Head = void 0;
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
9
|
var _react = require("react");
|
10
|
-
var
|
11
|
-
var
|
12
|
-
var
|
13
|
-
var
|
14
|
-
var _ScreenReaderContent2 = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
15
|
-
var _IconCheckLine = require("@instructure/ui-icons/lib/IconCheckLine.js");
|
10
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
11
|
+
var _uiSimpleSelect = require("@instructure/ui-simple-select");
|
12
|
+
var _uiA11yContent = require("@instructure/ui-a11y-content");
|
13
|
+
var _uiIcons = require("@instructure/ui-icons");
|
16
14
|
var _console = require("@instructure/console");
|
17
15
|
var _emotion = require("@instructure/emotion");
|
18
16
|
var _styles = _interopRequireDefault(require("./styles"));
|
@@ -59,7 +57,7 @@ let Head = exports.Head = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
59
57
|
let sortable = false;
|
60
58
|
if (row) {
|
61
59
|
_react.Children.forEach(row.props.children, colHeader => {
|
62
|
-
if ((0,
|
60
|
+
if ((0, _uiReactUtils.matchComponentTypes)(colHeader, [_ColHeader.ColHeader])) {
|
63
61
|
if (colHeader.props.onRequestSort) sortable = true;
|
64
62
|
}
|
65
63
|
});
|
@@ -84,7 +82,7 @@ let Head = exports.Head = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
84
82
|
const _ref3 = _react.Children.toArray(children),
|
85
83
|
_ref4 = (0, _slicedToArray2.default)(_ref3, 1),
|
86
84
|
row = _ref4[0];
|
87
|
-
if (!(0,
|
85
|
+
if (!(0, _uiReactUtils.matchComponentTypes)(row, [_Row.Row])) {
|
88
86
|
return null;
|
89
87
|
}
|
90
88
|
const options = [];
|
@@ -93,7 +91,7 @@ let Head = exports.Head = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
93
91
|
let count = 0;
|
94
92
|
_react.Children.forEach(row.props.children, colHeader => {
|
95
93
|
count += 1;
|
96
|
-
if ((0,
|
94
|
+
if ((0, _uiReactUtils.matchComponentTypes)(colHeader, [_ColHeader.ColHeader])) {
|
97
95
|
const _colHeader$props = colHeader.props,
|
98
96
|
id = _colHeader$props.id,
|
99
97
|
stackedSortByLabel = _colHeader$props.stackedSortByLabel,
|
@@ -131,19 +129,19 @@ let Head = exports.Head = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
131
129
|
}, (0, _emotion.jsx)("div", {
|
132
130
|
role: "cell",
|
133
131
|
"aria-colspan": count
|
134
|
-
}, (0, _emotion.jsx)(
|
135
|
-
renderLabel: renderSortLabel ? (0,
|
136
|
-
renderBeforeInput: selectedOption &&
|
132
|
+
}, (0, _emotion.jsx)(_uiSimpleSelect.SimpleSelect, {
|
133
|
+
renderLabel: renderSortLabel ? (0, _uiReactUtils.callRenderProp)(renderSortLabel) : _ScreenReaderContent || (_ScreenReaderContent = (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null)),
|
134
|
+
renderBeforeInput: selectedOption && _uiIcons.IconCheckLine,
|
137
135
|
value: selectedOption,
|
138
136
|
onChange: handleSelect
|
139
137
|
}, options.map(({
|
140
138
|
id,
|
141
139
|
label
|
142
|
-
}) => (0, _emotion.jsx)(
|
140
|
+
}) => (0, _emotion.jsx)(_uiSimpleSelect.SimpleSelect.Option, {
|
143
141
|
id: id,
|
144
142
|
key: id,
|
145
143
|
value: id,
|
146
|
-
renderBeforeLabel: id === selectedOption ?
|
144
|
+
renderBeforeLabel: id === selectedOption ? _uiIcons.IconCheckLine : () => (0, _emotion.jsx)(_uiIcons.IconCheckLine, {
|
147
145
|
style: {
|
148
146
|
color: 'transparent'
|
149
147
|
}
|
@@ -155,9 +153,9 @@ let Head = exports.Head = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
155
153
|
children = _this$props4.children,
|
156
154
|
isStacked = _this$props4.isStacked,
|
157
155
|
styles = _this$props4.styles;
|
158
|
-
return isStacked ? this.renderSelect() : (0, _emotion.jsx)("thead", Object.assign({}, (0,
|
156
|
+
return isStacked ? this.renderSelect() : (0, _emotion.jsx)("thead", Object.assign({}, (0, _uiReactUtils.omitProps)(this.props, Head.allowedProps), {
|
159
157
|
css: styles === null || styles === void 0 ? void 0 : styles.head
|
160
|
-
}), _react.Children.map(children, child => (0,
|
158
|
+
}), _react.Children.map(children, child => (0, _uiReactUtils.matchComponentTypes)(child, [_Row.Row]) ? child : null));
|
161
159
|
}
|
162
160
|
}, _class2.displayName = "Head", _class2.componentId = 'Table.Head', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
163
161
|
children: null
|
package/lib/Table/Head/props.js
CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
|
-
var
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
10
10
|
var _Row = require("../Row");
|
11
11
|
/*
|
12
12
|
* The MIT License (MIT)
|
@@ -33,7 +33,7 @@ var _Row = require("../Row");
|
|
33
33
|
*/
|
34
34
|
|
35
35
|
const propTypes = exports.propTypes = {
|
36
|
-
children:
|
36
|
+
children: _uiPropTypes.Children.oneOf([_Row.Row]),
|
37
37
|
isStacked: _propTypes.default.bool,
|
38
38
|
renderSortLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func])
|
39
39
|
};
|
package/lib/Table/Row/index.js
CHANGED
@@ -6,10 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.default = exports.Row = void 0;
|
8
8
|
var _react = require("react");
|
9
|
-
var
|
10
|
-
var
|
11
|
-
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
12
|
-
var _View = require("@instructure/ui-view/lib/View");
|
9
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
10
|
+
var _uiView = require("@instructure/ui-view");
|
13
11
|
var _emotion = require("@instructure/emotion");
|
14
12
|
var _styles = _interopRequireDefault(require("./styles"));
|
15
13
|
var _theme = _interopRequireDefault(require("./theme"));
|
@@ -63,22 +61,22 @@ let Row = exports.Row = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.
|
|
63
61
|
styles = _this$props3.styles,
|
64
62
|
isStacked = _this$props3.isStacked,
|
65
63
|
headers = _this$props3.headers;
|
66
|
-
return (0, _emotion.jsx)(
|
64
|
+
return (0, _emotion.jsx)(_uiView.View, Object.assign({}, _uiView.View.omitViewProps((0, _uiReactUtils.omitProps)(this.props, Row.allowedProps), Row), {
|
67
65
|
as: isStacked ? 'div' : 'tr',
|
68
66
|
css: styles === null || styles === void 0 ? void 0 : styles.row,
|
69
67
|
role: isStacked ? 'row' : void 0
|
70
68
|
}), _react.Children.toArray(children).filter(Boolean).map((child, index) => {
|
71
|
-
if ((0,
|
69
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_ColHeader.ColHeader])) {
|
72
70
|
return child;
|
73
71
|
}
|
74
|
-
if ((0,
|
75
|
-
return (0,
|
72
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_RowHeader.RowHeader])) {
|
73
|
+
return (0, _uiReactUtils.safeCloneElement)(child, {
|
76
74
|
key: child.props.name,
|
77
75
|
isStacked
|
78
76
|
});
|
79
77
|
}
|
80
|
-
if ((0,
|
81
|
-
return (0,
|
78
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_Cell.Cell])) {
|
79
|
+
return (0, _uiReactUtils.safeCloneElement)(child, {
|
82
80
|
key: child.props.name,
|
83
81
|
isStacked,
|
84
82
|
header: headers && headers[index]
|
package/lib/Table/Row/props.js
CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
|
-
var
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
10
10
|
var _ColHeader = require("../ColHeader");
|
11
11
|
var _RowHeader = require("../RowHeader");
|
12
12
|
var _Cell = require("../Cell");
|
@@ -35,7 +35,7 @@ var _Cell = require("../Cell");
|
|
35
35
|
*/
|
36
36
|
|
37
37
|
const propTypes = exports.propTypes = {
|
38
|
-
children:
|
38
|
+
children: _uiPropTypes.Children.oneOf([_ColHeader.ColHeader, _RowHeader.RowHeader, _Cell.Cell]),
|
39
39
|
hover: _propTypes.default.bool,
|
40
40
|
isStacked: _propTypes.default.bool,
|
41
41
|
headers: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]))
|
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.default = exports.RowHeader = void 0;
|
8
8
|
var _react = require("react");
|
9
|
-
var
|
10
|
-
var
|
11
|
-
var _View = require("@instructure/ui-view/lib/View");
|
9
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
10
|
+
var _uiView = require("@instructure/ui-view");
|
12
11
|
var _emotion = require("@instructure/emotion");
|
13
12
|
var _styles = _interopRequireDefault(require("./styles"));
|
14
13
|
var _theme = _interopRequireDefault(require("./theme"));
|
@@ -58,12 +57,12 @@ let RowHeader = exports.RowHeader = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
58
57
|
children = _this$props3.children,
|
59
58
|
isStacked = _this$props3.isStacked,
|
60
59
|
styles = _this$props3.styles;
|
61
|
-
return (0, _emotion.jsx)(
|
60
|
+
return (0, _emotion.jsx)(_uiView.View, Object.assign({}, _uiView.View.omitViewProps((0, _uiReactUtils.omitProps)(this.props, RowHeader.allowedProps), RowHeader), {
|
62
61
|
as: isStacked ? 'div' : 'th',
|
63
62
|
css: styles === null || styles === void 0 ? void 0 : styles.rowHeader,
|
64
63
|
scope: "row",
|
65
64
|
role: isStacked ? 'rowheader' : void 0
|
66
|
-
}), (0,
|
65
|
+
}), (0, _uiReactUtils.callRenderProp)(children));
|
67
66
|
}
|
68
67
|
}, _class2.displayName = "RowHeader", _class2.componentId = 'Table.RowHeader', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
69
68
|
textAlign: 'start',
|
package/lib/Table/index.js
CHANGED
@@ -7,11 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.default = exports.Table = void 0;
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
9
|
var _react = require("react");
|
10
|
-
var
|
11
|
-
var
|
12
|
-
var
|
13
|
-
var _View = require("@instructure/ui-view/lib/View");
|
14
|
-
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
10
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
11
|
+
var _uiView = require("@instructure/ui-view");
|
12
|
+
var _uiA11yContent = require("@instructure/ui-a11y-content");
|
15
13
|
var _emotion = require("@instructure/emotion");
|
16
14
|
var _styles = _interopRequireDefault(require("./styles"));
|
17
15
|
var _theme = _interopRequireDefault(require("./theme"));
|
@@ -77,13 +75,13 @@ let Table = exports.Table = (_dec = (0, _emotion.withStyle)(_styles.default, _th
|
|
77
75
|
const _ref = _react.Children.toArray(children),
|
78
76
|
_ref2 = (0, _slicedToArray2.default)(_ref, 1),
|
79
77
|
head = _ref2[0];
|
80
|
-
if ((0,
|
78
|
+
if ((0, _uiReactUtils.matchComponentTypes)(head, [_Head.Head])) {
|
81
79
|
const _Children$toArray = _react.Children.toArray(head.props.children),
|
82
80
|
_Children$toArray2 = (0, _slicedToArray2.default)(_Children$toArray, 1),
|
83
81
|
row = _Children$toArray2[0];
|
84
|
-
if ((0,
|
82
|
+
if ((0, _uiReactUtils.matchComponentTypes)(row, [_Row.Row])) {
|
85
83
|
return _react.Children.map(row.props.children, colHeader => {
|
86
|
-
return (0,
|
84
|
+
return (0, _uiReactUtils.matchComponentTypes)(colHeader, [_ColHeader.ColHeader]) ? colHeader.props.children : void 0;
|
87
85
|
});
|
88
86
|
}
|
89
87
|
}
|
@@ -99,22 +97,22 @@ let Table = exports.Table = (_dec = (0, _emotion.withStyle)(_styles.default, _th
|
|
99
97
|
styles = _this$props3.styles;
|
100
98
|
const isStacked = layout === 'stacked';
|
101
99
|
const headers = isStacked ? this.getHeaders() : void 0;
|
102
|
-
return (0, _emotion.jsx)(
|
100
|
+
return (0, _emotion.jsx)(_uiView.View, Object.assign({}, _uiView.View.omitViewProps((0, _uiReactUtils.omitProps)(this.props, Table.allowedProps), Table), {
|
103
101
|
as: isStacked ? 'div' : 'table',
|
104
102
|
margin: margin,
|
105
103
|
elementRef: this.handleRef,
|
106
104
|
css: styles === null || styles === void 0 ? void 0 : styles.table,
|
107
105
|
role: isStacked ? 'table' : void 0,
|
108
106
|
"aria-label": isStacked ? caption : void 0
|
109
|
-
}), !isStacked && (0, _emotion.jsx)("caption", null, (0, _emotion.jsx)(
|
110
|
-
if ((0,
|
111
|
-
return (0,
|
107
|
+
}), !isStacked && (0, _emotion.jsx)("caption", null, (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, caption)), _react.Children.map(children, child => {
|
108
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_Head.Head])) {
|
109
|
+
return (0, _uiReactUtils.safeCloneElement)(child, {
|
112
110
|
key: child.props.name,
|
113
111
|
isStacked
|
114
112
|
});
|
115
113
|
}
|
116
|
-
if ((0,
|
117
|
-
return (0,
|
114
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_Body.Body])) {
|
115
|
+
return (0, _uiReactUtils.safeCloneElement)(child, {
|
118
116
|
key: child.props.name,
|
119
117
|
isStacked,
|
120
118
|
hover,
|
package/lib/Table/props.js
CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
|
-
var
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
10
10
|
var _emotion = require("@instructure/emotion");
|
11
11
|
var _Head = require("./Head");
|
12
12
|
var _Body = require("./Body");
|
@@ -36,7 +36,7 @@ var _Body = require("./Body");
|
|
36
36
|
|
37
37
|
const propTypes = exports.propTypes = {
|
38
38
|
caption: _propTypes.default.node.isRequired,
|
39
|
-
children:
|
39
|
+
children: _uiPropTypes.Children.oneOf([_Head.Head, _Body.Body]),
|
40
40
|
margin: _emotion.ThemeablePropTypes.spacing,
|
41
41
|
elementRef: _propTypes.default.func,
|
42
42
|
hover: _propTypes.default.bool,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@instructure/ui-table",
|
3
|
-
"version": "8.56.
|
3
|
+
"version": "8.56.5-pr-snapshot-1728655013879",
|
4
4
|
"description": "A styled HTML table component",
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
6
6
|
"module": "./es/index.js",
|
@@ -23,24 +23,24 @@
|
|
23
23
|
},
|
24
24
|
"license": "MIT",
|
25
25
|
"devDependencies": {
|
26
|
-
"@instructure/ui-babel-preset": "8.56.
|
27
|
-
"@instructure/ui-color-utils": "8.56.
|
28
|
-
"@instructure/ui-test-utils": "8.56.
|
29
|
-
"@instructure/ui-themes": "8.56.
|
26
|
+
"@instructure/ui-babel-preset": "8.56.5-pr-snapshot-1728655013879",
|
27
|
+
"@instructure/ui-color-utils": "8.56.5-pr-snapshot-1728655013879",
|
28
|
+
"@instructure/ui-test-utils": "8.56.5-pr-snapshot-1728655013879",
|
29
|
+
"@instructure/ui-themes": "8.56.5-pr-snapshot-1728655013879"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
32
|
"@babel/runtime": "^7.23.2",
|
33
|
-
"@instructure/console": "8.56.
|
34
|
-
"@instructure/emotion": "8.56.
|
35
|
-
"@instructure/shared-types": "8.56.
|
36
|
-
"@instructure/ui-a11y-content": "8.56.
|
37
|
-
"@instructure/ui-icons": "8.56.
|
38
|
-
"@instructure/ui-prop-types": "8.56.
|
39
|
-
"@instructure/ui-react-utils": "8.56.
|
40
|
-
"@instructure/ui-simple-select": "8.56.
|
41
|
-
"@instructure/ui-testable": "8.56.
|
42
|
-
"@instructure/ui-utils": "8.56.
|
43
|
-
"@instructure/ui-view": "8.56.
|
33
|
+
"@instructure/console": "8.56.5-pr-snapshot-1728655013879",
|
34
|
+
"@instructure/emotion": "8.56.5-pr-snapshot-1728655013879",
|
35
|
+
"@instructure/shared-types": "8.56.5-pr-snapshot-1728655013879",
|
36
|
+
"@instructure/ui-a11y-content": "8.56.5-pr-snapshot-1728655013879",
|
37
|
+
"@instructure/ui-icons": "8.56.5-pr-snapshot-1728655013879",
|
38
|
+
"@instructure/ui-prop-types": "8.56.5-pr-snapshot-1728655013879",
|
39
|
+
"@instructure/ui-react-utils": "8.56.5-pr-snapshot-1728655013879",
|
40
|
+
"@instructure/ui-simple-select": "8.56.5-pr-snapshot-1728655013879",
|
41
|
+
"@instructure/ui-testable": "8.56.5-pr-snapshot-1728655013879",
|
42
|
+
"@instructure/ui-utils": "8.56.5-pr-snapshot-1728655013879",
|
43
|
+
"@instructure/ui-view": "8.56.5-pr-snapshot-1728655013879",
|
44
44
|
"prop-types": "^15.8.1"
|
45
45
|
},
|
46
46
|
"peerDependencies": {
|