import { jsxs, Fragment, jsx } from "react/jsx-runtime";
import { Icon, FieldContainer, Dropdown } from "@contember/ui";
import { memo, useMemo } from "react";
import { useMessageFormatter } from "@contember/react-i18n";
import { AddNewBlockButtonInner } from "./AddNewBlockButtonInner.js";
import { blockRepeaterDictionary } from "./Dictionary.js";
const AddNewBlockButton = memo((props) => {
  const formatter = useMessageFormatter(blockRepeaterDictionary);
  const buttonProps = useMemo(
    () => ({
      children: /* @__PURE__ */ jsxs(Fragment, { children: [
        /* @__PURE__ */ jsx(
          Icon,
          {
            blueprintIcon: "add",
            style: {
              marginRight: "0.2em",
              position: "relative",
              top: "-0.071em"
            }
          }
        ),
        props.children ?? formatter("blockRepeater.addNewBlockButton.addBlock")
      ] }),
      disabled: props.isMutating,
      distinction: "seamless",
      display: "block",
      justify: "start"
    }),
    [formatter, props.isMutating, props.children]
  );
  return /* @__PURE__ */ jsx(FieldContainer, { label: void 0, children: /* @__PURE__ */ jsx(Dropdown, { buttonProps, alignment: "center", children: ({ requestClose, forceUpdate, update }) => /* @__PURE__ */ jsx(
    AddNewBlockButtonInner,
    {
      normalizedBlocks: props.normalizedBlocks,
      createNewEntity: props.createNewEntity,
      isMutating: props.isMutating,
      discriminationField: props.discriminationField,
      requestClose,
      forceUpdate,
      update
    }
  ) }) });
});
AddNewBlockButton.displayName = "AddNewBlockButton";
export {
  AddNewBlockButton
};
//# sourceMappingURL=AddNewBlockButton.js.map
