const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let antd = require("antd");
//#region src/components/pisellSingleLineText/components/EditView.tsx
/**
* PisellSingleLineText 编辑态视图组件
* 
* 负责渲染编辑态的输入框，基于 Ant Design Input 组件
* 
* 功能：
* - 文本输入
* - 实时或失焦校验
* - 错误提示展示
* - 字数统计
* - 清空按钮
* - 前后缀、前后置标签
* 
* @param props 组件 Props
*/
const EditView = (props) => {
	const { value, isValid, errors, handleChange, handleBlur, handleFocus } = (0, _pisell_utils.useTextInputState)(props);
	return /* @__PURE__ */ react.default.createElement("div", { className: "pisell-single-line-text-edit" }, /* @__PURE__ */ react.default.createElement(antd.Input, {
		value,
		onChange: (e) => handleChange(e.target.value),
		onBlur: handleBlur,
		onFocus: handleFocus,
		onPressEnter: (e) => {
			var _props$onPressEnter;
			return (_props$onPressEnter = props.onPressEnter) === null || _props$onPressEnter === void 0 ? void 0 : _props$onPressEnter.call(props, e.currentTarget.value);
		},
		placeholder: props.placeholder,
		maxLength: props.maxLength,
		showCount: props.showCount,
		allowClear: props.allowClear,
		prefix: props.prefix,
		suffix: props.suffix,
		addonBefore: props.addonBefore,
		addonAfter: props.addonAfter,
		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.default.createElement("div", { className: "pisell-single-line-text-error" }, errors[0]));
};
//#endregion
exports.default = EditView;
