UNPKG

@atlaskit/dropdown-menu

Version:

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

64 lines (63 loc) • 1.98 kB
/* dropdown-item-group.tsx generated by @compiled/babel-plugin v3.0.4 */ import _extends from "@babel/runtime/helpers/extends"; import "./dropdown-item-group.compiled.css"; import { ax, ix } from "@compiled/react/runtime"; import React, { forwardRef } from 'react'; import { useId } from '@atlaskit/ds-lib/use-id'; import Section from '@atlaskit/menu/section'; import { fg } from '@atlaskit/platform-feature-flags/fg'; import GroupTitle from './internal/components/group-title'; const styles = { root: "_18zr12x7 _1e0c1txw _kqswpfqs _2lx21bp4 _1p57v77o _1q5112x7 _85i512x7 _1o9zidpf", separator: "_qgnu1l7x _1sw7nqa1 _7myae4h9", scrollable: "_1reo1wug _18m91wug _1o9zkb7n" }; /** * __Dropdown item group__ * * A wrapping element for dropdown menu items. * */ export const DropdownItemGroup = /*#__PURE__*/forwardRef(({ children, id, isList, isScrollable, title, testId, hasSeparator, titleId, label, ...rest }, ref) => { const uid = useId(); const oldTitleId = `dropdown-menu-item-group-title-${uid}`; const groupTitleId = titleId || (title ? `dropdown-menu-item-group-title-${uid}` : undefined); if (fg('platform-dst-new-menu')) { return /*#__PURE__*/React.createElement("div", { role: "group", "data-testid": testId, "aria-label": label, "aria-labelledby": groupTitleId, id: id, ref: ref, className: ax([styles.root, hasSeparator && styles.separator, isScrollable && styles.scrollable]) }, title && /*#__PURE__*/React.createElement(GroupTitle, { id: groupTitleId, title: title }), children); } return /*#__PURE__*/React.createElement(Section, _extends({ id: id, ref: ref, isList: isList, isScrollable: isScrollable, hasSeparator: hasSeparator, testId: testId, titleId: title ? oldTitleId : titleId, label: label }, rest), title && /*#__PURE__*/React.createElement(GroupTitle, { id: oldTitleId, title: title }), children); });