@instructure/ui-table 11.7.3-snapshot-7 → 11.7.3-snapshot-26
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 +5 -2
- package/es/Table/v1/Body/index.js +21 -15
- package/es/Table/v1/Body/theme.js +9 -8
- package/es/Table/v1/Cell/index.js +20 -16
- package/es/Table/v1/Cell/styles.js +3 -1
- package/es/Table/v1/Cell/theme.js +13 -12
- package/es/Table/v1/ColHeader/index.js +43 -41
- package/es/Table/v1/ColHeader/styles.js +4 -2
- package/es/Table/v1/ColHeader/theme.js +19 -18
- package/es/Table/v1/Head/index.js +34 -34
- package/es/Table/v1/Head/theme.js +9 -8
- package/es/Table/v1/Row/index.js +18 -14
- package/es/Table/v1/Row/styles.js +4 -2
- package/es/Table/v1/Row/theme.js +14 -13
- package/es/Table/v1/RowHeader/index.js +19 -15
- package/es/Table/v1/RowHeader/styles.js +3 -1
- package/es/Table/v1/RowHeader/theme.js +13 -12
- package/es/Table/v1/index.js +50 -55
- package/es/Table/v1/styles.js +3 -1
- package/es/Table/v1/theme.js +10 -9
- package/es/Table/v2/Body/index.js +21 -15
- package/es/Table/v2/Cell/index.js +20 -16
- package/es/Table/v2/Cell/styles.js +3 -1
- package/es/Table/v2/ColHeader/index.js +45 -43
- package/es/Table/v2/ColHeader/styles.js +4 -2
- package/es/Table/v2/Head/index.js +37 -37
- package/es/Table/v2/Row/index.js +18 -14
- package/es/Table/v2/Row/styles.js +4 -2
- package/es/Table/v2/RowHeader/index.js +19 -15
- package/es/Table/v2/RowHeader/styles.js +3 -1
- package/es/Table/v2/index.js +50 -55
- package/es/Table/v2/styles.js +3 -1
- package/lib/Table/v1/Body/index.js +21 -15
- package/lib/Table/v1/Body/theme.js +9 -8
- package/lib/Table/v1/Cell/index.js +20 -16
- package/lib/Table/v1/Cell/styles.js +3 -1
- package/lib/Table/v1/Cell/theme.js +13 -12
- package/lib/Table/v1/ColHeader/index.js +43 -41
- package/lib/Table/v1/ColHeader/styles.js +4 -2
- package/lib/Table/v1/ColHeader/theme.js +19 -18
- package/lib/Table/v1/Head/index.js +35 -35
- package/lib/Table/v1/Head/theme.js +9 -8
- package/lib/Table/v1/Row/index.js +18 -14
- package/lib/Table/v1/Row/styles.js +4 -2
- package/lib/Table/v1/Row/theme.js +14 -13
- package/lib/Table/v1/RowHeader/index.js +19 -15
- package/lib/Table/v1/RowHeader/styles.js +3 -1
- package/lib/Table/v1/RowHeader/theme.js +13 -12
- package/lib/Table/v1/index.js +50 -55
- package/lib/Table/v1/styles.js +3 -1
- package/lib/Table/v1/theme.js +10 -9
- package/lib/Table/v2/Body/index.js +21 -15
- package/lib/Table/v2/Cell/index.js +20 -16
- package/lib/Table/v2/Cell/styles.js +3 -1
- package/lib/Table/v2/ColHeader/index.js +45 -43
- package/lib/Table/v2/ColHeader/styles.js +4 -2
- package/lib/Table/v2/Head/index.js +38 -38
- package/lib/Table/v2/Row/index.js +18 -14
- package/lib/Table/v2/Row/styles.js +4 -2
- package/lib/Table/v2/RowHeader/index.js +19 -15
- package/lib/Table/v2/RowHeader/styles.js +3 -1
- package/lib/Table/v2/index.js +50 -55
- package/lib/Table/v2/styles.js +3 -1
- package/package.json +15 -15
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
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
|
-
## [11.7.3-snapshot-
|
|
6
|
+
## [11.7.3-snapshot-26](https://github.com/instructure/instructure-ui/compare/v11.7.2...v11.7.3-snapshot-26) (2026-05-05)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **many:** update dependencies, remove lots of Babel plugins, remove Webpack 4 support ([f916fca](https://github.com/instructure/instructure-ui/commit/f916fcafdddcb2d7de401f93e8ff92cfdfa47bba))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _class
|
|
1
|
+
var _dec, _class;
|
|
2
2
|
/*
|
|
3
3
|
* The MIT License (MIT)
|
|
4
4
|
*
|
|
@@ -38,25 +38,33 @@ id: Table.Body
|
|
|
38
38
|
---
|
|
39
39
|
**/
|
|
40
40
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
41
|
-
let Body = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class =
|
|
41
|
+
let Body = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Body extends Component {
|
|
42
|
+
static displayName = "Body";
|
|
43
|
+
static componentId = 'Table.Body';
|
|
44
|
+
static contextType = TableContext;
|
|
45
|
+
static allowedProps = allowedProps;
|
|
46
|
+
static defaultProps = {
|
|
47
|
+
children: null
|
|
48
|
+
};
|
|
42
49
|
componentDidMount() {
|
|
43
|
-
|
|
44
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
50
|
+
this.props.makeStyles?.();
|
|
45
51
|
}
|
|
46
52
|
componentDidUpdate() {
|
|
47
|
-
|
|
48
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
53
|
+
this.props.makeStyles?.();
|
|
49
54
|
}
|
|
50
55
|
render() {
|
|
51
|
-
const
|
|
52
|
-
children
|
|
53
|
-
styles
|
|
54
|
-
|
|
56
|
+
const {
|
|
57
|
+
children,
|
|
58
|
+
styles
|
|
59
|
+
} = this.props;
|
|
60
|
+
const {
|
|
61
|
+
isStacked
|
|
62
|
+
} = this.context;
|
|
55
63
|
return _jsx(View, {
|
|
56
64
|
...View.omitViewProps(omitProps(this.props, Body.allowedProps), Body),
|
|
57
65
|
as: isStacked ? 'div' : 'tbody',
|
|
58
|
-
css: styles
|
|
59
|
-
role: isStacked ? 'rowgroup' :
|
|
66
|
+
css: styles?.body,
|
|
67
|
+
role: isStacked ? 'rowgroup' : undefined,
|
|
60
68
|
children: Children.map(children, child => {
|
|
61
69
|
if (/*#__PURE__*/isValidElement(child)) {
|
|
62
70
|
return safeCloneElement(child, {
|
|
@@ -67,8 +75,6 @@ let Body = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
67
75
|
})
|
|
68
76
|
});
|
|
69
77
|
}
|
|
70
|
-
}
|
|
71
|
-
children: null
|
|
72
|
-
}, _Body)) || _class);
|
|
78
|
+
}) || _class);
|
|
73
79
|
export default Body;
|
|
74
80
|
export { Body };
|
|
@@ -28,15 +28,16 @@
|
|
|
28
28
|
* @return {Object} The final theme object with the overrides and component variables
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
typography
|
|
31
|
+
const {
|
|
32
|
+
colors,
|
|
33
|
+
typography
|
|
34
|
+
} = theme;
|
|
34
35
|
const componentVariables = {
|
|
35
|
-
fontSize: typography
|
|
36
|
-
fontFamily: typography
|
|
37
|
-
fontWeight: typography
|
|
38
|
-
color: colors
|
|
39
|
-
background: colors
|
|
36
|
+
fontSize: typography?.fontSizeMedium,
|
|
37
|
+
fontFamily: typography?.fontFamily,
|
|
38
|
+
fontWeight: typography?.fontWeightNormal,
|
|
39
|
+
color: colors?.contrasts?.grey125125,
|
|
40
|
+
background: colors?.contrasts?.white1010
|
|
40
41
|
};
|
|
41
42
|
return {
|
|
42
43
|
...componentVariables
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _class
|
|
1
|
+
var _dec, _class;
|
|
2
2
|
/*
|
|
3
3
|
* The MIT License (MIT)
|
|
4
4
|
*
|
|
@@ -38,32 +38,36 @@ id: Table.Cell
|
|
|
38
38
|
---
|
|
39
39
|
**/
|
|
40
40
|
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
41
|
-
let Cell = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class =
|
|
41
|
+
let Cell = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Cell extends Component {
|
|
42
|
+
static displayName = "Cell";
|
|
43
|
+
static componentId = 'Table.Cell';
|
|
44
|
+
static contextType = TableContext;
|
|
45
|
+
static allowedProps = allowedProps;
|
|
46
|
+
static defaultProps = {
|
|
47
|
+
textAlign: 'start',
|
|
48
|
+
children: null
|
|
49
|
+
};
|
|
42
50
|
componentDidMount() {
|
|
43
|
-
|
|
44
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
51
|
+
this.props.makeStyles?.();
|
|
45
52
|
}
|
|
46
53
|
componentDidUpdate() {
|
|
47
|
-
|
|
48
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
54
|
+
this.props.makeStyles?.();
|
|
49
55
|
}
|
|
50
56
|
render() {
|
|
51
|
-
const
|
|
52
|
-
children
|
|
53
|
-
styles
|
|
54
|
-
header
|
|
57
|
+
const {
|
|
58
|
+
children,
|
|
59
|
+
styles,
|
|
60
|
+
header
|
|
61
|
+
} = this.props;
|
|
55
62
|
const isStacked = this.context.isStacked;
|
|
56
63
|
return _jsxs(View, {
|
|
57
64
|
...View.omitViewProps(omitProps(this.props, Cell.allowedProps), Cell),
|
|
58
65
|
as: isStacked ? 'div' : 'td',
|
|
59
|
-
css: styles
|
|
60
|
-
role: isStacked ? 'cell' :
|
|
66
|
+
css: styles?.cell,
|
|
67
|
+
role: isStacked ? 'cell' : undefined,
|
|
61
68
|
children: [header && callRenderProp(header), header && ': ', callRenderProp(children)]
|
|
62
69
|
});
|
|
63
70
|
}
|
|
64
|
-
}
|
|
65
|
-
textAlign: 'start',
|
|
66
|
-
children: null
|
|
67
|
-
}, _Cell)) || _class);
|
|
71
|
+
}) || _class);
|
|
68
72
|
export default Cell;
|
|
69
73
|
export { Cell };
|
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
* @return {Object} The final style object, which will be used in the component
|
|
34
34
|
*/
|
|
35
35
|
const generateStyle = (componentTheme, props) => {
|
|
36
|
-
const
|
|
36
|
+
const {
|
|
37
|
+
textAlign
|
|
38
|
+
} = props;
|
|
37
39
|
return {
|
|
38
40
|
cell: {
|
|
39
41
|
label: 'cell',
|
|
@@ -28,19 +28,20 @@
|
|
|
28
28
|
* @return {Object} The final theme object with the overrides and component variables
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
typography
|
|
34
|
-
spacing
|
|
31
|
+
const {
|
|
32
|
+
colors,
|
|
33
|
+
typography,
|
|
34
|
+
spacing
|
|
35
|
+
} = theme;
|
|
35
36
|
const componentVariables = {
|
|
36
|
-
fontSize: typography
|
|
37
|
-
fontFamily: typography
|
|
38
|
-
fontWeight: typography
|
|
39
|
-
color: colors
|
|
40
|
-
background: colors
|
|
41
|
-
borderColor: colors
|
|
42
|
-
lineHeight: typography
|
|
43
|
-
padding: `${spacing
|
|
37
|
+
fontSize: typography?.fontSizeMedium,
|
|
38
|
+
fontFamily: typography?.fontFamily,
|
|
39
|
+
fontWeight: typography?.fontWeightNormal,
|
|
40
|
+
color: colors?.contrasts?.grey125125,
|
|
41
|
+
background: colors?.contrasts?.white1010,
|
|
42
|
+
borderColor: colors?.contrasts?.grey3045,
|
|
43
|
+
lineHeight: typography?.lineHeightCondensed,
|
|
44
|
+
padding: `${spacing?.xSmall} ${spacing?.small}`
|
|
44
45
|
};
|
|
45
46
|
return {
|
|
46
47
|
...componentVariables
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _class
|
|
1
|
+
var _dec, _class;
|
|
2
2
|
/*
|
|
3
3
|
* The MIT License (MIT)
|
|
4
4
|
*
|
|
@@ -37,59 +37,66 @@ id: Table.ColHeader
|
|
|
37
37
|
---
|
|
38
38
|
**/
|
|
39
39
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
40
|
-
let ColHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
}
|
|
40
|
+
let ColHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class ColHeader extends Component {
|
|
41
|
+
static displayName = "ColHeader";
|
|
42
|
+
static componentId = 'Table.ColHeader';
|
|
43
|
+
static allowedProps = allowedProps;
|
|
44
|
+
static defaultProps = {
|
|
45
|
+
textAlign: 'start',
|
|
46
|
+
sortDirection: 'none',
|
|
47
|
+
children: null,
|
|
48
|
+
scope: 'col'
|
|
49
|
+
};
|
|
52
50
|
componentDidMount() {
|
|
53
|
-
|
|
54
|
-
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
51
|
+
this.props.makeStyles?.();
|
|
55
52
|
}
|
|
56
53
|
componentDidUpdate() {
|
|
57
|
-
|
|
58
|
-
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
54
|
+
this.props.makeStyles?.();
|
|
59
55
|
}
|
|
56
|
+
handleClick = event => {
|
|
57
|
+
const {
|
|
58
|
+
id,
|
|
59
|
+
onRequestSort
|
|
60
|
+
} = this.props;
|
|
61
|
+
onRequestSort && onRequestSort(event, {
|
|
62
|
+
id
|
|
63
|
+
});
|
|
64
|
+
};
|
|
60
65
|
renderSortArrow() {
|
|
61
|
-
const
|
|
62
|
-
sortDirection
|
|
63
|
-
onRequestSort
|
|
64
|
-
styles
|
|
66
|
+
const {
|
|
67
|
+
sortDirection,
|
|
68
|
+
onRequestSort,
|
|
69
|
+
styles
|
|
70
|
+
} = this.props;
|
|
65
71
|
if (sortDirection === 'ascending') {
|
|
66
72
|
return _jsx(IconMiniArrowUpLine, {
|
|
67
|
-
css: styles
|
|
73
|
+
css: styles?.sortedIconColor
|
|
68
74
|
});
|
|
69
75
|
}
|
|
70
76
|
if (sortDirection === 'descending') {
|
|
71
77
|
return _jsx(IconMiniArrowDownLine, {
|
|
72
|
-
css: styles
|
|
78
|
+
css: styles?.sortedIconColor
|
|
73
79
|
});
|
|
74
80
|
}
|
|
75
81
|
if (onRequestSort) {
|
|
76
82
|
return _jsx(IconMiniArrowDoubleLine, {
|
|
77
|
-
css: styles
|
|
83
|
+
css: styles?.unSortedIconColor
|
|
78
84
|
});
|
|
79
85
|
}
|
|
80
|
-
return
|
|
86
|
+
return undefined;
|
|
81
87
|
}
|
|
82
88
|
render() {
|
|
83
|
-
const
|
|
84
|
-
onRequestSort
|
|
85
|
-
width
|
|
86
|
-
children
|
|
87
|
-
sortDirection
|
|
88
|
-
scope
|
|
89
|
-
styles
|
|
89
|
+
const {
|
|
90
|
+
onRequestSort,
|
|
91
|
+
width,
|
|
92
|
+
children,
|
|
93
|
+
sortDirection,
|
|
94
|
+
scope,
|
|
95
|
+
styles
|
|
96
|
+
} = this.props;
|
|
90
97
|
return _jsxs("th", {
|
|
91
98
|
...omitProps(this.props, ColHeader.allowedProps),
|
|
92
|
-
css: styles
|
|
99
|
+
css: styles?.colHeader,
|
|
93
100
|
style: {
|
|
94
101
|
width
|
|
95
102
|
},
|
|
@@ -97,19 +104,14 @@ let ColHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_
|
|
|
97
104
|
"aria-sort": sortDirection,
|
|
98
105
|
children: [onRequestSort && _jsx("button", {
|
|
99
106
|
onClick: this.handleClick,
|
|
100
|
-
css: styles
|
|
107
|
+
css: styles?.button,
|
|
101
108
|
children: _jsxs("div", {
|
|
102
|
-
css: styles
|
|
109
|
+
css: styles?.buttonContent,
|
|
103
110
|
children: [callRenderProp(children), this.renderSortArrow()]
|
|
104
111
|
})
|
|
105
112
|
}), !onRequestSort && children, !onRequestSort && this.renderSortArrow()]
|
|
106
113
|
});
|
|
107
114
|
}
|
|
108
|
-
}
|
|
109
|
-
textAlign: 'start',
|
|
110
|
-
sortDirection: 'none',
|
|
111
|
-
children: null,
|
|
112
|
-
scope: 'col'
|
|
113
|
-
}, _ColHeader)) || _class);
|
|
115
|
+
}) || _class);
|
|
114
116
|
export default ColHeader;
|
|
115
117
|
export { ColHeader };
|
|
@@ -32,8 +32,10 @@
|
|
|
32
32
|
* @return {Object} The final style object, which will be used in the component
|
|
33
33
|
*/
|
|
34
34
|
const generateStyle = (componentTheme, props) => {
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const {
|
|
36
|
+
onRequestSort,
|
|
37
|
+
textAlign
|
|
38
|
+
} = props;
|
|
37
39
|
const headerStyle = {
|
|
38
40
|
color: componentTheme.color,
|
|
39
41
|
fontSize: componentTheme.fontSize,
|
|
@@ -28,12 +28,13 @@
|
|
|
28
28
|
* @return {Object} The final theme object with the overrides and component variables
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
colors
|
|
34
|
-
borders
|
|
35
|
-
spacing
|
|
36
|
-
themeName
|
|
31
|
+
const {
|
|
32
|
+
typography,
|
|
33
|
+
colors,
|
|
34
|
+
borders,
|
|
35
|
+
spacing,
|
|
36
|
+
key: themeName
|
|
37
|
+
} = theme;
|
|
37
38
|
const themeSpecificStyle = {
|
|
38
39
|
canvas: {
|
|
39
40
|
focusOutlineColor: theme['ic-brand-primary'],
|
|
@@ -41,18 +42,18 @@ const generateComponentTheme = theme => {
|
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
44
|
const componentVariables = {
|
|
44
|
-
fontSize: typography
|
|
45
|
-
fontFamily: typography
|
|
46
|
-
color: colors
|
|
47
|
-
background: colors
|
|
48
|
-
borderColor: colors
|
|
49
|
-
lineHeight: typography
|
|
50
|
-
padding: `${spacing
|
|
51
|
-
focusOutlineColor: colors
|
|
52
|
-
focusOutlineWidth: borders
|
|
53
|
-
focusOutlineStyle: borders
|
|
54
|
-
unSortedIconColor: colors
|
|
55
|
-
sortedIconColor: colors
|
|
45
|
+
fontSize: typography?.fontSizeMedium,
|
|
46
|
+
fontFamily: typography?.fontFamily,
|
|
47
|
+
color: colors?.contrasts?.grey125125,
|
|
48
|
+
background: colors?.contrasts?.white1010,
|
|
49
|
+
borderColor: colors?.contrasts?.grey1214,
|
|
50
|
+
lineHeight: typography?.lineHeightCondensed,
|
|
51
|
+
padding: `${spacing?.xSmall} ${spacing?.small}`,
|
|
52
|
+
focusOutlineColor: colors?.contrasts?.blue4570,
|
|
53
|
+
focusOutlineWidth: borders?.widthMedium,
|
|
54
|
+
focusOutlineStyle: borders?.style,
|
|
55
|
+
unSortedIconColor: colors?.contrasts?.grey3045,
|
|
56
|
+
sortedIconColor: colors?.contrasts?.blue4570
|
|
56
57
|
};
|
|
57
58
|
return {
|
|
58
59
|
...componentVariables,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var _dec, _class, _Head, _ScreenReaderContent;
|
|
1
|
+
var _dec, _class;
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -42,19 +41,24 @@ id: Table.Head
|
|
|
42
41
|
---
|
|
43
42
|
**/
|
|
44
43
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
45
|
-
let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class =
|
|
44
|
+
let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Head extends Component {
|
|
45
|
+
static displayName = "Head";
|
|
46
|
+
static componentId = 'Table.Head';
|
|
47
|
+
static contextType = TableContext;
|
|
48
|
+
static allowedProps = allowedProps;
|
|
49
|
+
static defaultProps = {
|
|
50
|
+
children: null
|
|
51
|
+
};
|
|
52
|
+
|
|
46
53
|
/**
|
|
47
54
|
* Returns `true` if the first child's children have a `onRequestSort` prop
|
|
48
55
|
*/
|
|
49
56
|
get isSortable() {
|
|
50
|
-
const
|
|
51
|
-
_ref2 = _slicedToArray(_ref, 1),
|
|
52
|
-
firstRow = _ref2[0];
|
|
57
|
+
const [firstRow] = Children.toArray(this.props.children);
|
|
53
58
|
let sortable = false;
|
|
54
59
|
if (firstRow && firstRow.props && firstRow.props.children) {
|
|
55
60
|
Children.forEach(firstRow.props.children, grandchild => {
|
|
56
|
-
|
|
57
|
-
if (grandchild !== null && grandchild !== void 0 && (_grandchild$props = grandchild.props) !== null && _grandchild$props !== void 0 && _grandchild$props.onRequestSort) {
|
|
61
|
+
if (grandchild?.props?.onRequestSort) {
|
|
58
62
|
sortable = true;
|
|
59
63
|
return;
|
|
60
64
|
}
|
|
@@ -63,15 +67,13 @@ let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
63
67
|
return sortable;
|
|
64
68
|
}
|
|
65
69
|
componentDidMount() {
|
|
66
|
-
|
|
67
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
70
|
+
this.props.makeStyles?.();
|
|
68
71
|
}
|
|
69
72
|
componentDidUpdate() {
|
|
70
|
-
var _this$props$makeStyle2, _this$props2;
|
|
71
73
|
if (this.isSortable && typeof this.props.renderSortLabel === 'undefined') {
|
|
72
74
|
warn(false, '[Table.Head] The `renderSortLabel` prop should be provided when Table is sortable.');
|
|
73
75
|
}
|
|
74
|
-
|
|
76
|
+
this.props.makeStyles?.();
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
/**
|
|
@@ -80,14 +82,12 @@ let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
80
82
|
* there the `id`, `stackedSortByLabel`, `sortDirection`, `onRequestSort` props
|
|
81
83
|
*/
|
|
82
84
|
renderSelect() {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
firstRow = _ref4[0];
|
|
90
|
-
if (!(firstRow !== null && firstRow !== void 0 && (_firstRow$props = firstRow.props) !== null && _firstRow$props !== void 0 && _firstRow$props.children)) {
|
|
85
|
+
const {
|
|
86
|
+
children,
|
|
87
|
+
renderSortLabel
|
|
88
|
+
} = this.props;
|
|
89
|
+
const [firstRow] = Children.toArray(children);
|
|
90
|
+
if (!firstRow?.props?.children) {
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
93
93
|
const options = [];
|
|
@@ -96,12 +96,13 @@ let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
96
96
|
let count = 0;
|
|
97
97
|
Children.forEach(firstRow.props.children, grandchild => {
|
|
98
98
|
count += 1;
|
|
99
|
-
if (!
|
|
100
|
-
const
|
|
101
|
-
id
|
|
102
|
-
stackedSortByLabel
|
|
103
|
-
sortDirection
|
|
104
|
-
onRequestSort
|
|
99
|
+
if (!grandchild?.props) return; // grandchild can be false
|
|
100
|
+
const {
|
|
101
|
+
id,
|
|
102
|
+
stackedSortByLabel,
|
|
103
|
+
sortDirection,
|
|
104
|
+
onRequestSort
|
|
105
|
+
} = grandchild.props;
|
|
105
106
|
if (id && onRequestSort) {
|
|
106
107
|
const label = stackedSortByLabel || id;
|
|
107
108
|
options.push({
|
|
@@ -134,7 +135,7 @@ let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
134
135
|
role: "cell",
|
|
135
136
|
"aria-colspan": count,
|
|
136
137
|
children: _jsx(SimpleSelect, {
|
|
137
|
-
renderLabel: renderSortLabel ? callRenderProp(renderSortLabel) :
|
|
138
|
+
renderLabel: renderSortLabel ? callRenderProp(renderSortLabel) : _jsx(ScreenReaderContent, {}),
|
|
138
139
|
renderBeforeInput: selectedOption && IconCheckLine,
|
|
139
140
|
value: selectedOption,
|
|
140
141
|
onChange: handleSelect,
|
|
@@ -157,17 +158,16 @@ let Head = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
157
158
|
});
|
|
158
159
|
}
|
|
159
160
|
render() {
|
|
160
|
-
const
|
|
161
|
-
children
|
|
162
|
-
styles
|
|
161
|
+
const {
|
|
162
|
+
children,
|
|
163
|
+
styles
|
|
164
|
+
} = this.props;
|
|
163
165
|
return this.context.isStacked ? this.renderSelect() : _jsx("thead", {
|
|
164
166
|
...omitProps(this.props, Head.allowedProps),
|
|
165
|
-
css: styles
|
|
167
|
+
css: styles?.head,
|
|
166
168
|
children: children
|
|
167
169
|
});
|
|
168
170
|
}
|
|
169
|
-
}
|
|
170
|
-
children: null
|
|
171
|
-
}, _Head)) || _class);
|
|
171
|
+
}) || _class);
|
|
172
172
|
export default Head;
|
|
173
173
|
export { Head };
|
|
@@ -28,15 +28,16 @@
|
|
|
28
28
|
* @return {Object} The final theme object with the overrides and component variables
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
typography
|
|
31
|
+
const {
|
|
32
|
+
colors,
|
|
33
|
+
typography
|
|
34
|
+
} = theme;
|
|
34
35
|
const componentVariables = {
|
|
35
|
-
fontSize: typography
|
|
36
|
-
fontFamily: typography
|
|
37
|
-
fontWeight: typography
|
|
38
|
-
color: colors
|
|
39
|
-
background: colors
|
|
36
|
+
fontSize: typography?.fontSizeMedium,
|
|
37
|
+
fontFamily: typography?.fontFamily,
|
|
38
|
+
fontWeight: typography?.fontWeightNormal,
|
|
39
|
+
color: colors?.contrasts?.grey125125,
|
|
40
|
+
background: colors?.contrasts?.white1010
|
|
40
41
|
};
|
|
41
42
|
return {
|
|
42
43
|
...componentVariables
|
package/es/Table/v1/Row/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _class
|
|
1
|
+
var _dec, _class;
|
|
2
2
|
/*
|
|
3
3
|
* The MIT License (MIT)
|
|
4
4
|
*
|
|
@@ -38,32 +38,38 @@ id: Table.Row
|
|
|
38
38
|
---
|
|
39
39
|
**/
|
|
40
40
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
41
|
-
let Row = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class =
|
|
41
|
+
let Row = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Row extends Component {
|
|
42
|
+
static displayName = "Row";
|
|
43
|
+
static componentId = 'Table.Row';
|
|
44
|
+
static contextType = TableContext;
|
|
45
|
+
static allowedProps = allowedProps;
|
|
46
|
+
static defaultProps = {
|
|
47
|
+
children: null
|
|
48
|
+
};
|
|
42
49
|
componentDidMount() {
|
|
43
|
-
|
|
44
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
50
|
+
this.props.makeStyles?.({
|
|
45
51
|
isStacked: this.context.isStacked,
|
|
46
52
|
hover: this.context.hover
|
|
47
53
|
});
|
|
48
54
|
}
|
|
49
55
|
componentDidUpdate() {
|
|
50
|
-
|
|
51
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
|
|
56
|
+
this.props.makeStyles?.({
|
|
52
57
|
isStacked: this.context.isStacked,
|
|
53
58
|
hover: this.context.hover
|
|
54
59
|
});
|
|
55
60
|
}
|
|
56
61
|
render() {
|
|
57
|
-
const
|
|
58
|
-
children
|
|
59
|
-
styles
|
|
62
|
+
const {
|
|
63
|
+
children,
|
|
64
|
+
styles
|
|
65
|
+
} = this.props;
|
|
60
66
|
const isStacked = this.context.isStacked;
|
|
61
67
|
const headers = this.context.headers;
|
|
62
68
|
return _jsx(View, {
|
|
63
69
|
...View.omitViewProps(omitProps(this.props, Row.allowedProps), Row),
|
|
64
70
|
as: isStacked ? 'div' : 'tr',
|
|
65
|
-
css: styles
|
|
66
|
-
role: isStacked ? 'row' :
|
|
71
|
+
css: styles?.row,
|
|
72
|
+
role: isStacked ? 'row' : undefined,
|
|
67
73
|
children: Children.toArray(children).filter(Boolean).map((child, index) => {
|
|
68
74
|
if (/*#__PURE__*/isValidElement(child)) {
|
|
69
75
|
return safeCloneElement(child, {
|
|
@@ -76,8 +82,6 @@ let Row = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
76
82
|
})
|
|
77
83
|
});
|
|
78
84
|
}
|
|
79
|
-
}
|
|
80
|
-
children: null
|
|
81
|
-
}, _Row)) || _class);
|
|
85
|
+
}) || _class);
|
|
82
86
|
export default Row;
|
|
83
87
|
export { Row };
|
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
* @return {Object} The final style object, which will be used in the component
|
|
34
34
|
*/
|
|
35
35
|
const generateStyle = (componentTheme, props, extraArgs) => {
|
|
36
|
-
const
|
|
36
|
+
const {
|
|
37
|
+
setHoverStateTo
|
|
38
|
+
} = props;
|
|
37
39
|
const hoverStyles = {
|
|
38
40
|
borderLeftColor: componentTheme.hoverBorderColor,
|
|
39
41
|
borderRightColor: componentTheme.hoverBorderColor
|
|
@@ -50,7 +52,7 @@ const generateStyle = (componentTheme, props, extraArgs) => {
|
|
|
50
52
|
borderBottomStyle: 'solid',
|
|
51
53
|
borderBottomWidth: '0.0625rem',
|
|
52
54
|
borderBottomColor: componentTheme.borderColor,
|
|
53
|
-
...((setHoverStateTo
|
|
55
|
+
...((setHoverStateTo ?? extraArgs.hover) && {
|
|
54
56
|
borderLeft: '0.1875rem solid transparent',
|
|
55
57
|
borderRight: '0.1875rem solid transparent',
|
|
56
58
|
...(setHoverStateTo === true ? hoverStyles : {
|