@gechiui/components
Version:
UI components for GeChiUI.
45 lines (42 loc) • 1.01 kB
JavaScript
import { createElement } from "@gechiui/element";
/**
* External dependencies
*/
import { noop } from 'lodash';
/**
* GeChiUI dependencies
*/
import { check } from '@gechiui/icons';
/**
* Internal dependencies
*/
import MenuItem from '../menu-item';
export default function MenuItemsChoice(_ref) {
let {
choices = [],
onHover = noop,
onSelect,
value
} = _ref;
return choices.map(item => {
const isSelected = value === item.value;
return createElement(MenuItem, {
key: item.value,
role: "menuitemradio",
icon: isSelected && check,
info: item.info,
isSelected: isSelected,
shortcut: item.shortcut,
className: "components-menu-items-choice",
onClick: () => {
if (!isSelected) {
onSelect(item.value);
}
},
onMouseEnter: () => onHover(item.value),
onMouseLeave: () => onHover(null),
"aria-label": item['aria-label']
}, item.label);
});
}
//# sourceMappingURL=index.js.map