Liferay.Loader.define("portal-workflow-metrics-web@2.0.46/js/shared/components/quick-action-kebab/QuickActionKebab.es", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/button', '@frontend-taglib-clay$clayui/drop-down', '@frontend-taglib-clay$clayui/icon', 'frontend-js-react-web$react'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = exports.KebabDropDown = void 0;

    var _button = _interopRequireDefault(require("@frontend-taglib-clay$clayui/button"));

    var _dropDown = require("@frontend-taglib-clay$clayui/drop-down");

    var _icon = _interopRequireDefault(require("@frontend-taglib-clay$clayui/icon"));

    var _react = _interopRequireDefault(require("frontend-js-react-web$react"));

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    function ownKeys(object, enumerableOnly) {
      var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {
          return Object.getOwnPropertyDescriptor(object, sym).enumerable;
        });keys.push.apply(keys, symbols);
      }return keys;
    }

    function _objectSpread(target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {
          ownKeys(Object(source), true).forEach(function (key) {
            _defineProperty(target, key, source[key]);
          });
        } else if (Object.getOwnPropertyDescriptors) {
          Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
        } else {
          ownKeys(Object(source)).forEach(function (key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
          });
        }
      }return target;
    }

    function _defineProperty(obj, key, value) {
      if (key in obj) {
        Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
      } else {
        obj[key] = value;
      }return obj;
    }

    var IconItem = function IconItem(_ref) {
      var icon = _ref.icon,
          onClick = _ref.onClick;
      return (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
          className: "component-action quick-action-item",
          onClick: onClick,
          role: "button"
        }, /*#__PURE__*/_react.default.createElement(_icon.default, {
          symbol: icon
        })))
      );
    };

    var QuickActionKebab = function QuickActionKebab(_ref2) {
      var _ref2$dropDownItems = _ref2.dropDownItems,
          dropDownItems = _ref2$dropDownItems === void 0 ? [] : _ref2$dropDownItems,
          _ref2$disabled = _ref2.disabled,
          disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
          _ref2$iconItems = _ref2.iconItems,
          iconItems = _ref2$iconItems === void 0 ? [] : _ref2$iconItems,
          _ref2$items = _ref2.items,
          items = _ref2$items === void 0 ? [] : _ref2$items;

      if (items.length > 0) {
        dropDownItems = items;
        iconItems = items.filter(function (_ref3) {
          var icon = _ref3.icon;
          return icon;
        });
      }

      dropDownItems = dropDownItems.map(function (item) {
        return _objectSpread({}, item);
      });
      return (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !disabled && iconItems.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
          className: "quick-action-menu"
        }, iconItems.map(function (_ref4, index) {
          var icon = _ref4.icon,
              onClick = _ref4.onClick;
          return (/*#__PURE__*/_react.default.createElement(IconItem, {
              icon: icon,
              key: index,
              onClick: onClick
            })
          );
        })), dropDownItems.length > 0 && /*#__PURE__*/_react.default.createElement(KebabDropDown, {
          disabled: disabled,
          items: dropDownItems
        }))
      );
    };

    var KebabDropDown = function KebabDropDown(_ref5) {
      var disabled = _ref5.disabled,
          items = _ref5.items;
      return (/*#__PURE__*/_react.default.createElement(_dropDown.ClayDropDownWithItems, {
          items: items,
          trigger: /*#__PURE__*/_react.default.createElement(_button.default, {
            className: "component-action",
            disabled: disabled,
            displayType: "unstyled",
            monospaced: true
          }, /*#__PURE__*/_react.default.createElement(_icon.default, {
            symbol: "ellipsis-v"
          }))
        })
      );
    };

    exports.KebabDropDown = KebabDropDown;
    var _default = QuickActionKebab;
    exports.default = _default;
    //# sourceMappingURL=QuickActionKebab.es.js.map
  }
});
//# sourceMappingURL=QuickActionKebab.es.js.map