import{objectSpread2 as e,taggedTemplateLiteral as t,slicedToArray as o}from"../../_virtual/_rollupPluginBabelHelpers.esm.js";import{useState as r}from"react";import n from"styled-components";import m from"../../_virtual/index.esm.js";import a from"@mui/material/Tooltip";import s from"./TextInput.esm.js";import{AutocompleteComponent as p}from"./AutocompleteComponent.esm.js";import i from"./SearchInputComponent.esm.js";import l from"./CheckboxInputComponent.esm.js";import c from"./CodeInputComponent.esm.js";import u from"./DateInputComponent.esm.js";import{TextareaInputComponent as f}from"./TextareaInputComponent.esm.js";import d from"./SelectInputComponent.esm.js";import h from"./PasswordInputComponent.esm.js";import g from"./NumberInputComponent.esm.js";import C from"./EmailInputComponent.esm.js";import x from"./TimeInputComponent.esm.js";import j from"./FileInputComponent.esm.js";import{jsx as b,jsxs as I,Fragment as v}from"react/jsx-runtime";var T;function y(t){var n=r(""),m=o(n,2),T=m[0],y=m[1],P=function(e){var o=e.target.value,r=t.inputRegex;r?r.test(o)?(t.onChange({target:{name:t.name,value:o}}),y("")):(console.error("Invalid input. Please follow the correct format. ".concat(r)),y("Invalid input. Please follow the correct format."),setTimeout(function(){y("")},3e3)):t.onChange({target:{name:t.name,value:o}})};return b(w,{children:b(a,{title:t.description,children:I(a,{componentsProps:{tooltip:{sx:{backgroundColor:"rgba(255, 0, 0, 0.51)"}}},title:T,open:T.length>0,children:[b(v,{}),function(){switch(t.type){case"text":return b(s,e(e({},t),{},{onChange:P}));case"password":return b(h,e({},t));case"textarea":return b(f,e({},t));case"select":return b(d,e({},t));case"date":case"datetime-local":return b(u,e({},t));case"number":return b(g,e(e({},t),{},{onChange:P}));case"email":return b(C,e({},t));case"checkbox":return b(l,e({},t));case"time":return b(x,e({},t));case"autocomplete":return b(p,e({},t));case"file":return b(j,e({},t));case"code":return b(c,e({},t));case"search":return b(i,e({},t));default:return I(v,{children:["Input Type: ",t.type,", Not Found"]})}}()]})})})}y.propTypes=e(e(e({type:m.oneOf(["text","password","textarea","select","date","datetime-local","number","email","checkbox","time","autocomplete","file","code","search"]),required:m.bool,label:m.string,placeholder:m.string,value:m.string,name:m.string,description:m.string,variant:m.string,shrink:m.bool,onFocus:m.func,onChange:m.func,fullWidth:m.bool,maxRows:m.number},f.PropsTypes),j.PropTypes),c.PropTypes);var w=n.div(T||(T=t(["\n  display: flex;\n  flex-direction: column;\n  width: 100%;\n  gap: 5px;\n"])));export{y as Input,y as default};
//# sourceMappingURL=Input.esm.js.map
