'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),React=require("react"),helpers=require("./common/helpers.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js");const ProductPropertyInput=({setting:e,styles:s})=>{let t=core.useUniqProductID(),{name:r,type:a,placeholder:c,required:u,handleChange:l,label:n,validationData:o}=e??{},i=React.useMemo(()=>{switch(a){case"textarea":case"hidden":return"textarea";default:return"input"}},[a]),m=React.useMemo(()=>"hidden"===a,[a]),d=`${c}${c&&u&&!n?" *":""}`,y=system.createClass({...classes.getClasses(s),...core.composeClasses("hidden"===a?"gp-cursor-default":"")}),p=system.createStyle({...styles.getStyles(s),...o?.isValid||"hidden"===a?{}:core.makeStyle({bc:"#F44336"})}),{elementType:h,elementValue:g,minLength:q,maxLength:x}=helpers.getElementContent(e);return jsxRuntime.jsx(i,{id:`${t}-${r}`,type:h,value:g,placeholder:d,name:r,readOnly:m,className:y,style:p,required:u,minLength:q,maxLength:x,onChange:l})};exports.default=ProductPropertyInput;
