import { Minus } from "@wix/wix-ui-icons-common";
import React, { useContext, useState } from "react";
import { RicosContext } from "./../../../ricos-context/index.js";
import { getIsModalOpen, useModalState } from "./../../../ricos-modals/modal-service-provider.js";
import { DropdownButton } from "./../../../_shared/dropdown-button.js";
import { dividerStyleData } from "./divider-buttons-data.js";
const DividerStyleButton = ({ toolbarItem, dataHook, id }) => {
  const { t } = useContext(RicosContext) || {};
  const isModalOpen = useModalState(getIsModalOpen(id));
  const [referenceElement, setReferenceElement] = useState(null);
  const SelectedStyleIcon = dividerStyleData.find(({ commandKey }) => commandKey === toolbarItem?.attributes.nodeStyle)?.icon || Minus;
  return /* @__PURE__ */ React.createElement(
    DropdownButton,
    {
      dataHook,
      active: isModalOpen,
      onClick: () => toolbarItem.commands.click({ referenceElement }),
      ref: setReferenceElement,
      icon: SelectedStyleIcon,
      tooltip: t("DividerPlugin_SelectType_Tooltip"),
      tabIndex: toolbarItem.presentation.tabIndex
    }
  );
};
export {
  DividerStyleButton
};
//# sourceMappingURL=divider-style-button.js.map
