/*! ratio-ui · design system for knowledge sharing · https://github.com/losol/ratio-ui · (c) 2026 Losol AS · MPL-2.0 */
import { ChevronDown } from "../../icons/index.js";
import { Stack } from "../../layout/Stack/Stack.js";
import React from "react";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
import clsx$1 from "clsx";
//#region src/core/Accordion/Accordion.tsx
function Root({ children }) {
	if (React.Children.count(children) <= 1) return /* @__PURE__ */ jsx(Fragment, { children });
	return /* @__PURE__ */ jsx(Stack, {
		gap: "sm",
		children
	});
}
function Item({ children, className, ...rest }) {
	return /* @__PURE__ */ jsx("details", {
		className: clsx$1("group rounded-md border border-border-1 bg-card", className),
		...rest,
		children
	});
}
function Summary({ children, className, hideChevron, ...rest }) {
	return /* @__PURE__ */ jsxs("summary", {
		className: clsx$1("flex cursor-pointer list-none items-center justify-between gap-2 px-3 py-3 font-medium", "hover:bg-card-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--focus-ring)", "[&::-webkit-details-marker]:hidden", className),
		...rest,
		children: [/* @__PURE__ */ jsx("span", {
			className: "flex-1",
			children
		}), !hideChevron && /* @__PURE__ */ jsx(ChevronDown, {
			className: "h-4 w-4 shrink-0 transition-transform duration-200 group-open:rotate-180",
			"aria-hidden": "true"
		})]
	});
}
function Content({ children, className, ...rest }) {
	return /* @__PURE__ */ jsx("div", {
		className: clsx$1("p-3 text-sm", "transition-discrete transition-opacity duration-200 starting:opacity-0", className),
		...rest,
		children
	});
}
/**
* Accordion — compound disclosure built on native `<details>`/`<summary>`.
*
* @beta API may change before 1.0.
*/
var Accordion = Object.assign(Root, {
	Item,
	Summary,
	Content
});
//#endregion
export { Accordion };

//# sourceMappingURL=Accordion.js.map