Closed jeroenransijn closed 6 years ago
I vote for SelectMenu
. Also for using Downshift for the accessibility.
Also what's the difference between evergreen-select-menu
and evergreen-select-menu-popover
?
@Rowno one would be inside of a Popover, so you can simply wrap it around a Button
. It's for convenience. Otherwise engineers will need to do some plumbing every time they want to use this, instead of simply passing in items
and a onSelect
. What do you think?
Would you ever use evergreen-select-menu
though?
@Rowno probably not, it's probably better to export multiple components from the same package instead:
import SelectMenu, { SelectMenuStandalone } from 'evergreen-select-menu'
A
DropdownMenu
component that can be triggered by buttons and select like interfaces.multiSelect
andmaxSelection
propsreact-tiny-virtual-list
just like in Autocompletefuzzaldrin-plus
by default for filteringFilter or enter value...
in search bar,allowCustomValues
prop (?)Remaining questions
MenuItem
(name tbd) useTableRow
or not?Downshift
? we'll get a lot of functionality and accessibility for freeDesign Example
Current implementation
I have already build a working implementation of this thing, but there is still some API tweaks I would like to make — and some implementation details to consider.
Take a look at the current code and implementation
```jsx import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import fuzzaldrin from 'fuzzaldrin-plus' import { Pane } from 'evergreen-layers' import VirtualList from 'react-tiny-virtual-list' import { TableRow, TextTableCell, SearchTableHeaderCell } from 'evergreen-table' const fuzzyFilter = (items, input) => fuzzaldrin.filter(items, input) const CheckIcon = ({ fill = 'currentColor', ...props }) => ( ) CheckIcon.propTypes = { fill: PropTypes.string, } const itemRenderer = ({ key, name, onSelect, isSelected, style, height }) => (Usage example
Items API
In some cases you want the label to be different in the list as in the button. For example if you are dealing with
=
, you want= (equals)
in the menu list. I am suggesting the following API, which is different from what's in the current implementation:ItemShapePropType
```jsx const ItemShapePropType = PropTypes.shape({ label: PropTypes.string, labelInList: PropTypes.string, value: PropTypes.oneOf([PropTypes.string, PropTypes.number]), }) ```Naming considerations
Some of the options I could think about for naming this thing are:
Option 1 — Menu
evergreen-menu
evergreen-menu-popover
Option 2 — OptionList
evergreen-option-list
evergreen-option-list-popover
Option 3 — SelectableList
evergreen-selectable-list
evergreen-selectable-list-popover
Option 4 — SelectMenu
evergreen-select-menu
evergreen-select-menu-popover
I am not sure about naming yet, the term
Menu
might be better used in a more traditional dropdown menu like this:How is this different from Autocomplete and Combobox?
Combobox is a little bulky in some cases, it does add more affordability, so i think there will still be use cases for it. We'll want to make the look and feel consistent of the actual list of both this component and the Autocomplete.