<script setup lang="ts" generic="T extends object">
withDefaults(
  defineProps<{
    items: T[];
    itemKey: (item: T) => string;
    label?: string;
    emptyText?: string;
  }>(),
  { label: "审计时间线", emptyText: "暂无审计记录。" },
);
</script>

<template>
  <ol v-if="items.length" class="audit-timeline" :aria-label="label">
    <li v-for="item in items" :key="itemKey(item)">
      <slot name="item" :item="item" />
    </li>
  </ol>
  <p v-else class="muted-box">{{ emptyText }}</p>
</template>
