import { cn } from "./cva.js";
import { Badge } from "./Badge.js";
import * as React from "react";
import { jsx, jsxs } from "react/jsx-runtime";
import * as RTabs from "@radix-ui/react-tabs";
//#region src/Tabs.tsx
const Tabs = RTabs.Root;
const TabsList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(RTabs.List, {
	ref,
	className: cn("inline-flex items-center gap-2 rounded-lg bg-[var(--mod-color-neutral-3)] p-1", className),
	...props
}));
TabsList.displayName = "TabsList";
const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(RTabs.Trigger, {
	ref,
	className: cn("inline-flex min-h-[var(--mod-touch-min)] items-center gap-2 rounded-md px-3 text-[var(--mod-color-accent-11)] data-[state=inactive]:bg-[var(--mod-color-accent-3)] data-[state=inactive]:hover:bg-[var(--mod-color-accent-4)] data-[state=inactive]:active:bg-[var(--mod-color-accent-5)] data-[state=active]:bg-[var(--mod-color-accent-9)] data-[state=active]:text-[var(--mod-color-accent-contrast)] focus-visible:outline-[var(--mod-focus-ring-width)] focus-visible:outline-[var(--mod-focus-ring-color)] focus-visible:outline-offset-[var(--mod-focus-ring-offset)] disabled:cursor-not-allowed disabled:opacity-[var(--mod-opacity-disabled)]", className),
	...props
}));
TabsTrigger.displayName = "TabsTrigger";
const TabsContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(RTabs.Content, {
	ref,
	className: cn("focus-visible:outline-[var(--mod-focus-ring-width)] focus-visible:outline-[var(--mod-focus-ring-color)] focus-visible:outline-offset-[var(--mod-focus-ring-offset)]", className),
	...props
}));
TabsContent.displayName = "TabsContent";
function tabBadgeTone(count, warnAt, dangerAt) {
	if (count >= dangerAt) return "danger";
	if (count >= warnAt) return "warning";
	return "neutral";
}
const TabsTriggerWithBadge = React.forwardRef(({ count, warnAt, dangerAt, children, className, ...props }, ref) => /* @__PURE__ */ jsxs(TabsTrigger, {
	ref,
	className: cn("justify-center", className),
	...props,
	children: [children, count != null && count > 0 ? /* @__PURE__ */ jsx(Badge, {
		tone: tabBadgeTone(count, warnAt ?? Infinity, dangerAt ?? Infinity),
		children: count
	}) : null]
}));
TabsTriggerWithBadge.displayName = "TabsTriggerWithBadge";
//#endregion
export { Tabs, TabsContent, TabsList, TabsTrigger, TabsTriggerWithBadge, tabBadgeTone };
