import { cx } from '@onbeam/styled-system/css';
import { forwardRef } from 'react';
import { dappInputField, gridBackground, noiseBackground } from '@onbeam/styled-system/recipes';
import { formatUsd } from '@onbeam/utils';
import { jsxs, jsx } from 'react/jsx-runtime';

var l=forwardRef(({className:s,placeholder:u="0.00",currency:r,topRightAddon:m,bottomRightAddon:c,nativeBalance:o,usdBalance:d,hasError:f,onChange:v,...I},g)=>{let y=typeof o<"u"&&typeof r<"u",p=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 jsxs("div",{className:cx(gridBackground(),noiseBackground(),p.root,s),"data-error":f,children:[jsxs("div",{className:p.row,children:[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]}),jsxs("div",{className:cx(p.row,p.balances),children:[typeof d<"u"&&jsx("span",{children:formatUsd(d,{prefix:"~"})}),jsxs("div",{className:p.nativeBalance,children:[jsx("span",{children:y?`${o} ${r}`:"-"}),c]})]})]})});l.displayName="DappInputField";

export { l as a };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-WR7JBESP.js.map