'use strict';

var css = require('@onbeam/styled-system/css');
var react = require('react');
var recipes = require('@onbeam/styled-system/recipes');
var utils = require('@onbeam/utils');
var jsxRuntime = require('react/jsx-runtime');

var l=react.forwardRef(({className:s,placeholder:u="0.00",currency:r,topRightAddon:m,bottomRightAddon:f,nativeBalance:d,usdBalance:o,hasError:c,onChange:v,...I},g)=>{let y=typeof d<"u"&&typeof r<"u",p=recipes.dappInputField(),F=a=>{let e=a.target.value;e=e.replace(/[^0-9.,]/g,""),e=e.replace(",","."),e=e.replace(/(\..*)\..*/g,"$1"),e=e.replace(/^0+(?=\d)/,""),a.target.value=e,v?.(a);};return jsxRuntime.jsxs("div",{className:css.cx(recipes.gridBackground(),recipes.noiseBackground(),p.root,s),"data-error":c,"data-testid":"dapp-input-field",children:[jsxRuntime.jsxs("div",{className:p.row,children:[jsxRuntime.jsx("input",{ref:g,className:p.input,placeholder:u,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",onWheel:a=>a.currentTarget.blur(),onChange:F,...I}),m]}),jsxRuntime.jsxs("div",{className:css.cx(p.row,p.balances),children:[typeof o<"u"&&jsxRuntime.jsx("span",{children:utils.formatUsd(o,{prefix:"~"})}),jsxRuntime.jsxs("div",{className:p.nativeBalance,children:[jsxRuntime.jsx("span",{children:y?`${d} ${r}`:"-"}),f]})]})]})});l.displayName="DappInputField";

exports.a = l;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-LPTMIGOR.cjs.map