Skip to content
This repository was archived by the owner on Oct 19, 2021. It is now read-only.

Commit 835b7d6

Browse files
ryanomackeyjoshblack
authored andcommitted
feat(DataTable): allow TableSelect components to be disabled (#1003)
1 parent 5e13b23 commit 835b7d6

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/components/DataTable/TableSelectAll.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const TableSelectAll = ({
99
indeterminate,
1010
name,
1111
onSelect,
12+
disabled,
1213
}) => (
1314
<th scope="col">
1415
<InlineCheckbox
@@ -18,6 +19,7 @@ const TableSelectAll = ({
1819
indeterminate={indeterminate}
1920
name={name}
2021
onClick={onSelect}
22+
disabled={disabled}
2123
/>
2224
</th>
2325
);

src/components/DataTable/TableSelectRow.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@ import PropTypes from 'prop-types';
22
import React from 'react';
33
import InlineCheckbox from '../InlineCheckbox';
44

5-
const TableSelectRow = ({ ariaLabel, checked, id, name, onSelect }) => (
5+
const TableSelectRow = ({
6+
ariaLabel,
7+
checked,
8+
id,
9+
name,
10+
onSelect,
11+
disabled,
12+
}) => (
613
<td>
714
<InlineCheckbox
815
id={id}
916
name={name}
1017
onClick={onSelect}
1118
checked={checked}
1219
ariaLabel={ariaLabel}
20+
disabled={disabled}
1321
/>
1422
</td>
1523
);

src/components/InlineCheckbox/InlineCheckbox.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ export default class InlineCheckbox extends React.Component {
1313
*/
1414
checked: PropTypes.bool.isRequired,
1515

16+
/**
17+
* Specify whether the underlying input control should be disabled
18+
*/
19+
disabled: PropTypes.bool,
20+
1621
/**
1722
* Provide an `id` for the underlying input control
1823
*/
@@ -58,6 +63,7 @@ export default class InlineCheckbox extends React.Component {
5863
id,
5964
indeterminate,
6065
checked,
66+
disabled,
6167
ariaLabel,
6268
name,
6369
onClick,
@@ -72,6 +78,7 @@ export default class InlineCheckbox extends React.Component {
7278
type: 'checkbox',
7379
ref: this.handleRef,
7480
checked: false,
81+
disabled,
7582
};
7683

7784
if (checked) {

0 commit comments

Comments
 (0)