<script lang="ts">
  import projectGroupStore from "../stores/projectGroup";

  export let value = "";
  export let name = "";
  export let disabled = false;
  export let optional = false;
</script>

<select name={name} bind:value={value} disabled={disabled || $projectGroupStore.loading}>
  {#if optional}
    <option value={""} selected={"" === value}>None</option>
  {/if}
  {#each $projectGroupStore.groups as group (group.id)}
    {#if group.id !== "META_UNGROUPED"}
      <option value={group.id} selected={group.id === value}>{group.name}</option>
    {/if}
  {/each}
</select>