'use strict';

var chunk5XB54L7P_cjs = require('./chunk-5XB54L7P.cjs');
var css = require('@onbeam/styled-system/css');
var recipes = require('@onbeam/styled-system/recipes');
var icons = require('@onbeam/icons');
var jsxRuntime = require('react/jsx-runtime');

var d=chunk5XB54L7P_cjs.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=recipes.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 jsxRuntime.jsxs("label",{className:css.cx(t.root,E),children:[I,jsxRuntime.jsx("div",{className:css.cx(recipes.gridBackground(),t.inputWrapper),"data-error":p,children:jsxRuntime.jsxs("div",{className:t.inputContainer,"data-error":p,children:[i&&jsxRuntime.jsx("div",{className:css.cx(t.addon,t.leftAddon),children:i}),jsxRuntime.jsx(v,{ref:g,className:css.cx(t.input,N),rows:1,"data-error":p,...y}),(u||o)&&jsxRuntime.jsx("div",{className:t.addon,"data-clear-button":o,children:o?jsxRuntime.jsx("button",{type:"button",onClick:w,className:t.clearButton,children:jsxRuntime.jsx(icons.CloseIcon,{height:20,width:20})}):u})]})}),s]})});d.displayName="Input";

exports.a = d;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-J5PH5EHB.cjs.map