import React from "react";
import { useTextInputState } from "@pisell/utils";
import { Input } from "antd";
//#region src/components/pisellLongText/components/EditView.tsx
const { TextArea } = Input;
/**
* PisellLongText 编辑态视图组件
* 
* 负责渲染编辑态的多行输入框，基于 Ant Design TextArea 组件
* 
* 功能：
* - 多行文本输入
* - 自动高度调整（autoSize）
* - 实时或失焦校验
* - 错误提示展示
* - 字数统计
* - 清空按钮
* 
* @param props 组件 Props
*/
const EditView = (props) => {
	const { value, isValid, errors, handleChange, handleBlur, handleFocus } = useTextInputState(props);
	const autoSizeConfig = props.autoSize ? props.autoSize : props.minRows || props.maxRows ? {
		minRows: props.minRows,
		maxRows: props.maxRows
	} : false;
	return /* @__PURE__ */ React.createElement("div", { className: "pisell-long-text-edit" }, /* @__PURE__ */ React.createElement(TextArea, {
		value,
		onChange: (e) => handleChange(e.target.value),
		onBlur: handleBlur,
		onFocus: handleFocus,
		onPressEnter: props.onPressEnter,
		placeholder: props.placeholder,
		maxLength: props.maxLength,
		showCount: props.showCount,
		allowClear: props.allowClear,
		rows: props.rows || 3,
		autoSize: autoSizeConfig,
		disabled: props.disabled,
		autoFocus: props.autoFocus,
		status: isValid ? void 0 : "error",
		className: props.className,
		style: props.style,
		"aria-label": props["aria-label"],
		"aria-describedby": props["aria-describedby"]
	}), !isValid && errors.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "pisell-long-text-error" }, errors[0]));
};
//#endregion
export { EditView as default };
