import React, { createElement as _createElement } from 'react';
import { SidebarMenuItem } from './sidebar-menu-item';
import { SidebarMenuLink } from './sidebar-menu-link';
import { defaultLevelsConfig } from './utils';
import { jsx as _jsx } from "react/jsx-runtime";
export function SidebarSubMenu({
  activeKey,
  expandedKeys,
  level,
  handleActiveItemChange,
  testId,
  onDelete,
  onEdit,
  onChange,
  shouldShowActiveBgOnTopLevel,
  levels = defaultLevelsConfig,
  subOptions = [],
  LinkComponent = SidebarMenuLink,
  editItemInputPlaceholder,
  deleteAriaLabel,
  editAriaLabel
}) {
  const levelsConfig = {
    ...defaultLevelsConfig,
    ...levels
  };
  return /*#__PURE__*/_jsx("ul", {
    "test-id": testId,
    className: "sidebar-sub-menu",
    children: subOptions && subOptions.length >= 1 && subOptions.map(({
      key,
      validity,
      ...rest
    }) => {
      const subOptionsTestId = rest.testId || key;
      return /*#__PURE__*/_createElement(SidebarMenuItem, {
        ...rest,
        key: key,
        itemKey: key,
        activeKey: activeKey,
        expandedKeys: expandedKeys,
        level: level,
        levels: levelsConfig,
        handleActiveItemChange: handleActiveItemChange,
        testId: typeof subOptionsTestId === 'number' ? `${subOptionsTestId}` : subOptionsTestId,
        LinkComponent: LinkComponent,
        shouldShowActiveBgOnTopLevel: shouldShowActiveBgOnTopLevel,
        onDelete: onDelete,
        onEdit: onEdit,
        onChange: onChange,
        validity: validity,
        editItemInputPlaceholder: editItemInputPlaceholder,
        deleteAriaLabel: deleteAriaLabel,
        editAriaLabel: editAriaLabel
      });
    })
  });
}