UNPKG

@atlaskit/dropdown-menu

Version:

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

41 lines 1.58 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["children", "hasSeparator", "id", "isList", "isScrollable", "testId", "title"]; 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. * */ var DropdownItemCheckboxGroup = function DropdownItemCheckboxGroup(_ref) { var children = _ref.children, hasSeparator = _ref.hasSeparator, id = _ref.id, isList = _ref.isList, isScrollable = _ref.isScrollable, testId = _ref.testId, title = _ref.title, rest = _objectWithoutProperties(_ref, _excluded); var uid = useId(); var titleId = "dropdown-menu-item-checkbox-group-title-".concat(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;