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

[EuiFilterGroup][FieldValueSelectionFilter] Use EuiSelectable #5387

Merged
merged 48 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
375cf88
use euiselectable
thompsongl Nov 16, 2021
d78d084
Merge branch 'main' into 3735-filtergroup
thompsongl Nov 17, 2021
49f1d09
update docs text
thompsongl Nov 17, 2021
6e76af9
Merge branch 'main' into 3735-filtergroup
thompsongl Nov 17, 2021
039ee0c
use message props
thompsongl Nov 18, 2021
3c6aa94
isVirtualized, labelProps support
thompsongl Nov 18, 2021
91a0693
refactor search filters to use euiselectable
thompsongl Nov 18, 2021
81cc0cd
Merge branch 'main' into 3735-filtergroup
thompsongl Nov 18, 2021
93d946e
Merge branch 'main' into 3735-filtergroup
thompsongl Nov 22, 2021
4842870
CL
thompsongl Nov 22, 2021
265bc61
Merge branch 'main' into 3735-filtergroup
thompsongl Nov 29, 2021
d0ac920
Merge branch 'main' into 3735-filtergroup
thompsongl Dec 1, 2021
62712d6
Merge branch 'main' into 3735-filtergroup
thompsongl Dec 7, 2021
7c49da3
clean up
thompsongl Dec 7, 2021
a5138e5
add docs for new configuration options
thompsongl Dec 7, 2021
a75a43b
Merge branch 'main' into 3735-filtergroup
thompsongl Dec 8, 2021
53d5438
CL fix
thompsongl Dec 8, 2021
5922629
Merge branch 'main' into 3735-filtergroup
thompsongl Dec 13, 2021
ff81cc6
Merge branch 'main' into 3735-filtergroup
thompsongl Dec 16, 2021
6f901b8
Merge branch 'main' into 3735-filtergroup
thompsongl Dec 21, 2021
08131a3
Merge branch 'main' into 3735-filtergroup
thompsongl Jan 5, 2022
cecc83e
Merge branch 'main' into 3735-filtergroup
thompsongl Jan 11, 2022
cf3140e
Merge branch 'main' into 3735-filtergroup
thompsongl Jan 13, 2022
4ff3225
Merge branch 'main' into 3735-filtergroup
thompsongl Jan 18, 2022
43a939c
review feedback
thompsongl Jan 18, 2022
013fb1f
fragment
thompsongl Jan 18, 2022
70b7a70
Merge branch 'main' into 3735-filtergroup
thompsongl Jan 19, 2022
8c0917a
Merge branch 'main' into 3735-filtergroup
thompsongl Jan 19, 2022
7de5911
Merge branch 'main' into 3735-filtergroup
thompsongl Jan 19, 2022
0505e18
Merge branch 'main' into 3735-filtergroup
thompsongl Jan 31, 2022
9ded92a
Merge branch 'main' into 3735-filtergroup
thompsongl Feb 2, 2022
c21d8a7
Merge branch 'main' into 3735-filtergroup
thompsongl Feb 3, 2022
93a1f9c
docs
thompsongl Feb 3, 2022
7fa49e4
convert tests to cypress
thompsongl Feb 3, 2022
bb467b6
update filter count based on exclusions
thompsongl Feb 3, 2022
94c998f
add recommendation for sizing
thompsongl Feb 3, 2022
1903af5
Merge branch 'main' into 3735-filtergroup
thompsongl Feb 4, 2022
2704e38
use errorMessage
thompsongl Feb 4, 2022
23f9aa9
fix cypress tests
thompsongl Feb 4, 2022
0fdc08f
Merge branch 'main' into 3735-filtergroup
thompsongl Feb 7, 2022
8ab04ce
Merge branch 'main' into 3735-filtergroup
thompsongl Feb 7, 2022
ea1e8cb
Merge branch 'main' into 3735-filtergroup
thompsongl Feb 9, 2022
df9b011
docs
thompsongl Feb 9, 2022
86be75d
Merge branch 'main' into 3735-filtergroup
thompsongl Feb 10, 2022
573b2ce
Merge branch 'main' into 3735-filtergroup
thompsongl Feb 10, 2022
b1e90bf
update docs
thompsongl Feb 10, 2022
092c754
Merge branch 'main' into 3735-filtergroup
thompsongl Feb 10, 2022
871a6d6
Merge branch 'main' into 3735-filtergroup
thompsongl Feb 11, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Updated the outline color in `euiCustomControlFocused` mixin to use
`$euiFocusRingColor` instead of `currentColor` ([#5479](https://github.com/elastic/eui/pull/5479))
- **[Beta]** Added `optimize` build as a lighter weight option more suited to prodcution environments ([#5527](https://github.com/elastic/eui/pull/5527))
- Converted `FieldValueSelectionFilter` in `EuiSearchBar` to use `EuiSelectable` ([#5387](https://github.com/elastic/eui/issues/5387))

## [`45.0.0`](https://github.com/elastic/eui/tree/v45.0.0)

Expand Down
11 changes: 7 additions & 4 deletions src-docs/src/views/filter_group/filter_group_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
EuiFilterGroup,
EuiFilterButton,
EuiFilterSelectItem,
EuiLink,
} from '../../../../src/components';

import FilterGroup from './filter_group';
Expand Down Expand Up @@ -75,10 +76,12 @@ export const FilterGroupExample = {
<Fragment>
<p>
To provide a long list of grouped filter, use a popover for
filtering an array of passed items. This mostly uses standard
popover mechanics, but the component{' '}
<strong>EuiFilterSelectItem</strong> is used for the items
themselves.
filtering an array of passed items. This uses standard popover
mechanics and{' '}
<EuiLink href="#/forms/selectable">
<strong>EuiSelectable</strong>
</EuiLink>
.
</p>
thompsongl marked this conversation as resolved.
Show resolved Hide resolved
<h3>Indicating number of filters</h3>
<p>
Expand Down
119 changes: 39 additions & 80 deletions src-docs/src/views/filter_group/filter_group_multi.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ import React, { useState } from 'react';
import {
EuiPopover,
EuiPopoverTitle,
EuiFieldSearch,
EuiFilterSelectItem,
EuiLoadingChart,
EuiSpacer,
EuiIcon,
EuiFilterGroup,
EuiFilterButton,
EuiSelectable,
} from '../../../../src/components';
import { useGeneratedHtmlId } from '../../../../src/services';

Expand All @@ -29,50 +25,26 @@ export default () => {
});

const [items, setItems] = useState([
{ name: 'Johann Sebastian Bach', checked: 'on' },
{ name: 'Wolfgang Amadeus Mozart', checked: 'on' },
{ name: 'Antonín Dvořák', checked: 'off' },
{ name: 'Dmitri Shostakovich' },
{ name: 'Felix Mendelssohn-Bartholdy' },
{ name: 'Franz Liszt' },
{ name: 'Franz Schubert' },
{ name: 'Frédéric Chopin' },
{ name: 'Georg Friedrich Händel' },
{ name: 'Giuseppe Verdi' },
{ name: 'Gustav Mahler' },
{ name: 'Igor Stravinsky' },
{ name: 'Johannes Brahms' },
{ name: 'Joseph Haydn' },
{ name: 'Ludwig van Beethoven' },
{ name: 'Piotr Illitch Tchaïkovsky' },
{ name: 'Robert Schumann' },
{ name: 'Sergej S. Prokofiew' },
{ name: 'Wolfgang Amadeus Mozart' },
{ label: 'Johann Sebastian Bach', checked: 'on' },
{ label: 'Wolfgang Amadeus Mozart', checked: 'on' },
{ label: 'Antonín Dvořák', checked: 'off' },
{ label: 'Dmitri Shostakovich' },
{ label: 'Felix Mendelssohn-Bartholdy' },
{ label: 'Franz Liszt' },
{ label: 'Franz Schubert' },
{ label: 'Frédéric Chopin' },
{ label: 'Georg Friedrich Händel' },
{ label: 'Giuseppe Verdi' },
{ label: 'Gustav Mahler' },
{ label: 'Igor Stravinsky' },
{ label: 'Johannes Brahms' },
{ label: 'Joseph Haydn' },
{ label: 'Ludwig van Beethoven' },
{ label: 'Piotr Illitch Tchaïkovsky' },
{ label: 'Robert Schumann' },
{ label: 'Sergej S. Prokofiew' },
]);

function updateItem(index) {
if (!items[index]) {
return;
}

const newItems = [...items];

switch (newItems[index].checked) {
case 'on':
newItems[index].checked = 'off';
break;

case 'off':
newItems[index].checked = undefined;
break;

default:
newItems[index].checked = 'on';
}

setItems(newItems);
}

const button = (
<EuiFilterButton
iconType="arrowDown"
Expand All @@ -95,40 +67,27 @@ export default () => {
closePopover={closePopover}
panelPaddingSize="none"
>
<EuiPopoverTitle paddingSize="s">
<EuiFieldSearch compressed />
</EuiPopoverTitle>
<div className="euiFilterSelect__items">
{items.map((item, index) => (
<EuiFilterSelectItem
checked={item.checked}
key={index}
onClick={() => updateItem(index)}
>
{item.name}
</EuiFilterSelectItem>
))}
{/*
Use when loading items initially
*/}
<div className="euiFilterSelect__note">
<div className="euiFilterSelect__noteContent">
<EuiLoadingChart size="m" />
<EuiSpacer size="xs" />
<p>Loading filters</p>
</div>
</div>
{/*
Use when no results are returned
*/}
<div className="euiFilterSelect__note">
<div className="euiFilterSelect__noteContent">
<EuiIcon type="minusInCircle" />
<EuiSpacer size="xs" />
<p>No filters found</p>
<EuiSelectable
allowExclusions
searchable
searchProps={{
placeholder: 'Filter list',
compressed: true,
}}
aria-label="Composers"
options={items}
onChange={(newOptions) => setItems(newOptions)}
loadingMessage="Loading filters"
thompsongl marked this conversation as resolved.
Show resolved Hide resolved
emptyMessage="No filters available"
noMatchesMessage="No filters found"
>
{(list, search) => (
<div>
<EuiPopoverTitle paddingSize="s">{search}</EuiPopoverTitle>
{list}
</div>
</div>
</div>
)}
</EuiSelectable>
</EuiPopover>
</EuiFilterGroup>
);
Expand Down
Loading