Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for indeterminate checkboxes #1108

Merged
merged 6 commits into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `3.4.0`.
- Added support for `indeterminate` to `EuiCheckbox` ([#1108](https://github.com/elastic/eui/pull/1108))

## [`3.4.0`](https://github.com/elastic/eui/tree/v3.4.0)

Expand Down
16 changes: 16 additions & 0 deletions src-docs/src/views/form_controls/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default class extends Component {

this.state = {
checked: false,
indeterminate: true,
};
}

Expand All @@ -25,6 +26,12 @@ export default class extends Component {
});
};

onChangeIndeterminate = () => {
this.setState({
indeterminate: !this.state.indeterminate,
});
};

render() {
return (
<Fragment>
Expand All @@ -37,6 +44,15 @@ export default class extends Component {

<EuiSpacer size="m" />

<EuiCheckbox
id={makeId()}
label="I am an indeterminate checkbox"
indeterminate={this.state.indeterminate}
onChange={this.onChangeIndeterminate}
/>

<EuiSpacer size="m" />

<EuiCheckbox
id={makeId()}
label="I am a disabled checkbox"
Expand Down
28 changes: 28 additions & 0 deletions src/components/basic_table/__snapshots__/basic_table.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ exports[`EuiBasicTable with pagination and selection 1`] = `
data-test-subj="checkboxSelectAll"
disabled={false}
id="_selection_column-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -787,6 +788,7 @@ exports[`EuiBasicTable with pagination and selection 1`] = `
data-test-subj="checkboxSelectRow-1"
disabled={false}
id="_selection_column_1-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -817,6 +819,7 @@ exports[`EuiBasicTable with pagination and selection 1`] = `
data-test-subj="checkboxSelectRow-2"
disabled={false}
id="_selection_column_2-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -847,6 +850,7 @@ exports[`EuiBasicTable with pagination and selection 1`] = `
data-test-subj="checkboxSelectRow-3"
disabled={false}
id="_selection_column_3-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -914,6 +918,7 @@ exports[`EuiBasicTable with pagination, selection and sorting 1`] = `
data-test-subj="checkboxSelectAll"
disabled={false}
id="_selection_column-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -947,6 +952,7 @@ exports[`EuiBasicTable with pagination, selection and sorting 1`] = `
data-test-subj="checkboxSelectRow-1"
disabled={false}
id="_selection_column_1-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -977,6 +983,7 @@ exports[`EuiBasicTable with pagination, selection and sorting 1`] = `
data-test-subj="checkboxSelectRow-2"
disabled={false}
id="_selection_column_2-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1007,6 +1014,7 @@ exports[`EuiBasicTable with pagination, selection and sorting 1`] = `
data-test-subj="checkboxSelectRow-3"
disabled={false}
id="_selection_column_3-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1074,6 +1082,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and a single record a
data-test-subj="checkboxSelectAll"
disabled={false}
id="_selection_column-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1114,6 +1123,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and a single record a
data-test-subj="checkboxSelectRow-1"
disabled={false}
id="_selection_column_1-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1172,6 +1182,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and a single record a
data-test-subj="checkboxSelectRow-2"
disabled={false}
id="_selection_column_2-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1230,6 +1241,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and a single record a
data-test-subj="checkboxSelectRow-3"
disabled={false}
id="_selection_column_3-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1325,6 +1337,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and column dataType 1
data-test-subj="checkboxSelectAll"
disabled={false}
id="_selection_column-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1358,6 +1371,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and column dataType 1
data-test-subj="checkboxSelectRow-1"
disabled={false}
id="_selection_column_1-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1388,6 +1402,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and column dataType 1
data-test-subj="checkboxSelectRow-2"
disabled={false}
id="_selection_column_2-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1418,6 +1433,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and column dataType 1
data-test-subj="checkboxSelectRow-3"
disabled={false}
id="_selection_column_3-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1485,6 +1501,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and column renderer 1
data-test-subj="checkboxSelectAll"
disabled={false}
id="_selection_column-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1518,6 +1535,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and column renderer 1
data-test-subj="checkboxSelectRow-1"
disabled={false}
id="_selection_column_1-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1548,6 +1566,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and column renderer 1
data-test-subj="checkboxSelectRow-2"
disabled={false}
id="_selection_column_2-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1578,6 +1597,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and column renderer 1
data-test-subj="checkboxSelectRow-3"
disabled={false}
id="_selection_column_3-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1645,6 +1665,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and multiple record a
data-test-subj="checkboxSelectAll"
disabled={false}
id="_selection_column-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1685,6 +1706,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and multiple record a
data-test-subj="checkboxSelectRow-1"
disabled={false}
id="_selection_column_1-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1741,6 +1763,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and multiple record a
data-test-subj="checkboxSelectRow-2"
disabled={false}
id="_selection_column_2-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1797,6 +1820,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and multiple record a
data-test-subj="checkboxSelectRow-3"
disabled={false}
id="_selection_column_3-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1890,6 +1914,7 @@ exports[`EuiBasicTable with pagination, selection, sorting, column renderer and
data-test-subj="checkboxSelectAll"
disabled={false}
id="_selection_column-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1923,6 +1948,7 @@ exports[`EuiBasicTable with pagination, selection, sorting, column renderer and
data-test-subj="checkboxSelectRow-1"
disabled={false}
id="_selection_column_1-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1953,6 +1979,7 @@ exports[`EuiBasicTable with pagination, selection, sorting, column renderer and
data-test-subj="checkboxSelectRow-2"
disabled={false}
id="_selection_column_2-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down Expand Up @@ -1983,6 +2010,7 @@ exports[`EuiBasicTable with pagination, selection, sorting, column renderer and
data-test-subj="checkboxSelectRow-3"
disabled={false}
id="_selection_column_3-checkbox"
indeterminate={false}
onChange={[Function]}
type="inList"
/>
Expand Down
3 changes: 1 addition & 2 deletions src/components/form/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@
}

transition: background-color $euiAnimSpeedFast ease-in,
border-color $euiAnimSpeedFast ease-in,
background-image 0s ease-out $euiAnimSpeedFast;
border-color $euiAnimSpeedFast ease-in;
}

@mixin euiCustomControl--selected($type: null){
Expand Down
Loading