@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.
- package/CHANGELOG.md +6 -0
- package/es/Table/Body/index.js +16 -28
- package/{src/Table/Cell/types.ts → es/Table/Body/props.js} +14 -8
- package/es/Table/Cell/index.js +16 -28
- package/{src/Table/types.ts → es/Table/Cell/props.js} +12 -11
- package/es/Table/ColHeader/index.js +22 -63
- package/es/Table/ColHeader/props.js +66 -0
- package/es/Table/Head/index.js +18 -29
- package/{src/Table/Body/types.ts → es/Table/Head/props.js} +13 -8
- package/es/Table/Row/index.js +16 -28
- package/{src/Table/ColHeader/types.ts → es/Table/Row/props.js} +16 -12
- package/es/Table/RowHeader/index.js +15 -26
- package/{src/Table/Head/types.ts → es/Table/RowHeader/props.js} +11 -6
- package/es/Table/index.js +21 -60
- package/es/Table/props.js +66 -0
- package/lib/Table/Body/index.js +16 -29
- package/lib/Table/Body/props.js +50 -0
- package/lib/Table/Cell/index.js +16 -28
- package/lib/Table/Cell/props.js +47 -0
- package/lib/Table/ColHeader/index.js +22 -63
- package/lib/Table/ColHeader/props.js +77 -0
- package/lib/Table/Head/index.js +18 -30
- package/lib/Table/Head/props.js +49 -0
- package/lib/Table/Row/index.js +16 -29
- package/lib/Table/Row/props.js +54 -0
- package/lib/Table/RowHeader/index.js +15 -26
- package/lib/Table/RowHeader/props.js +46 -0
- package/lib/Table/index.js +20 -60
- package/lib/Table/props.js +81 -0
- package/package.json +17 -18
- package/src/Table/Body/index.tsx +7 -25
- package/src/Table/{Row/types.ts → Body/props.ts} +39 -3
- package/src/Table/Cell/index.tsx +8 -24
- package/src/Table/Cell/props.ts +62 -0
- package/src/Table/Cell/styles.ts +1 -1
- package/src/Table/ColHeader/index.tsx +9 -51
- package/src/Table/ColHeader/props.ts +94 -0
- package/src/Table/ColHeader/styles.ts +1 -1
- package/src/Table/Head/index.tsx +8 -24
- package/src/Table/Head/props.ts +62 -0
- package/src/Table/Row/index.tsx +8 -27
- package/src/Table/Row/props.ts +70 -0
- package/src/Table/Row/styles.ts +1 -1
- package/src/Table/RowHeader/index.tsx +8 -23
- package/src/Table/RowHeader/{types.ts → props.ts} +28 -3
- package/src/Table/RowHeader/styles.ts +1 -1
- package/src/Table/index.tsx +10 -49
- package/src/Table/props.ts +93 -0
- package/src/Table/styles.ts +1 -1
- package/src/index.ts +7 -7
- package/types/Table/Body/index.d.ts +13 -16
- package/types/Table/Body/index.d.ts.map +1 -1
- package/types/Table/Body/props.d.ts +17 -0
- package/types/Table/Body/props.d.ts.map +1 -0
- package/types/Table/Cell/index.d.ts +14 -14
- package/types/Table/Cell/index.d.ts.map +1 -1
- package/types/Table/Cell/props.d.ts +17 -0
- package/types/Table/Cell/props.d.ts.map +1 -0
- package/types/Table/Cell/styles.d.ts +1 -1
- package/types/Table/ColHeader/index.d.ts +22 -40
- package/types/Table/ColHeader/index.d.ts.map +1 -1
- package/types/Table/ColHeader/props.d.ts +21 -0
- package/types/Table/ColHeader/props.d.ts.map +1 -0
- package/types/Table/ColHeader/styles.d.ts +1 -1
- package/types/Table/Head/index.d.ts +11 -15
- package/types/Table/Head/index.d.ts.map +1 -1
- package/types/Table/Head/props.d.ts +16 -0
- package/types/Table/Head/props.d.ts.map +1 -0
- package/types/Table/Row/index.d.ts +14 -17
- package/types/Table/Row/index.d.ts.map +1 -1
- package/types/Table/Row/props.d.ts +17 -0
- package/types/Table/Row/props.d.ts.map +1 -0
- package/types/Table/Row/styles.d.ts +1 -1
- package/types/Table/RowHeader/index.d.ts +12 -13
- package/types/Table/RowHeader/index.d.ts.map +1 -1
- package/types/Table/RowHeader/props.d.ts +16 -0
- package/types/Table/RowHeader/props.d.ts.map +1 -0
- package/types/Table/RowHeader/styles.d.ts +1 -1
- package/types/Table/index.d.ts +18 -41
- package/types/Table/index.d.ts.map +1 -1
- package/types/Table/props.d.ts +19 -0
- package/types/Table/props.d.ts.map +1 -0
- package/types/Table/styles.d.ts +1 -1
- package/types/index.d.ts +7 -7
- package/LICENSE.md +0 -27
- package/es/Table/Body/types.js +0 -1
- package/es/Table/Cell/types.js +0 -1
- package/es/Table/ColHeader/types.js +0 -1
- package/es/Table/Head/types.js +0 -1
- package/es/Table/Row/types.js +0 -1
- package/es/Table/RowHeader/types.js +0 -1
- package/es/Table/types.js +0 -1
- package/lib/Table/Body/types.js +0 -1
- package/lib/Table/Cell/types.js +0 -1
- package/lib/Table/ColHeader/types.js +0 -1
- package/lib/Table/Head/types.js +0 -1
- package/lib/Table/Row/types.js +0 -1
- package/lib/Table/RowHeader/types.js +0 -1
- package/lib/Table/types.js +0 -1
- package/types/Table/Body/types.d.ts +0 -9
- package/types/Table/Body/types.d.ts.map +0 -1
- package/types/Table/Cell/types.d.ts +0 -9
- package/types/Table/Cell/types.d.ts.map +0 -1
- package/types/Table/ColHeader/types.d.ts +0 -12
- package/types/Table/ColHeader/types.d.ts.map +0 -1
- package/types/Table/Head/types.d.ts +0 -8
- package/types/Table/Head/types.d.ts.map +0 -1
- package/types/Table/Row/types.d.ts +0 -9
- package/types/Table/Row/types.d.ts.map +0 -1
- package/types/Table/RowHeader/types.d.ts +0 -7
- package/types/Table/RowHeader/types.d.ts.map +0 -1
- package/types/Table/types.d.ts +0 -12
- package/types/Table/types.d.ts.map +0 -1
@@ -21,11 +21,16 @@
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
import PropTypes from 'prop-types';
|
25
|
+
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
26
|
+
import { Row } from '../Row';
|
27
|
+
const propTypes = {
|
28
|
+
/**
|
29
|
+
* `Table.Row`
|
30
|
+
*/
|
31
|
+
children: ChildrenPropTypes.oneOf([Row]),
|
32
|
+
isStacked: PropTypes.bool,
|
33
|
+
renderSortLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
34
|
+
};
|
35
|
+
const allowedProps = ['children', 'isStacked', 'renderSortLabel'];
|
36
|
+
export { propTypes, allowedProps };
|
package/es/Table/Row/index.js
CHANGED
@@ -26,9 +26,7 @@ var _dec, _class, _class2, _temp;
|
|
26
26
|
|
27
27
|
/** @jsx jsx */
|
28
28
|
import { Component, Children } from 'react';
|
29
|
-
import PropTypes from 'prop-types';
|
30
29
|
import { omitProps, matchComponentTypes, safeCloneElement } from '@instructure/ui-react-utils';
|
31
|
-
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
32
30
|
import { View } from '@instructure/ui-view';
|
33
31
|
import { withStyle, jsx } from '@instructure/emotion';
|
34
32
|
import generateStyle from './styles';
|
@@ -36,34 +34,36 @@ import generateComponentTheme from './theme';
|
|
36
34
|
import { ColHeader } from '../ColHeader';
|
37
35
|
import { RowHeader } from '../RowHeader';
|
38
36
|
import { Cell } from '../Cell';
|
39
|
-
|
37
|
+
import { allowedProps, propTypes } from './props';
|
40
38
|
/**
|
41
39
|
---
|
42
40
|
parent: Table
|
43
41
|
id: Table.Row
|
44
42
|
---
|
45
43
|
**/
|
46
|
-
let Row = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Row extends Component {
|
47
|
-
/* eslint-disable react/require-default-props */
|
48
44
|
|
49
|
-
|
45
|
+
let Row = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Row extends Component {
|
50
46
|
componentDidMount() {
|
51
|
-
|
47
|
+
var _this$props$makeStyle, _this$props;
|
48
|
+
|
49
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
52
50
|
}
|
53
51
|
|
54
|
-
componentDidUpdate(
|
55
|
-
|
52
|
+
componentDidUpdate() {
|
53
|
+
var _this$props$makeStyle2, _this$props2;
|
54
|
+
|
55
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
56
56
|
}
|
57
57
|
|
58
58
|
render() {
|
59
|
-
const _this$
|
60
|
-
children = _this$
|
61
|
-
styles = _this$
|
62
|
-
isStacked = _this$
|
63
|
-
headers = _this$
|
59
|
+
const _this$props3 = this.props,
|
60
|
+
children = _this$props3.children,
|
61
|
+
styles = _this$props3.styles,
|
62
|
+
isStacked = _this$props3.isStacked,
|
63
|
+
headers = _this$props3.headers;
|
64
64
|
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Row.propTypes), Row), {
|
65
65
|
as: isStacked ? 'div' : 'tr',
|
66
|
-
css: styles.row,
|
66
|
+
css: styles === null || styles === void 0 ? void 0 : styles.row,
|
67
67
|
role: isStacked ? 'row' : void 0
|
68
68
|
}), Children.toArray(children).filter(Boolean).map((child, index) => {
|
69
69
|
if (matchComponentTypes(child, [ColHeader])) {
|
@@ -89,19 +89,7 @@ let Row = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
89
89
|
}));
|
90
90
|
}
|
91
91
|
|
92
|
-
}, _class2.displayName = "Row", _class2.componentId = 'Table.Row', _class2.propTypes = {
|
93
|
-
/**
|
94
|
-
* `Table.ColHeader`, `Table.RowHeader` or `Table.Cell`
|
95
|
-
*/
|
96
|
-
// eslint-disable-next-line react/require-default-props
|
97
|
-
makeStyles: PropTypes.func,
|
98
|
-
// eslint-disable-next-line react/require-default-props
|
99
|
-
styles: PropTypes.object,
|
100
|
-
children: ChildrenPropTypes.oneOf([ColHeader, RowHeader, Cell]),
|
101
|
-
hover: PropTypes.bool,
|
102
|
-
isStacked: PropTypes.bool,
|
103
|
-
headers: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.node, PropTypes.func]))
|
104
|
-
}, _class2.defaultProps = {
|
92
|
+
}, _class2.displayName = "Row", _class2.componentId = 'Table.Row', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
105
93
|
children: null
|
106
94
|
}, _temp)) || _class);
|
107
95
|
export default Row;
|
@@ -21,15 +21,19 @@
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
24
|
+
import PropTypes from 'prop-types';
|
25
|
+
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
26
|
+
import { ColHeader } from '../ColHeader';
|
27
|
+
import { RowHeader } from '../RowHeader';
|
28
|
+
import { Cell } from '../Cell';
|
29
|
+
const propTypes = {
|
30
|
+
/**
|
31
|
+
* `Table.ColHeader`, `Table.RowHeader` or `Table.Cell`
|
32
|
+
*/
|
33
|
+
children: ChildrenPropTypes.oneOf([ColHeader, RowHeader, Cell]),
|
34
|
+
hover: PropTypes.bool,
|
35
|
+
isStacked: PropTypes.bool,
|
36
|
+
headers: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.node, PropTypes.func]))
|
37
|
+
};
|
38
|
+
const allowedProps = ['children', 'hover', 'isStacked', 'headers'];
|
39
|
+
export { propTypes, allowedProps };
|
@@ -26,57 +26,46 @@ var _dec, _class, _class2, _temp;
|
|
26
26
|
|
27
27
|
/** @jsx jsx */
|
28
28
|
import { Component } from 'react';
|
29
|
-
import PropTypes from 'prop-types';
|
30
29
|
import { omitProps, callRenderProp } from '@instructure/ui-react-utils';
|
31
30
|
import { View } from '@instructure/ui-view';
|
32
31
|
import { withStyle, jsx } from '@instructure/emotion';
|
33
32
|
import generateStyle from './styles';
|
34
33
|
import generateComponentTheme from './theme';
|
35
|
-
|
34
|
+
import { allowedProps, propTypes } from './props';
|
36
35
|
/**
|
37
36
|
---
|
38
37
|
parent: Table
|
39
38
|
id: Table.RowHeader
|
40
39
|
---
|
41
40
|
**/
|
42
|
-
let RowHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class RowHeader extends Component {
|
43
|
-
/* eslint-disable react/require-default-props */
|
44
41
|
|
45
|
-
|
42
|
+
let RowHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class RowHeader extends Component {
|
46
43
|
componentDidMount() {
|
47
|
-
|
44
|
+
var _this$props$makeStyle, _this$props;
|
45
|
+
|
46
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
48
47
|
}
|
49
48
|
|
50
|
-
componentDidUpdate(
|
51
|
-
|
49
|
+
componentDidUpdate() {
|
50
|
+
var _this$props$makeStyle2, _this$props2;
|
51
|
+
|
52
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
52
53
|
}
|
53
54
|
|
54
55
|
render() {
|
55
|
-
const _this$
|
56
|
-
children = _this$
|
57
|
-
isStacked = _this$
|
58
|
-
styles = _this$
|
56
|
+
const _this$props3 = this.props,
|
57
|
+
children = _this$props3.children,
|
58
|
+
isStacked = _this$props3.isStacked,
|
59
|
+
styles = _this$props3.styles;
|
59
60
|
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, RowHeader.propTypes), RowHeader), {
|
60
61
|
as: isStacked ? 'div' : 'th',
|
61
|
-
css: styles.rowHeader,
|
62
|
+
css: styles === null || styles === void 0 ? void 0 : styles.rowHeader,
|
62
63
|
scope: "row",
|
63
64
|
role: isStacked ? 'rowheader' : void 0
|
64
65
|
}), callRenderProp(children));
|
65
66
|
}
|
66
67
|
|
67
|
-
}, _class2.displayName = "RowHeader", _class2.componentId = 'Table.RowHeader', _class2.propTypes = {
|
68
|
-
// eslint-disable-next-line react/require-default-props
|
69
|
-
makeStyles: PropTypes.func,
|
70
|
-
// eslint-disable-next-line react/require-default-props
|
71
|
-
styles: PropTypes.object,
|
72
|
-
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
73
|
-
isStacked: PropTypes.bool,
|
74
|
-
|
75
|
-
/**
|
76
|
-
* Control the text alignment in row header
|
77
|
-
*/
|
78
|
-
textAlign: PropTypes.oneOf(['start', 'center', 'end'])
|
79
|
-
}, _class2.defaultProps = {
|
68
|
+
}, _class2.displayName = "RowHeader", _class2.componentId = 'Table.RowHeader', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
80
69
|
textAlign: 'start',
|
81
70
|
children: null
|
82
71
|
}, _temp)) || _class);
|
@@ -21,10 +21,15 @@
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
|
+
import PropTypes from 'prop-types';
|
25
|
+
const propTypes = {
|
26
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
27
|
+
isStacked: PropTypes.bool,
|
24
28
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
/**
|
30
|
+
* Control the text alignment in row header
|
31
|
+
*/
|
32
|
+
textAlign: PropTypes.oneOf(['start', 'center', 'end'])
|
33
|
+
};
|
34
|
+
const allowedProps = ['children', 'isStacked', 'textAlign'];
|
35
|
+
export { propTypes, allowedProps };
|
package/es/Table/index.js
CHANGED
@@ -28,12 +28,10 @@ var _dec, _class, _class2, _temp;
|
|
28
28
|
|
29
29
|
/** @jsx jsx */
|
30
30
|
import { Component, Children } from 'react';
|
31
|
-
import PropTypes from 'prop-types';
|
32
31
|
import { matchComponentTypes, safeCloneElement, omitProps } from '@instructure/ui-react-utils';
|
33
|
-
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
34
32
|
import { View } from '@instructure/ui-view';
|
35
33
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
36
|
-
import { withStyle, jsx
|
34
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
37
35
|
import generateStyle from './styles';
|
38
36
|
import generateComponentTheme from './theme';
|
39
37
|
import { Head } from './Head';
|
@@ -42,19 +40,24 @@ import { Row } from './Row';
|
|
42
40
|
import { ColHeader } from './ColHeader';
|
43
41
|
import { RowHeader } from './RowHeader';
|
44
42
|
import { Cell } from './Cell';
|
45
|
-
|
43
|
+
import { allowedProps, propTypes } from './props';
|
46
44
|
/**
|
47
45
|
---
|
48
46
|
category: components
|
49
47
|
---
|
50
48
|
**/
|
49
|
+
|
51
50
|
let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Table extends Component {
|
52
51
|
componentDidMount() {
|
53
|
-
|
52
|
+
var _this$props$makeStyle, _this$props;
|
53
|
+
|
54
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
54
55
|
}
|
55
56
|
|
56
|
-
componentDidUpdate(
|
57
|
-
|
57
|
+
componentDidUpdate() {
|
58
|
+
var _this$props$makeStyle2, _this$props2;
|
59
|
+
|
60
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
58
61
|
}
|
59
62
|
|
60
63
|
getHeaders() {
|
@@ -80,21 +83,21 @@ let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
|
|
80
83
|
}
|
81
84
|
|
82
85
|
render() {
|
83
|
-
const _this$
|
84
|
-
margin = _this$
|
85
|
-
elementRef = _this$
|
86
|
-
layout = _this$
|
87
|
-
caption = _this$
|
88
|
-
children = _this$
|
89
|
-
hover = _this$
|
90
|
-
styles = _this$
|
86
|
+
const _this$props3 = this.props,
|
87
|
+
margin = _this$props3.margin,
|
88
|
+
elementRef = _this$props3.elementRef,
|
89
|
+
layout = _this$props3.layout,
|
90
|
+
caption = _this$props3.caption,
|
91
|
+
children = _this$props3.children,
|
92
|
+
hover = _this$props3.hover,
|
93
|
+
styles = _this$props3.styles;
|
91
94
|
const isStacked = layout === 'stacked';
|
92
95
|
const headers = isStacked ? this.getHeaders() : null;
|
93
96
|
return jsx(View, Object.assign({}, View.omitViewProps(omitProps(this.props, Table.propTypes), Table), {
|
94
97
|
as: isStacked ? 'div' : 'table',
|
95
98
|
margin: margin,
|
96
99
|
elementRef: elementRef,
|
97
|
-
css: styles.table,
|
100
|
+
css: styles === null || styles === void 0 ? void 0 : styles.table,
|
98
101
|
role: isStacked ? 'table' : void 0,
|
99
102
|
"aria-label": isStacked ? caption : void 0
|
100
103
|
}), !isStacked && jsx("caption", null, jsx(ScreenReaderContent, null, caption)), Children.map(children, child => {
|
@@ -118,52 +121,10 @@ let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
|
|
118
121
|
}));
|
119
122
|
}
|
120
123
|
|
121
|
-
}, _class2.displayName = "Table", _class2.componentId = 'Table', _class2.propTypes = {
|
122
|
-
// eslint-disable-next-line react/require-default-props
|
123
|
-
makeStyles: PropTypes.func,
|
124
|
-
// eslint-disable-next-line react/require-default-props
|
125
|
-
styles: PropTypes.object,
|
126
|
-
|
127
|
-
/**
|
128
|
-
* Provide a screen reader friendly description. Anything passed to this
|
129
|
-
* prop will be wrapped by `<ScreenReaderContent>` when it is rendered.
|
130
|
-
*/
|
131
|
-
caption: PropTypes.node.isRequired,
|
132
|
-
|
133
|
-
/**
|
134
|
-
* Build table via `Table.Head` and `Table.Body`
|
135
|
-
*/
|
136
|
-
children: ChildrenPropTypes.oneOf([Head, Body]),
|
137
|
-
|
138
|
-
/**
|
139
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
140
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
141
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
142
|
-
*/
|
143
|
-
margin: ThemeablePropTypes.spacing,
|
144
|
-
|
145
|
-
/**
|
146
|
-
* Provide a reference to the underlying html element
|
147
|
-
*/
|
148
|
-
elementRef: PropTypes.func,
|
149
|
-
|
150
|
-
/**
|
151
|
-
* Highlight each row on hover
|
152
|
-
*/
|
153
|
-
hover: PropTypes.bool,
|
154
|
-
|
155
|
-
/**
|
156
|
-
* `auto` lets the browser determine table column widths based on cell content,
|
157
|
-
* while `fixed` forces columns of equal width. `stacked` renders table in one
|
158
|
-
* column to be more readable on narrow screens
|
159
|
-
*/
|
160
|
-
layout: PropTypes.oneOf(['auto', 'fixed', 'stacked'])
|
161
|
-
}, _class2.defaultProps = {
|
124
|
+
}, _class2.displayName = "Table", _class2.componentId = 'Table', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
162
125
|
children: null,
|
163
126
|
hover: false,
|
164
|
-
layout: 'auto'
|
165
|
-
margin: void 0,
|
166
|
-
elementRef: void 0
|
127
|
+
layout: 'auto'
|
167
128
|
}, _class2.Head = Head, _class2.Body = Body, _class2.Row = Row, _class2.ColHeader = ColHeader, _class2.RowHeader = RowHeader, _class2.Cell = Cell, _temp)) || _class);
|
168
129
|
export default Table;
|
169
130
|
export { Table };
|
@@ -0,0 +1,66 @@
|
|
1
|
+
/*
|
2
|
+
* The MIT License (MIT)
|
3
|
+
*
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
5
|
+
*
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
11
|
+
* furnished to do so, subject to the following conditions:
|
12
|
+
*
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
14
|
+
* copies or substantial portions of the Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
* SOFTWARE.
|
23
|
+
*/
|
24
|
+
import PropTypes from 'prop-types';
|
25
|
+
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
26
|
+
import { ThemeablePropTypes } from '@instructure/emotion';
|
27
|
+
import { Head } from './Head';
|
28
|
+
import { Body } from './Body';
|
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
|
+
caption: PropTypes.node.isRequired,
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Build table via `Table.Head` and `Table.Body`
|
38
|
+
*/
|
39
|
+
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
|
+
margin: ThemeablePropTypes.spacing,
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Provide a reference to the underlying html element
|
50
|
+
*/
|
51
|
+
elementRef: PropTypes.func,
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Highlight each row on hover
|
55
|
+
*/
|
56
|
+
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
|
+
layout: PropTypes.oneOf(['auto', 'fixed', 'stacked'])
|
64
|
+
};
|
65
|
+
const allowedProps = ['caption', 'children', 'margin', 'elementRef', 'hover', 'layout'];
|
66
|
+
export { propTypes, allowedProps };
|
package/lib/Table/Body/index.js
CHANGED
@@ -9,16 +9,12 @@ exports.Body = 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 _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
15
13
|
|
16
14
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
17
15
|
|
18
16
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
19
17
|
|
20
|
-
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
21
|
-
|
22
18
|
var _View = require("@instructure/ui-view/lib/View");
|
23
19
|
|
24
20
|
var _emotion = require("@instructure/emotion");
|
@@ -29,6 +25,8 @@ var _theme = _interopRequireDefault(require("./theme"));
|
|
29
25
|
|
30
26
|
var _Row = require("../Row");
|
31
27
|
|
28
|
+
var _props = require("./props");
|
29
|
+
|
32
30
|
var _dec, _class, _class2, _temp;
|
33
31
|
|
34
32
|
/**
|
@@ -38,27 +36,28 @@ id: Table.Body
|
|
38
36
|
---
|
39
37
|
**/
|
40
38
|
let Body = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Body extends _react.Component {
|
41
|
-
/* eslint-disable react/require-default-props */
|
42
|
-
|
43
|
-
/* eslint-enable react/require-default-props */
|
44
39
|
componentDidMount() {
|
45
|
-
|
40
|
+
var _this$props$makeStyle, _this$props;
|
41
|
+
|
42
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
46
43
|
}
|
47
44
|
|
48
45
|
componentDidUpdate(prevProps, prevState, snapshot) {
|
49
|
-
|
46
|
+
var _this$props$makeStyle2, _this$props2;
|
47
|
+
|
48
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
50
49
|
}
|
51
50
|
|
52
51
|
render() {
|
53
|
-
const _this$
|
54
|
-
children = _this$
|
55
|
-
hover = _this$
|
56
|
-
isStacked = _this$
|
57
|
-
headers = _this$
|
58
|
-
styles = _this$
|
52
|
+
const _this$props3 = this.props,
|
53
|
+
children = _this$props3.children,
|
54
|
+
hover = _this$props3.hover,
|
55
|
+
isStacked = _this$props3.isStacked,
|
56
|
+
headers = _this$props3.headers,
|
57
|
+
styles = _this$props3.styles;
|
59
58
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Body.propTypes), Body), {
|
60
59
|
as: isStacked ? 'div' : 'tbody',
|
61
|
-
css: styles.body,
|
60
|
+
css: styles === null || styles === void 0 ? void 0 : styles.body,
|
62
61
|
role: isStacked ? 'rowgroup' : void 0
|
63
62
|
}), _react.Children.map(children, child => (0, _matchComponentTypes.matchComponentTypes)(child, [_Row.Row]) ? (0, _safeCloneElement.safeCloneElement)(child, {
|
64
63
|
key: child.props.name,
|
@@ -68,19 +67,7 @@ let Body = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
68
67
|
}) : null));
|
69
68
|
}
|
70
69
|
|
71
|
-
}, _class2.displayName = "Body", _class2.componentId = 'Table.Body', _class2.propTypes = {
|
72
|
-
/**
|
73
|
-
* `Table.Row`
|
74
|
-
*/
|
75
|
-
// eslint-disable-next-line react/require-default-props
|
76
|
-
makeStyles: _propTypes.default.func,
|
77
|
-
// eslint-disable-next-line react/require-default-props
|
78
|
-
styles: _propTypes.default.object,
|
79
|
-
children: _Children.Children.oneOf([_Row.Row]),
|
80
|
-
hover: _propTypes.default.bool,
|
81
|
-
isStacked: _propTypes.default.bool,
|
82
|
-
headers: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]))
|
83
|
-
}, _class2.defaultProps = {
|
70
|
+
}, _class2.displayName = "Body", _class2.componentId = 'Table.Body', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
84
71
|
children: null
|
85
72
|
}, _temp)) || _class);
|
86
73
|
exports.Body = Body;
|