diff --git a/CHANGELOG.md b/CHANGELOG.md index 25667bf8d580..3ce1a13357bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,13 @@ ## [`main`](https://github.com/elastic/eui/tree/main) +- Added `compressed` prop to `EuiFilterGroup` and reduced the size of the `EuiFilterButton` notification badge ([#5717](https://github.com/elastic/eui/pull/5717)) - Updated `testenv` mock for `EuiIcon` to render `aria-label` as text ([#5709](https://github.com/elastic/eui/pull/5709)) - Added `editorChecklist` glyph to `EuiIcon` ([#5705](https://github.com/elastic/eui/pull/5705)) **Breaking changes** - Removed Legacy theme including compiled CSS ([#5688](https://github.com/elastic/eui/pull/5688)) +- Removed `flush` and `size` props in `EuiFilterButtonProps` ([#5717](https://github.com/elastic/eui/pull/5717)) **CSS-in-JS conversions** diff --git a/src-docs/src/views/filter_group/filter_group_simple.js b/src-docs/src/views/filter_group/filter_group_simple.js index 8639fa850c96..c0191508ed4e 100644 --- a/src-docs/src/views/filter_group/filter_group_simple.js +++ b/src-docs/src/views/filter_group/filter_group_simple.js @@ -1,6 +1,7 @@ import React, { useState } from 'react'; import { EuiFilterGroup, EuiFilterButton } from '../../../../src/components'; +import { DisplayToggles } from '../form_controls/display_toggles'; export default () => { const [isFilterOn, setIsFilterOn] = useState(false); @@ -22,23 +23,31 @@ export default () => { }; return ( - - - Single filter - - - On - - - Off - - + + + + Single filter + + + On + + + Off + + + ); }; diff --git a/src/components/filter_group/__snapshots__/filter_button.test.tsx.snap b/src/components/filter_group/__snapshots__/filter_button.test.tsx.snap index e0595f5d9cdd..34908e06df0a 100644 --- a/src/components/filter_group/__snapshots__/filter_button.test.tsx.snap +++ b/src/components/filter_group/__snapshots__/filter_button.test.tsx.snap @@ -1,5 +1,26 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`EuiFilterButton does not render a badge or count if numFilters is not passed 1`] = ` + +`; + exports[`EuiFilterButton is rendered 1`] = ` `; - -exports[`EuiFilterButton does not render a badge or count if numFilters is not passed 1`] = ` - -`; diff --git a/src/components/filter_group/__snapshots__/filter_group.test.tsx.snap b/src/components/filter_group/__snapshots__/filter_group.test.tsx.snap index 910577566b47..069f998a003d 100644 --- a/src/components/filter_group/__snapshots__/filter_group.test.tsx.snap +++ b/src/components/filter_group/__snapshots__/filter_group.test.tsx.snap @@ -8,6 +8,12 @@ exports[`EuiFilterGroup is rendered 1`] = ` /> `; +exports[`EuiFilterGroup props compressed is rendered 1`] = ` +
+`; + exports[`EuiFilterGroup props fullWidth is rendered 1`] = `
; export const EuiFilterButton: FunctionComponent = ({ children, @@ -107,7 +108,6 @@ export const EuiFilterButton: FunctionComponent = ({ const badgeContent = showBadge && ( diff --git a/src/components/filter_group/filter_group.test.tsx b/src/components/filter_group/filter_group.test.tsx index 5985af82b796..68dfadb05ba8 100644 --- a/src/components/filter_group/filter_group.test.tsx +++ b/src/components/filter_group/filter_group.test.tsx @@ -25,5 +25,11 @@ describe('EuiFilterGroup', () => { expect(component).toMatchSnapshot(); }); + + test('compressed is rendered', () => { + const component = render(); + + expect(component).toMatchSnapshot(); + }); }); }); diff --git a/src/components/filter_group/filter_group.tsx b/src/components/filter_group/filter_group.tsx index f502906e2edc..f747d212d532 100644 --- a/src/components/filter_group/filter_group.tsx +++ b/src/components/filter_group/filter_group.tsx @@ -17,18 +17,24 @@ export type EuiFilterGroupProps = HTMLAttributes & * Expand the whole bar to fill its parent's width */ fullWidth?: boolean; + /** + * When `true`, creates a shorter height filter group matching that of `compressed` form controls + */ + compressed?: boolean; }; export const EuiFilterGroup: FunctionComponent = ({ children, className, fullWidth = false, + compressed, ...rest }) => { const classes = classNames( 'euiFilterGroup', { 'euiFilterGroup--fullWidth': fullWidth, + 'euiFilterGroup--compressed': compressed, }, className ); diff --git a/src/themes/amsterdam/overrides/_filter_group.scss b/src/themes/amsterdam/overrides/_filter_group.scss index 3d907497a7c4..b311a6726e30 100644 --- a/src/themes/amsterdam/overrides/_filter_group.scss +++ b/src/themes/amsterdam/overrides/_filter_group.scss @@ -5,6 +5,14 @@ box-shadow: inset 0 0 0 1px $euiFormBorderColor; } +.euiFilterGroup--compressed { + border-radius: $euiFormControlCompressedBorderRadius; + + & .euiFilterButton { + height: $euiFormControlCompressedHeight; + } +} + .euiFilterButton { border-radius: 0; border: none;