import{template as e}from"@gem-sdk/core";import{getDynamicSourceLocales as t}from"../../../helpers.js";import{createStyle as s,createClass as r,If as a}from"@gem-sdk/system";import{composeContainerStyles as o,composeTextareaStyles as l,getRowsTextArea as d}from"./common/styles.js";import{composeContainerClasses as i,composeTextFieldClasses as m}from"./common/classes.js";let TextInput=({setting:$,builderProps:p,className:c,builderAttrs:u,advanced:n,pageContext:x,styles:v})=>{let{text:f,name:y,placeholder:h,required:g,translate:j,formType:I}=$??{},T=y?.[I??"text"]===""||void 0===y?"contact[first_name]":y?.[I??"text"],k=t({val:h,uid:p?.uid,settingId:"placeholder",pageContext:x,translate:j}),q=s(o(n,$)),w=r(i(n,p)),C=r(m($,p,c??"")),F=s(l(n,$,v)),_=r({composedTextFieldClasses:!0}),b=d($),z="textarea"===I;return e`
    <div
      ${u}
      data-id="${p?.uid}"
      class="${w}"
      style="${q}"
    >
      <div>
        ${a(!z,e`<input
            type="text"
            class="${C}"
            style="${F}"
            placeholder="${k}"
            ${a(g,"required")}
            name="${T}"
            value="${f}"
          ></input>`,e`<textarea
            rows="${b}"
            class="${_}"
            style="${F}"
            placeholder="${k}"
            ${a(g,"required")}
            name="${T}"
            value="${f}"
          ></textarea>`)}
      </div>
    </div>
  `};export{TextInput as default};
