"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const designSystem = require("@choiceform/design-system");
const React = require("react");
const index = require("../../../../i18n/index.cjs");
const tv = require("./tv.cjs");
const promptInputContext = require("../../context/prompt-input-context.cjs");
const PromptTextArea = React.memo(
  React.forwardRef(function PromptTextArea2(props, ref) {
    const { className, children, ...rest } = props;
    const {
      contextInputRef,
      inputValue,
      placeholder,
      mentionTriggers,
      mentionPrefix,
      minHeight,
      variant,
      size,
      handleInputChange,
      handleKeyDown,
      handleCompositionStart,
      handleCompositionEnd,
      onMentionSelect,
      setIsInputFocused
    } = promptInputContext.usePromptInputContext();
    const inputPlaceholder = index.t("prompt-input", "input-placeholder");
    const tv$1 = tv.promptTextAreaTv({ size });
    return /* @__PURE__ */ jsxRuntime.jsx(
      designSystem.ContextInput,
      {
        className: tv$1.input({ className }),
        ref: designSystem.mergeRefs(contextInputRef, ref),
        value: inputValue,
        placeholder: placeholder ?? inputPlaceholder,
        mentionPrefix,
        triggers: mentionTriggers,
        minHeight,
        variant,
        size,
        onChange: handleInputChange,
        onKeyDown: handleKeyDown,
        onCompositionStart: handleCompositionStart,
        onCompositionEnd: handleCompositionEnd,
        onMentionSelect,
        onFocus: () => setIsInputFocused(true),
        onBlur: () => setIsInputFocused(false),
        ...rest,
        children: children && /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContextInput.Footer, { className: tv$1.footer(), children })
      }
    );
  })
);
exports.PromptTextArea = PromptTextArea;
//# sourceMappingURL=prompt-text-area.cjs.map
