Object.defineProperties(exports, {
	__esModule: { value: true },
	[Symbol.toStringTag]: { value: "Module" }
});
require("../chunk-BN4qSVkS.cjs");
const require_components_TextInput = require("./TextInput.cjs");
const require_hooks_useNumberInput_useNumberInput = require("../hooks/useNumberInput/useNumberInput.cjs");
let react = require("react");
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
//#region src/components/NumberInput.tsx
function NumberInput({ maxValue, onRightButtonClick, onChange: onChangeProp, ...rest }) {
	const ref = (0, react.useRef)(null);
	const { getRenderValue, handleOnChange, handleOnBlur, handleOnFocus, handleOnKeyDown, handleOnKeyUp } = require_hooks_useNumberInput_useNumberInput.useNumberInput({
		...rest,
		onChange: onChangeProp,
		ref
	});
	const onChange = (0, react.useCallback)((value, event) => {
		handleOnChange(event);
	}, [handleOnChange]);
	const handleRightButtonClick = (0, react.useCallback)((event) => {
		event.preventDefault();
		if (maxValue && onChangeProp) onChangeProp(maxValue.toString());
		if (onRightButtonClick) onRightButtonClick(event);
	}, [
		maxValue,
		onRightButtonClick,
		onChangeProp
	]);
	const onKeyDown = (0, react.useCallback)((keyValue, event) => {
		handleOnKeyDown(event);
	}, [handleOnKeyDown]);
	return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_components_TextInput.TextInput, {
		placeholder: "Enter a number",
		...rest,
		onKeyDown,
		onKeyUp: handleOnKeyUp,
		onChange,
		onBlur: handleOnBlur,
		onFocus: handleOnFocus,
		value: getRenderValue(),
		inputRef: ref,
		type: "text",
		inputMode: "decimal",
		pattern: "[0-9,.]*",
		rightButtonText: maxValue ? "Max" : void 0,
		onRightButtonClick: handleRightButtonClick
	});
}
//#endregion
exports.NumberInput = NumberInput;
exports.default = NumberInput;
