'use client';
import{jsx as e}from"react/jsx-runtime";import{useUniqProductID as r,composeClasses as t,makeStyle as m}from"@gem-sdk/core";import{createClass as o,createStyle as s}from"@gem-sdk/system";import{useMemo as a}from"react";import{getElementContent as n}from"./common/helpers.js";import{getClasses as d}from"./common/classes.js";import{getStyles as i}from"./common/styles.js";let c=({setting:c,styles:l})=>{let p=r(),{name:u,type:f,placeholder:h,required:g,handleChange:y,label:x,validationData:j}=c??{},$=a(()=>{switch(f){case"textarea":case"hidden":return"textarea";default:return"input"}},[f]),k=a(()=>"hidden"===f,[f]),L=`${h}${h&&g&&!x?" *":""}`,P=o({...d(l),...t("hidden"===f?"gp-cursor-default":"")}),b=s({...i(l),...j?.isValid||"hidden"===f?{}:m({bc:"#F44336"})}),{elementType:q,elementValue:v,minLength:w,maxLength:C}=n(c);return e($,{id:`${p}-${u}`,type:q,value:v,placeholder:L,name:u,readOnly:k,className:P,style:b,required:g,minLength:w,maxLength:C,onChange:y})};export{c as default};
