// packages/block-library/src/tab/add-tab-toolbar-control.js
import { createBlock } from "@wordpress/blocks";
import {
  BlockControls,
  store as blockEditorStore
} from "@wordpress/block-editor";
import { ToolbarGroup, ToolbarButton } from "@wordpress/components";
import { __ } from "@wordpress/i18n";
import { useDispatch } from "@wordpress/data";
import { jsx } from "react/jsx-runtime";
function AddTabToolbarControl({ attributes, tabsClientId }) {
  const { insertBlock } = useDispatch(blockEditorStore);
  const { className, fontFamily, fontSize } = attributes;
  const addTab = () => {
    const newTabBlock = createBlock("core/tab", {
      className,
      fontFamily,
      fontSize
    });
    insertBlock(newTabBlock, void 0, tabsClientId);
  };
  return /* @__PURE__ */ jsx(BlockControls, { group: "block", children: /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(
    ToolbarButton,
    {
      className: "components-toolbar__control",
      label: __("Add Tab"),
      onClick: addTab,
      showTooltip: true,
      text: __("Add Tab")
    }
  ) }) });
}
export {
  AddTabToolbarControl as default
};
//# sourceMappingURL=add-tab-toolbar-control.js.map
