import {
  Loading
} from "./chunk-STMV644L.js";
import {
  Success
} from "./chunk-GBENSQUV.js";
import {
  useButton
} from "./chunk-FB3CIPAZ.js";

// src/components/Button/Button.tsx
import classNames from "classnames/dedupe";
import "@simplybusiness/mobius/src/components/Button/Button.css";
import { jsx, jsxs } from "react/jsx-runtime";
var Button = ({ ref, ...props }) => {
  const {
    children,
    elementType: Component = "button",
    isDisabled,
    isLoading,
    isSuccess,
    variant = "primary",
    size = "md",
    onPress,
    onClick,
    ...otherProps
  } = props;
  const { buttonProps } = useButton(props);
  otherProps.className = classNames(
    "mobius",
    "mobius-button",
    `--variant-${variant}`,
    `--size-${size}`,
    {
      "--is-disabled": isDisabled,
      "--is-loading": isLoading,
      "--is-success": isSuccess && !isLoading
    },
    otherProps.className
  );
  return /* @__PURE__ */ jsxs(Component, { ref, ...buttonProps, ...otherProps, children: [
    isLoading ? /* @__PURE__ */ jsx(Loading, { children }) : children,
    isSuccess && !isLoading && /* @__PURE__ */ jsx(Success, {})
  ] });
};
Button.displayName = "Button";

export {
  Button
};
//# sourceMappingURL=chunk-FD3JTY5L.js.map
