/**
 * Collaboration form input box component
 * Provides a reusable input field with label, error message, and chat icon functionality
 */
'use client';
import { jsx as _jsx } from "react/jsx-runtime";
import React from 'react';
import { HazoUiFlexInput } from 'hazo_ui';
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 input box component
 */
export const HazoCollabFormInputbox = React.forwardRef((props, ref) => {
    const base = use_base_form_field(props, ref);
    if (base.should_hide)
        return null;
    const { value, onChange, field_validator, input_type, text_len_min, text_len_max, num_min, num_max, regex, num_decimals, format_guide, format_guide_info, input_wrapper_class_name, } = props;
    // Component-specific: handle input change with validation
    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);
    // Remove component-specific props that are handled explicitly
    delete rest_props.value;
    delete rest_props.onChange;
    delete rest_props.input_type;
    delete rest_props.text_len_min;
    delete rest_props.text_len_max;
    delete rest_props.num_min;
    delete rest_props.num_max;
    delete rest_props.regex;
    delete rest_props.num_decimals;
    delete rest_props.format_guide;
    delete rest_props.format_guide_info;
    return (_jsx(BaseFieldLayout, { base: base, wrapper_class_name: "cls_collab_input_wrapper", wrapper_extra_class_name: input_wrapper_class_name, children: _jsx(HazoUiFlexInput, { ref: base.component_ref, id: base.field_id_final, value: value, onChange: handle_change, disabled: base.is_field_disabled, className: cn('cls_collab_input w-full h-9 rounded-md border border-input bg-transparent px-3 py-1 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', 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, input_type: input_type, text_len_min: text_len_min, text_len_max: text_len_max, num_min: num_min, num_max: num_max, regex: regex, num_decimals: num_decimals, format_guide: format_guide, format_guide_info: format_guide_info, ...get_dom_safe_props(rest_props) }) }));
});
HazoCollabFormInputbox.displayName = 'HazoCollabFormInputbox';
//# sourceMappingURL=hazo_collab_form_inputbox.js.map