import { a } from './chunk-TWGPE4V7.js';
import { cx } from '@onbeam/styled-system/css';
import { input, gridBackground } from '@onbeam/styled-system/recipes';
import { CloseIcon } from '@onbeam/icons';
import { jsxs, jsx } from 'react/jsx-runtime';

var d=a(({as:v="input",size:f="md",label:I,hasError:b=!1,errorMessage:s,leftAddon:i,rightAddon:u,className:E,inputClassName:N,hasClearButton:o,...y},g)=>{let p=!!s||b,t=input({size:f}),w=a=>{a.stopPropagation(),a.preventDefault();let n=a.currentTarget.parentElement?.previousElementSibling;if(n?.tagName!=="INPUT")return;let l=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value")?.set;if(!l)return;l.call(n,"");let P=new Event("input",{bubbles:!0});n.dispatchEvent(P),n.focus();};return jsxs("label",{className:cx(t.root,E),children:[I,jsx("div",{className:cx(gridBackground(),t.inputWrapper),"data-error":p,children:jsxs("div",{className:t.inputContainer,"data-error":p,children:[i&&jsx("div",{className:cx(t.addon,t.leftAddon),children:i}),jsx(v,{ref:g,className:cx(t.input,N),rows:1,"data-error":p,...y}),(u||o)&&jsx("div",{className:t.addon,"data-clear-button":o,children:o?jsx("button",{type:"button",onClick:w,className:t.clearButton,children:jsx(CloseIcon,{height:20,width:20})}):u})]})}),s]})});d.displayName="Input";

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