import { Box, TextButton } from "@wix/design-system";
import React, { useContext } from "react";
import { RicosContext } from "./../../../../../ricos-context/index.js";
import {
  MEDIA_SETTINGS_DELETE_ITEMS_BUTTON,
  MEDIA_SETTINGS_DESELECT_ALL_ITEMS_BUTTON,
  MEDIA_SETTINGS_EDIT_ITEM_BUTTON,
  MEDIA_SETTINGS_SELECT_ALL_ITEMS_BUTTON
} from "../../../../data-hooks.js";
const MediaItemActionMenu = ({
  onSelectAllClick,
  onUnselectAllClick,
  onDeleteClick,
  items,
  onEditClick,
  logBi
}) => {
  const { t } = useContext(RicosContext);
  const selectedItems = items.filter((item) => item.selected);
  return /* @__PURE__ */ React.createElement(Box, { maxHeight: "fit-content", align: "space-between", marginBottom: "SP3" }, selectedItems.length === 0 ? /* @__PURE__ */ React.createElement(
    ItemActionButton,
    {
      key: "selectAllButton",
      dataHook: MEDIA_SETTINGS_SELECT_ALL_ITEMS_BUTTON,
      onClick: onSelectAllClick,
      label: t("GallerySettings_Select_All") + ` (${items.length})`,
      logBi
    }
  ) : /* @__PURE__ */ React.createElement(
    ItemActionButton,
    {
      key: "deselectAllButton",
      dataHook: MEDIA_SETTINGS_DESELECT_ALL_ITEMS_BUTTON,
      onClick: onUnselectAllClick,
      label: t("GallerySettings_Deselect") + ` (${selectedItems.length})`,
      logBi
    }
  ), /* @__PURE__ */ React.createElement(Box, { gap: "SP2" }, selectedItems.length >= 1 && /* @__PURE__ */ React.createElement(
    ItemActionButton,
    {
      key: "deleteButton",
      dataHook: MEDIA_SETTINGS_DELETE_ITEMS_BUTTON,
      onClick: onDeleteClick,
      label: t("GallerySettings_Delete"),
      logBi
    }
  ), selectedItems.length === 1 && /* @__PURE__ */ React.createElement(
    ItemActionButton,
    {
      key: "itemSettingsButton",
      dataHook: MEDIA_SETTINGS_EDIT_ITEM_BUTTON,
      onClick: () => onEditClick(true),
      label: t("GallerySettings_Image_Settings"),
      logBi
    }
  )));
};
const ItemActionButton = ({ label, onClick, dataHook, logBi }) => {
  return /* @__PURE__ */ React.createElement(
    TextButton,
    {
      "aria-label": label,
      role: "menuitem",
      size: "small",
      onClick: () => {
        logBi({ dataHook });
        onClick();
      },
      dataHook,
      underline: "always"
    },
    label
  );
};
export {
  MediaItemActionMenu
};
//# sourceMappingURL=media-item-action-menu.js.map
