@instructure/ui-table 11.7.7 → 11.7.8-snapshot-3
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 +7 -0
- package/es/Table/v2/Row/index.js +50 -47
- package/es/Table/v2/Row/styles.js +7 -7
- package/lib/Table/v2/Row/index.js +49 -46
- package/lib/Table/v2/Row/styles.js +7 -7
- package/package.json +14 -14
- package/src/Table/v2/Row/index.tsx +44 -52
- package/src/Table/v2/Row/props.ts +2 -2
- package/src/Table/v2/Row/styles.ts +10 -10
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Table/v2/Row/index.d.ts +12 -19
- package/types/Table/v2/Row/index.d.ts.map +1 -1
- package/types/Table/v2/Row/props.d.ts +2 -2
- package/types/Table/v2/Row/props.d.ts.map +1 -1
- package/types/Table/v2/Row/styles.d.ts +4 -5
- package/types/Table/v2/Row/styles.d.ts.map +1 -1
- package/types/Table/v2/index.d.ts +12 -2
- package/types/Table/v2/index.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
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.8-snapshot-3](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8-snapshot-3) (2026-09-28)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **ui-link,ui-breadcrumb,ui-table:** avoid layout shifts on SSR hydration ([d90cd09](https://github.com/instructure/instructure-ui/commit/d90cd09fcf63775879830a1809cd5169acf91b5f))
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
## [11.7.7](https://github.com/instructure/instructure-ui/compare/v11.7.6...v11.7.7) (2026-09-23)
|
|
7
14
|
|
|
8
15
|
**Note:** Version bump only for package @instructure/ui-table
|
package/es/Table/v2/Row/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _dec, _class;
|
|
2
1
|
/*
|
|
3
2
|
* The MIT License (MIT)
|
|
4
3
|
*
|
|
@@ -23,10 +22,10 @@ var _dec, _class;
|
|
|
23
22
|
* SOFTWARE.
|
|
24
23
|
*/
|
|
25
24
|
|
|
26
|
-
import {
|
|
25
|
+
import { forwardRef, useContext, Children, isValidElement } from 'react';
|
|
27
26
|
import { omitProps, safeCloneElement } from '@instructure/ui-react-utils';
|
|
28
27
|
import { View } from '@instructure/ui-view/latest';
|
|
29
|
-
import {
|
|
28
|
+
import { useStyleNew } from '@instructure/emotion';
|
|
30
29
|
import generateStyle from './styles.js';
|
|
31
30
|
import { allowedProps } from './props.js';
|
|
32
31
|
import TableContext from '../TableContext.js';
|
|
@@ -38,50 +37,54 @@ id: Table.Row
|
|
|
38
37
|
---
|
|
39
38
|
**/
|
|
40
39
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
const Row = /*#__PURE__*/forwardRef((props, ref) => {
|
|
41
|
+
const {
|
|
42
|
+
children,
|
|
43
|
+
setHoverStateTo,
|
|
44
|
+
themeOverride
|
|
45
|
+
} = props;
|
|
46
|
+
const {
|
|
47
|
+
isStacked,
|
|
48
|
+
hover,
|
|
49
|
+
headers
|
|
50
|
+
} = useContext(TableContext);
|
|
51
|
+
const styles = useStyleNew({
|
|
52
|
+
generateStyle,
|
|
53
|
+
themeOverride,
|
|
54
|
+
params: {
|
|
55
|
+
isStacked,
|
|
56
|
+
hover,
|
|
57
|
+
setHoverStateTo
|
|
58
|
+
},
|
|
59
|
+
componentId: 'TableRow',
|
|
60
|
+
displayName: 'Row'
|
|
61
|
+
});
|
|
62
|
+
const handleElementRef = el => {
|
|
63
|
+
if (typeof ref === 'function') {
|
|
64
|
+
ref(el);
|
|
65
|
+
} else if (ref) {
|
|
66
|
+
const refObject = ref;
|
|
67
|
+
refObject.current = el;
|
|
68
|
+
}
|
|
48
69
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return _jsx(View, {
|
|
69
|
-
...View.omitViewProps(omitProps(this.props, Row.allowedProps), Row),
|
|
70
|
-
as: isStacked ? 'div' : 'tr',
|
|
71
|
-
css: styles?.row,
|
|
72
|
-
role: isStacked ? 'row' : undefined,
|
|
73
|
-
children: Children.toArray(children).filter(Boolean).map((child, index) => {
|
|
74
|
-
if (/*#__PURE__*/isValidElement(child)) {
|
|
75
|
-
return safeCloneElement(child, {
|
|
76
|
-
key: child.props.name,
|
|
77
|
-
// used by `Cell` to render its column title in `stacked` layout
|
|
78
|
-
header: headers && headers[index]
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
return child;
|
|
82
|
-
})
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}) || _class);
|
|
70
|
+
return _jsx(View, {
|
|
71
|
+
...View.omitViewProps(omitProps(props, allowedProps), Row),
|
|
72
|
+
as: isStacked ? 'div' : 'tr',
|
|
73
|
+
css: styles?.row,
|
|
74
|
+
role: isStacked ? 'row' : undefined,
|
|
75
|
+
elementRef: handleElementRef,
|
|
76
|
+
children: Children.toArray(children).filter(Boolean).map((child, index) => {
|
|
77
|
+
if (/*#__PURE__*/isValidElement(child)) {
|
|
78
|
+
return safeCloneElement(child, {
|
|
79
|
+
key: child.props.name,
|
|
80
|
+
// used by `Cell` to render its column title in `stacked` layout
|
|
81
|
+
header: headers && headers[index]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return child;
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
Row.displayName = 'Row';
|
|
86
89
|
export default Row;
|
|
87
90
|
export { Row };
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
* ---
|
|
29
29
|
* Generates the style object from the theme and provided additional information
|
|
30
30
|
* @param {Object} componentTheme The theme variable object.
|
|
31
|
-
* @param {Object}
|
|
32
|
-
* @param {Object} _sharedTokens Shared token object (not used in this component)
|
|
33
|
-
* @param {Object} extraArgs the state of the component, the style is applied to
|
|
31
|
+
* @param {Object} params the props and Table context values the style depends on
|
|
34
32
|
* @return {Object} The final style object, which will be used in the component
|
|
35
33
|
*/
|
|
36
|
-
const generateStyle = (componentTheme,
|
|
34
|
+
const generateStyle = (componentTheme, params) => {
|
|
37
35
|
const {
|
|
36
|
+
isStacked,
|
|
37
|
+
hover,
|
|
38
38
|
setHoverStateTo
|
|
39
|
-
} =
|
|
39
|
+
} = params;
|
|
40
40
|
const hoverStyles = {
|
|
41
41
|
borderLeftColor: componentTheme.hoverBorderColor,
|
|
42
42
|
borderRightColor: componentTheme.hoverBorderColor
|
|
@@ -53,14 +53,14 @@ const generateStyle = (componentTheme, props, _sharedTokens, extraArgs) => {
|
|
|
53
53
|
borderBottomStyle: 'solid',
|
|
54
54
|
borderBottomWidth: '0.0625rem',
|
|
55
55
|
borderBottomColor: componentTheme.borderColor,
|
|
56
|
-
...((setHoverStateTo ??
|
|
56
|
+
...((setHoverStateTo ?? hover) && {
|
|
57
57
|
borderLeft: '0.1875rem solid transparent',
|
|
58
58
|
borderRight: '0.1875rem solid transparent',
|
|
59
59
|
...(setHoverStateTo === true ? hoverStyles : {
|
|
60
60
|
'&:hover': hoverStyles
|
|
61
61
|
})
|
|
62
62
|
}),
|
|
63
|
-
...(
|
|
63
|
+
...(isStacked && {
|
|
64
64
|
padding: `${componentTheme.paddingVertical} ${componentTheme.paddingHorizontal}`
|
|
65
65
|
})
|
|
66
66
|
}
|
|
@@ -14,7 +14,6 @@ var _styles = _interopRequireDefault(require("./styles.js"));
|
|
|
14
14
|
var _props = require("./props.js");
|
|
15
15
|
var _TableContext = _interopRequireDefault(require("../TableContext.js"));
|
|
16
16
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
17
|
-
var _dec, _class;
|
|
18
17
|
/*
|
|
19
18
|
* The MIT License (MIT)
|
|
20
19
|
*
|
|
@@ -38,55 +37,59 @@ var _dec, _class;
|
|
|
38
37
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
39
38
|
* SOFTWARE.
|
|
40
39
|
*/
|
|
40
|
+
|
|
41
41
|
/**
|
|
42
42
|
---
|
|
43
43
|
parent: Table
|
|
44
44
|
id: Table.Row
|
|
45
45
|
---
|
|
46
|
-
**/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
**/const Row = exports.Row = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
47
|
+
const {
|
|
48
|
+
children,
|
|
49
|
+
setHoverStateTo,
|
|
50
|
+
themeOverride
|
|
51
|
+
} = props;
|
|
52
|
+
const {
|
|
53
|
+
isStacked,
|
|
54
|
+
hover,
|
|
55
|
+
headers
|
|
56
|
+
} = (0, _react.useContext)(_TableContext.default);
|
|
57
|
+
const styles = (0, _emotion.useStyleNew)({
|
|
58
|
+
generateStyle: _styles.default,
|
|
59
|
+
themeOverride,
|
|
60
|
+
params: {
|
|
61
|
+
isStacked,
|
|
62
|
+
hover,
|
|
63
|
+
setHoverStateTo
|
|
64
|
+
},
|
|
65
|
+
componentId: 'TableRow',
|
|
66
|
+
displayName: 'Row'
|
|
67
|
+
});
|
|
68
|
+
const handleElementRef = el => {
|
|
69
|
+
if (typeof ref === 'function') {
|
|
70
|
+
ref(el);
|
|
71
|
+
} else if (ref) {
|
|
72
|
+
const refObject = ref;
|
|
73
|
+
refObject.current = el;
|
|
74
|
+
}
|
|
54
75
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return (0, _jsxRuntime.jsx)(_latest.View, {
|
|
75
|
-
..._latest.View.omitViewProps((0, _omitProps.omitProps)(this.props, Row.allowedProps), Row),
|
|
76
|
-
as: isStacked ? 'div' : 'tr',
|
|
77
|
-
css: styles?.row,
|
|
78
|
-
role: isStacked ? 'row' : undefined,
|
|
79
|
-
children: _react.Children.toArray(children).filter(Boolean).map((child, index) => {
|
|
80
|
-
if (/*#__PURE__*/(0, _react.isValidElement)(child)) {
|
|
81
|
-
return (0, _safeCloneElement.safeCloneElement)(child, {
|
|
82
|
-
key: child.props.name,
|
|
83
|
-
// used by `Cell` to render its column title in `stacked` layout
|
|
84
|
-
header: headers && headers[index]
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
return child;
|
|
88
|
-
})
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}) || _class);
|
|
76
|
+
return (0, _jsxRuntime.jsx)(_latest.View, {
|
|
77
|
+
..._latest.View.omitViewProps((0, _omitProps.omitProps)(props, _props.allowedProps), Row),
|
|
78
|
+
as: isStacked ? 'div' : 'tr',
|
|
79
|
+
css: styles?.row,
|
|
80
|
+
role: isStacked ? 'row' : undefined,
|
|
81
|
+
elementRef: handleElementRef,
|
|
82
|
+
children: _react.Children.toArray(children).filter(Boolean).map((child, index) => {
|
|
83
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(child)) {
|
|
84
|
+
return (0, _safeCloneElement.safeCloneElement)(child, {
|
|
85
|
+
key: child.props.name,
|
|
86
|
+
// used by `Cell` to render its column title in `stacked` layout
|
|
87
|
+
header: headers && headers[index]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return child;
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
Row.displayName = 'Row';
|
|
92
95
|
var _default = exports.default = Row;
|
|
@@ -34,15 +34,15 @@ exports.default = void 0;
|
|
|
34
34
|
* ---
|
|
35
35
|
* Generates the style object from the theme and provided additional information
|
|
36
36
|
* @param {Object} componentTheme The theme variable object.
|
|
37
|
-
* @param {Object}
|
|
38
|
-
* @param {Object} _sharedTokens Shared token object (not used in this component)
|
|
39
|
-
* @param {Object} extraArgs the state of the component, the style is applied to
|
|
37
|
+
* @param {Object} params the props and Table context values the style depends on
|
|
40
38
|
* @return {Object} The final style object, which will be used in the component
|
|
41
39
|
*/
|
|
42
|
-
const generateStyle = (componentTheme,
|
|
40
|
+
const generateStyle = (componentTheme, params) => {
|
|
43
41
|
const {
|
|
42
|
+
isStacked,
|
|
43
|
+
hover,
|
|
44
44
|
setHoverStateTo
|
|
45
|
-
} =
|
|
45
|
+
} = params;
|
|
46
46
|
const hoverStyles = {
|
|
47
47
|
borderLeftColor: componentTheme.hoverBorderColor,
|
|
48
48
|
borderRightColor: componentTheme.hoverBorderColor
|
|
@@ -59,14 +59,14 @@ const generateStyle = (componentTheme, props, _sharedTokens, extraArgs) => {
|
|
|
59
59
|
borderBottomStyle: 'solid',
|
|
60
60
|
borderBottomWidth: '0.0625rem',
|
|
61
61
|
borderBottomColor: componentTheme.borderColor,
|
|
62
|
-
...((setHoverStateTo ??
|
|
62
|
+
...((setHoverStateTo ?? hover) && {
|
|
63
63
|
borderLeft: '0.1875rem solid transparent',
|
|
64
64
|
borderRight: '0.1875rem solid transparent',
|
|
65
65
|
...(setHoverStateTo === true ? hoverStyles : {
|
|
66
66
|
'&:hover': hoverStyles
|
|
67
67
|
})
|
|
68
68
|
}),
|
|
69
|
-
...(
|
|
69
|
+
...(isStacked && {
|
|
70
70
|
padding: `${componentTheme.paddingVertical} ${componentTheme.paddingHorizontal}`
|
|
71
71
|
})
|
|
72
72
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-table",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.8-snapshot-3",
|
|
4
4
|
"description": "A styled HTML table component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,22 +15,22 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/console": "11.7.
|
|
19
|
-
"@instructure/emotion": "11.7.
|
|
20
|
-
"@instructure/shared-types": "11.7.
|
|
21
|
-
"@instructure/ui-a11y-content": "11.7.
|
|
22
|
-
"@instructure/ui-icons": "11.7.
|
|
23
|
-
"@instructure/ui-
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-
|
|
27
|
-
"@instructure/ui-view": "11.7.
|
|
18
|
+
"@instructure/console": "11.7.8-snapshot-3",
|
|
19
|
+
"@instructure/emotion": "11.7.8-snapshot-3",
|
|
20
|
+
"@instructure/shared-types": "11.7.8-snapshot-3",
|
|
21
|
+
"@instructure/ui-a11y-content": "11.7.8-snapshot-3",
|
|
22
|
+
"@instructure/ui-icons": "11.7.8-snapshot-3",
|
|
23
|
+
"@instructure/ui-simple-select": "11.7.8-snapshot-3",
|
|
24
|
+
"@instructure/ui-utils": "11.7.8-snapshot-3",
|
|
25
|
+
"@instructure/ui-react-utils": "11.7.8-snapshot-3",
|
|
26
|
+
"@instructure/ui-themes": "11.7.8-snapshot-3",
|
|
27
|
+
"@instructure/ui-view": "11.7.8-snapshot-3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"vitest": "^5.0.0",
|
|
31
|
-
"@instructure/ui-axe-check": "11.7.
|
|
32
|
-
"@instructure/ui-color-utils": "11.7.
|
|
33
|
-
"@instructure/ui-babel-preset": "11.7.
|
|
31
|
+
"@instructure/ui-axe-check": "11.7.8-snapshot-3",
|
|
32
|
+
"@instructure/ui-color-utils": "11.7.8-snapshot-3",
|
|
33
|
+
"@instructure/ui-babel-preset": "11.7.8-snapshot-3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": ">=18 <=19"
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import {
|
|
26
|
-
|
|
26
|
+
forwardRef,
|
|
27
|
+
useContext,
|
|
27
28
|
Children,
|
|
28
|
-
ContextType,
|
|
29
29
|
isValidElement,
|
|
30
30
|
type ReactElement
|
|
31
31
|
} from 'react'
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
import { omitProps, safeCloneElement } from '@instructure/ui-react-utils'
|
|
34
34
|
import { View } from '@instructure/ui-view/latest'
|
|
35
35
|
|
|
36
|
-
import {
|
|
36
|
+
import { useStyleNew } from '@instructure/emotion'
|
|
37
37
|
|
|
38
38
|
import generateStyle from './styles.js'
|
|
39
39
|
|
|
@@ -47,60 +47,52 @@ parent: Table
|
|
|
47
47
|
id: Table.Row
|
|
48
48
|
---
|
|
49
49
|
**/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
static readonly componentId = 'Table.Row'
|
|
54
|
-
static contextType = TableContext
|
|
55
|
-
declare context: ContextType<typeof TableContext>
|
|
56
|
-
static allowedProps = allowedProps
|
|
50
|
+
const Row = forwardRef<HTMLElement, TableRowProps>((props, ref) => {
|
|
51
|
+
const { children, setHoverStateTo, themeOverride } = props
|
|
52
|
+
const { isStacked, hover, headers } = useContext(TableContext)
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
hover: this.context.hover
|
|
66
|
-
})
|
|
67
|
-
}
|
|
54
|
+
const styles = useStyleNew({
|
|
55
|
+
generateStyle,
|
|
56
|
+
themeOverride,
|
|
57
|
+
params: { isStacked, hover, setHoverStateTo },
|
|
58
|
+
componentId: 'TableRow',
|
|
59
|
+
displayName: 'Row'
|
|
60
|
+
})
|
|
68
61
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
62
|
+
const handleElementRef = (el: HTMLElement | null) => {
|
|
63
|
+
if (typeof ref === 'function') {
|
|
64
|
+
ref(el)
|
|
65
|
+
} else if (ref) {
|
|
66
|
+
const refObject = ref as React.MutableRefObject<HTMLElement | null>
|
|
67
|
+
refObject.current = el
|
|
68
|
+
}
|
|
74
69
|
}
|
|
75
70
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
return (
|
|
72
|
+
<View
|
|
73
|
+
{...View.omitViewProps(omitProps(props, allowedProps), Row)}
|
|
74
|
+
as={isStacked ? 'div' : 'tr'}
|
|
75
|
+
css={styles?.row}
|
|
76
|
+
role={isStacked ? 'row' : undefined}
|
|
77
|
+
elementRef={handleElementRef}
|
|
78
|
+
>
|
|
79
|
+
{Children.toArray(children)
|
|
80
|
+
.filter(Boolean)
|
|
81
|
+
.map((child, index) => {
|
|
82
|
+
if (isValidElement(child)) {
|
|
83
|
+
return safeCloneElement(child, {
|
|
84
|
+
key: (child as ReactElement<any>).props.name,
|
|
85
|
+
// used by `Cell` to render its column title in `stacked` layout
|
|
86
|
+
header: headers && headers[index]
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
return child
|
|
90
|
+
})}
|
|
91
|
+
</View>
|
|
92
|
+
)
|
|
93
|
+
})
|
|
80
94
|
|
|
81
|
-
|
|
82
|
-
<View
|
|
83
|
-
{...View.omitViewProps(omitProps(this.props, Row.allowedProps), Row)}
|
|
84
|
-
as={isStacked ? 'div' : 'tr'}
|
|
85
|
-
css={styles?.row}
|
|
86
|
-
role={isStacked ? 'row' : undefined}
|
|
87
|
-
>
|
|
88
|
-
{Children.toArray(children)
|
|
89
|
-
.filter(Boolean)
|
|
90
|
-
.map((child, index) => {
|
|
91
|
-
if (isValidElement(child)) {
|
|
92
|
-
return safeCloneElement(child, {
|
|
93
|
-
key: (child as ReactElement<any>).props.name,
|
|
94
|
-
// used by `Cell` to render its column title in `stacked` layout
|
|
95
|
-
header: headers && headers[index]
|
|
96
|
-
})
|
|
97
|
-
}
|
|
98
|
-
return child
|
|
99
|
-
})}
|
|
100
|
-
</View>
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
95
|
+
Row.displayName = 'Row'
|
|
104
96
|
|
|
105
97
|
export default Row
|
|
106
98
|
export { Row }
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
26
|
import type { OtherHTMLAttributes } from '@instructure/shared-types'
|
|
27
|
-
import type { ComponentStyle,
|
|
27
|
+
import type { ComponentStyle, NewThemeOverrideProp } from '@instructure/emotion'
|
|
28
28
|
import type { NewComponentTypes } from '@instructure/ui-themes'
|
|
29
29
|
|
|
30
30
|
type TableRowOwnProps = {
|
|
@@ -57,7 +57,7 @@ type PropKeys = keyof TableRowOwnProps
|
|
|
57
57
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
58
58
|
|
|
59
59
|
type TableRowProps = TableRowOwnProps &
|
|
60
|
-
|
|
60
|
+
NewThemeOverrideProp<ReturnType<NewComponentTypes['TableRow']>> &
|
|
61
61
|
OtherHTMLAttributes<TableRowOwnProps>
|
|
62
62
|
|
|
63
63
|
type TableRowStyle = ComponentStyle<'row'>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import type { NewComponentTypes
|
|
25
|
+
import type { NewComponentTypes } from '@instructure/ui-themes'
|
|
26
26
|
import type { TableRowProps, TableRowStyle } from './props'
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -31,18 +31,18 @@ import type { TableRowProps, TableRowStyle } from './props'
|
|
|
31
31
|
* ---
|
|
32
32
|
* Generates the style object from the theme and provided additional information
|
|
33
33
|
* @param {Object} componentTheme The theme variable object.
|
|
34
|
-
* @param {Object}
|
|
35
|
-
* @param {Object} _sharedTokens Shared token object (not used in this component)
|
|
36
|
-
* @param {Object} extraArgs the state of the component, the style is applied to
|
|
34
|
+
* @param {Object} params the props and Table context values the style depends on
|
|
37
35
|
* @return {Object} The final style object, which will be used in the component
|
|
38
36
|
*/
|
|
39
37
|
const generateStyle = (
|
|
40
38
|
componentTheme: ReturnType<NewComponentTypes['TableRow']>,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
params: {
|
|
40
|
+
isStacked: boolean
|
|
41
|
+
hover: boolean
|
|
42
|
+
setHoverStateTo: TableRowProps['setHoverStateTo']
|
|
43
|
+
}
|
|
44
44
|
): TableRowStyle => {
|
|
45
|
-
const { setHoverStateTo } =
|
|
45
|
+
const { isStacked, hover, setHoverStateTo } = params
|
|
46
46
|
|
|
47
47
|
const hoverStyles = {
|
|
48
48
|
borderLeftColor: componentTheme.hoverBorderColor,
|
|
@@ -62,13 +62,13 @@ const generateStyle = (
|
|
|
62
62
|
borderBottomWidth: '0.0625rem',
|
|
63
63
|
borderBottomColor: componentTheme.borderColor,
|
|
64
64
|
|
|
65
|
-
...((setHoverStateTo ??
|
|
65
|
+
...((setHoverStateTo ?? hover) && {
|
|
66
66
|
borderLeft: '0.1875rem solid transparent',
|
|
67
67
|
borderRight: '0.1875rem solid transparent',
|
|
68
68
|
...(setHoverStateTo === true ? hoverStyles : { '&:hover': hoverStyles })
|
|
69
69
|
}),
|
|
70
70
|
|
|
71
|
-
...(
|
|
71
|
+
...(isStacked && {
|
|
72
72
|
padding: `${componentTheme.paddingVertical} ${componentTheme.paddingHorizontal}`
|
|
73
73
|
})
|
|
74
74
|
}
|