"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _Button = _interopRequireDefault(require("../Button"));
var _Menu = require("../Menu");
var _jsxRuntime = require("react/jsx-runtime");
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.

/**
 * `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__*/(0, _jsxRuntime.jsx)(_Button.default, {
        ghost: true,
        tooltip: children,
        ...props
      });
    }
    return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Menu.MenuItem, {
      tooltip: tooltip,
      ...props,
      children: children
    });
  };
  const unwrap = cb => cb({
    wrap: children => render(children)
  });
  if (typeof children === 'function') {
    return unwrap(children);
  }
  return render(children);
};
var _default = exports.default = ListAction;