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

[EuiSuggest] Use EuiSelectable #5157

Merged
merged 105 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from 103 commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
0c26555
update euiselectable with paddingSize prop, tests
thompsongl Sep 8, 2021
08afa9b
euisuggest use euiselectable; more tests
thompsongl Sep 8, 2021
37d8c62
CL
thompsongl Sep 8, 2021
ec00be6
handle empty list
thompsongl Sep 8, 2021
7ad561e
Merge branch 'master' into 3733-euisuggest
thompsongl Sep 8, 2021
b582e45
Merge branch 'master' into 3733-euisuggest
thompsongl Sep 10, 2021
4441d93
WIP: useCombobox
thompsongl Sep 29, 2021
9abae26
WIP: temporary docs
thompsongl Sep 29, 2021
9f36199
Merge branch 'master' into 3733-euisuggest
thompsongl Sep 30, 2021
58eb516
snapshots
thompsongl Sep 30, 2021
4ea443f
Merge branch 'master' into 3733-euisuggest
thompsongl Oct 7, 2021
942829d
Merge branch 'master' into 3733-euisuggest
thompsongl Oct 13, 2021
1bf759f
keyboard nav
thompsongl Oct 13, 2021
ddbbe51
i18n
thompsongl Oct 13, 2021
8c81549
prevent prop overlap
thompsongl Oct 13, 2021
61d1356
open logic
thompsongl Oct 13, 2021
037d6e8
status i18n
thompsongl Oct 14, 2021
fb7e65f
Merge branch 'master' into 3733-euisuggest
thompsongl Oct 14, 2021
9dd680f
clean up
thompsongl Oct 14, 2021
124e8ed
aria-checked; empty state
thompsongl Oct 15, 2021
53101ed
Merge branch 'master' into 3733-euisuggest
thompsongl Oct 15, 2021
cfc6c0f
restrict aria-checked to role=option items
thompsongl Oct 15, 2021
7f5bc6c
checked screenreader text
thompsongl Oct 19, 2021
35e5295
Merge branch 'master' into 3733-euisuggest
thompsongl Oct 19, 2021
034a21c
Merge branch 'master' into 3733-euisuggest
thompsongl Oct 20, 2021
59eb0b1
WIP: EuiScreenReaderStatus
thompsongl Oct 20, 2021
c363cb1
Merge branch 'master' into 3733-euisuggest
thompsongl Oct 21, 2021
fe8c16a
i18n token
thompsongl Oct 21, 2021
29528d7
i18n fix
thompsongl Oct 21, 2021
5414547
Merge branch 'master' into 3733-euisuggest
thompsongl Oct 28, 2021
eb1c034
filter out disabled items
thompsongl Nov 1, 2021
4a1ebe1
Merge branch 'master' into 3733-euisuggest
thompsongl Nov 3, 2021
2e05490
space bar toggles selection in non-searchable euiselectable
thompsongl Nov 3, 2021
9c23d03
Merge branch 'main' into 3733-euisuggest
thompsongl Nov 4, 2021
ccf46f7
update tri-state helper text
thompsongl Nov 4, 2021
2239712
fix dupe token
thompsongl Nov 4, 2021
5aed456
Merge branch 'main' into 3733-euisuggest
thompsongl Nov 9, 2021
81e41f6
euiScreenReaderStatus
thompsongl Nov 10, 2021
d9b2776
Merge branch 'main' into 3733-euisuggest
thompsongl Nov 10, 2021
ef87997
optional virtualized rendering, use in EuiSelectable
thompsongl Nov 10, 2021
f11798b
Merge branch 'main' into 3733-euisuggest
thompsongl Nov 11, 2021
8e58a9b
fix CL
thompsongl Nov 11, 2021
0dab8e6
expose isVirtualized option
thompsongl Nov 11, 2021
f68aeca
CL
thompsongl Nov 11, 2021
facc0df
Fixed tall lists by added `maxHeight` prop
Nov 11, 2021
3aff57f
Fix a few item styles
Nov 11, 2021
799e5d7
Fix height for `isVirtualized` and add `title`s to spans
Nov 12, 2021
ff3fbf6
[EuiSelectable] Don’t render unnecessary wrappers
Nov 12, 2021
3e016a4
More cleanup of item code and styles
Nov 12, 2021
d6a8e19
Fixing `fullWidth` support
Nov 13, 2021
7942fca
Docs
Nov 15, 2021
86ca51c
Merge branch 'main' into 3733-euisuggest
thompsongl Nov 16, 2021
a23fee4
Merge branch '3733-euisuggest' of https://github.com/thompsongl/eui i…
thompsongl Nov 16, 2021
a2d4308
Merge branch 'main' into 3733-euisuggest
thompsongl Nov 19, 2021
96cfb44
import
thompsongl Nov 19, 2021
12d1913
Merge branch 'main' into 3733-euisuggest
thompsongl Nov 23, 2021
b1c7f07
1.2 spec
thompsongl Nov 23, 2021
a768c38
Merge branch 'main' into 3733-euisuggest
thompsongl Nov 29, 2021
b8b55ce
pass aria attrs to input
thompsongl Nov 29, 2021
bd08c79
Merge branch 'main' into 3733-euisuggest
thompsongl Nov 29, 2021
27de41d
clean up
thompsongl Nov 29, 2021
d6234c0
Merge branch 'main' into 3733-euisuggest
thompsongl Dec 1, 2021
23a99e0
fix CL
thompsongl Dec 1, 2021
402d66b
Merge branch 'main' into 3733-euisuggest
thompsongl Dec 7, 2021
05b8f3e
Merge branch 'main' into 3733-euisuggest
thompsongl Dec 8, 2021
43cbf53
add key to non-virtualized list items
thompsongl Dec 8, 2021
a4e1d22
remove unused component; rename sendValue prop
thompsongl Dec 8, 2021
945ece6
Refactor to simplify EuiScreenReaderStatus, support more panel prop c…
chandlerprall Dec 8, 2021
8911a6a
clean up
thompsongl Dec 8, 2021
9bffdc8
Merge branch 'main' into 3733-euisuggest
thompsongl Dec 13, 2021
7bc8e0e
Merge branch 'main' into 3733-euisuggest
thompsongl Dec 16, 2021
780405f
Merge branch 'main' into 3733-euisuggest
thompsongl Dec 21, 2021
7343ab9
Merge branch 'main' into 3733-euisuggest
thompsongl Jan 5, 2022
afee4be
Fix input style when append array is empty; Update docs for suggest item
Jan 5, 2022
261795c
Merge branch 'main' into 3733-euisuggest
thompsongl Jan 6, 2022
588d7c6
euiscreenreaderonly
thompsongl Jan 6, 2022
79984ee
euiscreenreaderstatus
thompsongl Jan 6, 2022
a40cb61
Merge branch '3733-euisuggest' of https://github.com/thompsongl/eui i…
thompsongl Jan 6, 2022
da0ce9d
Merge branch 'main' into 3733-euisuggest
thompsongl Jan 11, 2022
ab6dc6a
tests, comments
thompsongl Jan 12, 2022
2b436bb
Merge branch 'main' into 3733-euisuggest
thompsongl Jan 13, 2022
1ab0cd5
Merge branch 'main' into 3733-euisuggest
thompsongl Jan 18, 2022
3c29b28
Apply suggestions from code review
thompsongl Jan 18, 2022
df49d11
merge fixes
thompsongl Jan 19, 2022
e64d72c
clean up
thompsongl Jan 19, 2022
b8d311b
Merge branch 'main' into 3733-euisuggest
thompsongl Jan 19, 2022
4663843
docs clean up
thompsongl Jan 19, 2022
b2251ea
docs clean up
thompsongl Jan 19, 2022
6969d77
id pattern fix
thompsongl Jan 19, 2022
75ae639
Merge branch 'main' into 3733-euisuggest
thompsongl Jan 26, 2022
d71b7fc
Merge branch 'main' into 3733-euisuggest
thompsongl Jan 28, 2022
862f5a8
Merge branch 'main' into 3733-euisuggest
thompsongl Jan 31, 2022
e43541f
Merge branch 'main' into 3733-euisuggest
thompsongl Jan 31, 2022
b0afb6a
Merge branch 'main' into 3733-euisuggest
thompsongl Feb 2, 2022
73416e0
Merge branch 'main' into 3733-euisuggest
thompsongl Feb 4, 2022
3d46f56
fix bad merge
thompsongl Feb 4, 2022
8142f31
Merge branch 'main' into 3733-euisuggest
thompsongl Feb 7, 2022
81adda0
Merge branch 'main' into 3733-euisuggest
thompsongl Feb 7, 2022
a58f492
disabled redundant focus trap
thompsongl Feb 8, 2022
5fa82d1
Merge branch 'main' into 3733-euisuggest
thompsongl Feb 8, 2022
4930e20
docs and tests
thompsongl Feb 8, 2022
f1fb323
move state message
thompsongl Feb 8, 2022
ee0eb31
Merge branch 'main' into 3733-euisuggest
thompsongl Feb 8, 2022
bd7c33e
Update src/components/suggest/suggest.tsx
thompsongl Feb 8, 2022
cf55e68
lint
thompsongl Feb 9, 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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
## [`main`](https://github.com/elastic/eui/tree/main)

- Refactored `EuiSuggest` to use `EuiSelectable` ([#5157](https://github.com/elastic/eui/pull/5157))

**Bug fixes**

- Fixed `EuiDataGrid` to correctly remove the cell expansion action button when a column sets both `cellActions` and `isExpandable` to false ([#5592](https://github.com/elastic/eui/pull/5592))
- Fixed `EuiDataGrid` re-playing the cell actions animation when hovering over an already-focused cell ([#5592](https://github.com/elastic/eui/pull/5592))

**Breaking changes**

- Removed `EuiSuggestInput` ([#5157](https://github.com/elastic/eui/pull/5157))
- Required `aria-label` or `aria-labelledby` for `EuiSuggest` ([#5157](https://github.com/elastic/eui/pull/5157))
- Renamed `sendValue` prop to `onSearchChange` for `EuiSuggest` ([#5157](https://github.com/elastic/eui/pull/5157))

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

- Added support for React 17 (this is a backwards compatible change - React 16.12+ is still supported for consuming applications) ([#5584](https://github.com/elastic/eui/pull/5584))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import {
EuiRadioGroup,
EuiSuggest,
EuiSpacer,
EuiFormRow,
EuiSuggestionProps,
} from '../../../../src/components';

import { EuiSuggestStatus } from '../../../../src/components/suggest/types';

import { htmlIdGenerator } from '../../../../src/services';

const shortDescription = 'This is the description';
Expand Down Expand Up @@ -44,21 +48,25 @@ const sampleItems = [
const idPrefix = htmlIdGenerator()();

export default () => {
const radios = [
const radios: Array<{
id: string;
value: EuiSuggestStatus;
label: string;
}> = [
{ id: `${idPrefix}0`, value: 'unchanged', label: 'No new changes' },
{ id: `${idPrefix}1`, value: 'unsaved', label: 'Not yet saved' },
{ id: `${idPrefix}2`, value: 'saved', label: 'Saved' },
{ id: `${idPrefix}3`, value: 'loading', label: 'Loading' },
];
const [status, setStatus] = useState('unchanged');
const [status, setStatus] = useState<EuiSuggestStatus>('unchanged');
const [radioIdSelected, setSelectedId] = useState(`${idPrefix}0`);

const onChange = (optionId) => {
const onChange = (optionId: string) => {
setSelectedId(optionId);
setStatus(radios.find((x) => x.id === optionId).value);
setStatus(radios.find((x) => x.id === optionId)!.value);
};

const onItemClick = (item) => {
const onItemClick = (item: EuiSuggestionProps) => {
console.log(item);
};

Expand All @@ -70,13 +78,17 @@ export default () => {
onChange={(id) => onChange(id)}
/>
<EuiSpacer size="xl" />
<EuiSuggest
status={status}
onInputChange={() => {}}
onItemClick={onItemClick}
placeholder="Enter query to display suggestions"
suggestions={sampleItems}
/>
<EuiFormRow label="Suggest" id={idPrefix}>
<EuiSuggest
fullWidth
aria-labelledby={`${idPrefix}-label`}
status={status}
onInputChange={() => {}}
onItemClick={onItemClick}
placeholder="Enter query to display suggestions"
suggestions={sampleItems}
/>
</EuiFormRow>
</div>
);
};
71 changes: 43 additions & 28 deletions src-docs/src/views/suggest/suggest_example.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { Link } from 'react-router-dom';

import { GuideSectionTypes } from '../../components';

Expand All @@ -7,7 +8,7 @@ import {
EuiCode,
EuiSpacer,
EuiSuggest,
EuiSuggestItem,
EuiText,
} from '../../../../src/components';

import Suggest from './suggest';
Expand All @@ -16,8 +17,7 @@ const suggestSource = require('!!raw-loader!./suggest');
import SavedQueries from './saved_queries';
const savedQueriesSource = require('!!raw-loader!./saved_queries');

import SuggestItem from './suggest_item';
const suggestItemSource = require('!!raw-loader!./suggest_item');
import SuggestItem from './suggest_item_example';
const suggestItemSnippet = [
`<EuiSuggestItem
type={sampleItem.type}
Expand Down Expand Up @@ -77,45 +77,61 @@ export const SuggestExample = {
},
],
text: (
<div>
<>
<p>
<strong>EuiSuggest</strong> is a text field component used to
display suggestions. The status of the component is shown on its
right side. The available <EuiCode>status</EuiCode> are:{' '}
<EuiCode>unsaved</EuiCode>, <EuiCode>saved</EuiCode>,
<EuiCode>unchanged</EuiCode> and <EuiCode>isLoading</EuiCode>.
</p>
</div>
<p>
Note that <strong>EuiSuggest</strong> does not maintain internal
selection state. Use the <EuiCode>onChange</EuiCode> callback to
update your application state with the desired selection changes.
</p>
</>
),
props: { EuiSuggest },
snippet: suggestSnippet,
demo: <Suggest />,
},
{
title: 'Suggest item',
source: [
{
type: GuideSectionTypes.JS,
code: suggestItemSource,
},
],
wrapText: false,
text: (
<div>
<p>
<strong>EuiSuggestItem</strong> is a list item component to display
suggestions when typing queries in <strong>EuiSuggest</strong>. Use{' '}
<EuiCode>labelDisplay</EuiCode> to set whether the{' '}
<EuiCode>label</EuiCode> has a fixed width or not. By default, fixed
labels will have a width of 50%, you can adjust this by setting{' '}
<EuiCode>labelWidth</EuiCode>. Use{' '}
<EuiCode>descriptionDisplay</EuiCode> to set whether the{' '}
<EuiCode>description</EuiCode> truncates or wraps.
</p>
</div>
<>
<EuiText>
<p>
<strong>EuiSuggestItem</strong> is a list item component to
display suggestions when typing queries into{' '}
<strong>EuiSuggest</strong>. Each item requires a{' '}
<EuiCode>label</EuiCode> and <EuiCode>type</EuiCode> and can
optionally display a <EuiCode>description</EuiCode>. By default,
labels will have a width of 50% which you can adjust by setting{' '}
<EuiCode>labelWidth</EuiCode> to a multiple of{' '}
<EuiCode>10</EuiCode>.
</p>
<p>
Suggest item types are an object that requires an{' '}
<EuiCode>iconType</EuiCode> and <EuiCode>color</EuiCode>.
</p>
<p>
Set <EuiCode>truncate</EuiCode> to false to force line-wrapping of
both the label and description. Note that wrapping text is not
compatible with the virtualized setting on{' '}
<strong>EuiSuggest</strong>. See{' '}
<Link to="forms/selectable#rendering-the-options">
EuiSelectable
</Link>{' '}
for more information on rendering items virtually.
</p>
</EuiText>
<EuiSpacer />
<SuggestItem />
cchaos marked this conversation as resolved.
Show resolved Hide resolved
</>
),
props: { EuiSuggestItem },
snippet: suggestItemSnippet,
demo: <SuggestItem />,
},
{
title: 'Saved queries and filters',
Expand All @@ -126,7 +142,7 @@ export const SuggestExample = {
},
],
text: (
<div>
<>
<EuiCallOut color="warning" title="Demo of visual pattern only">
<p>
This documents a <strong>visual</strong> pattern for Kibana&apos;s
Expand All @@ -135,8 +151,7 @@ export const SuggestExample = {
logic is well-formed.
</p>
</EuiCallOut>
<EuiSpacer />
</div>
</>
),
props: { EuiSuggest },
demo: <SavedQueries />,
Expand Down
117 changes: 0 additions & 117 deletions src-docs/src/views/suggest/suggest_item.js

This file was deleted.

Loading