@atlaskit/dropdown-menu
Version:
A dropdown menu displays a list of actions or options to a user.
41 lines • 1.26 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import React from 'react';
import { useId } from '@atlaskit/ds-lib/use-id';
import Section from '@atlaskit/menu/section';
import GroupTitle from '../internal/components/group-title';
import { CheckboxGroupContext } from '../internal/context/checkbox-group-context';
/**
* __Dropdown item checkbox group__
*
* A wrapping element for dropdown menu checkbox items.
*
*/
const DropdownItemCheckboxGroup = ({
children,
hasSeparator,
id,
isList,
isScrollable,
testId,
title,
// DSP-13312 TODO: remove spread props in future major release
...rest
}) => {
const uid = useId();
const titleId = `dropdown-menu-item-checkbox-group-title-${uid}`;
return /*#__PURE__*/React.createElement(CheckboxGroupContext.Provider, {
value: id
}, /*#__PURE__*/React.createElement(Section, _extends({
hasSeparator: hasSeparator,
id: id,
isList: isList,
isScrollable: isScrollable,
testId: testId,
titleId: title ? titleId : undefined
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
}, rest), title && /*#__PURE__*/React.createElement(GroupTitle, {
id: titleId,
title: title
}), children));
};
export default DropdownItemCheckboxGroup;