var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import React, { forwardRef, useContext } from "react";
import { ChevronDownIcon } from "@navikt/aksel-icons";
import { cl } from "../utils/helpers/index.js";
import { useI18n } from "../utils/i18n/i18n.hooks.js";
import { ExpansionCardContext } from "./context.js";
const ExpansionCardHeader = forwardRef((_a, ref) => {
    var { children, className } = _a, rest = __rest(_a, ["children", "className"]);
    const panelContext = useContext(ExpansionCardContext);
    const translate = useI18n("global");
    if (panelContext === null) {
        console.error("<ExpansionCard.Header> has to be used within an <ExpansionCard>");
        return null;
    }
    return (React.createElement("div", Object.assign({ ref: ref }, rest, { className: cl("aksel-expansioncard__header", className), "data-open": panelContext.open }),
        React.createElement("div", null, children),
        React.createElement("button", { className: "aksel-expansioncard__header-button", onClick: panelContext.toggleOpen, type: "button", "aria-expanded": panelContext.open },
            React.createElement(ChevronDownIcon, { className: "aksel-expansioncard__header-chevron", title: translate("showMore") }))));
});
export default ExpansionCardHeader;
//# sourceMappingURL=ExpansionCardHeader.js.map