import{h}from"./index-38ad4957.js";import{i as intl}from"./global-96c14d63.js";import{j as jss,a as create}from"./JSS-67b5cff8.js";import{E as ErrorStyles}from"./mixins-f750863a.js";var style={ErrorStyle:ErrorStyles,FieldContainer:{"margin-bottom":"var(--sl-spacing-medium)"}};var vanillaStyle="\n:host {\n  margin: 0 auto;\n  width: 100%;\n  display: block;\n}\n";jss.setup(create());var sheet=jss.createStyleSheet(style);var styleString=sheet.toString();function LeadInputFieldView(e){var a,l,i,r,t,s;var o=e.states,d=e.content;var n=function(e){var a=e.fieldLabel;return intl.formatMessage({id:"requiredFieldErrorMessage-"+a,defaultMessage:d.requiredFieldErrorMessage},{fieldLabel:a})};return h("div",{class:sheet.classes.FieldContainer,part:"sqm-base"},h("style",{type:"text/css"},vanillaStyle,styleString),h("sl-input",Object.assign({exportparts:"label: input-label, base: input-base",name:"/"+d.fieldName,type:d.fieldType,label:""+d.fieldLabel+(d.fieldOptional?" "+d.optionalLabel:"")},!d.fieldOptional?{required:true}:[],{disabled:((a=o.leadFormState)===null||a===void 0?void 0:a.loading)||((l=o.leadFormState)===null||l===void 0?void 0:l.disabled),validationError:function(e){var a=e.value;if(!a&&!d.fieldOptional){return n({fieldLabel:d.fieldLabel})}}},((r=(i=o.leadFormState)===null||i===void 0?void 0:i.validationErrors)===null||r===void 0?void 0:r[d.fieldName])?{class:sheet.classes.ErrorStyle,helpText:((s=(t=o.leadFormState)===null||t===void 0?void 0:t.validationErrors)===null||s===void 0?void 0:s[d.fieldName])||d.requiredFieldErrorMessage}:[])))}export{LeadInputFieldView as L};