<script>
    import { storeMdjs } from "@/stores/mdjs.store";
    import { XmlConverter } from "@/libs/xml-converter/xml-converter";

    import InputField from "./elements/InputField.svelte";

    export let field;

    $: isReady = $storeMdjs;

    $: value = $storeMdjs ? converter.getValue($storeMdjs, field.name, "md")[0] : "";

    const converter = new XmlConverter();
</script>

{#if isReady}
    <InputField
        type={field.type}
        label={field.label}
        {value}
        help={field.help}
        error={field.error}
        field={field.name}
        strong={true}
    />
{/if}

<style>
</style>
