import { filterUndefined } from "../utils/object.js";
import { cs } from "../utils/styles.js";
import "../utils/index.js";
import { useStyleConfig } from "../core/theme.js";
import { styled } from "../core/styled.js";
import { vui } from "../core/vui.js";
import "../core/index.js";
import list_default from "../list/list.js";
import "../list/index.js";
import { AccordionProvider } from "./context.js";
import accordionItem_default from "./accordionItem.js";
import accordionItemHorizontal_default from "./accordionItemHorizontal.js";
import { useMemo } from "react";
import { jsx } from "react/jsx-runtime";

//#region src/accordion/accordion.tsx
const AccordionBase = styled.divBox`
  display: flex;
  min-width: 0;
  transition-duration: normal;
`;
/** Allows to show and hide sections of related content on a page. */
const Accordion = vui((props, ref) => {
	const { children, className, items, orientation = "vertical", iconPosition = "end", size, variant, ...rest } = props;
	const styles = useStyleConfig("Accordion", props);
	const context = useMemo(() => filterUndefined({
		size,
		variant
	}), [size, variant]);
	const aliasedProps = filterUndefined({});
	const isVertical = orientation === "vertical";
	return /* @__PURE__ */ jsx(AccordionProvider, {
		value: context,
		children: /* @__PURE__ */ jsx(AccordionBase, {
			borderLeft: isVertical ? void 0 : `1px solid transparent
        `,
			borderTop: isVertical ? `1px solid transparent` : void 0,
			className: cs("vui-accordion", className),
			ref,
			w: "100%",
			...styles.container,
			...aliasedProps,
			...rest,
			children: isVertical ? /* @__PURE__ */ jsx(list_default, {
				w: "100%",
				children: items ? items?.map?.((item, key) => /* @__PURE__ */ jsx(accordionItem_default, {
					iconPosition,
					...item
				}, key)) : children
			}) : items ? items?.map?.((item, key) => /* @__PURE__ */ jsx(accordionItemHorizontal_default, { ...item }, key)) : children
		})
	});
});
Accordion.Item = accordionItem_default;
Accordion.ItemHorizontal = accordionItemHorizontal_default;
Accordion.displayName = "Accordion";

//#endregion
export { Accordion, AccordionBase };
globalThis.__vuiVersion__ = "4.0.0-beta.1"
//# sourceMappingURL=accordion.js.map