"use client";
import { jsx as a, jsxs as h } from "react/jsx-runtime";
import f from "react";
import { ArrowsClockwise as w } from "@phosphor-icons/react";
import { L as N } from "./loader-hr2w7cpqeev3p3vl.js";
import { T } from "./tooltip-odudhkxe282wxinq.js";
import { c } from "./cn-ct4n7r74mh8y0f48.js";
import { u as B } from "./link-provider-mn2voeohon7cj9o4.js";
const i = {
  shape: {
    base: {
      classes: "",
      description: "Default rectangular button shape"
    },
    square: {
      classes: "items-center justify-center p-0",
      description: "Square button for icon-only actions"
    },
    circle: {
      classes: "items-center justify-center p-0 rounded-full",
      description: "Circular button for icon-only actions"
    }
  },
  size: {
    xs: {
      classes: "h-5 gap-1 rounded-sm px-1.5 text-xs",
      description: "Extra small button for compact UIs"
    },
    sm: {
      classes: "h-6.5 gap-1 rounded-md px-2 text-xs",
      description: "Small button for secondary actions"
    },
    base: {
      classes: "h-9 gap-1.5 rounded-lg px-3 text-base",
      description: "Default button size"
    },
    lg: {
      classes: "h-10 gap-2 rounded-lg px-4 text-base",
      description: "Large button for primary CTAs"
    }
  },
  compactSize: {
    xs: { classes: "size-3.5" },
    sm: { classes: "size-6.5" },
    base: { classes: "size-9" },
    lg: { classes: "size-10" }
  },
  variant: {
    primary: {
      classes: "bg-kumo-brand !text-white hover:bg-kumo-brand-hover disabled:bg-kumo-brand/50",
      description: "High-emphasis button for primary actions"
    },
    secondary: {
      classes: "bg-kumo-base !text-kumo-default ring not-disabled:hover:bg-kumo-tint disabled:bg-kumo-base/50 disabled:!text-kumo-default/70 ring-kumo-hairline data-[state=open]:bg-kumo-base",
      description: "Default button style for most actions"
    },
    ghost: {
      classes: "text-kumo-default hover:bg-kumo-tint shadow-none bg-inherit",
      description: "Minimal button with no background"
    },
    destructive: {
      classes: "bg-kumo-danger !text-white hover:bg-kumo-danger/70",
      description: "Danger button for destructive actions like delete"
    },
    "secondary-destructive": {
      classes: "bg-kumo-base !text-kumo-danger ring not-disabled:hover:bg-kumo-base disabled:bg-kumo-base/50 disabled:!text-kumo-danger/70 ring-kumo-hairline data-[state=open]:bg-kumo-base",
      description: "Secondary button with destructive text for less prominent dangerous actions"
    },
    outline: {
      classes: "bg-transparent text-kumo-default ring ring-kumo-hairline",
      description: "Bordered button with transparent background"
    }
  }
}, g = {
  shape: "base",
  size: "base",
  variant: "secondary"
};
function x({
  variant: s = g.variant,
  size: t = g.size,
  shape: e = g.shape
} = {}) {
  const o = e === "square" || e === "circle";
  return c(
    // Base styles
    "group flex w-max shrink-0 items-center font-medium select-none",
    "border-0 shadow-xs",
    "focus:outline-none focus:ring-kumo-focus/50 focus-visible:ring-2 focus-visible:ring-kumo-brand",
    "cursor-pointer",
    // Disabled state
    "disabled:cursor-not-allowed disabled:text-kumo-subtle",
    // Apply variant, size, shape styles from KUMO_BUTTON_VARIANTS
    i.variant[s].classes,
    i.size[t].classes,
    i.shape[e].classes,
    o && i.compactSize[t].classes
  );
}
const y = (s) => s ? f.isValidElement(s) ? s : /* @__PURE__ */ a(s, {}) : null, v = f.forwardRef(
  ({
    children: s,
    className: t,
    disabled: e,
    loading: o,
    shape: u = "base",
    size: r = "base",
    variant: l = "secondary",
    icon: d,
    title: n,
    ...b
  }, m) => {
    const { type: p, ...z } = b, k = /* @__PURE__ */ h(
      "button",
      {
        ref: m,
        className: c(
          x({ variant: l, size: r, shape: u }),
          e && "cursor-not-allowed opacity-50",
          t
        ),
        disabled: o || e,
        type: p ?? "button",
        ...z,
        children: [
          o && /* @__PURE__ */ a(N, { size: r === "lg" ? 16 : 14 }),
          !o && y(d),
          s
        ]
      }
    );
    return n ? /* @__PURE__ */ a(T, { content: n, render: k }) : k;
  }
);
v.displayName = "Button";
const j = ({
  "aria-label": s = "Refresh",
  loading: t,
  ...e
}) => /* @__PURE__ */ a(v, { shape: "square", "aria-label": s, ...e, children: /* @__PURE__ */ a(
  w,
  {
    className: c({
      "animate-refresh": t,
      "size-4.5": e.size === "base" || !e.size,
      "size-4": e.size === "sm",
      "size-5": e.size === "lg"
    })
  }
) }), L = f.forwardRef(
  ({
    children: s,
    className: t,
    external: e,
    href: o,
    shape: u = "base",
    size: r = "base",
    variant: l = "ghost",
    icon: d,
    // linksExternal = false,
    ...n
  }, b) => {
    const m = B(), p = e ? { target: "_blank", rel: "noopener noreferrer" } : {};
    return /* @__PURE__ */ h(
      m,
      {
        ref: b,
        className: c(
          x({ variant: l, size: r, shape: u }),
          "flex items-center no-underline!",
          t
        ),
        href: o,
        to: typeof o == "string" ? o : void 0,
        ...p,
        ...n,
        children: [
          y(d),
          s
        ]
      }
    );
  }
);
L.displayName = "LinkButton";
export {
  v as B,
  L,
  j as R,
  x as b
};
//# sourceMappingURL=button-6by9ntsa3nj553mq.js.map
