import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { ChevronLeft, ChevronRight } from '@gravity-ui/icons';
import { Icon, Text } from '@gravity-ui/uikit';
import { block } from "../../../utils/cn.js";
import { ActionButton } from "../../atoms/ActionButton/index.js";
import "./Suggestions.css";
const b = block('suggestions');
/**
 * Suggestions component displays a group of clickable suggestion buttons
 * arranged in either horizontal (grid) or vertical (list) layout
 *
 * @param props - Component props
 * @returns React component
 */
export function Suggestions(props) {
    const { items, onClick, title, layout = 'list', textAlign = 'left', wrapText = false, className, qa, } = props;
    const handleClick = (item) => {
        onClick(item.title, item.id);
    };
    const renderButton = (item, index) => {
        return (_jsx(ActionButton, { tooltipTitle: wrapText ? undefined : item.title, size: "m", view: item.view || 'outlined', onClick: () => handleClick(item), className: b('button', { layout }), width: "auto", children: _jsxs("div", { className: b('button-content', {
                    layout,
                    'text-align': item.icon ? undefined : textAlign,
                }), children: [item.icon === 'left' && (_jsx("div", { className: b('button-icon'), children: _jsx(Icon, { data: ChevronLeft, size: 16 }) })), _jsx(Text, { as: "div", className: b(wrapText ? 'button-text-wrap' : 'button-text'), children: item.title }), item.icon === 'right' && (_jsx("div", { className: b('button-icon'), children: _jsx(Icon, { data: ChevronRight, size: 16 }) }))] }) }, item.id || index));
    };
    return (_jsxs("div", { className: b('container', className), "data-qa": qa, children: [title && (_jsx("div", { className: b('title'), children: typeof title === 'string' ? (_jsx(Text, { variant: "body-1", color: "primary", children: title })) : (title) })), _jsx("div", { className: b({ layout }), children: items.map((item, index) => renderButton(item, index)) })] }));
}
//# sourceMappingURL=Suggestions.js.map
