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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from "react";
import { useCallback } from "react";
import { cn } from "@utils";
import { panelHeaderVariants } from "./panelVariants";
import { Button } from "../button";
import { iconList } from "../adpIcon";
export const PanelHeader = React.forwardRef((_a, ref) => {
    var { className, showBackButton = false, onBackHandler, showCloseButton = false, onCloseHandler, customCTA, header, subHeader } = _a, props = __rest(_a, ["className", "showBackButton", "onBackHandler", "showCloseButton", "onCloseHandler", "customCTA", "header", "subHeader"]);
    const closePanel = useCallback(() => (typeof onCloseHandler === "function" ? onCloseHandler() : undefined), [onCloseHandler]);
    return (_jsxs("div", Object.assign({ className: cn(panelHeaderVariants(), className), "data-testid": "panel-header", ref: ref }, props, { children: [showBackButton && (_jsx(Button, { prefixIcon: iconList.arrowTurnLeft, size: "md", className: "rtl:scale-x-[-1]", onClick: onBackHandler, variant: "text", color: "secondary" })), (header || subHeader) && (_jsxs("div", { className: "panel__heading-container flex-1", children: [header && _jsx("p", { className: "panel__heading text-secondary-500 font-semibold dark:text-secondary-50", id: "panel-label", children: header }), subHeader && _jsx("p", { className: "panel__sub-heading text-secondary-400 font-regular text-base line-clamp-2 dark:text-secondary-300", children: subHeader })] })), customCTA, showCloseButton && (_jsx(Button, { prefixIcon: iconList.cross, size: "md", className: "ms-auto", onClick: closePanel, variant: "text", color: "secondary", autoFocus: true }))] })));
});
PanelHeader.displayName = "PanelHeader";
//# sourceMappingURL=panelHeader.js.map