Files
heroui-vue/apps/docs/demos/alert-dialog-sizes.vue
T
maoyingjie 53e76f676d fix(demos): restore form, overlay and toast demos to the pinned cn baseline
HD-02 scope, all against heroui ce90ea3 cn sources:

- card: add the text-primary class to the coin icons (source parity);
  card-with-form drops the added required validation and inline business
  note, restores the plain href="#" forgot-password link and the baseline
  alert("表单提交成功!") submit feedback (autocomplete kept: no visible
  impact, allowed by the task card)
- input-group-with-textarea: restore the four Tooltips and the Enter Kbd
  hint; drop the stale "Tooltip 组件尚未迁移" note from input-group.md
- alert-dialog: restore the h-px top light line in custom-styles and the
  truncated/missing description text in sizes/custom-portal/
  custom-animations (+ controlled); align the fluid-slide icon with the
  modal mapping (IconArrowBarUp for gravity-ui:arrow-up-from-line)
- toast: restore the upstream demo layout shells (variants/simple/
  custom-indicator/custom-queue) and the action button default variant:
  ToastActionButton now falls back to the Button defaults (primary/md)
  like upstream ToastActionButton, so variants' actions render primary,
  danger stays danger and default stays tertiary; toast.md defaults fixed
- submit demos: restore baseline feedback and structure — alert() for
  card/fieldset/form/checkbox/checkbox-group/switch/select/combo-box/
  autocomplete and console.log for search/number/time field form examples;
  modal-with-form returns to the close-only footer (no submit/result row);
  drop the added inline status/result rows and the max-w-full/
  max-sm:min-w-0 width guards from the restored demos
- radio-group-validation: add the missing text-muted to the result line;
  label.md invalid example gives the real control its invalid state and
  matches the baseline input shape

Tests re-pinned to the baseline contracts (alert/console/close behavior,
four tooltips + Kbd, positional modal footer); full suite 110 files /
1617 tests, typecheck, build:docs and the m35-m36 tarball contract pass.
2026-10-28 14:10:10 +08:00

71 lines
2.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { IconRocket } from "@tabler/icons-vue";
import {
AlertDialog,
AlertDialogBackdrop,
AlertDialogBody,
AlertDialogClose,
AlertDialogCloseTrigger,
AlertDialogContainer,
AlertDialogDialog,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogHeading,
AlertDialogIcon,
Button,
} from "@heroui-vue/components";
const SIZE_LABELS = {
cover: "通栏",
lg: "大",
md: "中",
sm: "小",
xs: "超小",
} as const;
const sizes = ["xs", "sm", "md", "lg", "cover"] as const;
</script>
<template>
<div class="flex flex-wrap gap-4">
<AlertDialog v-for="size in sizes" :key="size">
<Button variant="secondary">{{ SIZE_LABELS[size] }}</Button>
<AlertDialogBackdrop>
<AlertDialogContainer :size="size">
<AlertDialogDialog>
<AlertDialogCloseTrigger />
<AlertDialogHeader>
<AlertDialogIcon class="bg-default text-foreground">
<IconRocket aria-hidden="true" class="size-5" />
</AlertDialogIcon>
<AlertDialogHeading>
尺寸:{{ SIZE_LABELS[size] }}
</AlertDialogHeading>
</AlertDialogHeader>
<AlertDialogBody>
<p v-if="size === 'cover'">
此警告框使用
<code>cover</code>
尺寸:在移动端与桌面端保留边距(移动端约 16px、桌面端约
40px)铺满可视区域,仍保持圆角与标准内边距,适合需要最大宽度又保留对话框气质的关键确认。
</p>
<p v-else>
此警告框使用
<code>{{ size }}</code>
尺寸。在移动端各尺寸都会接近全宽以便阅读;在桌面端则对应不同的最大宽度,以适配不同信息量。
</p>
</AlertDialogBody>
<AlertDialogFooter>
<AlertDialogClose as-child>
<Button variant="tertiary">取消</Button>
</AlertDialogClose>
<AlertDialogClose as-child>
<Button>确认</Button>
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogDialog>
</AlertDialogContainer>
</AlertDialogBackdrop>
</AlertDialog>
</div>
</template>