@atlaskit/dropdown-menu
Version:
A dropdown menu displays a list of actions or options to a user.
39 lines (38 loc) • 1.34 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["children", "id", "isList", "isScrollable", "title", "testId", "hasSeparator"];
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.
*
*/
var DropdownMenuItemGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
var children = _ref.children,
id = _ref.id,
isList = _ref.isList,
isScrollable = _ref.isScrollable,
title = _ref.title,
testId = _ref.testId,
hasSeparator = _ref.hasSeparator,
rest = _objectWithoutProperties(_ref, _excluded);
var uid = useId();
var titleId = "dropdown-menu-item-group-title-".concat(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;