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 } from "react/jsx-runtime";
import { useState } from 'react';
import { Label, LabelGroup } from '@patternfly/react-core';
import { CheckIcon } from '@patternfly/react-icons';
export const QuickResponse = ({ quickResponses, quickResponseContainerProps = { numLabels: 5 }, onSelect, isCompact }) => {
    const [selectedQuickResponse, setSelectedQuickResponse] = useState();
    const handleQuickResponseClick = (id, onClick) => {
        setSelectedQuickResponse(id);
        onClick && onClick();
        onSelect && onSelect(id);
    };
    return (_jsx(LabelGroup, Object.assign({ className: `pf-chatbot__message-quick-response ${(quickResponseContainerProps === null || quickResponseContainerProps === void 0 ? void 0 : quickResponseContainerProps.className) ? quickResponseContainerProps === null || quickResponseContainerProps === void 0 ? void 0 : quickResponseContainerProps.className : ''}` }, quickResponseContainerProps, { children: quickResponses.map((_a) => {
            var { id, onClick, content, className } = _a, props = __rest(_a, ["id", "onClick", "content", "className"]);
            return (_jsx(Label, Object.assign({ variant: id === selectedQuickResponse ? undefined : 'outline', icon: id === selectedQuickResponse ? _jsx(CheckIcon, {}) : undefined, color: "blue", onClick: () => handleQuickResponseClick(id, onClick), className: `${id === selectedQuickResponse ? 'pf-chatbot__message-quick-response--selected' : ''} ${className ? className : ''}`, isCompact: isCompact }, props, { children: content }), id));
        }) })));
};
export default QuickResponse;
