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