import { cn, surface } from "./cva.js";
import * as React from "react";
import { jsx, jsxs } from "react/jsx-runtime";
import * as RSelect from "@radix-ui/react-select";
//#region src/Select.tsx
const Select = RSelect.Root;
const SelectValue = RSelect.Value;
const SelectGroup = RSelect.Group;
const SelectLabel = RSelect.Label;
const SelectSeparator = RSelect.Separator;
function ChevronDownIcon() {
	return /* @__PURE__ */ jsx("svg", {
		className: "h-4 w-4",
		viewBox: "0 0 16 16",
		fill: "none",
		"aria-hidden": true,
		children: /* @__PURE__ */ jsx("path", {
			d: "M4 6L8 10L12 6",
			stroke: "currentColor",
			strokeWidth: "2",
			strokeLinecap: "round",
			strokeLinejoin: "round"
		})
	});
}
function ChevronUpIcon() {
	return /* @__PURE__ */ jsx("svg", {
		className: "h-4 w-4",
		viewBox: "0 0 16 16",
		fill: "none",
		"aria-hidden": true,
		children: /* @__PURE__ */ jsx("path", {
			d: "M12 10L8 6L4 10",
			stroke: "currentColor",
			strokeWidth: "2",
			strokeLinecap: "round",
			strokeLinejoin: "round"
		})
	});
}
const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(RSelect.Trigger, {
	ref,
	className: cn(surface({
		tone: "surface",
		radius: "md"
	}), "flex min-h-[var(--mod-touch-min)] items-center justify-between gap-2 border border-border px-3 py-2 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,
	children: [children, /* @__PURE__ */ jsx(RSelect.Icon, {
		className: "text-fg-muted",
		"aria-hidden": true,
		children: /* @__PURE__ */ jsx(ChevronDownIcon, {})
	})]
}));
SelectTrigger.displayName = "SelectTrigger";
const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(RSelect.ScrollUpButton, {
	ref,
	className: cn("flex cursor-default items-center justify-center py-1 text-fg-muted", className),
	...props,
	children: /* @__PURE__ */ jsx(ChevronUpIcon, {})
}));
SelectScrollUpButton.displayName = "SelectScrollUpButton";
const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(RSelect.ScrollDownButton, {
	ref,
	className: cn("flex cursor-default items-center justify-center py-1 text-fg-muted", className),
	...props,
	children: /* @__PURE__ */ jsx(ChevronDownIcon, {})
}));
SelectScrollDownButton.displayName = "SelectScrollDownButton";
const SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(RSelect.Portal, { children: /* @__PURE__ */ jsxs(RSelect.Content, {
	ref,
	position,
	className: cn(surface({
		tone: "surface",
		radius: "lg"
	}), "relative z-50 max-h-96 min-w-32 overflow-hidden border border-border shadow-[var(--mod-shadow-md)]", className),
	...props,
	children: [
		/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
		/* @__PURE__ */ jsx(RSelect.Viewport, {
			className: "p-1",
			children
		}),
		/* @__PURE__ */ jsx(SelectScrollDownButton, {})
	]
}) }));
SelectContent.displayName = "SelectContent";
const SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(RSelect.Item, {
	ref,
	className: cn("relative flex min-h-[var(--mod-touch-min)] w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm text-[var(--mod-color-accent-11)] outline-none focus:bg-[var(--mod-color-accent-4)] active:bg-[var(--mod-color-accent-5)] data-[disabled]:opacity-[var(--mod-opacity-disabled)]", className),
	...props,
	children: [/* @__PURE__ */ jsx("span", {
		className: "absolute left-2 inline-flex items-center justify-center",
		children: /* @__PURE__ */ jsx(RSelect.ItemIndicator, {
			"aria-hidden": true,
			children: "✓"
		})
	}), /* @__PURE__ */ jsx(RSelect.ItemText, { children })]
}));
SelectItem.displayName = "SelectItem";
//#endregion
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue };
