import { jsx } from "react/jsx-runtime";
import { forwardRef } from "react";
import { useMantineTheme } from "../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/MantineProvider/MantineThemeProvider/MantineThemeProvider.mjs";
import { Loader } from "../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Loader/Loader.mjs";
import { Button as Button$1 } from "../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Button/Button.mjs";
const _Button = forwardRef((props, ref) => {
  const theme = useMantineTheme();
  const {
    leftSection,
    loading,
    disabled,
    loaderProps,
    ["data-disabled"]: dataDisabled,
    ["data-loading"]: dataLoading,
    ...rest
  } = props;
  const loader = /* @__PURE__ */ jsx(Loader, { size: 16, color: `${props.color ?? theme.primaryColor}.6`, ...loaderProps });
  const isLoading = loading || dataLoading;
  const isDisabled = disabled || dataDisabled || isLoading;
  return /* @__PURE__ */ jsx(Button$1, { ...rest, ref, leftSection: isLoading ? loader : leftSection, disabled: isDisabled });
});
const Button = _Button;
Button.Group = Button$1.Group;
Button.classes = Button$1.classes;
Button.displayName = Button$1.displayName;
Button.extend = Button$1.extend;
Button.withProps = Button$1.withProps;
export {
  Button
};
