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