UNPKG

@engie-group/fluid-design-system-react

Version:

Fluid Design System React

17 lines (14 loc) 897 B
import { jsxs, jsx } from 'react/jsx-runtime'; import React__default, { useId } from 'react'; import { Utils } from '../../../utils/util.js'; import '../../list/item/NJListItem.js'; import { NJListRoot } from '../../list/root/NJListRoot.js'; const rootClass = 'nj-menu-group'; const NJMenuGroup = React__default.forwardRef((props, forwardedRef) => { const { header, children, listRef, ...htmlProps } = props; const headerId = useId(); const className = Utils.classNames(htmlProps.className, rootClass); return (jsxs("div", { ref: forwardedRef, role: "group", "aria-labelledby": header ? headerId : undefined, ...htmlProps, className: className, children: [header && (jsx("h3", { className: `${rootClass}__header`, id: headerId, children: header })), jsx(NJListRoot, { ref: listRef, children: children })] })); }); NJMenuGroup.displayName = 'NJMenuGroup'; export { NJMenuGroup };