"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const ui = require("@contember/ui");
const react = require("react");
const reactI18n = require("@contember/react-i18n");
const AddNewBlockButtonInner = require("./AddNewBlockButtonInner.cjs");
const Dictionary = require("./Dictionary.cjs");
const AddNewBlockButton = react.memo((props) => {
  const formatter = reactI18n.useMessageFormatter(Dictionary.blockRepeaterDictionary);
  const buttonProps = react.useMemo(
    () => ({
      children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
        /* @__PURE__ */ jsxRuntime.jsx(
          ui.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__ */ jsxRuntime.jsx(ui.FieldContainer, { label: void 0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Dropdown, { buttonProps, alignment: "center", children: ({ requestClose, forceUpdate, update }) => /* @__PURE__ */ jsxRuntime.jsx(
    AddNewBlockButtonInner.AddNewBlockButtonInner,
    {
      normalizedBlocks: props.normalizedBlocks,
      createNewEntity: props.createNewEntity,
      isMutating: props.isMutating,
      discriminationField: props.discriminationField,
      requestClose,
      forceUpdate,
      update
    }
  ) }) });
});
AddNewBlockButton.displayName = "AddNewBlockButton";
exports.AddNewBlockButton = AddNewBlockButton;
//# sourceMappingURL=AddNewBlockButton.cjs.map
