import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useActionHandlers } from '@gravity-ui/uikit';
import { Foldable, HTML, ToggleArrow, YFMWrapper } from "../../../components/index.js";
import Link from "../../../components/Link/Link.js";
import { block } from "../../../utils/index.js";
import { FaqMicrodataValues } from "../models.js";
import './QuestionBlockItem.css';
const b = block('QuestionsBlockItem');
export const QuestionBlockItem = ({ title: itemTitle, text: itemText, link, listStyle = 'dash', isOpened, onClick, }) => {
    const { onKeyDown } = useActionHandlers(onClick);
    return (_jsxs("div", { className: b(), itemScope: true, itemProp: FaqMicrodataValues.QuestionProp, itemType: FaqMicrodataValues.QuestionType, role: 'listitem', children: [_jsxs("button", { className: b('title'), onClick: onClick, "aria-expanded": isOpened, onKeyDown: onKeyDown, children: [_jsx(HTML, { itemProp: FaqMicrodataValues.QuestionNameProp, children: itemTitle }), _jsx(ToggleArrow, { open: isOpened, size: 16, type: 'vertical', iconType: "navigation", className: b('arrow') })] }), _jsx(Foldable, { isOpened: isOpened, children: _jsxs("div", { className: b('text'), itemScope: true, itemProp: FaqMicrodataValues.AnswerProp, itemType: FaqMicrodataValues.AnswerType, "aria-hidden": !isOpened, children: [_jsx(YFMWrapper, { content: itemText, modifiers: {
                                constructor: true,
                                constructorListStyle: true,
                                constructorListStyleDash: listStyle === 'dash',
                            }, itemProp: FaqMicrodataValues.QuestionTextProp }), link && _jsx(Link, { ...link, tabIndex: isOpened ? 0 : -1, className: b('link') })] }) })] }));
};
//# sourceMappingURL=QuestionBlockItem.js.map
