<script>
    import { getErrorMessage } from "./errorMessage";
    export let field;
    export let value;
    export let isCreateMode;
    export let validationErrors;
    let thisEl;
    $: errorMessage = getErrorMessage(validationErrors, field.name);
    export let id;

</script>

<div class="mb-0">
    <input
            type="text"
            {id}
            class="form-control"
            class:is-invalid={errorMessage}
            bind:value
            autocomplete="off"
            readonly={field.readonly && !isCreateMode}
    />

    {#if errorMessage}
        <div class="invalid-feedback d-block">
            {errorMessage}
        </div>
    {/if}
</div>

