UNPKG

@grafana/ui

Version:
28 lines (25 loc) 937 B
import { jsxs, jsx } from 'react/jsx-runtime'; import { css } from '@emotion/css'; import { uniqueId } from 'lodash'; import { useStyles2 } from '../../themes/ThemeContext.mjs'; "use strict"; const MenuGroup = ({ label, ariaLabel, children }) => { const styles = useStyles2(getStyles); const labelID = `group-label-${uniqueId()}`; return /* @__PURE__ */ jsxs("div", { role: "group", "aria-labelledby": !ariaLabel && label ? labelID : void 0, "aria-label": ariaLabel, children: [ label && /* @__PURE__ */ jsx("label", { id: labelID, className: styles.groupLabel, "aria-hidden": true, children: label }), children ] }); }; MenuGroup.displayName = "MenuGroup"; const getStyles = (theme) => { return { groupLabel: css({ color: theme.colors.text.secondary, fontSize: theme.typography.size.sm, padding: theme.spacing(0.5, 1) }) }; }; export { MenuGroup }; //# sourceMappingURL=MenuGroup.mjs.map