import { jsxDEV, Fragment } from "react/jsx-dev-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__ */ jsxDEV(Fragment, { children: [
        /* @__PURE__ */ jsxDEV(
          Icon,
          {
            blueprintIcon: "add",
            style: {
              marginRight: "0.2em",
              position: "relative",
              top: "-0.071em"
            }
          },
          void 0,
          false,
          {
            fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx",
            lineNumber: 19,
            columnNumber: 6
          },
          void 0
        ),
        props.children ?? formatter("blockRepeater.addNewBlockButton.addBlock")
      ] }, void 0, true, {
        fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx",
        lineNumber: 18,
        columnNumber: 5
      }, void 0),
      disabled: props.isMutating,
      distinction: "seamless",
      display: "block",
      justify: "start"
    }),
    [formatter, props.isMutating, props.children]
  );
  return /* @__PURE__ */ jsxDEV(FieldContainer, { label: void 0, children: /* @__PURE__ */ jsxDEV(Dropdown, { buttonProps, alignment: "center", children: ({ requestClose, forceUpdate, update }) => /* @__PURE__ */ jsxDEV(
    AddNewBlockButtonInner,
    {
      normalizedBlocks: props.normalizedBlocks,
      createNewEntity: props.createNewEntity,
      isMutating: props.isMutating,
      discriminationField: props.discriminationField,
      requestClose,
      forceUpdate,
      update
    },
    void 0,
    false,
    {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx",
      lineNumber: 42,
      columnNumber: 6
    },
    void 0
  ) }, void 0, false, {
    fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx",
    lineNumber: 40,
    columnNumber: 4
  }, void 0) }, void 0, false, {
    fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx",
    lineNumber: 39,
    columnNumber: 3
  }, void 0);
});
AddNewBlockButton.displayName = "AddNewBlockButton";
export {
  AddNewBlockButton
};
//# sourceMappingURL=AddNewBlockButton.js.map
