UNPKG

@atlaskit/dropdown-menu

Version:

A dropdown menu displays a list of actions or options to a user.

38 lines (37 loc) 981 B
import _extends from "@babel/runtime/helpers/extends"; import React, { forwardRef } from 'react'; import { useId } from '@atlaskit/ds-lib/use-id'; import { Section } from '@atlaskit/menu'; import GroupTitle from './internal/components/group-title'; /** * __Dropdown item checkbox group__ * * A wrapping element for dropdown menu items. * */ const DropdownMenuItemGroup = /*#__PURE__*/forwardRef(({ children, id, isList, isScrollable, title, testId, hasSeparator, ...rest }, ref) => { const uid = useId(); const titleId = `dropdown-menu-item-group-title-${uid}`; return /*#__PURE__*/React.createElement(Section, _extends({ id: id, ref: ref, isList: isList, isScrollable: isScrollable, hasSeparator: hasSeparator, testId: testId, titleId: title ? titleId : undefined }, rest), title && /*#__PURE__*/React.createElement(GroupTitle, { id: titleId, title: title }), children); }); export default DropdownMenuItemGroup;