import React from "react";
import { useNumberInputState } from "@pisell/utils";
import { InputNumber } from "antd";
//#region src/components/pisellNumber/components/EditView.tsx
/**
* PisellNumber 编辑态视图组件
* 
* 负责渲染编辑态的输入框，基于 Ant Design InputNumber 组件
* 
* 功能：
* - 数值输入
* - 实时或失焦校验
* - 错误提示展示
* - 步进器调节
* - 前后缀、前后置标签
* 
* @param props 组件 Props
*/
const EditView = (props) => {
	const { min, max, step, precision, formatter, parser, placeholder = "请输入数字", prefix, suffix, addonBefore, addonAfter, disabled, autoFocus, size, keyboard, controls, className, style, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, id, name, onPressEnter } = props;
	const { value, isValid, errors, handleChange, handleBlur, handleFocus } = useNumberInputState(props);
	return /* @__PURE__ */ React.createElement("div", { className: `pisell-number pisell-number-edit ${className || ""}` }, /* @__PURE__ */ React.createElement(InputNumber, {
		value: value !== null && value !== void 0 ? value : void 0,
		onChange: handleChange,
		onBlur: handleBlur,
		onFocus: handleFocus,
		onPressEnter: () => onPressEnter === null || onPressEnter === void 0 ? void 0 : onPressEnter(value !== null && value !== void 0 ? value : null),
		min,
		max,
		step,
		precision,
		formatter,
		parser,
		placeholder,
		prefix,
		addonBefore,
		addonAfter,
		disabled,
		autoFocus,
		size,
		keyboard,
		controls,
		status: isValid ? void 0 : "error",
		style,
		"aria-label": ariaLabel,
		"aria-describedby": ariaDescribedBy,
		id,
		name
	}), !isValid && errors.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "pisell-number-error" }, errors[0]));
};
//#endregion
export { EditView as default };
