"use strict";Object.defineProperty(exports, "__esModule", {value: true});

var _chunkCBZWRFNUcjs = require('./chunk-CBZWRFNU.cjs');


var _chunkILBP4CTUcjs = require('./chunk-ILBP4CTU.cjs');




var _chunkZ6EUSUADcjs = require('./chunk-Z6EUSUAD.cjs');

// src/components/NumberInput.tsx
var _react = require('react');
var _jsxruntime = require('@emotion/react/jsx-runtime');
function NumberInput(_a) {
  var _b = _a, {
    maxValue,
    onRightButtonClick,
    onChange: onChangeProp
  } = _b, rest = _chunkZ6EUSUADcjs.__objRest.call(void 0, _b, [
    "maxValue",
    "onRightButtonClick",
    "onChange"
  ]);
  const ref = _react.useRef.call(void 0, null);
  const {
    getRenderValue,
    handleOnChange,
    handleOnBlur,
    handleOnFocus,
    handleOnKeyDown,
    handleOnKeyUp
  } = _chunkCBZWRFNUcjs.useNumberInput.call(void 0, _chunkZ6EUSUADcjs.__spreadProps.call(void 0, _chunkZ6EUSUADcjs.__spreadValues.call(void 0, {}, rest), {
    onChange: onChangeProp,
    ref
  }));
  const onChange = _react.useCallback.call(void 0, 
    (value, event) => {
      handleOnChange(event);
    },
    [handleOnChange]
  );
  const handleRightButtonClick = _react.useCallback.call(void 0, 
    (event) => {
      event.preventDefault();
      if (maxValue && onChangeProp) {
        onChangeProp(maxValue.toString());
      }
      if (onRightButtonClick) {
        onRightButtonClick(event);
      }
    },
    [maxValue, onRightButtonClick, onChangeProp]
  );
  const onKeyDown = _react.useCallback.call(void 0, 
    (keyValue, event) => {
      handleOnKeyDown(event);
    },
    [handleOnKeyDown]
  );
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
    _chunkILBP4CTUcjs.TextInput,
    _chunkZ6EUSUADcjs.__spreadProps.call(void 0, _chunkZ6EUSUADcjs.__spreadValues.call(void 0, {
      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
    })
  );
}
var NumberInput_default = NumberInput;




exports.NumberInput = NumberInput; exports.NumberInput_default = NumberInput_default;
