@uva-glass/component-library
Version:
React components UvA
56 lines (55 loc) • 1.68 kB
JavaScript
import { jsxs as i, jsx as d } from "react/jsx-runtime";
import { c as _ } from "../../clsx-OuTLNxxd.js";
import { useState as x, useId as m } from "react";
import { Icon as b } from "../Icon/Icon.js";
import '../../assets/Accordion.css';const v = "_accordion_bvnps_1", f = "_accordion__title_bvnps_6", u = "_accordion__content_bvnps_33", o = {
accordion: v,
accordion__title: f,
"accordion__title-icon": "_accordion__title-icon_bvnps_22",
"accordion__title-icon--expanded": "_accordion__title-icon--expanded_bvnps_28",
accordion__content: u,
"accordion__content--expanded": "_accordion__content--expanded_bvnps_37"
}, E = ({ title: a, content: r, expanded: s = !1 }) => {
const [c, n] = x(s), e = m();
function l(p) {
const { code: t } = p;
(t === "Enter" || t === "Space") && n(!c);
}
return /* @__PURE__ */ i("div", { className: o.accordion, children: [
/* @__PURE__ */ i(
"div",
{
className: o.accordion__title,
id: e,
role: "button",
tabIndex: 0,
onClick: () => n(!c),
onKeyUp: l,
"aria-expanded": c,
children: [
a,
/* @__PURE__ */ d(
b,
{
className: _(o["accordion__title-icon"], { [o["accordion__title-icon--expanded"]]: c }),
name: "CheveronLeft",
size: 16
}
)
]
}
),
/* @__PURE__ */ d(
"div",
{
"aria-labelledby": e,
className: _(o.accordion__content, { [o["accordion__content--expanded"]]: c }),
children: r
}
)
] });
};
export {
E as Accordion
};
//# sourceMappingURL=Accordion.js.map