// Copyright 1999-2023. Plesk International GmbH. All rights reserved.

import Button from '../Button';
import { MenuItem } from '../Menu';
import { jsx as _jsx } from "react/jsx-runtime";
/**
 * `ListAction` component is a part of [ListActions](#!/ListActions) component.
 * It accepts the props of [Button](#!/Button) and [MenuItem](#!/MenuItem) components.
 * @since 3.3.0
 */

const ListAction = _ref => {
  let {
    primary,
    children,
    tooltip,
    ...props
  } = _ref;
  const render = children => {
    if (primary) {
      return /*#__PURE__*/_jsx(Button, {
        ghost: true,
        tooltip: children,
        ...props
      });
    }
    return /*#__PURE__*/_jsx(MenuItem, {
      tooltip: tooltip,
      ...props,
      children: children
    });
  };
  const unwrap = cb => cb({
    wrap: children => render(children)
  });
  if (typeof children === 'function') {
    return unwrap(children);
  }
  return render(children);
};
export default ListAction;