/**
 * Collaboration form textarea component
 * Provides a reusable textarea field with label, error message, and chat icon functionality
 */
'use client';
import { jsx as _jsx } from "react/jsx-runtime";
import React from 'react';
import { cn } from '../utils/cn.js';
import { get_dom_safe_props } from '../utils/filter_dom_props.js';
import { use_base_form_field } from './shared/use_base_form_field.js';
import { BaseFieldLayout } from './shared/base_field_layout.js';
import { strip_base_props } from './shared/strip_base_props.js';
/**
 * Collaboration form textarea component
 */
export const HazoCollabFormTextArea = React.forwardRef((props, ref) => {
    const base = use_base_form_field(props, ref);
    if (base.should_hide)
        return null;
    const { value, onChange, field_validator, textarea_wrapper_class_name } = props;
    const handle_change = React.useCallback((e) => {
        const new_value = e.target.value;
        if (field_validator) {
            base.set_validation_error(field_validator(new_value));
        }
        onChange(new_value);
    }, [field_validator, onChange, base.set_validation_error]);
    // Strip base props to get only DOM-safe attributes
    const rest_props = strip_base_props(props);
    delete rest_props.value;
    delete rest_props.onChange;
    return (_jsx(BaseFieldLayout, { base: base, wrapper_class_name: "cls_collab_textarea_wrapper", wrapper_extra_class_name: textarea_wrapper_class_name, force_full_row: true, children: _jsx("textarea", { ref: base.component_ref, id: base.field_id_final, value: value, onChange: handle_change, disabled: base.is_field_disabled, className: cn('cls_collab_textarea w-full min-h-[100px] rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm resize-y', base.display_error && 'border-destructive focus-visible:ring-destructive', base.locked && 'bg-slate-100', base.skipped && 'bg-slate-100 opacity-60', base.show_required_highlight && 'bg-red-50', base.className), "aria-invalid": base.display_error ? 'true' : 'false', "aria-describedby": base.display_error ? `${base.field_id_final}-error` : undefined, ...get_dom_safe_props(rest_props) }) }));
});
HazoCollabFormTextArea.displayName = 'HazoCollabFormTextArea';
//# sourceMappingURL=hazo_collab_form_textarea.js.map