@instructure/ui-table 10.22.0 → 10.22.1-snapshot-1

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 CHANGED
@@ -3,6 +3,17 @@
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
+ ## [10.22.1-snapshot-1](https://github.com/instructure/instructure-ui/compare/v10.22.0...v10.22.1-snapshot-1) (2025-07-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * **ui-table:** add setHoverStateTo to control the hover state of the Table's row ([60001cd](https://github.com/instructure/instructure-ui/commit/60001cd8439ecacc5eb3dc3a5be1144f7f5faa31))
12
+
13
+
14
+
15
+
16
+
6
17
  # [10.22.0](https://github.com/instructure/instructure-ui/compare/v10.21.0...v10.22.0) (2025-07-04)
7
18
 
8
19
  **Note:** Version bump only for package @instructure/ui-table
@@ -24,7 +24,8 @@
24
24
 
25
25
  import PropTypes from 'prop-types';
26
26
  const propTypes = {
27
- children: PropTypes.node
27
+ children: PropTypes.node,
28
+ setHoverStateTo: PropTypes.bool
28
29
  };
29
- const allowedProps = ['children'];
30
+ const allowedProps = ['children', 'setHoverStateTo'];
30
31
  export { propTypes, allowedProps };
@@ -32,7 +32,12 @@
32
32
  * @param {Object} extraArgs the state of the component, the style is applied to
33
33
  * @return {Object} The final style object, which will be used in the component
34
34
  */
35
- const generateStyle = (componentTheme, _props, extraArgs) => {
35
+ const generateStyle = (componentTheme, props, extraArgs) => {
36
+ const setHoverStateTo = props.setHoverStateTo;
37
+ const hoverStyles = {
38
+ borderLeftColor: componentTheme.hoverBorderColor,
39
+ borderRightColor: componentTheme.hoverBorderColor
40
+ };
36
41
  return {
37
42
  row: {
38
43
  label: 'row',
@@ -45,13 +50,12 @@ const generateStyle = (componentTheme, _props, extraArgs) => {
45
50
  borderBottomStyle: 'solid',
46
51
  borderBottomWidth: '0.0625rem',
47
52
  borderBottomColor: componentTheme.borderColor,
48
- ...(extraArgs.hover && {
53
+ ...((setHoverStateTo !== null && setHoverStateTo !== void 0 ? setHoverStateTo : extraArgs.hover) && {
49
54
  borderLeft: '0.1875rem solid transparent',
50
55
  borderRight: '0.1875rem solid transparent',
51
- '&:hover': {
52
- borderLeftColor: componentTheme.hoverBorderColor,
53
- borderRightColor: componentTheme.hoverBorderColor
54
- }
56
+ ...(setHoverStateTo === true ? hoverStyles : {
57
+ '&:hover': hoverStyles
58
+ })
55
59
  }),
56
60
  ...(extraArgs.isStacked && {
57
61
  padding: componentTheme.padding
@@ -31,6 +31,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
31
31
  */
32
32
 
33
33
  const propTypes = exports.propTypes = {
34
- children: _propTypes.default.node
34
+ children: _propTypes.default.node,
35
+ setHoverStateTo: _propTypes.default.bool
35
36
  };
36
- const allowedProps = exports.allowedProps = ['children'];
37
+ const allowedProps = exports.allowedProps = ['children', 'setHoverStateTo'];
@@ -38,7 +38,12 @@ exports.default = void 0;
38
38
  * @param {Object} extraArgs the state of the component, the style is applied to
39
39
  * @return {Object} The final style object, which will be used in the component
40
40
  */
41
- const generateStyle = (componentTheme, _props, extraArgs) => {
41
+ const generateStyle = (componentTheme, props, extraArgs) => {
42
+ const setHoverStateTo = props.setHoverStateTo;
43
+ const hoverStyles = {
44
+ borderLeftColor: componentTheme.hoverBorderColor,
45
+ borderRightColor: componentTheme.hoverBorderColor
46
+ };
42
47
  return {
43
48
  row: {
44
49
  label: 'row',
@@ -51,13 +56,12 @@ const generateStyle = (componentTheme, _props, extraArgs) => {
51
56
  borderBottomStyle: 'solid',
52
57
  borderBottomWidth: '0.0625rem',
53
58
  borderBottomColor: componentTheme.borderColor,
54
- ...(extraArgs.hover && {
59
+ ...((setHoverStateTo !== null && setHoverStateTo !== void 0 ? setHoverStateTo : extraArgs.hover) && {
55
60
  borderLeft: '0.1875rem solid transparent',
56
61
  borderRight: '0.1875rem solid transparent',
57
- '&:hover': {
58
- borderLeftColor: componentTheme.hoverBorderColor,
59
- borderRightColor: componentTheme.hoverBorderColor
60
- }
62
+ ...(setHoverStateTo === true ? hoverStyles : {
63
+ '&:hover': hoverStyles
64
+ })
61
65
  }),
62
66
  ...(extraArgs.isStacked && {
63
67
  padding: componentTheme.padding
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-table",
3
- "version": "10.22.0",
3
+ "version": "10.22.1-snapshot-1",
4
4
  "description": "A styled HTML table component",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,10 +23,10 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-axe-check": "10.22.0",
27
- "@instructure/ui-babel-preset": "10.22.0",
28
- "@instructure/ui-color-utils": "10.22.0",
29
- "@instructure/ui-themes": "10.22.0",
26
+ "@instructure/ui-axe-check": "10.22.1-snapshot-1",
27
+ "@instructure/ui-babel-preset": "10.22.1-snapshot-1",
28
+ "@instructure/ui-color-utils": "10.22.1-snapshot-1",
29
+ "@instructure/ui-themes": "10.22.1-snapshot-1",
30
30
  "@testing-library/jest-dom": "^6.6.3",
31
31
  "@testing-library/react": "^16.0.1",
32
32
  "@testing-library/user-event": "^14.6.1",
@@ -34,17 +34,17 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@babel/runtime": "^7.27.6",
37
- "@instructure/console": "10.22.0",
38
- "@instructure/emotion": "10.22.0",
39
- "@instructure/shared-types": "10.22.0",
40
- "@instructure/ui-a11y-content": "10.22.0",
41
- "@instructure/ui-icons": "10.22.0",
42
- "@instructure/ui-prop-types": "10.22.0",
43
- "@instructure/ui-react-utils": "10.22.0",
44
- "@instructure/ui-simple-select": "10.22.0",
45
- "@instructure/ui-testable": "10.22.0",
46
- "@instructure/ui-utils": "10.22.0",
47
- "@instructure/ui-view": "10.22.0",
37
+ "@instructure/console": "10.22.1-snapshot-1",
38
+ "@instructure/emotion": "10.22.1-snapshot-1",
39
+ "@instructure/shared-types": "10.22.1-snapshot-1",
40
+ "@instructure/ui-a11y-content": "10.22.1-snapshot-1",
41
+ "@instructure/ui-icons": "10.22.1-snapshot-1",
42
+ "@instructure/ui-prop-types": "10.22.1-snapshot-1",
43
+ "@instructure/ui-react-utils": "10.22.1-snapshot-1",
44
+ "@instructure/ui-simple-select": "10.22.1-snapshot-1",
45
+ "@instructure/ui-testable": "10.22.1-snapshot-1",
46
+ "@instructure/ui-utils": "10.22.1-snapshot-1",
47
+ "@instructure/ui-view": "10.22.1-snapshot-1",
48
48
  "prop-types": "^15.8.1"
49
49
  },
50
50
  "peerDependencies": {
@@ -40,6 +40,13 @@ type TableRowOwnProps = {
40
40
  * By default `Table.ColHeader` or `Table.RowHeader` or `Table.Cell`
41
41
  */
42
42
  children?: React.ReactElement | React.ReactElement[]
43
+
44
+ /**
45
+ * Controls the hover state of the row.
46
+ * When set to true, the row will appear highlighted even when not hovered.
47
+ * When set to false, the row will not highlight on hover even if the hover prop is set to true.
48
+ */
49
+ setHoverStateTo?: boolean
43
50
  }
44
51
 
45
52
  type PropKeys = keyof TableRowOwnProps
@@ -53,10 +60,11 @@ type TableRowProps = TableRowOwnProps &
53
60
  type TableRowStyle = ComponentStyle<'row'>
54
61
 
55
62
  const propTypes: PropValidators<PropKeys> = {
56
- children: PropTypes.node
63
+ children: PropTypes.node,
64
+ setHoverStateTo: PropTypes.bool
57
65
  }
58
66
 
59
- const allowedProps: AllowedPropKeys = ['children']
67
+ const allowedProps: AllowedPropKeys = ['children', 'setHoverStateTo']
60
68
 
61
69
  export type { TableRowProps, TableRowStyle }
62
70
  export { propTypes, allowedProps }
@@ -37,9 +37,16 @@ import type { TableRowProps, TableRowStyle } from './props'
37
37
  */
38
38
  const generateStyle = (
39
39
  componentTheme: TableRowTheme,
40
- _props: TableRowProps,
40
+ props: TableRowProps,
41
41
  extraArgs: { isStacked: boolean; hover: boolean }
42
42
  ): TableRowStyle => {
43
+ const { setHoverStateTo } = props
44
+
45
+ const hoverStyles = {
46
+ borderLeftColor: componentTheme.hoverBorderColor,
47
+ borderRightColor: componentTheme.hoverBorderColor
48
+ }
49
+
43
50
  return {
44
51
  row: {
45
52
  label: 'row',
@@ -53,14 +60,10 @@ const generateStyle = (
53
60
  borderBottomWidth: '0.0625rem',
54
61
  borderBottomColor: componentTheme.borderColor,
55
62
 
56
- ...(extraArgs.hover && {
63
+ ...((setHoverStateTo ?? extraArgs.hover) && {
57
64
  borderLeft: '0.1875rem solid transparent',
58
65
  borderRight: '0.1875rem solid transparent',
59
-
60
- '&:hover': {
61
- borderLeftColor: componentTheme.hoverBorderColor,
62
- borderRightColor: componentTheme.hoverBorderColor
63
- }
66
+ ...(setHoverStateTo === true ? hoverStyles : { '&:hover': hoverStyles })
64
67
  }),
65
68
 
66
69
  ...(extraArgs.isStacked && { padding: componentTheme.padding })