<script>
    import { createEventDispatcher } from 'svelte';
    import { open } from '@tauri-apps/api/dialog';
    import Setting from './Setting.svelte';

    export let title;
    export let value;

    const dispatch = createEventDispatcher();
</script>


<Setting {title}>
    <div slot="input">
        <input
            type="text"
            class="input input-sm input-bordered grow text-right"
            bind:value
            on:change={() => dispatch('update', {value})}
        >
        <button 
            class="btn btn-sm btn-primary"
            on:click={async () => value = await open()}
        >Browse</button>
    </div>
    <slot name="description" slot="description"></slot>
</Setting>
