import { jsxs, jsx } from "react/jsx-runtime";
import { useMutationState } from "@contember/binding";
import { Button, Icon } from "@contember/ui";
import { useClassName } from "@contember/utilities";
import { memo } from "react";
const defaultIconProps = {
  blueprintIcon: "add",
  style: {
    marginRight: "0.2em",
    position: "relative",
    top: "0.05em"
  }
};
const CreateNewEntityButton = memo(
  ({ createNewEntity, iconProps, children = "Add", ...buttonProps }) => {
    const isMutating = useMutationState();
    return /* @__PURE__ */ jsxs(
      Button,
      {
        onClick: () => createNewEntity(),
        disabled: isMutating,
        loading: isMutating,
        className: useClassName("new-entity-button"),
        distinction: "seamless",
        justification: "justifyStart",
        ...buttonProps,
        children: [
          /* @__PURE__ */ jsx(Icon, { ...defaultIconProps, ...iconProps }),
          children
        ]
      }
    );
  }
);
export {
  CreateNewEntityButton
};
//# sourceMappingURL=CreateNewEntityButton.js.map
