/*! ratio-ui · design system for knowledge sharing · https://github.com/losol/ratio-ui · (c) 2026 Losol AS · MPL-2.0 */
import { Check } from "../../icons/index.js";
import "react";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/core/List/List.tsx
var ListItem = ({ className, children, variant = "default" }) => {
	if (variant === "check") return /* @__PURE__ */ jsxs("li", {
		className: `flex items-start gap-3 ${className || ""}`,
		children: [/* @__PURE__ */ jsx(Check, { className: "mt-0.5 h-5 w-5 shrink-0 text-success-text" }), /* @__PURE__ */ jsx("span", { children })]
	});
	return /* @__PURE__ */ jsx("li", {
		className,
		children
	});
};
var variantStyles = {
	unstyled: {
		list: "list-none",
		item: "mb-4"
	},
	markdown: {
		list: "ml-6 pb-4 space-y-2 marker:text-blue-600",
		item: "pl-2 leading-relaxed"
	},
	"markdown-compact": {
		list: "ml-6 pb-3 space-y-1.5 marker:text-blue-600",
		item: "pl-2"
	}
};
var List = ({ items, children, as: Component = "ul", variant = "unstyled", className, itemClassName, itemSpacing }) => {
	const variantStyle = variantStyles[variant];
	const markerStyles = Component === "ol" && variant !== "unstyled" ? "marker:font-semibold" : "";
	let listTypeStyles = "";
	if (variant !== "unstyled") listTypeStyles = Component === "ul" ? "list-disc" : "list-decimal";
	const finalListClassName = [
		variant === "unstyled" ? "text-(--text) font-medium" : "",
		listTypeStyles,
		variantStyle.list,
		markerStyles,
		className
	].filter(Boolean).join(" ");
	const finalItemClassName = [itemSpacing || variantStyle.item, itemClassName].filter(Boolean).join(" ");
	if (children) return /* @__PURE__ */ jsx(Component, {
		className: finalListClassName,
		children
	});
	if (items?.length) return /* @__PURE__ */ jsx(Component, {
		className: finalListClassName,
		children: items.map((item, idx) => /* @__PURE__ */ jsx(ListItem, {
			className: finalItemClassName,
			children: item.text
		}, item.key ?? idx))
	});
	return null;
};
List.Item = ListItem;
//#endregion
export { List, ListItem };

//# sourceMappingURL=List.js.map