@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
58 lines (57 loc) • 1.96 kB
JavaScript
"use client";
import { actionVariants } from "./style.mjs";
import { AccordionHeader, AccordionItem, AccordionPanel, AccordionRoot, AccordionTrigger } from "./atoms.mjs";
import { jsx, jsxs } from "react/jsx-runtime";
import { cx } from "antd-style";
//#region src/base-ui/Accordion/Accordion.tsx
const Accordion = ({ className, classNames, defaultValue, gap, hideIndicator, indicatorPlacement = "start", items, keepMounted, multiple = true, onValueChange, ref, style, styles: customStyles, value, variant = "borderless" }) => {
return /* @__PURE__ */ jsx(AccordionRoot, {
className: cx(classNames?.root, className),
defaultValue,
hideIndicator,
indicatorPlacement,
multiple,
ref,
style: {
gap,
...style,
...customStyles?.root
},
value,
variant,
onValueChange: onValueChange ? (next) => onValueChange(next) : void 0,
children: items?.map((item) => /* @__PURE__ */ jsxs(AccordionItem, {
className: classNames?.item,
disabled: item.disabled,
style: customStyles?.item,
value: item.key,
children: [/* @__PURE__ */ jsxs(AccordionHeader, {
className: classNames?.header,
style: customStyles?.header,
children: [/* @__PURE__ */ jsx(AccordionTrigger, {
className: classNames?.trigger,
style: customStyles?.trigger,
children: item.title
}), item.action && /* @__PURE__ */ jsx("div", {
style: customStyles?.action,
className: cx("accordion-action", actionVariants({
alwaysVisible: item.alwaysShowAction,
variant
}), classNames?.action),
children: item.action
})]
}), /* @__PURE__ */ jsx(AccordionPanel, {
className: classNames?.panel,
contentClassName: classNames?.content,
contentStyle: customStyles?.content,
keepMounted,
style: customStyles?.panel,
children: item.children
})]
}, item.key))
});
};
Accordion.displayName = "Accordion";
//#endregion
export { Accordion as default };
//# sourceMappingURL=Accordion.mjs.map