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