import { jsxs, jsx } from 'react/jsx-runtime';
import { forwardRef, useRef } from 'react';
import Icon from '../Icon/Icon.js';
import Tooltip from '../Tooltip/Tooltip.js';
import { useKeyboardActions } from '../../utils/keyBoardActionUtil/UseKeyboardActions.js';
import classNames from '../../_virtual/index.js';
import { checkEmpty } from '../../utils/checkEmpty/checkEmpty.js';

const Prompt = forwardRef(({ width = 300, height = 40, iconHeight = 16, iconWidth = 16, placeholder = 'Enter text', iconName = 'right_arrow_filled_icon', iconPosition = 'left', borderRadius = 4, autoFocus = false, value = '', iconColor = 'var(--brand-color)', tooltipTitle = 'send', submitPrompt, onPromptChange, onBlur, onFocus, disableInput, isAdditionalIcon = false, additionalIconName, additionIconToolTip, onAdditionalIconClick, }, ref) => {
    const containerRef = useRef(null);
    useKeyboardActions([{ key: 'Enter', action: () => handleKeyBoard() }], containerRef);
    const handleKeyBoard = (key) => {
        {
            if (value) {
                submitPrompt?.(value.trim());
            }
        }
    };
    return (jsxs("div", { className: classNames('ff-prompt-container', {
            'icon-left': iconPosition === 'left',
            'icon-right': iconPosition !== 'left',
        }), style: {
            width: `${width}px`,
            height: `${height}px`,
            borderRadius,
        }, ref: containerRef, children: [jsx(Tooltip, { placement: "top", title: tooltipTitle, children: jsx(Icon, { name: iconName, className: "ff-prompt-icon", height: iconHeight, width: iconWidth, onClick: submitPrompt, color: iconColor, disabled: checkEmpty(value) }) }), jsx("input", { ref: ref, className: "ff-prompt-input", type: "text", placeholder: placeholder, autoFocus: autoFocus, onChange: onPromptChange, onFocus: onFocus, onBlur: onBlur, value: value, readOnly: disableInput }), isAdditionalIcon && additionalIconName && (jsx(Tooltip, { placement: "top", title: additionIconToolTip, children: jsx(Icon, { name: additionalIconName, className: "ff-prompt-icon additional-icon", height: iconHeight, width: iconWidth, onClick: onAdditionalIconClick }) }))] }));
});

export { Prompt as default };
//# sourceMappingURL=Prompt.js.map
