@lanaco/lnc-react-ui
Version:
React component library
79 lines (77 loc) • 1.79 kB
JavaScript
import { jsxs as y, jsx as _ } from "react/jsx-runtime";
import { forwardRef as C } from "react";
import { P as o } from "./index-S5Cd7WrG.js";
import { n as g } from "./emotion-styled.browser.esm-CjCaF13H.js";
import h from "./Icon.js";
import { b as x } from "./utils-DtRLzzTZ.js";
import { u as A } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
const N = {
small: "0.6rem 1rem",
medium: "0.8rem 1.25rem",
large: "1rem 1.5rem"
}, O = g.div`
display: flex;
justify-content: space-between;
cursor: pointer;
color: ${(e) => x(
e.theme,
"Accordion",
"primary",
"enabled",
"summaryText"
)};
padding: ${(e) => N[e.size]};
& .accordion-icon-lnc {
transform: ${(e) => e.isExpanded ? "rotate(180deg)" : "rotate(0)"};
transition: transform 0.25s ease;
}
`, s = C((e, n) => {
const {
__TYPE__: T = "ACCORDION_SUMMARY",
disabled: a,
isExpanded: m,
onExpand: t,
onClick: i = () => {
},
size: c = "small",
className: l = "",
style: d = {},
children: p,
...f
} = e, u = { theme: A(), size: c, style: d, className: l };
return /* @__PURE__ */ y(
O,
{
ref: n,
...u,
onClick: (r) => {
a == !1 && t(r), i(r);
},
isExpanded: m,
...f,
children: [
p,
/* @__PURE__ */ _(
h,
{
icon: "angle-down",
sizeInUnits: "1.125rem",
className: "accordion-icon-lnc"
}
)
]
}
);
});
s.propTypes = {
__TYPE__: o.string,
onClick: o.func,
//---------------------------------------------------------------
className: o.string,
style: o.object,
size: o.oneOf(["small", "medium", "large"])
};
s.displayName = "ACCORDION_SUMMARY";
export {
s as default
};