UNPKG

@octopusdeploy/design-system-components

Version:
18 lines (17 loc) 1.13 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.MenuList = MenuList; const jsx_runtime_1 = require("react/jsx-runtime"); const MenuList_1 = __importDefault(require("@mui/material/MenuList")); const flattenFragments_1 = require("../../utils/flattenFragments"); function MenuList({ children, accessibleName }) { // Material-ui MenuLists don't support fragments as children // This is so that they can inspect the props of their children in order to work out which one is selected // This is using a feature of MenuLists (selection) that we don't use, so for our usages we can allow fragments const childrenWithoutFragments = (0, flattenFragments_1.flattenFragments)(children); return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(MenuList_1.default, { component: "div", autoFocus: false, "aria-label": accessibleName, children: childrenWithoutFragments }) })); } MenuList.displayName = "MenuList";