import { cx } from '@emotion/css'; import { Trans, t } from '@grafana/i18n'; import { Button, ScrollContainer, Stack, useStyles2, useTheme2 } from '@grafana/ui'; import { getSelectStyles } from '@grafana/ui/internal'; import { Role } from 'app/types'; import { RoleMenuOption } from './RoleMenuOption'; import { MENU_MAX_HEIGHT } from './constants'; import { getStyles } from './styles'; import { isNotDelegatable } from './utils'; interface RolePickerSubMenuProps { options: Role[]; selectedOptions: Role[]; disabledOptions?: Role[]; onSelect: (option: Role) => void; onClear?: () => void; showOnLeft?: boolean; } export const RolePickerSubMenu = ({ options, selectedOptions, disabledOptions, onSelect, onClear, showOnLeft, }: RolePickerSubMenuProps): JSX.Element => { const theme = useTheme2(); const styles = getSelectStyles(theme); const customStyles = useStyles2(getStyles); const onClearInternal = async () => { if (onClear) { onClear(); } }; return (