Compare commits

...

16 Commits

Author SHA1 Message Date
maoyingjie a9bfc71c8a docs: record Root aliases main integration 2026-10-27 19:56:20 +08:00
maoyingjie 08c9bf5767 merge: integrate verified Root aliases and ProgressBar demo 2026-10-27 19:56:07 +08:00
maoyingjie bdbb2cb7dc docs: accept API aliases and progress demo review fixes 2026-10-27 19:56:07 +08:00
maoyingjie 5937577101 test: reproduce NumberField typing regression within one task 2026-10-27 19:55:43 +08:00
maoyingjie 9720ba1d03 docs: record API root aliases and progress-bar demo results 2026-10-27 19:50:38 +08:00
maoyingjie 8f51b0e097 feat: align public Root aliases and rework progress-bar custom-value demo
- 包根补齐固定上游 82 对 Xxx/XxxRoot 同对象别名(55 个缺失 Root 别名 + Dropdown 反向别名)与 59 个 RootProps/Menu/Dropdown 类型别名;不杜撰上游没有的名称(如 CheckboxGroupRoot、ToastRootProps)
- tests/package 新增 api-root-aliases 契约:完整别名清单、82 对身份等价断言与 strict NodeNext/bundler 类型正反例
- progress-bar custom-value 演示回填公共 NumberField/Select,保持固定源文案/布局/范围/四格式与边界处理
- 修复 NumberFieldInput keydown 无条件 restore 还原同任务键入字符的缺陷,并入 number-field 回归
- 文档导航 dropdown 归位固定 meta.json 顺序并补顺序断言;修正“原生临时控件”陈述
2026-10-27 19:48:35 +08:00
maoyingjie e0dd052cc3 docs: record Form main integration verification 2026-10-27 18:29:25 +08:00
maoyingjie 0847db9ae0 merge: integrate verified public Form migration 2026-10-27 18:28:58 +08:00
maoyingjie f53ce0a520 docs: record Form client migration acceptance 2026-10-27 18:28:58 +08:00
maoyingjie 2c221e0995 feat: complete public Form migration and validation focus contract 2026-10-27 18:28:13 +08:00
maoyingjie f424fa5597 docs: plan public Form migration completion 2026-10-27 18:16:46 +08:00
maoyingjie ee43cc615d docs: record Avatar main integration verification 2026-10-27 18:06:38 +08:00
maoyingjie 8f3880073d merge: integrate verified Avatar migration completion 2026-10-27 18:06:02 +08:00
maoyingjie 4f2061a809 docs: record Avatar migration acceptance evidence 2026-10-27 18:06:02 +08:00
maoyingjie fa8b22719e fix: complete Avatar image composition and fallback migration 2026-10-27 18:05:26 +08:00
maoyingjie 6de246de49 docs: plan Avatar migration completion 2026-10-27 17:59:15 +08:00
43 changed files with 3236 additions and 112 deletions
+1
View File
@@ -381,6 +381,7 @@ async function copyMarkdownCode(event: MouseEvent) {
<IconArrowUpRight :size="12" aria-hidden="true" />
</Link>
<Link
v-if="frontmatter.stylesSource !== false"
:href="`https://github.com/heroui-inc/heroui/blob/ce90ea3ab49d58f6c428f71bfd6fe8ae2a87b960/packages/styles/components/${componentSlug}.css`"
target="_blank"
rel="noreferrer noopener"
+10 -5
View File
@@ -160,6 +160,11 @@ export const componentItems: DocsItem[] = [
url: "/components/drawer",
category: "overlays",
},
{
title: "Dropdown 下拉菜单",
url: "/components/dropdown",
category: "collections",
},
{
title: "EmptyState 空状态",
url: "/components/empty-state",
@@ -180,6 +185,11 @@ export const componentItems: DocsItem[] = [
url: "/components/fieldset",
category: "forms",
},
{
title: "Form 表单",
url: "/components/form",
category: "forms",
},
{
title: "Header 标题",
url: "/components/header",
@@ -215,11 +225,6 @@ export const componentItems: DocsItem[] = [
url: "/components/link",
category: "navigation",
},
{
title: "Dropdown 下拉菜单",
url: "/components/dropdown",
category: "collections",
},
{
title: "ListBox 列表框",
url: "/components/list-box",
+7 -3
View File
@@ -110,7 +110,7 @@ Avatar 组件使用以下 CSS 类:
## API 参考
### Avatar
### Avatar / AvatarRoot
| Prop | 类型 | 默认值 | 描述 |
| --------- | ------------------------------------------------------------- | ----------- | ----------------- |
@@ -123,7 +123,7 @@ Avatar 组件使用以下 CSS 类:
| Prop | 类型 | 默认值 | 描述 |
| ------------- | ---------------------------------- | ------- | ------------------------------------------ |
| `src` | `string` | - | 图片 URL |
| `src` | `string` | - | 可选图片 URL,省略时显示回退 |
| `srcSet` | `string` | - | 响应式图片的 `srcset` 属性 |
| `sizes` | `string` | - | 响应式图片的 `sizes` 属性 |
| `alt` | `string` | - | 图片替代文本 |
@@ -138,10 +138,14 @@ Avatar 组件使用以下 CSS 类:
| Prop | 类型 | 默认值 | 描述 |
| --------- | ------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------- |
| `delayMs` | `number` | - | 显示 fallback 前的延迟(防止闪烁)。`0` 与未指定不同:底座在 `delayMs=0` 时不会显示 fallback,需要延迟时请传正数 |
| `delayMs` | `number` | - | 显示 fallback 前的延迟(毫秒);省略或 `0` 时立即显示,正数延迟可动态更新 |
| `color` | `'default' \| 'accent' \| 'success' \| 'warning' \| 'danger'` | - | 覆盖父级颜色(替换而非叠加) |
| `class` | `string` | - | 附加 CSS 类 |
三个部件均支持 `as`(根/回退默认 `span`,图片默认 `img`)与 `asChild`(默认 `false`)。`asChild` 需要单个可接收属性的元素或组件;自定义组件应将 attrs 和事件透传到实际 DOM。Image 的默认插槽用于提供自定义图片,Root / Fallback 的默认插槽分别提供部件与回退内容。`referrerPolicy` 接受原生图片策略并透传。
`AvatarRoot` 是 `Avatar` 的同一组件别名。React ref 改用 Vue 模板 ref 的 `$el` 获取根 DOM;不提供框架专属合成事件。图片加载由底座预加载 `src` 来决定显示状态,`srcSet` / `sizes` 传给实际图片,预加载探测不按响应式候选选择图片;加载中的实际 img 保留在 DOM 并以 `display:none` 隐藏,这是与上游 Radix 按加载状态挂载图片的差异。未提供 `src` 时仅有 `srcSet` 不会令图片显示。
Avatar 使用 Reka UI 的 `AvatarRoot` / `AvatarImage` / `AvatarFallback` 处理加载与回退状态。`onLoad` / `onError` 对应 Vue 原生 `@load` / `@error` 事件,不声明与 React 合成事件完全等价。
## 相关组件
+185
View File
@@ -0,0 +1,185 @@
---
title: Form 表单
description: 用于表单校验与提交处理的包裹组件
component: form
stylesSource: false
group: 组件
---
## 用法
```vue
<script setup lang="ts">
import { Form } from "@heroui-vue/components";
</script>
```
<ComponentPreview name="form-basic" />
## 组件结构
```vue
<script setup lang="ts">
import { Form, Button } from "@heroui-vue/components";
</script>
<template>
<Form>
<!-- 表单字段 -->
<Button type="submit">提交</Button>
<Button type="reset">重置</Button>
</Form>
</template>
```
## 示例
### 渲染函数
上游 `render={(props) => <form {...props} data-custom="foo" />}` 在 Vue 中直接通过 `data-custom="foo"` 透传到同一个原生 `<form>`;无需为添加属性替换根元素。Form 始终保留表单语义,不提供 React `render` prop 或替换为非表单元素的 API。
<ComponentPreview name="form-render-function" />
## 自定义样式
### Tailwind CSS
<ComponentPreview name="form-custom-styles" />
### 全局 CSS
要自定义表单布局与间距,可在 `<Form>` 上使用 `class`,或通过 `@layer components` 添加项目级类。
`Form` 渲染原生 `<form>` 元素,聚焦校验与提交。本库样式包中无专用 BEM 类;从全局 CSS 应用容器样式,控件级自定义请使用字段组件。
```css
@layer components {
.form-layout {
@apply flex flex-col gap-4 rounded-xl border border-border bg-surface p-4 shadow-sm;
}
}
```
```vue
<Form class="form-layout" @submit.prevent="handleSubmit">
<!-- TextField、Input、Button 等 -->
</Form>
```
分组字段与共享布局请使用 [Fieldset](./fieldset),并定位 `.hv-fieldset`、`.hv-fieldset__legend` 等相关类。单个控件请参阅 [TextField](./text-field)、[Input](./input)、[Label](./label)、[FieldError](./field-error) 的全局 CSS 部分。
## 样式参考
本库对提供样式的组件遵循 BEM 方法论。
`Form` 渲染原生 `<form>` 元素,无专用 BEM 类或 variants。通过 `class` 应用布局、间距与表面样式。字段外观与校验状态来自 `TextField`、`Input`、`Label`、`Description`、`FieldError` 等子组件。结构化多字段布局请与 Fieldset 组合使用。
## API 参考
### Form / FormRoot
Form 复用本库共享字段上下文与浏览器 Constraint Validation API。`FormRoot` 是同一组件别名;原生属性、ARIA、class、style 与 DOM 监听器透传到实际 form。
| Prop / 事件 | 类型 | 默认值 | 描述 |
| --- | --- | --- | --- |
| `action` | `string` | - | 提交表单数据的 URL;保留浏览器传统提交 |
| `class` | Vue class 绑定 | - | 应用于 form 元素的布局与样式 |
| 默认插槽 | `() => VNodeChild` | - | 表单内容(字段、按钮等) |
| `enctype` | `string` | - | 原生编码类型,如 `multipart/form-data` |
| `method` | `string` | - | 原生提交方法,如 `get` / `post` |
| `@invalid` | `(event: Event) => void` | - | 每个无效控件每次检查通知一次;`preventDefault()` 取消默认焦点,不放行无效提交 |
| `@reset` | `(event: Event) => void` | - | 原生重置事件;可 `preventDefault()` 取消 |
| `@submit` | `(event: SubmitEvent) => void` | - | 校验通过或显式跳过校验时调用;使用 `.prevent` 接管提交 |
| `target` | `string` | - | 提交后显示响应的位置 |
| `validationBehavior` | `'native' \| 'aria'` | `'native'` | 默认字段校验策略;字段可覆盖 |
| `validationErrors` | `Record<string, string \| string[]>` | `{}` | 按字段名映射的服务端错误;编辑该字段后忽略当前响应中的错误 |
| `aria-label` | `string` | - | 表单的无障碍名称 |
| `aria-labelledby` | `string` | - | 标注表单的元素 ID |
| `novalidate` / `noValidate` | `boolean` | `false`(调用方意图) | 为 `true` 或空属性时跳过本库提交检查;实际 DOM 始终有 novalidate,见下文 |
| `render`(上游) | Vue attrs / 默认插槽替代 | - | 添加原生属性直接透传;不移植 React DOMRenderFunction |
公开类型包含 `FormProps`、`FormRootProps`、`FormSlots`、`FormExpose`。实例能力是 Vue 扩展:
| 实例成员 | 类型 | 说明 |
| --- | --- | --- |
| `element` | `HTMLFormElement \| undefined` | 挂载后实际 form |
| `checkValidity()` | `() => boolean` | 按 native/aria 策略检查并产生 invalid;不自动聚焦 |
| `reportValidity()` | `() => boolean` | 检查并聚焦首个无效字段,除非调用方取消;错误由 FieldError 展示,不重复调用原生气泡校验 |
| `reset()` | `() => void` | 调用原生 form.reset(),遵守取消与既有受控值协议 |
### Form Validation
Form 支持:
- 内置 HTML5 校验属性(`required`、`minLength`、`pattern` 等)。
- TextField 的同步 `validate(value)` 校验函数。
- FieldError 展示字段错误。
- 校验通过后处理提交。
- `validationErrors` 提供服务端校验结果。
#### Validation Behavior
`validationBehavior` 控制校验展示方式:
- **`native`**(默认):有错误时阻止提交,提交尝试后显示错误并聚焦首个无效字段。
- **`aria`**:实时显示错误语义,允许提交,由调用方处理。
可在表单级或单个字段级设置。Form 在实际 DOM 上使用 `novalidate` 接管验证,再按每个控件的 `data-validation-behavior` 或表单默认值检查,因此允许混合两种策略。调用方显式 `novalidate`、提交按钮的 `formnovalidate` 可跳过提交检查。即使监听 `@submit.capture`,无效提交也先由 Form 拦截。
`validationErrors` 使用新的响应对象更新。编辑一个字段只忽略当前响应里该字段的错误,不修改传入对象。同步 `validate` 不接受 Promise;异步请求和竞态由调用方管理。原生外部 `form` 关联的控件也在验证集合中;字段的服务端错误上下文仍按 Vue 组件祖先继承,DOM form 关联不会跨组件树注入上下文。
### Form Submission
表单支持传统 `action` 提交、JavaScript 事件处理及 FormData API:
```vue
<script setup lang="ts">
function handleSubmit(event: SubmitEvent) {
const formData = new FormData(event.currentTarget as HTMLFormElement);
const data = Object.fromEntries(formData);
console.log("Form data:", data);
}
</script>
<template>
<Form @submit.prevent="handleSubmit">
<!-- 表单字段 -->
</Form>
</template>
```
默认插槽不维护第二份表单值。禁用控件不进入 FormData,只读控件保留。reset 恢复非受控初始值,受控值仍由父级决定;取消 reset 会保留当前值。`element.submit()` 遵循浏览器行为并绕过校验与 submit 事件,常规提交应使用按钮或 `element.requestSubmit()`。
### Integration with Form Fields
Form 与共享字段组件协作:
- **TextField**:带标签与校验的文本输入。
- **Checkbox / CheckboxGroup**:布尔选择及多选集合。
- **RadioGroup**:多选一。
- **Switch**:开关控件。
- **Button**:提交与重置。
值、错误关联与重置使用各字段现有协议;复杂日期、颜色、数值和集合字段的具体差异仍以各自组件页为准。
### Advanced Usage
可组合第三方校验库,将结果映射到 `validationErrors`;无需为使用 Input 强制引入其他库。自定义错误焦点使用 `@invalid` 并调用 `event.preventDefault()`。共享上下文和集成验证示例见[字段与表单基础](/fields)。不提供 React Form Context、React 函数 action 或完整 React Aria ValidationResult。
## 无障碍
- 原生 `<form>` 语义。
- 使用 `aria-label` 或 `aria-labelledby` 提供 form landmark 名称。
- 无效提交默认聚焦首个无效字段;组合字段聚焦其可操作部件。
- 错误通过 FieldError 与真实控件的 ARIA 描述关联。
- `validationBehavior="aria"` 保留错误语义但不阻止提交。
三个预览沿用固定源的字段、文案、校验与布局;为适应窄屏增加 `max-w-full`,提交结果用页内 `status` 替代上游 `alert`,reset 同时清除该反馈。React 专属机制按上述 Vue 方式适配。当前仅支持浏览器客户端;未将完整读屏矩阵或逐像素比较视为已完成。
## 相关案例
[字段与表单基础](/fields)提供服务端错误注入、原生 FormData 和重置的额外组合示例。
## 相关组件
[TextField](./text-field) · [Fieldset](./fieldset) · [FieldError](./field-error) · [Button](./button)
+1 -1
View File
@@ -85,7 +85,7 @@ import {
<ComponentPreview name="progress-bar-custom-value" />
> 基线差异:上游示例使用 `NumberField` 与 `Select` 调节数值与格式;这两个组件尚未迁移。本示例以原生 `input[type=number]` / `select` 搭配 `hv-input` 样式临时替代,交互与布局对齐基线,控件本身不是本库已发布的 NumberField/Select。
> 控件说明:该示例与上游一致,使用本库公共 `NumberField` 与 `Select` 调节数值与格式。清空或无效输入草稿被拒绝并恢复上一个接受值;越界输入收敛到当前最小/最大值范围内,不会产生 NaN 或进度显示失配。
## 自定义样式
+74
View File
@@ -0,0 +1,74 @@
<script setup lang="ts">
import { ref } from "vue";
import { IconCheck } from "@tabler/icons-vue";
import {
Button,
Description,
FieldError,
Form,
Input,
Label,
TextField,
} from "@heroui-vue/components";
const result = ref("");
function onSubmit(event: Event) {
event.preventDefault();
const formData = new FormData(event.currentTarget as HTMLFormElement);
const data: Record<string, string> = {};
formData.forEach((value, key) => {
data[key] = value.toString();
});
result.value = `表单提交数据:${JSON.stringify(data, null, 2)}`;
}
function validateEmail(value: string) {
return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(value)
? null
: "请输入有效的邮箱地址";
}
function validatePassword(value: string) {
if (value.length < 8) return "密码至少需要 8 个字符";
if (!/[A-Z]/.test(value)) return "密码至少需要包含一个大写字母";
if (!/[0-9]/.test(value)) return "密码至少需要包含一个数字";
return null;
}
</script>
<template>
<Form
class="flex w-96 max-w-full flex-col gap-4"
@submit="onSubmit"
@reset="result = ''"
>
<TextField is-required name="email" type="email" :validate="validateEmail">
<Label>邮箱</Label>
<Input placeholder="john@example.com" />
<FieldError />
</TextField>
<TextField
is-required
:min-length="8"
name="password"
type="password"
:validate="validatePassword"
>
<Label>密码</Label>
<Input placeholder="输入密码" />
<Description>至少 8 个字符,且包含 1 个大写字母和 1 个数字</Description>
<FieldError />
</TextField>
<div class="flex gap-2">
<Button type="submit">
<IconCheck aria-hidden="true" class="size-4 shrink-0" />
提交
</Button>
<Button type="reset" variant="secondary">重置</Button>
</div>
<pre
v-if="result"
role="status"
aria-label="提交结果"
class="whitespace-pre-wrap break-all text-xs"
>{{ result }}</pre>
</Form>
</template>
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
import { Button, Form, Input, Label, TextField } from "@heroui-vue/components";
</script>
<template>
<Form
class="flex w-80 max-w-full flex-col gap-3 rounded-xl border border-border/80 bg-surface p-4 shadow-sm"
@submit.prevent
>
<TextField is-required name="email" type="email">
<Label>工作邮箱</Label>
<Input class="bg-field" placeholder="you@company.com" />
</TextField>
<Button class="w-full" type="submit">继续</Button>
</Form>
</template>
+75
View File
@@ -0,0 +1,75 @@
<script setup lang="ts">
import { ref } from "vue";
import { IconCheck } from "@tabler/icons-vue";
import {
Button,
Description,
FieldError,
Form,
Input,
Label,
TextField,
} from "@heroui-vue/components";
const result = ref("");
function onSubmit(event: Event) {
event.preventDefault();
const formData = new FormData(event.currentTarget as HTMLFormElement);
const data: Record<string, string> = {};
formData.forEach((value, key) => {
data[key] = value.toString();
});
result.value = `表单提交数据:${JSON.stringify(data, null, 2)}`;
}
function validateEmail(value: string) {
return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(value)
? null
: "请输入有效的邮箱地址";
}
function validatePassword(value: string) {
if (value.length < 8) return "密码至少需要 8 个字符";
if (!/[A-Z]/.test(value)) return "密码至少需要包含一个大写字母";
if (!/[0-9]/.test(value)) return "密码至少需要包含一个数字";
return null;
}
</script>
<template>
<Form
class="flex w-96 max-w-full flex-col gap-4"
data-custom="foo"
@submit="onSubmit"
@reset="result = ''"
>
<TextField is-required name="email" type="email" :validate="validateEmail">
<Label>邮箱</Label>
<Input placeholder="john@example.com" />
<FieldError />
</TextField>
<TextField
is-required
:min-length="8"
name="password"
type="password"
:validate="validatePassword"
>
<Label>密码</Label>
<Input placeholder="输入密码" />
<Description>至少 8 个字符,且包含 1 个大写字母和 1 个数字</Description>
<FieldError />
</TextField>
<div class="flex gap-2">
<Button type="submit">
<IconCheck aria-hidden="true" class="size-4 shrink-0" />
提交
</Button>
<Button type="reset" variant="secondary">重置</Button>
</div>
<pre
v-if="result"
role="status"
aria-label="提交结果"
class="whitespace-pre-wrap break-all text-xs"
>{{ result }}</pre>
</Form>
</template>
+92 -52
View File
@@ -2,10 +2,23 @@
import { computed, ref } from "vue";
import {
Label,
ListBox,
ListBoxItem,
ListBoxItemIndicator,
NumberField,
NumberFieldDecrementButton,
NumberFieldGroup,
NumberFieldIncrementButton,
NumberFieldInput,
ProgressBar,
ProgressBarFill,
ProgressBarOutput,
ProgressBarTrack,
Select,
SelectIndicator,
SelectPopover,
SelectTrigger,
SelectValue,
Separator,
} from "@heroui-vue/components";
@@ -30,22 +43,27 @@ const formatOptionsMap: Record<string, Intl.NumberFormatOptions> = {
const formatOptions = computed(() => formatOptionsMap[format.value]);
function onValueChange(event: Event) {
const next = Number((event.target as HTMLInputElement).value);
function onValueChange(next: number | null) {
// 清空或无效草稿不接受,受控字段恢复上一个接受值。
if (next == null || !Number.isFinite(next)) return;
value.value = Math.min(Math.max(next, minValue.value), maxValue.value);
}
function onMinChange(event: Event) {
const next = Number((event.target as HTMLInputElement).value);
function onMinChange(next: number | null) {
if (next == null || !Number.isFinite(next)) return;
minValue.value = Math.min(next, maxValue.value - 1);
if (value.value < minValue.value) value.value = minValue.value;
}
function onMaxChange(event: Event) {
const next = Number((event.target as HTMLInputElement).value);
function onMaxChange(next: number | null) {
if (next == null || !Number.isFinite(next)) return;
maxValue.value = Math.max(next, minValue.value + 1);
if (value.value > maxValue.value) value.value = maxValue.value;
}
function onFormatChange(next: string | number | (string | number)[] | null) {
if (typeof next === "string" && next in formatOptionsMap) format.value = next;
}
</script>
<template>
@@ -73,53 +91,75 @@ function onMaxChange(event: Event) {
<div class="flex max-w-52 flex-col gap-3">
<Label class="text-xs font-medium text-muted">选项</Label>
<Label for="pb-cv-value">值</Label>
<input
id="pb-cv-value"
class="hv-input hv-input--secondary hv-input--full-width"
type="number"
:min="minValue"
:max="maxValue"
:value="value"
@change="onValueChange"
/>
<Label for="pb-cv-min">最小值</Label>
<input
id="pb-cv-min"
class="hv-input hv-input--secondary hv-input--full-width"
type="number"
min="0"
:max="maxValue - 1"
:value="minValue"
@change="onMinChange"
/>
<Label for="pb-cv-max">最大值</Label>
<input
id="pb-cv-max"
class="hv-input hv-input--secondary hv-input--full-width"
type="number"
:min="minValue + 1"
max="2000"
:value="maxValue"
@change="onMaxChange"
/>
<Label for="pb-cv-format">格式</Label>
<select
id="pb-cv-format"
v-model="format"
class="hv-input hv-input--secondary hv-input--full-width"
<NumberField
:max-value="maxValue"
:min-value="minValue"
:model-value="value"
variant="secondary"
@update:model-value="onValueChange"
>
<option
v-for="option in formatStyleOptions"
:key="option.value"
:value="option.value"
>
{{ option.label }}
</option>
</select>
<Label>值</Label>
<NumberFieldGroup>
<NumberFieldDecrementButton />
<NumberFieldInput />
<NumberFieldIncrementButton />
</NumberFieldGroup>
</NumberField>
<NumberField
:max-value="maxValue - 1"
:min-value="0"
:model-value="minValue"
variant="secondary"
@update:model-value="onMinChange"
>
<Label>最小值</Label>
<NumberFieldGroup>
<NumberFieldDecrementButton />
<NumberFieldInput />
<NumberFieldIncrementButton />
</NumberFieldGroup>
</NumberField>
<NumberField
:max-value="2000"
:min-value="minValue + 1"
:model-value="maxValue"
variant="secondary"
@update:model-value="onMaxChange"
>
<Label>最大值</Label>
<NumberFieldGroup>
<NumberFieldDecrementButton />
<NumberFieldInput />
<NumberFieldIncrementButton />
</NumberFieldGroup>
</NumberField>
<Select
:model-value="format"
variant="secondary"
@update:model-value="onFormatChange"
>
<Label>格式</Label>
<SelectTrigger>
<SelectValue />
<SelectIndicator />
</SelectTrigger>
<SelectPopover>
<ListBox>
<ListBoxItem
v-for="option in formatStyleOptions"
:id="option.value"
:key="option.value"
:text-value="option.label"
>
{{ option.label }}
<ListBoxItemIndicator />
</ListBoxItem>
</ListBox>
</SelectPopover>
</Select>
</div>
</div>
</template>
+2 -3
View File
@@ -59,6 +59,7 @@ Form 的 `validation-errors` 是以字段 name 为键、字符串或字符串数
本页交付共享协议和验证场景,是字段/表单基础设施指南,不替代独立组件文档。TextField、Label、Description、FieldError、TextArea 的完整 API 与基线示例见各自组件页:
- [Form 表单](/components/form)
- [TextField 文本输入框](/components/text-field)
- [Label 标签](/components/label)
- [Description 描述](/components/description)
@@ -67,6 +68,4 @@ Form 的 `validation-errors` 是以字段 name 为键、字符串或字符串数
已迁移的三个 TextField 基线示例仍在此展示,便于联调验证。
SSR 支持标准的直接子部件、原生元素/Fragment 包裹的 Description/FieldError,即使说明放在控件之后也能生成完整 ID 关联。自定义 Vue 包装组件中的描述在客户端注册;若首屏 SSR 必须关联,请显式提供控件 aria-describedby 和对应描述 id。Nuxt 完整消费验收尚未进行。
Fieldset 的禁用继承、Checkbox/Radio/集合字段、异步校验调度仍是后续任务,不从本页示例推断已经实现。
当前仅支持浏览器客户端使用,SSR/水合/Nuxt 服务端不在支持范围。Form 的正式 API、3 个固定源示例及行为差异见 [Form 表单](/components/form)。Fieldset 和 Checkbox/Radio 已集成;异步校验调度仍由调用方处理。
+8 -4
View File
@@ -9,7 +9,7 @@
| accordion | 验证中(M23) | Accordion/Item/Heading/Trigger/Panel/Body/Indicator;10/10 基线例;surface/hideSeparator;复用组键协议 |
| alert-dialog | 验证中(M33) | 11 部件;role=alertdialog;默认不误关;14/14 基线例;Reka Dialog 底座 |
| autocomplete | 已迁移(有已知差异) | Autocomplete 七部件;24/24 基线例;触发器单一 Tab 入口 + 弹层内搜索框虚拟焦点、受控开关/文本、多选 Value 用作用域插槽;见 B02 报告 |
| avatar | 验证中(最小实现) | Reka Avatar 加载/回退;size/color/variant;Image asChild;AvatarGroup 继承仅限直接子级 |
| avatar | 已迁移(客户端,有已知差异) | Avatar/AvatarRoot、Image/Fallback;7/7 基线例;as/asChild、可选src、原生load/error、零/正延迟与动态更新、换图恢复;Reka预加载src与隐藏DOM差异见AVATAR结果;AvatarGroup继承仅限直接子级 |
| avatar-group | 验证中(最小实现) | max 截断与自动计数、显式 Count 不受截断、isGrid、overlap clip/ring;默认无 role=group |
| badge | 验证中(最小实现) | Badge/BadgeAnchor/BadgeLabel;四角定位、圆点、文本/数字自动包装;Anchor 非链接 |
| breadcrumbs | 验证中(M17) | Breadcrumbs/BreadcrumbsItem;7/7 基线例;ol+aria-label、末项 current、禁用/无 href span、separator 插槽;onAction 未提供,class 同时落 li/link |
@@ -31,7 +31,7 @@
| date-picker | 已迁移(客户端,有已知差异) | DatePicker/Root、Trigger、TriggerIndicator、Popover;10/10 基线例;复用 DateField 字段、Calendar 视图/年份层与 Popover;唯一日期提交、受控拒绝/重试、时间草稿、locale/RTL、嵌套 Modal Escape;见 DATE-PICKER 结果。 |
| date-range-picker | 已迁移(客户端,有已知差异) | DateRangePicker 五部件;10/10 基线例;复用双端点 DateField、RangeCalendar 与 Popover;完整范围/双命名提交/时间草稿/非连续策略;见 DATE-RANGE-PICKER 结果。 |
| drawer | 验证中(M34) | 11 部件;四方向拖动关闭(30%/0.5px/ms);9/9 基线例;Content/Dialog 职责分离 |
| progress-bar | 验证中(M18) | ProgressBar/Output/Track/Fill;7/7 基线例;确定/未知进度、min/max/formatOptions/valueLabel;custom-value 的 NumberField/Select 为原生临时控件 |
| progress-bar | 验证中(M18) | ProgressBar/Output/Track/Fill;7/7 基线例;确定/未知进度、min/max/formatOptions/valueLabel;custom-value 使用公共 NumberField/Select 正式部件(清空/无效草稿拒绝恢复、越界收敛) |
| progress-circle | 验证中(M19) | ProgressCircle/Track/TrackCircle/FillCircle;7/7 基线例;圆环几何可覆盖;与 ProgressBar 共用取值语义 |
| time-field | 已迁移(客户端) | TimeField/Root及六个共享输入部件;15/15基线例;Time/CalendarDateTime/ZonedDateTime、完整精度、受控拒绝、键盘/Enter、校验/提交/reset;框架差异见 TIME-FIELD 结果。 |
| disclosure | 验证中(M21) | Disclosure/Heading/Trigger/Content/Body/Indicator;3/3 基线例;v-model:expanded;asChild 触发;高度动画映射测量变量 |
@@ -66,7 +66,7 @@
| empty-state | 验证中(M16) | 单根 EmptyState;4 个自编示例(基线无页面/示例);默认 fallback;空节点判断与上游 children 真值回退边界不同 |
| field-error | 验证中(通用字段) | 作用域插槽 validationErrors;独立页 2/2 示例;无完整 validationDetails(见基础协议) |
| fieldset | 验证中(FORM-02) | 四部件、3 基线例与禁用验证例;响应式禁用、首 Legend 例外,边界见 FORM-02 |
| form | 验证中(基础设施) | native/aria 校验、FormData/reset、服务端错误;完整基线文档与生态集成未完成 |
| form | 已迁移(客户端,有已知差异) | Form/FormRoot;3/3固定源例与独立中文页;native/aria、FormData/reset、服务端错误、invalid通知/取消焦点、首个无效组合字段;render→attrs,原生函数action/完整RAC上下文不移植;见FORM结果 |
| header | 验证中(M31) | Header/HeaderRoot;原生 `<header>` 集合分组标题;基线无独立文档/演示,自编 3 例并标注;无 v-model |
| radio | 验证中(基线实现) | 原生 radio + Content/Control/Indicator;须在 RadioGroup 内,成员禁用/只读、作用域状态 |
| radio-group | 验证中(基线实现) | 标量模型、roving Tab/方向键/dir/loop、原生提交/校验/reset;12 个基线预览 |
@@ -81,7 +81,7 @@
| menu-section | 验证中(B01) | MenuSection 分组与分组级选择;见 B01 |
| modal | 验证中(OVERLAY-02) | Root/Trigger/Backdrop/Container/Dialog/Heading/Header/Body/Footer/Icon/Close/CloseTrigger;14/14 基线例;焦点/锁/滚动/退出动画;Vue close 部件替代 React slot |
| pagination | 验证中(M30) | 组合式 nav 容器(无 total/page 状态机);11 具名部件;9/9 基线例;onPress→@click;显式 aria-current 可覆盖 |
| number-field | 验证中(NUMBER-01) | 五部件与 17/17 基线例;Reka 数值内核;受控/只读/表单 reset、SSR/水合;差异见 NUMBER-01 报告 |
| number-field | 验证中(NUMBER-01) | 五部件与 17/17 基线例;Reka 数值内核;受控/只读/表单 reset、SSR/水合;键入草稿保留(修复 keydown 后还原字符,见 API-ROOT-AND-PROGRESS-DEMO 结果);差异见 NUMBER-01 报告 |
| select | 验证中(SELECT-01) | 六部件、19/19 例、单/多选、清空、字段/原生提交/SSR/异步;复用 ListBox + Popover,重点浏览器已验,限制见 SELECT-01 |
| meter | 验证中(M20) | Meter/Output/Track/Fill;6/6 基线例;role=meter progressbar;无 isIndeterminate;测量语义独立于 Progress |
| slider | 验证中(SLIDER-01) | 六部件、9/9 基线例;原生 range/局部指针适配,单值/范围、受控/reset/SSR/水合;差异见 SLIDER-01 |
@@ -280,3 +280,7 @@ ComboBox/Autocomplete的正式组合、原30项返修和本轮定位/ref/ARIA/lo
公开 DateRangePicker/Root、Trigger、TriggerIndicator、RangeSeparator、Popover、dateRangePickerVariants 及 Props/RenderProps/state/time 类型;起止输入复用 DateFieldGroup/Input/InputContainer/Segment/Suffix,端点为可类型检查的 `endpoint` prop;日历复用 RangeCalendar 与 CalendarYearPicker 具名部件。固定源中文 10 个预览、API/插槽/状态表与导航已接入;Picker 拥有唯一完整范围接受值、双端点字段校验、两个命名提交值和 reset,未显式绑定的内嵌 RangeCalendar 继承范围、上下界、不可用、禁用/只读/无效、locale/dir 与非连续策略。
不完整范围、第一下日历点击和空值时间草稿都不提交;清空两端提交 null,清空一端在关闭/外部替换/reset 时回到接受状态。受控拒绝后可重试,日历修改保留两端各自的日期类、时间、时区与历法,字段编辑保留不可显示精度。固定源 `slot="start"/"end"` 映射为 `endpoint` prop;格式选项的 `w-full` 弹层宽度映射为 252px 日历加 24px 内边距。真实浏览器、定向回归和最终 tarball 验证见 [任务结果](tasks/results/DATE-RANGE-PICKER.md)。
## FORM 正式迁移(2026-10-27)
复用已有字段/FormData/reset协议,公开FormRoot及Props/实例/插槽类型;固定源中文3例与正式文档已接入。新增表单级invalid通知、取消默认焦点、外部form关联控件检查,避免重复invalid与后续组合字段抢焦点;choice共享适配与Switch尊重已取消事件。源Form无专用CSS,不新增variants或样式。具体范围/验证见 [FORM结果](tasks/results/FORM.md)。
+9
View File
@@ -5,6 +5,7 @@
## 公共行为
- 采用Vue具名部件、v-model与插槽;React PressEvent、React上下文、集合Set等框架机制不承诺直接等价。具体默认值、事件、插槽以组件文档和公共类型为准。
- 根组件在包根同时导出 `Xxx` 与 `XxxRoot` 双名(含上游公开的子部件 Root 名),两名称指向同一组件对象,Props 类型为同一类型;上游未导出的名字(如 `CheckboxGroupRoot`、`ToastRootProps`)不杜撰。完整 82 对映射与身份断言见 [API-ROOT-AND-PROGRESS-DEMO 结果](tasks/results/API-ROOT-AND-PROGRESS-DEMO.md)。
- 字段/Form使用共享ID、校验、原生提交/reset与外部form协议,不由每组件另建状态。见 [字段决策](decisions/field-form-foundation.md)。Checkbox/Radio等共享协议见 [选择字段决策](decisions/selection-field-foundation.md)。
- 弹层复用Reka及统一焦点/定位/嵌套/关闭生命周期。Root展开不等于面板已可见;Trigger与定位Anchor分别落实。见 [弹层决策](decisions/overlay-foundation.md)。
- ListBox/Select/ComboBox/Autocomplete使用有类型key及统一集合状态;数字0、字符串0与空key不同。逻辑全集与挂载DOM集合分开,虚拟化不以挂载项数当全集。见 [集合决策](decisions/collection-foundation.md)。ComboBox/Autocomplete当前公开验收见 [B02结果](tasks/results/B02-REVIEW.md)。
@@ -76,3 +77,11 @@ ColorPicker/ColorPickerRoot、ColorPickerTrigger、ColorPickerPopover、Props/
差异:固定源 `setColor(null)` 会把接受值改写为 `#000000`,本库组合拒绝空提案并保持接受颜色(共享颜色模型既有决策,独立字段仍可清空);固定源 Trigger 复用 Button render props,本库插槽状态收敛为 `color`/`isDisabled`;固定源 Root 经 `DialogTrigger` 内部管理展开,`open`/`isOpen`/`defaultOpen` 受控展开与 `name`/`form` 单值完整精度提交、`isDisabled`/`isReadOnly` 均为 Vue 扩展。弹层默认 `bottom left`,RTL 经 ConfigProvider `dir` 镜像为 `end` 对齐;轴名/输出等本地化文案跟随 ConfigProvider locale(默认 en-US),与其它颜色组件一致。
本项由主会话亲自实施/自测,未委派其他 AI,未宣称独立复核。SSR/水合/Nuxt 服务端、逐像素对比、完整读屏矩阵与真机矩阵未投入;截图需要可见桌面窗口、CDP 鼠标注入在本轮后半程持续超时,交互证据以真实键盘事件、真实拖动事件与真实浏览器 DOM 指针事件序列(isTrusted=false)加实际几何/计算样式为准。
## AVATAR(2026-10-27)
Avatar/AvatarRoot、Image/Fallback 已完成公共客户端迁移补齐,见 [结果](tasks/results/AVATAR.md)。修复Image asChild丢失默认插槽与delayMs=0永久隐藏;可选src、三部件as/asChild、原生事件类型和AvatarRootProps公开。加载状态仍由Reka持有,回退延迟使用本库定时器以处理零值/动态切换与卸载取消。实际img在加载中隐藏而不卸载,srcSet/sizes仅透传实际图片、预加载仍只探测src;与固定源差异已在文档记录。既有AvatarGroup直接子级继承不变。
## FORM(2026-10-27)
Form已有基础协议在本轮完成正式文档与3例迁移。Root保持原生form,render添加属性以attrs替代,不支持替换为非表单根。DOM始终novalidate,由本库按native/aria及字段覆盖验证;显式novalidate/formnovalidate跳过提交检查。invalid原生捕获后通知调用方,取消事件不放行提交、可阻止默认焦点;checkValidity不聚焦,report/submit仅首个无效字段可聚焦。组合字段共享适配/Switch保留错误更新并尊重取消;避免多控件抢焦点与重复reportValidity事件。错误使用FieldError而不承诺原生气泡。详见 [结果](tasks/results/FORM.md),React函数action/完整RAC ValidationResult/跨树上下文不移植。
+4
View File
@@ -53,3 +53,7 @@
## FORM-02 更新(2026-10-22)
M12–M14 已提交并复核,以上阶段 0 的“示例仅三项、尚未派发”属于历史。TextField 的状态/SSR/校验实现现位于 field/useTextField.ts,SearchField 复用同一内核;useTextControl 仍负责真实 Input/TextArea 的值恢复/reset。Fieldset 的独立禁用作用域已接入现有控件,首个直接 Legend 例外和嵌套有专项测试。完整交付见 FORM-02 报告;选择分组后续实施契约见 selection-field-foundation.md。
## FORM 正式迁移更新(2026-10-27)
正式组件页与3例已补齐,见 [FORM结果](../tasks/results/FORM.md)。Form使用原生invalid捕获传递同一可取消事件,不调用控件reportValidity重复发送事件;表单report/submit允许首个无效字段聚焦,check不聚焦,后续组合字段收到已取消事件而只更新错误。choice共享invalidEvent与Switch遵守进入处理器前的defaultPrevented状态。实例reportValidity使用本库错误展示与聚焦,不承诺浏览器原生气泡。其余既有值/服务器错误/reset与混合native/aria策略不变。
+6 -1
View File
@@ -10,7 +10,8 @@
- 字段/Form、Checkbox/Radio、数值/Slider/OTP、弹层/菜单、集合/ListBox/Select、ComboBox/Autocomplete、Tag、Toast/Table已集成。
- DateField、TimeField、Calendar、CalendarYearPicker、DatePicker 与 DateRangePicker 已有公共组件;RangeCalendar 已完成公共客户端迁移(20 个基线预览),范围选择与 Calendar 共用视图/焦点/年份设施。DatePicker 复用 DateField 字段、Calendar 视图与 Popover 弹层,10 个基线预览已接入。DateRangePicker 复用双端点 DateField、RangeCalendar 与 Popover,10 个基线预览已接入。
- ColorSwatch/ColorSwatchRoot及Color/parseColor公共子集已公开;ColorArea/ColorAreaRoot、ColorAreaThumb 与 colorAreaVariants 已公开,复用共享颜色 owner、二维交互与固定源 7 例;ColorSlider/ColorSliderRoot、ColorSliderOutput/Track/Thumb 与 colorSliderVariants 已公开,复用共享通道/轨道内核与固定源 9 例。ColorField/ColorFieldRoot、配套 ColorInputGroup 与具名字段部件、两套 variants 已完成客户端迁移,含固定源 13 例,并按用户授权合入 main。ColorSwatchPicker/ColorSwatchPickerRoot、ColorSwatchPickerItem/Swatch/Indicator 与 colorSwatchPickerVariants 已完成客户端迁移,含固定源 10 例(见 [结果](tasks/results/COLOR-SWATCH-PICKER.md),复核通过并已按用户授权合入 main)。ColorPicker/ColorPickerRoot、ColorPickerTrigger/Popover 与 colorPickerVariants 已完成客户端迁移,含固定源 6 例(见 [结果](tasks/results/COLOR-PICKER.md),独立复核通过,已按用户授权合入 main)。颜色家族公开迁移已完成。
- 兼容矩阵目前85条(包含子部件与基础设施),文档有72个组件页面。矩阵中的“验证中”保留其原有限制,不升级为完整兼容。
- 兼容矩阵目前85条(包含子部件与基础设施),文档有74个组件页面。矩阵中的“验证中”保留其原有限制,不升级为完整兼容。
- 公共根组件已对齐固定上游的 Root 双名导出(82 对 `Xxx`/`XxxRoot` 同对象,含上游公开的子部件 Root 名),完整清单与身份/类型断言见 [API-ROOT-AND-PROGRESS-DEMO 结果](tasks/results/API-ROOT-AND-PROGRESS-DEMO.md)。ProgressBar custom-value 演示已回填公共 NumberField/Select;NumberField 键入草稿保留缺陷已修复并入回归。
## 尚未完成的公共家族
@@ -36,3 +37,7 @@ TIME-FIELD 已完成公共迁移和客户端验收,见 [结果](tasks/results/
ColorSwatchPicker 最终修复 `3c8473d`,已合入 main(`457d340`),原复核阻断全部关闭;最终全量客户端105文件/1558项、类型、文档构建、五契约tarball及main集成回归通过。推送已获授权,远端同步以实际Git状态为准,详见任务结果。
ColorPicker 独立复核修复 `74cd597`,已合入 main(`23eecaf`);main 集成全量107文件/1571项、类型、文档构建和十契约最终tarball通过。补验390px窄屏与焦点恢复,原公开差异保留;远端同步以实际Git状态为准。
Avatar 头像已由主会话亲自补齐迁移,未委派其他AI;自定义图片插槽、零延迟回退、可选src、原生事件类型与Root别名已修正。7/7固定源例核对、加载回归及真实浏览器范围见 [AVATAR结果](tasks/results/AVATAR.md)。
Form 已完成正式客户端迁移收尾:FormRoot/公开类型、独立组件页与3/3固定源例、invalid取消及默认焦点管理;继续复用已有字段协议。实施/验收由主会话亲自完成,见 [FORM结果](tasks/results/FORM.md)。
+11 -10
View File
@@ -1,12 +1,13 @@
# 当前工作区交接
- 任务:COLOR-PICKER 独立复核通过,状态 `accepted`;已按用户授权合 main,待本记录提交后 push。
- 工作区/分支:heroui-vue / `main`;复核修复 `74cd597`,合并提交 `23eecaffef45714409e16db575c3912fac7fa189`;main 集成全量107文件/1571项通过。
- 复核对象:`63606399e374ac31c4c75149790c9df96af5ebfe`;起点 `d75540c5be53336b09a3a0cf3ac179990b9e5523`,实施 `ee5fce9`。
- 复核修正:颜色提案事件文档;既有 ColorField 焦点测试时间戳隔离。结果表 R1/R2 均关闭。
- 验证:全量107文件/1571项、typecheck、build:docs、十契约最终tarball通过;独立浏览器 basic/嵌套Select/焦点恢复/390px窄屏通过。
- 入口:`docs/tasks/COLOR-PICKER.md` 与 `docs/tasks/results/COLOR-PICKER.md`。
- 预览:保留已有文档5173,页面 `/components/color-picker`,未停止他人服务。
- 接续:当前无新实施任务;合并与远端同步以最终 Git SHA 回读为准。
单目录串行;后续先检查实际git状态,不从旧历史自动开始新工作。
- 任务:API-ROOT-AND-PROGRESS-DEMO 已完成实施及集成复核,状态 accepted;未委派其他AI。
- 工作区/分支:heroui-vue / `main`(任务分支 `task/api-root-and-progress-demo`);起点 `e0dd052cc3626303ee0dbeb74c4f9ad69f938998`。
- 实施提交 `8f51b0e097968d5560b4871a279d07c2900046da`(Root 别名、ProgressBar 演示回填、NumberField 键入修复、导航排序修正、契约与测试);结果提交见 Git 历史;首轮交付时未合 main、未 push。
- 验证:相关 4 文件/91 项、typecheck、build:docs、最终 tarball `api-root-aliases form avatar b01-menu-dropdown` 契约通过(82 对别名身份/类型断言)。
- 浏览器(5173 `/components/progress-bar`):三个数字字段键入/步进/清空拒绝/越界收敛、动态上下限联动、四格式键盘与点击选择、浅深主题截图、390px 窄屏无页面横向溢出、控制台干净;主题已恢复跟随系统。
- 附带修复:NumberFieldInput keydown 还原键入字符缺陷(回归入 tests/number-field.test.ts);文档导航 dropdown 归位固定 meta.json 顺序(回归入 tests/docs-shell.test.ts)。
- 入口:`docs/tasks/API-ROOT-AND-PROGRESS-DEMO.md`、`docs/tasks/results/API-ROOT-AND-PROGRESS-DEMO.md`。
- 保留原有 5173 文档服务;未停止他人服务。
- 复核修正:`593757710179859e3e5c11c8d24e938eeb572df6`;NumberField 回归用例改为同任务事件序列,旧实现反证失败、当前实现通过。全量109文件/1602项、typecheck、build:docs、四契约最终tarball通过;本次未重复浏览器操作。
- 集成:已按用户授权合 main,合并提交 `08c9bf5767b8c613518a678df9c419cfd432962a`,纳入验收提交 `bdbb2cb`。本记录提交后推送 origin/main;推送结果以远端核对为准。
- 接续:当前无实施占用,从实际 git 状态与任务入口选择工作。
+60
View File
@@ -0,0 +1,60 @@
<!-- task-metadata
{
"base": "e0dd052cc3626303ee0dbeb74c4f9ad69f938998",
"upstream": "ce90ea3ab49d58f6c428f71bfd6fe8ae2a87b960",
"status": "accepted",
"requires": [
"packages/vue/src/index.ts",
"packages/vue/src/components/number-field/NumberField.vue",
"apps/docs/demos/progress-bar-custom-value.vue",
"tests/package/client-checks.json",
"tests/progress-meter.test.ts"
],
"sources": [
"packages/react/src/index.ts",
"packages/react/src/components/progress-bar/index.ts",
"apps/docs/src/demos/cn/progress-bar/custom-value.tsx"
],
"checks": [
"pnpm exec vitest run tests/progress-meter.test.ts tests/number-field.test.ts tests/select.test.ts",
"pnpm typecheck",
"pnpm build:docs"
]
}
-->
# API-ROOT-AND-PROGRESS-DEMO:Root 别名对齐与 ProgressBar 正式控件回填
## 启动与边界
先读 AGENTS.md、docs/tasks/README.md、docs/tasks/ACTIVE.md 和实际 git 状态,运行 `node scripts/task-check.mjs API-ROOT-AND-PROGRESS-DEMO`。确认目录无人占用后,从包含本卡和前置实现的提交创建独立任务分支,记录准确起点 SHA。保留既有改动及服务,不合 main、不 push。
本任务只处理两项既有能力收尾:公共导出的 Root 别名缺口,以及 ProgressBar 演示使用正式 NumberField/Select。**55 是待核对的别名缺口数量,不是缺少 55 个组件,不得新建 55 套组件或空壳实现。** 仅客户端,不增加 SSR、水合、Nuxt 或逐像素专项。
## 一、补齐公共 Root 别名
1. 以固定上游提交的公开导出为准,逐项对照 Vue 包根 `packages/vue/src/index.ts` 及现有实现,列出“上游名称 → Vue 现有组件 → 目标 Root 别名 → 当前状态”。核对报告中的 55 项;若当前基线数量已变化,记录真实差异与原因,不为凑数生成名称,也不重新添加已有别名。
2. 对有现成根实现的缺失项增量补导出,保持旧名称兼容。Root 别名必须指向同一组件对象,不能用包装组件改变 attrs、事件、插槽、ref 或组件实例类型。不要机械地为每个子部件追加 Root。
3. 核对公共类型与最终声明可用性;不额外杜撰上游没有要求的类型别名。确无现成实现或存在框架语义差异的项目单独列出,禁止以空壳冒充补齐。
4. 在现有导出/产物验证设施中补上完整别名清单和身份等价断言,并验证最终 tarball 中具名导入、Props/事件/插槽/实例类型。沿用 `scripts/check-package.mjs` 与既有契约机制;若新增契约 ID,应登记并在结果中给出准确运行命令,不另建消费者框架。
## 二、ProgressBar 演示回填正式组件
主要入口为 `apps/docs/demos/progress-bar-custom-value.vue`,对照固定源 `apps/docs/src/demos/cn/progress-bar/custom-value.tsx`。
1. 用已实现的公共 NumberField 及其正式部件替换三个原生 number input,用公共 Select 及其正式部件替换原生 select。使用包根导入及现有 Vue 值协议,不通过手写 CSS 仿冒控件,也不直接导入底层 Reka。
2. 保持固定源中文文案、顺序、布局、初始值、范围和四种格式选项;值、最小值、最大值与进度文本/填充保持同步。核对源行为及既有边界处理,覆盖输入、步进、清空/无效草稿、范围变更和格式切换,不产生 NaN、非法区间或显示失配。
3. 保证标签关联、键盘操作、Select 面板定位/选择/关闭及焦点正常;预览、复制与高亮仍使用同一份 SFC。扫描其他 ProgressBar 演示,若有同类临时替代一并处理;不扩大为全站演示重写。
4. 修正 `docs/compatibility.md` 和相关当前组件说明中“NumberField/Select 为原生临时控件”的陈述。历史验证记录保留历史语义,不批量改写为本轮已验收。
## 验证与通过条件
- 所有待补别名均有逐项核对结果;实际新增数、已有数、明确差异可追溯。原导出保留,别名与原组件严格相等。
- 元数据中的相关单测、类型检查、文档构建通过;新增的别名契约/演示回归也须实际执行并记录准确命令。导出验证覆盖完整清单,不能只抽查一个别名。
- 使用 `node scripts/check-package.mjs <本轮相关或新增契约ID>` 检查最终 tarball 的 ESM 导出与 bundler/NodeNext 类型正反例;源码 alias 通过不能代替发布产物通过。
- 在真实文档站 5173 的 `/components/progress-bar` 操作正式演示:三个数字字段输入和步进、动态上下限、四种格式选择及键盘操作;检查进度值、文本和填充同步,浅深主题及窄屏无溢出,控制台无新增异常。原生 input 作为 NumberField 内部实现正常,禁止以 DOM 中没有 input 作为验收要求。
- 本轮只编写任务卡不代表实施或验收完成;实施者完成后按实际验证更新任务状态与当前矩阵,不将 API 别名补齐描述成新增组件完成。
## 交付
按 `docs/tasks/RESULT-TEMPLATE.md` 写 `docs/tasks/results/API-ROOT-AND-PROGRESS-DEMO.md`,包含分支/起点/实施 SHA、完整别名映射、演示改动、命令与场景证据、未完成项和限制。代码、任务卡及结果记录一并提交到任务分支,不合 main、不 push。
+41
View File
@@ -0,0 +1,41 @@
<!-- task-metadata
{
"base": "c05cc7dfa79c7657d78f376f23ed1912c83f3bf0",
"upstream": "ce90ea3ab49d58f6c428f71bfd6fe8ae2a87b960",
"status": "accepted",
"requires": [
"packages/vue/src/components/avatar/Avatar.vue",
"tests/close-button-avatar-skeleton.test.ts"
],
"sources": [
"packages/react/src/components/avatar/avatar.tsx",
"packages/styles/components/avatar.css",
"apps/docs/content/docs/cn/react/components/(media)/avatar.mdx"
],
"checks": [
"pnpm exec vitest run tests/close-button-avatar-skeleton.test.ts tests/avatar-loading.test.ts",
"pnpm typecheck",
"pnpm build:docs",
"node scripts/check-package.mjs avatar",
"pnpm test"
]
}
-->
# AVATAR:头像迁移补齐
由主会话亲自实施、自测,不委派其他AI。用户已授权验证通过后提交并合入main,不包含push。仅客户端,沿用AGENTS范围。
从包含本卡的已集成提交新建 `feat/avatar-complete`,记录准确起点。
## 目标与边界
逐项核对固定源Avatar三部件、CSS/variants和中文全部7例。修复Image asChild默认插槽丢失与Fallback delayMs=0永久隐藏;补齐Root/Image/Fallback的as/asChild公开属性、Root命名别名与可选src,保留Reka加载状态和既有AvatarGroup直接子级协议。不重写加载内核,不改变视觉数值。
## 用户可见验收
- 自定义图片组件实际渲染,alt/src/class/原生load/error事件落到真实图片,无嵌套img或丢失子节点。
- 成功→新src加载→失败回退→恢复可用;省略src和delayMs=0均显示fallback,正延迟不提前出现。
- 7/7源例逐项核对,浅深色/32、40、48px尺寸/窄屏在真实浏览器检查。
- 已有头像组继承与动态attrs回归保持通过;最终tarball导出、CSS及NodeNext/bundler类型正反例通过。
- 合main前全量客户端、类型、文档构建通过。交付证据写入docs/tasks/results/AVATAR.md。
+49
View File
@@ -0,0 +1,49 @@
<!-- task-metadata
{
"base": "ee43cc615d2529daf591e95b0fa354bde10af392",
"upstream": "ce90ea3ab49d58f6c428f71bfd6fe8ae2a87b960",
"status": "accepted",
"requires": [
"packages/vue/src/components/form/Form.vue",
"packages/vue/src/components/field/useTextField.ts",
"tests/field-foundation.test.ts"
],
"sources": [
"packages/react/src/components/form/form.tsx",
"packages/react/src/components/form/index.ts",
"apps/docs/content/docs/cn/react/components/(forms)/form.mdx",
"apps/docs/src/demos/cn/form/basic.tsx",
"apps/docs/src/demos/cn/form/render-function.tsx",
"apps/docs/src/demos/cn/form/custom-styles.tsx"
],
"checks": [
"pnpm exec vitest run tests/form.test.ts tests/field-foundation.test.ts tests/choice-fields.test.ts tests/fieldset-search-field.test.ts",
"pnpm typecheck",
"pnpm build:docs",
"node scripts/check-package.mjs form",
"pnpm test"
]
}
-->
# FORM:正式表单迁移收尾
由主会话亲自实施/自测,禁止委派其他AI;沿用用户授权,验收通过后提交并合main,不push。仅客户端,范围沿用AGENTS。
从包含本卡的已集成提交新建feat/form-public,记录起点SHA。
## 目标
复用既有Form/字段状态与原生Constraint Validation API,补齐FormRoot别名和公开Props/实例/插槽类型、固定中文组件页和全部3例(basic/render-function/custom-styles)、导航/来源/矩阵。无专用源CSS,不为Form杜撰样式包或变体。render示例保留form语义,用Vue attrs映射data-custom。
## 通过条件
- 三例按固定源文案、顺序、布局、字段及同步validate迁移,预览/复制/高亮同一SFC;图标用Tabler。提交反馈采用站内status替代alert并明确记录。
- 原生必填/邮箱/密码/自定义/服务端错误阻止native提交,正确输入FormData一致;reset/取消reset/受控拒绝沿用既有协议。aria默认及字段覆盖不退化。
- Form级@invalid接收实际无效事件;preventDefault取消默认焦点而不放行无效提交;每控件每次验证仅通知一次,关联外部form控件同样验证。
- submit/reset取消、submitter.formNoValidate/显式novalidate、动态attrs和实例checkValidity/reportValidity/reset可用。根始终原生form,不引入第二套状态源。
- 真实浏览器点击无效提交、焦点/关联错误、正确提交/重置、键盘提交、浅深主题与窄屏;最后tarball导出/类型正反例及全量回归通过。
## 交付
结果写docs/tasks/results/FORM.md,准确记录SHA、命令、场景→证据、框架差异和未验范围。保留已有5173服务,不停他人服务。
+3
View File
@@ -20,6 +20,9 @@
| 卡 | 用途 |
| ----------------------------------------- | ----------------------------------------------------------- |
| [API-ROOT-AND-PROGRESS-DEMO](API-ROOT-AND-PROGRESS-DEMO.md) | 补齐既有组件 Root 公共别名;ProgressBar 演示回填正式 NumberField/Select |
| [FORM](FORM.md) | 主会话亲自迁移表单正式API、3例与校验/焦点验收 |
| [AVATAR](AVATAR.md) | 主会话亲自补齐头像三部件、7例与加载回退验收 |
| [COLOR-PICKER](COLOR-PICKER.md) | 公共可组合颜色选择器迁移,含固定源 6 例、共享颜色与嵌套弹层验收 |
| [COLOR-SWATCH-PICKER](COLOR-SWATCH-PICKER.md) | 公共色块选择集合迁移,含固定源 10 例与产物验收 |
| [COLOR-SWATCH](COLOR-SWATCH.md) | 公共颜色值/Swatch家族 |
@@ -0,0 +1,76 @@
# API-ROOT-AND-PROGRESS-DEMO 交付
- 分支 `task/api-root-and-progress-demo`;起点 `e0dd052cc3626303ee0dbeb74c4f9ad69f938998`(含本任务卡);此前 main 同 `e0dd052`。
- 实施提交 `8f51b0e097968d5560b4871a279d07c2900046da`(代码、任务卡、README 任务表);结果/进度记录见本提交。未合 main、未 push。
- 固定源 HeroUI 3.2.6 / `ce90ea3ab49d58f6c428f71bfd6fe8ae2a87b960`:`packages/react/src/components/*/index.ts` 公开导出、`apps/docs/src/demos/cn/progress-bar/custom-value.tsx`、`apps/docs/content/docs/cn/react/components/meta.json`;只读核对。
## 一、Root 别名映射(上游名称 → Vue 现有组件 → 目标别名 → 状态)
核对口径:以固定上游每个组件 barrel 的公开值导出为准,取 `XxxRoot` 且上游同名导出 `Xxx` 的成对根名(含上游自有组件模块的 `ListBoxItemRoot/ListBoxSectionRoot/MenuItemRoot/MenuSectionRoot/DateInputGroupRoot`)。机器可读完整清单与断言在 `tests/package/client-checks.json` 的 `api-root-aliases.aliases`(82 对)。
| 类别 | 数量 | 明细 |
| --- | --- | --- |
| 本轮新增 `XxxRoot` 值别名 | 55 | Accordion、Alert、Autocomplete、AvatarGroup、Badge、Breadcrumbs、Button、ButtonGroup、Card、Checkbox、Chip、CloseButton、ComboBox、DateInputGroup、Description、Disclosure、DisclosureGroup、EmptyState、ErrorMessage、FieldError、Fieldset、Input、InputGroup、Kbd、Label、Link、ListBoxItem、ListBoxSection、MenuItem、MenuSection、Meter、Modal、Popover、ProgressBar、ProgressCircle、Radio、RadioGroup、ScrollShadow、SearchField、Separator、Skeleton、Spinner、Surface、Switch、SwitchGroup、Tabs、Tag、TagGroup、TextArea、TextField、ToggleButton、ToggleButtonGroup、Toolbar、Tooltip、Typography(各补 `+Root` 同对象导出) |
| 本轮新增反向别名 | 1 | `Dropdown`(此前仅 `DropdownRoot`;上游导出双名) |
| 基线已有双名(不改) | 26 | AlertDialog、Avatar、Calendar、ColorArea、ColorField、ColorInputGroup、ColorPicker、ColorSlider、ColorSwatch、ColorSwatchPicker、DateField、DatePicker、DateRangePicker、Drawer、Form、Header、InputOTP、ListBox、Menu、NumberField、Pagination、RangeCalendar、Select、Slider、Table、TimeField |
| 合计上游成对根名 | 82 | 与上游逐项一致,缺口 0(审计脚本重跑确认) |
类型侧(同一类型双名,不杜撰上游没有的名称):新增 57 个 `XxxRootProps`(上表 55 项减 MenuItem/MenuSection 加 AlertDialog/Drawer)+ `MenuItemRootProps`、`MenuSectionRootProps`、`MenuProps`、`DropdownProps`,共 59 个。例外:上游无 `CheckboxGroupRoot`(checkbox-group 只导出 `CheckboxGroup`)故不加;上游 toast barrel 只导出 `Toast`(无 `ToastRoot`/`ToastRootProps`),本库 `ToastRoot` 值兼容名保留不删、不计入 82 对;上游无 `TagProps`(只有 `TagRootProps`),本库 `TagProps` 旧名保留;`ColorField*` 等 3 项经 `export type *` 已有 RootProps,非缺口。上游 `Xxx.Props` 复合类型命名空间属 React 类型机制,列为框架语义差异,不平移。
## 二、ProgressBar 演示回填
`apps/docs/demos/progress-bar-custom-value.vue`(预览/复制/高亮同一 SFC,文件名未变)用包根公共 NumberField(Group/Input/IncrementButton/DecrementButton)替换三个原生 number input,公共 Select(Trigger/Value/Indicator/Popover + ListBox/ListBoxItem/Indicator)替换原生 select;保留固定源中文文案、顺序、布局、初始 750/0/1000、四格式选项与 `variant="secondary"`。边界沿用既有处理并明确:清空/无效草稿拒绝并恢复上一接受值;越界提交收敛到当前范围。`progress-bar.md` 与 `compatibility.md` 的“原生临时控件”陈述已修正;其他 progress/indicator 演示扫描无同类临时替代。
## 场景与证据
| 验收场景 | 断言或复现步骤 | 实际结果 |
| --- | --- | --- |
| 别名完整清单 | `node scripts/task-check.mjs` 前置 + 审计脚本对照上游 barrel | 55 项与报告口径一致(55 缺 Root + 1 反向 `Dropdown`);重跑缺口 0 |
| 别名身份等价 | `node scripts/check-package.mjs api-root-aliases`(`check-client.mjs` 遍历 82 对 `lib[a]===lib[b]`、164 具名导出) | 通过(最终 tarball) |
| 别名类型/事件/插槽/实例 | `tests/package/api-root-aliases-contract.ts` strict NodeNext/bundler 正反例(`Same<>` 等价、`h()` 属性/事件/插槽、`@ts-expect-error` 变体与事件负载反例) | 通过(最终 tarball;泛型函数式 ListBox/Calendar 以组件对象等价覆盖实例成员) |
| 演示输入/步进 | `pnpm exec vitest run tests/progress-meter.test.ts`(6 个 custom-value 用例)+ 真实浏览器键入 500 → 500/50%/50%;增/减按钮 → 501(fill 50.1%)/500 | 通过 |
| 清空/无效草稿 | 单测:清空/`abc`/`-` 拒绝恢复、无 NaN;浏览器:清空 + Tab 恢复“500”,字母被输入层过滤 | 通过 |
| 动态上下限 | 单测 + 浏览器:min→800 时值 200→800(min=800、输出 0%);max→600 时值 900→600(max=600、输出 100%、增量按钮禁用) | 通过 |
| 四格式与键盘 | 浏览器 Select:ArrowDown 打开面板(208×168、4 项可见可点)→ ArrowDown+Enter 选 小数/单位(输出 600 / 600英里,页内 Intl 计算一致);点击 货币 → US$600.00,面板关闭、选择值回显 | 通过 |
| 浅深主题/窄屏/控制台 | 明确深色与浅色各截图;390px 同源 iframe:documentScrollWidth==clientWidth==390 无页面横向溢出、演示纵排、表无溢出;console 无 warn/error | 通过(截图存 opencode-browser 临时目录) |
| 单测/类型/文档构建 | `pnpm exec vitest run tests/progress-meter.test.ts tests/number-field.test.ts tests/select.test.ts tests/docs-shell.test.ts`(91 项)、`pnpm typecheck`、`pnpm build:docs` | 通过(chunk 大小提示为既有) |
| 最终产物回归 | `node scripts/check-package.mjs api-root-aliases form avatar b01-menu-dropdown` | 通过 |
| 文档排序 | 对照固定 meta.json 逐项审计 74 项:仅 `dropdown` 错位(位于 link 后),已归位 drawer 后;empty-state/header 为真实 Vue 页按字母位;类别全匹配;`docs-shell.test.ts` 增加固定顺序断言 | 通过 |
相关命令:
```sh
pnpm exec vitest run tests/progress-meter.test.ts tests/number-field.test.ts tests/select.test.ts tests/docs-shell.test.ts
pnpm typecheck
pnpm build:docs
node scripts/check-package.mjs api-root-aliases form avatar b01-menu-dropdown
```
## 缺陷修复(随本任务)
NumberFieldInput 的 `keydown` 在任意按键后 `nextTick(restore)`,会把同任务内真实键入的字符还原(同任务 keydown+insertText 探针:`1,0005` 微任务后回退 `1,000`;逐步键入/退格呈“每次从提交文本重算”)。已改为仅状态键(步进/边界/Enter)恢复提交文本,普通键入保留草稿;`tests/number-field.test.ts` 新增键入保留回归(16 项通过)。受影响面核对:既有受控拒绝/清空恢复、步进边界、表单用例全部保持通过。
## 未完成与限制
- 首轮实施未跑全量;后续集成复核已执行,结果见下文。
- NumberField 键入修复的真实输入链路由浏览器键入与同任务探针验证;未做人工 IME 逐输入法矩阵(不在范围)。
- 逐像素对比、完整读屏矩阵、真机矩阵、SSR/水合/Nuxt 不在范围。`ToastRoot`/`TagProps` 等本库兼容旧名保留并已记录;未新增上游不存在的名称。
- 上游 `Xxx.Props` 复合类型命名空间未平移(React 类型机制差异),如需另行立项。
## 2026-10-27 集成复核与回归修正
用户授权修正复核问题后合 main 并 push。修正提交 `593757710179859e3e5c11c8d24e938eeb572df6`,沿用任务分支及原实施基线。
| 问题 / 场景 | 证据 | 结果 |
| --- | --- | --- |
| P2:键入回归测试错开缺陷时序 | 原用例先 await keydown,导致旧 nextTick(restore) 在插入文本前执行;现改为同一同步任务派发可取消 keydown、写入文本、派发 input,随后等待刷新 | 已修正;不修改组件实现 |
| 旧实现反证 | 临时副本使用 `e0dd052` 的 NumberFieldInput 及本次修正用例;定向执行 `keeps characters typed after keydown` | 按预期失败:期望 49,实际 4;副本已删除 |
| 当前实现验证 | `pnpm exec vitest run tests/number-field.test.ts -t 'keeps characters typed after keydown'` | 通过 |
| 别名审计 | 固定上游组件 barrel 的值导出与当前契约清单逐项比对 | 82 对,无缺失、无额外项 |
| 集成回归 | `pnpm test` | 109 文件 / 1602 项通过;无新增 skip |
| 类型与静态文档 | `pnpm typecheck`、`pnpm build:docs` | 通过;文档保留既有 chunk 大小提示 |
| 最终 tarball | `node scripts/check-package.mjs api-root-aliases form avatar b01-menu-dropdown` | 四契约 ESM/CSS 与 NodeNext/bundler 类型正反例通过;普通沙箱 DNS 失败后联网重跑成功 |
本次未重复浏览器操作;正式演示浏览器证据沿用上述实施记录,不将本次单测描述为浏览器验收。复核问题已关闭,任务 accepted。准确合并及推送状态见 ACTIVE 与后续集成记录。
集成完成:main 合并提交 `08c9bf5767b8c613518a678df9c419cfd432962a`,包含验收提交 `bdbb2cb`。合并无冲突,代码树与通过验证的任务分支一致,仅后续交接文档更新;按用户授权推送 origin/main。
+42
View File
@@ -0,0 +1,42 @@
# AVATAR 交付
- 主会话亲自实施、自测,未委派其他AI;不声称独立复核。
- 分支:`feat/avatar-complete`;起点 `6de246de49cfdb0ce8c8770de9049d6e7644e4ed`(任务卡已提交);先前main `c05cc7dfa79c7657d78f376f23ed1912c83f3bf0`。
- 实施:`fa8b22719ece4ad0c6c3a93caeb77c871da28de2`。用户授权提交并合main,本轮未push。
- 固定源:HeroUI 3.2.6 / `ce90ea3ab49d58f6c428f71bfd6fe8ae2a87b960`,通过git show核对,不依赖参考仓库构建。
| 场景 | 断言/复现 | 结果 |
| --- | --- | --- |
| 自定义图片组合 | `tests/avatar-loading.test.ts` 直接挂载正式custom-image-component示例,确认单一img、子组件alt/width、库class、加载后fallback移除 | 修复前无img;修复后通过 |
| 原生事件和动态属性 | asChild下srcSet/sizes、子class、title更新;实际img各触发一次load/error | 通过;公开事件类型为Event |
| 换图/失败/恢复 | 模拟真实预加载事件:成功→新src加载隐藏→error回退→新src成功 | 通过,Reka继续持有图片状态 |
| 零/正延迟与卸载 | 省略src + delayMs=0显示JD;599ms无/600ms有;待定延迟改0立即出现,卸载清理定时器 | 修复前0永久隐藏;修复后通过 |
| 部件替换 | Root asChild div、Fallback asChild strong,attrs/class保持;发布类型含三部件as/asChild、可选src、AvatarRootProps | 通过 |
| 既有头像组及attrs | `pnpm exec vitest run tests/close-button-avatar-skeleton.test.ts tests/avatar-loading.test.ts` | 2文件/37项通过,保留组直接子级继承 |
| 样式/示例源核对 | CSS仅hv命名空间和来源注释差异;variants尺寸/颜色/变体保持;以下7例核销 | 无视觉数值变更 |
| 全量客户端 | `pnpm test` | 108文件/1577项通过 |
| 类型/文档 | `pnpm typecheck`、`pnpm build:docs` | 通过;构建保留已有chunk大小提示 |
| 最终tarball | `node scripts/check-package.mjs avatar`,独立安装最终两包,ESM/CSS、strict NodeNext/bundler正反例 | 通过;含AvatarRootProps;离线初试缺缓存,沙箱内联网DNS失败后使用获准联网环境通过,未把失败记为成功 |
| 浏览器 | 现有5173服务 `/components/avatar`;检查实际img loaded/naturalWidth和display、sm/md/lg几何、主题、失败示例NA、控制台 | 自定义图片40px加载可见;尺寸32/40/48px;浅/深色通过;562px viewport/document均562无整页横向溢出;warn/error为空 |
## 固定源7例核销
| 示例 | 核对内容与Vue适配 |
| --- | --- |
| basic | 两张源图、alt与JD/B/JR回退保持 |
| sizes | sm/md/lg与蓝/紫/红源图、SM/MD/LG保持 |
| colors | default/accent/success/warning/danger、DF/AC/SC/WR/DG顺序保持 |
| variants | 五颜色×字母/柔和字母/图标/柔和图标/图片、中文标签和源图保持;图标按项目约定使用Tabler IconUser |
| fallback | 文字、图标、600ms失败图、自定义渐变四组合保持 |
| custom-image-component | Next Image转换为透传attrs的Vue FrameworkImage;同源40×40、alt保持;本轮修复实际槽内容丢失 |
| custom-styles | rounded-lg、张三及源图保持 |
预览、复制、高亮仍共用既有同一SFC;未用自编页面替代固定例。浏览器截图为临时产物,以上步骤/断言在仓库可复现。
## 当前差异与限制
React复合对象/合成事件/ref映射为Vue具名组件、插槽、Event和根实例$el。加载中img采用Reka的display:none保留DOM;预加载仅探测src,srcSet/sizes只透传实际图片,只有srcSet且省略src不会显示图片。asChild依赖子组件正确透传attrs。动态正延迟更新会重新计时;0/省略立即可回退。已在组件文档明确,未宣称全部Radix能力完全兼容。
仅客户端。未执行SSR/水合/Nuxt服务端、逐像素自动对比、完整读屏或真机矩阵;562px为本轮窄屏实际值,不冒充390px/真机验收。AvatarGroup未在本轮升级整族验收状态。无本任务内剩余阻断。
合并提交 `8f3880073db8cbdea4333ab95d6ee88a2dd779d7`;main集成回归再次108文件/1577项通过。仅合并后的交接/验证记录更新,无后续实现修改。
+50
View File
@@ -0,0 +1,50 @@
# FORM 交付
- 主会话亲自实施/自测,未委派其他AI,不声称独立复核。
- 分支 `feat/form-public`;起点 `f424fa559725ef62909eccf56c9d63a3f0e161e6`(任务卡已集成);此前main `ee43cc615d2529daf591e95b0fa354bde10af392`。
- 实施提交 `2c221e09954aaa21d6bb72040db429ce48643e73`。沿用用户授权,验证通过后提交并合main;本轮不push。
- 固定源 HeroUI 3.2.6 / `ce90ea3ab49d58f6c428f71bfd6fe8ae2a87b960`:Form源码/index、中文form.mdx及全部3例;通过只读git show核对。
| 场景/改动 | 断言或复现步骤 | 实际结果/边界 |
| --- | --- | --- |
| basic固定例 | 官方邮箱正则、密码长度/大写/数字规则、邮箱/密码标签/描述、提交/重置及Check图标;直接挂载正式SFC | 通过;Tabler IconCheck、页内status替代alert、max-w-full为明确适配 |
| render-function固定例 | 同一字段/校验/布局,原生form输出data-custom=foo | 通过;React render添加属性改Vue attrs,不增加非表单根API |
| custom-styles固定例 | w-80/gap-3/rounded-xl/border/bg-surface/p-4/shadow-sm,工作邮箱、继续 | 通过;原生type=email/required提交校验及preventDefault有效 |
| 公开API | FormRoot同组件别名;FormProps/FormRootProps含原生属性;FormSlots/FormExpose与实例四成员 | 最终tarball bundler/NodeNext类型正反例通过 |
| invalid通知/取消焦点 | tests/form.test.ts:两个无效控件每次各一次通知;Form或字段preventDefault保留按钮焦点,提交仍阻止 | 修复前通知0次/忽略字段取消;修复后通过 |
| 首个组合字段/混合表单 | 原生input→CheckboxGroup/Switch的无效混合;取消组合字段焦点;checkValidity不聚焦 | 通过;choice共享invalidEvent及Switch保留错误更新并尊重取消;后续字段不抢焦点 |
| 外部form关联 | form外required input通过form=id关联;校验、通知及取消聚焦 | 通过;DOM关联不会跨Vue祖先注入服务端错误上下文 |
| 重复校验/实例 | checkValidity/reportValidity返回boolean,每个控件每次仅一次invalid;实例reset恢复原生值 | 通过;不调用第二次控件reportValidity产生重复事件 |
| 原生取消/跳过 | submit/reset preventDefault、submitter.formNoValidate、novalidate空/字符串/布尔false语义、动态action/method/data-custom | 通过;字符串false仍是存在的原生布尔属性,绑定boolean false才不跳过 |
| 字段共享回归 | 受控拒绝、取消reset、服务器错误替换、native/aria/字段覆盖、Fieldset/Choice/Select/ComboBox/Autocomplete | 相关7文件165项通过;原有字段值协议不重写 |
| 文档/导航 | 独立Form页按源标题/示例顺序/API/校验/提交/集成/无障碍组织,预览/复制/高亮同SFC;fields交叉链接 | 通过;Form源无专用CSS,stylesSource:false隐藏不存在的form.css链接;未新增variants |
| 类型 | pnpm typecheck | 通过 |
| 文档构建 | pnpm build:docs | 最终代码通过,保留已有chunk大小提示 |
| 最终产物 | node scripts/check-package.mjs form | 独立tarball安装、ESM导出/CSS、strict NodeNext/bundler正反例通过;在获准联网环境安装依赖 |
| 全量客户端 | pnpm test | 最终109文件/1594项通过 |
相关回归命令:
```sh
pnpm exec vitest run tests/form.test.ts tests/field-foundation.test.ts tests/choice-fields.test.ts tests/fieldset-search-field.test.ts tests/select.test.ts tests/autocomplete.test.ts tests/combo-box.test.ts
```
## 真实浏览器证据
使用既有5173工作区源码服务,未停止他人服务。页面 `/components/form`:
1. 1280px浅色,点击basic空表单提交,显示“请输入有效的邮箱地址”及“密码至少需要8个字符”,焦点在email;输入合法邮箱与Password,点击提交,缺数字错误显示且焦点在password。
2. 改Password1并在密码输入框按Enter,页内提交结果显示email=john@example.com、password=Password1;真实点击重置后两值为空、aria-invalid与结果移除。
3. render-function例输入jane@example.com/Password2,真实点击提交,data-custom=foo的同一form保留正确数据与结果。custom-styles例输入you@company.com点击继续,控件validity.valid=true且未导航。
4. 1280px三例实际宽384/384/320px;显式viewport=390×844时,documentWidth=390,三例width均316px,scrollWidth≤clientWidth;API两表width/scrollWidth均350px,无整页横向溢出。
5. 390px深色空表单点击提交,错误与email焦点正常;保存截图并目视检查。浏览器warn/error为空。测试后恢复跟随系统及默认viewport,保留Form文档预览。
浏览器验证针对工作区源码;独立最终tarball本轮验证ESM/CSS与发布类型,没有把两者混称为独立消费者浏览器验收。
## 当前差异与限制
Form始终原生form;React render以attrs/默认插槽替代。class/style/ARIA/native attrs直接透传。DOM总有novalidate,由本库按字段策略控制验证;显式novalidate/formnovalidate跳过提交检查。check/report/submit会触发invalid,report/submit默认聚焦首个无效字段;错误通过FieldError呈现,不承诺浏览器原生校验气泡。原生element.submit()绕过事件/校验,常规使用requestSubmit()。
不提供React函数action、React Form Context、完整RAC ValidationResult;同步validate不接Promise,服务器响应对象更新/异步竞态由调用方处理,复杂字段差异仍见各页。源官方3例已全部迁移,本任务无剩余阻断。仅客户端;SSR/水合/Nuxt服务端、逐像素自动对比、完整读屏/真机矩阵不在范围。
合并提交 `0847db9ae02eb4266301f398f37ac9397496aa83`;main集成全量回归再次109文件/1594项通过。随后仅更新本验收/交接记录,无实现修改。
+8
View File
@@ -320,3 +320,11 @@ CSS/tv 仅加 `hv-` 前缀与 Apache-2.0 来源,`size/variant/layout` 默认 `
CSS/tv 仅加 `hv-` 前缀与 Apache-2.0 来源;`colorPickerVariants` 保持基线的 base/trigger/popover 三槽、无 size/variant。差异有记录的适配:`origin-(--trigger-anchor-point)` → `--reka-popper-transform-origin`,`data-placement^` 方向动画 → `data-side`,弹层 `max-height` 取 `--reka-popover-content-available-height`,退出动画保留 `pointer-events: none` 与 reduced-motion 停用。
行为契约审计了固定依赖的官方发布源码(`react-aria-components@1.21.1` 的 ColorPicker 私有实现与类型声明、`react-stately` `useColorPickerState`),未安装或执行 React。要点:无值时默认 `#000000`(`props.defaultValue || '#000000'`)、受控 `null` 视为非受控、`setColor(null)` 改写为 `#000000`;本库共享 owner 拒绝空提案并保持接受颜色(差异已记录)。固定源 Root 经 `DialogTrigger` 内部管理展开,`open`/`isOpen`/`defaultOpen` 受控展开为 Vue 适配扩展;Trigger 的 Button render props 收敛为 `color`/`isDisabled` 插槽状态;`name`/`form` 单值提交与 `isDisabled`/`isReadOnly` 为 Vue 扩展,不冒充 RAC 原能力。来源与差异见 [任务结果](tasks/results/COLOR-PICKER.md)。
## AVATAR 迁移补齐(2026-10-27)
重新核对固定提交 `ce90ea3ab49d58f6c428f71bfd6fe8ae2a87b960` 的 `packages/react/src/components/avatar/{avatar.tsx,index.ts}`、Avatar CSS/variants、中文 `(media)/avatar.mdx` 与 `apps/docs/src/demos/cn/avatar` 全7例。保留既有来源/许可与hv命名空间、全部视觉数值;补Image默认插槽、可选src、Root别名/部件替换/原生事件类型及零延迟适配。仍用Reka处理图片状态,框架/预加载差异见组件文档与 [结果](tasks/results/AVATAR.md)。
## FORM(2026-10-27)
固定 `ce90ea3ab49d58f6c428f71bfd6fe8ae2a87b960`:`packages/react/src/components/form/{form.tsx,index.ts}`、中文 `(forms)/form.mdx` 与 `apps/docs/src/demos/cn/form/{basic,render-function,custom-styles}.tsx`。源无专用CSS/variants;复用已有字段样式。保留3例布局、文案、验证规则与字段,render添加data-custom改为Vue attrs、Gravity Check图标用Tabler IconCheck、alert提交反馈改页内status、增加max-w-full适应窄屏;差异见 [Form文档](../apps/docs/components/form.md)。
@@ -7,6 +7,8 @@ import { avatarContextKey, avatarGroupContextKey } from "./context";
defineOptions({ inheritAttrs: false });
const props = defineProps<{
as?: string;
asChild?: boolean;
color?: AvatarVariants["color"];
size?: AvatarVariants["size"];
variant?: AvatarVariants["variant"];
@@ -45,7 +47,13 @@ provide(avatarContextKey, { slots });
</script>
<template>
<AvatarRoot v-bind="attrs" :class="slots.base()" :data-slot="dataSlot">
<AvatarRoot
v-bind="attrs"
:as="as"
:as-child="asChild"
:class="slots.base()"
:data-slot="dataSlot"
>
<slot />
</AvatarRoot>
</template>
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { inject, useAttrs } from "vue";
import { inject, ref, watch, useAttrs } from "vue";
import { AvatarFallback } from "reka-ui";
import { avatarVariants, type AvatarVariants } from "@heroui-vue/styles";
import { avatarContextKey } from "./context";
@@ -7,10 +7,29 @@ import { avatarContextKey } from "./context";
defineOptions({ inheritAttrs: false });
const props = defineProps<{
as?: string;
asChild?: boolean;
delayMs?: number;
color?: AvatarVariants["color"];
}>();
// Keep loading ownership in Reka; normalize the delay independently because
// its truthy delay check leaves delayMs=0 hidden forever.
const canRender = ref(false);
watch(
() => props.delayMs,
(delay, _, onCleanup) => {
canRender.value = delay === undefined || delay <= 0;
if (!canRender.value) {
const timer = setTimeout(() => {
canRender.value = true;
}, delay);
onCleanup(() => clearTimeout(timer));
}
},
{ immediate: true },
);
const attrs = useAttrs();
const ctx = inject(avatarContextKey, undefined);
@@ -36,8 +55,10 @@ function fallbackClass() {
<template>
<AvatarFallback
v-if="canRender"
v-bind="restAttrs()"
:delay-ms="delayMs"
:as="as"
:as-child="asChild"
:class="fallbackClass()"
data-slot="avatar-fallback"
>
@@ -6,16 +6,19 @@ import { avatarContextKey } from "./context";
defineOptions({ inheritAttrs: false });
defineProps<{
src: string;
src?: string;
as?: string;
alt?: string;
asChild?: boolean;
crossOrigin?: "" | "anonymous" | "use-credentials";
loading?: "eager" | "lazy";
sizes?: string;
srcSet?: string;
referrerPolicy?: string;
referrerPolicy?: import("vue").ImgHTMLAttributes["referrerpolicy"];
}>();
const emit = defineEmits<{ load: [event: Event]; error: [event: Event] }>();
const attrs = useAttrs();
const ctx = inject(avatarContextKey, undefined);
const imageClass = computed(
@@ -26,7 +29,8 @@ const imageClass = computed(
<template>
<AvatarImage
v-bind="attrs"
:src="src"
:src="src ?? ''"
:as="as"
:alt="alt"
:as-child="asChild"
:crossorigin="crossOrigin"
@@ -35,6 +39,10 @@ const imageClass = computed(
:srcset="srcSet"
:referrerpolicy="referrerPolicy"
:class="imageClass"
@load="emit('load', $event)"
@error="emit('error', $event)"
data-slot="avatar-image"
/>
>
<slot />
</AvatarImage>
</template>
+2 -1
View File
@@ -189,9 +189,10 @@ export function useChoiceField<T>(
dismissed.value = form?.validationErrors.value;
}
function invalidEvent(event: Event, focus: () => void) {
const canceled = event.defaultPrevented;
event.preventDefault();
touched.value = true;
void nextTick(focus);
if (!canceled) void nextTick(focus);
}
function validity(control: HTMLInputElement | undefined) {
control?.setCustomValidity(
+67 -18
View File
@@ -1,5 +1,12 @@
<script setup lang="ts">
import { computed, provide, ref, useAttrs } from "vue";
import {
computed,
provide,
ref,
useAttrs,
onMounted,
onBeforeUnmount,
} from "vue";
import {
formContextKey,
type ValidationBehavior,
@@ -13,39 +20,81 @@ const props = withDefaults(
}>(),
{ validationBehavior: "native", validationErrors: () => ({}) },
);
const emit = defineEmits<{ invalid: [event: Event] }>();
defineSlots<{ default?: () => unknown }>();
const attrs = useAttrs();
provide(formContextKey, {
validationBehavior: computed(() => props.validationBehavior),
validationErrors: computed(() => props.validationErrors),
});
const element = ref<HTMLFormElement>();
let validation: { report: boolean; first?: EventTarget | null } | undefined;
function invalid(event: Event) {
// Native invalid does not bubble. Forward it during capture, while preserving
// the same cancelable event for consumer-controlled focus management.
if ((event.target as HTMLInputElement).form !== element.value) return;
emit("invalid", event);
// Composite fields redirect focus from their validation proxy. Only the
// first invalid field may do so during report/submit, none during check.
if (validation) {
if (!validation.report || validation.first) event.preventDefault();
validation.first ??= event.target;
}
}
// Use a native capture listener: a Vue capture invoker stamps invalid events
// before child Vue listeners run, which can suppress freshly mounted fields'
// handlers in the same millisecond. Do not touch Vue's private event markers.
onMounted(() => element.value?.addEventListener("invalid", invalid, true));
onBeforeUnmount(() =>
element.value?.removeEventListener("invalid", invalid, true),
);
function checkValidity(report = false) {
let first:
HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | undefined;
for (const control of Array.from(element.value?.elements ?? [])) {
if (
!("checkValidity" in control) ||
(control.getAttribute("data-validation-behavior") ??
props.validationBehavior) === "aria"
)
continue;
const field = control as
HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
if (!field.checkValidity() && !first) first = field;
}
if (report && first) {
first.focus();
first.reportValidity();
let firstEvent: Event | undefined;
const previous = validation;
validation = { report };
try {
for (const control of Array.from(element.value?.elements ?? [])) {
if (
!("checkValidity" in control) ||
(control.getAttribute("data-validation-behavior") ??
props.validationBehavior) === "aria"
)
continue;
const field = control as
HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
let invalidEvent: Event | undefined;
const observe = (event: Event) => {
invalidEvent = event;
// Associated controls outside the form DOM cannot reach its capture
// listener, but are still part of the native form.elements collection.
if (!element.value?.contains(field)) invalid(event);
};
field.addEventListener("invalid", observe, true);
try {
if (!field.checkValidity() && !first) {
first = field;
firstEvent = invalidEvent;
}
} finally {
field.removeEventListener("invalid", observe, true);
}
}
} finally {
validation = previous;
}
// A second reportValidity() on the control would dispatch invalid twice.
// FieldError provides the message; only apply the form's default focus here.
if (report && first && !firstEvent?.defaultPrevented) first.focus();
return !first;
}
function submit(event: Event) {
const submitter = (event as SubmitEvent).submitter as
HTMLButtonElement | HTMLInputElement | null;
const booleanAttribute = (value: unknown) => value != null && value !== false;
const skip =
attrs.novalidate === "" ||
attrs.novalidate === true ||
attrs.noValidate === true;
booleanAttribute(attrs.novalidate) || booleanAttribute(attrs.noValidate);
if (!skip && !submitter?.formNoValidate && !checkValidity(true)) {
event.preventDefault();
event.stopImmediatePropagation();
@@ -53,40 +53,49 @@ export default defineComponent({
if (event.defaultPrevented || event.isComposing || composing.value)
return;
if (field.disabled.value || field.readOnly.value) return;
// 只有状态键(步进/边界/提交)才在下一刷新恢复提交文本。
// 普通键入必须保留草稿,否则同任务内键入的字符会被还原。
let restoreAfter = false;
switch (event.key) {
case "ArrowUp":
event.preventDefault();
number.handleIncrease();
restoreAfter = true;
break;
case "ArrowDown":
event.preventDefault();
number.handleDecrease();
restoreAfter = true;
break;
case "PageUp":
event.preventDefault();
number.handleIncrease(10);
restoreAfter = true;
break;
case "PageDown":
event.preventDefault();
number.handleDecrease(10);
restoreAfter = true;
break;
case "Home":
if (number.min.value !== undefined) {
event.preventDefault();
number.handleMinMaxValue("min");
restoreAfter = true;
}
break;
case "End":
if (number.max.value !== undefined) {
event.preventDefault();
number.handleMinMaxValue("max");
restoreAfter = true;
}
break;
case "Enter":
commit();
break;
}
void nextTick(restore);
if (restoreAfter) void nextTick(restore);
}
function beforeinput(event: InputEvent) {
if (event.defaultPrevented || event.isComposing || composing.value)
@@ -167,9 +167,11 @@ watchEffect(() => {
);
});
function onInvalid(event: Event) {
const canceled = event.defaultPrevented;
event.preventDefault();
showError.value = true;
element.value?.querySelector<HTMLButtonElement>("[role=switch]")?.focus();
if (!canceled)
element.value?.querySelector<HTMLButtonElement>("[role=switch]")?.focus();
}
function reset(event: Event) {
void nextTick(() => {
+140 -3
View File
@@ -1,7 +1,11 @@
export { default as Button } from "./components/button/Button.vue";
export { default as ButtonRoot } from "./components/button/Button.vue";
export { default as Card } from "./components/card/Card.vue";
export { default as CardRoot } from "./components/card/Card.vue";
export { default as Input } from "./components/input/Input.vue";
export { default as InputRoot } from "./components/input/Input.vue";
export { default as Switch } from "./components/switch/Switch.vue";
export { default as SwitchRoot } from "./components/switch/Switch.vue";
export { default as CardHeader } from "./components/card/CardHeader.vue";
export { default as CardTitle } from "./components/card/CardTitle.vue";
export { default as CardDescription } from "./components/card/CardDescription.vue";
@@ -12,7 +16,9 @@ export { default as SwitchControl } from "./components/switch/SwitchControl.vue"
export { default as SwitchThumb } from "./components/switch/SwitchThumb.vue";
export { default as SwitchIcon } from "./components/switch/SwitchIcon.vue";
export { default as Label } from "./components/label/Label.vue";
export { default as LabelRoot } from "./components/label/Label.vue";
export { default as Description } from "./components/description/Description.vue";
export { default as DescriptionRoot } from "./components/description/Description.vue";
export {
buttonVariants,
cardVariants,
@@ -65,6 +71,7 @@ export type {
TextAreaProps,
CloseButtonProps,
AvatarProps,
AvatarRootProps,
AvatarImageProps,
AvatarFallbackProps,
AvatarGroupProps,
@@ -94,23 +101,34 @@ export type {
export { tv, cn, type VariantProps } from "@heroui-vue/styles";
export { default as SwitchGroup } from "./components/switch/SwitchGroup.vue";
export { default as SwitchGroupRoot } from "./components/switch/SwitchGroup.vue";
export { default as FieldError } from "./components/field/FieldError.vue";
export { default as FieldErrorRoot } from "./components/field/FieldError.vue";
export { default as Surface } from "./components/surface/Surface.vue";
export { default as SurfaceRoot } from "./components/surface/Surface.vue";
export {
surfaceContextKey,
type SurfaceContext,
} from "./components/surface/context";
export { default as Link } from "./components/link/Link.vue";
export { default as LinkRoot } from "./components/link/Link.vue";
export { default as LinkIcon } from "./components/link/LinkIcon.vue";
export { default as Spinner } from "./components/spinner/Spinner.vue";
export { default as SpinnerRoot } from "./components/spinner/Spinner.vue";
export { default as TextArea } from "./components/textarea/TextArea.vue";
export { default as TextAreaRoot } from "./components/textarea/TextArea.vue";
export { default as CloseButton } from "./components/close-button/CloseButton.vue";
export { default as Avatar } from "./components/avatar/Avatar.vue";
export { default as CloseButtonRoot } from "./components/close-button/CloseButton.vue";
export {
default as Avatar,
default as AvatarRoot,
} from "./components/avatar/Avatar.vue";
export { default as AvatarImage } from "./components/avatar/AvatarImage.vue";
export { default as AvatarFallback } from "./components/avatar/AvatarFallback.vue";
export { default as AvatarGroup } from "./components/avatar/AvatarGroup.vue";
export { default as AvatarGroupRoot } from "./components/avatar/AvatarGroup.vue";
export { default as AvatarGroupCount } from "./components/avatar/AvatarGroupCount.vue";
export {
AVATAR_GROUP_CHILD,
@@ -122,9 +140,12 @@ export {
type AvatarSlots,
} from "./components/avatar/context";
export { default as Skeleton } from "./components/skeleton/Skeleton.vue";
export { default as SkeletonRoot } from "./components/skeleton/Skeleton.vue";
export { default as Separator } from "./components/separator/Separator.vue";
export { default as SeparatorRoot } from "./components/separator/Separator.vue";
export { default as Kbd } from "./components/kbd/Kbd.vue";
export { default as KbdRoot } from "./components/kbd/Kbd.vue";
export { default as KbdAbbr } from "./components/kbd/KbdAbbr.vue";
export { default as KbdContent } from "./components/kbd/KbdContent.vue";
export {
@@ -138,6 +159,7 @@ export {
type KbdSlots,
} from "./components/kbd/context";
export { default as Chip } from "./components/chip/Chip.vue";
export { default as ChipRoot } from "./components/chip/Chip.vue";
export { default as ChipLabel } from "./components/chip/ChipLabel.vue";
export {
chipContextKey,
@@ -146,6 +168,7 @@ export {
} from "./components/chip/context";
export { default as Badge } from "./components/badge/Badge.vue";
export { default as BadgeRoot } from "./components/badge/Badge.vue";
export { default as BadgeAnchor } from "./components/badge/BadgeAnchor.vue";
export { default as BadgeLabel } from "./components/badge/BadgeLabel.vue";
export {
@@ -154,6 +177,7 @@ export {
type BadgeSlots,
} from "./components/badge/context";
export { default as Alert } from "./components/alert/Alert.vue";
export { default as AlertRoot } from "./components/alert/Alert.vue";
export { default as AlertIndicator } from "./components/alert/AlertIndicator.vue";
export { default as AlertContent } from "./components/alert/AlertContent.vue";
export { default as AlertTitle } from "./components/alert/AlertTitle.vue";
@@ -166,7 +190,11 @@ export {
} from "./components/alert/context";
export { default as TextField } from "./components/textfield/TextField.vue";
export { default as Form } from "./components/form/Form.vue";
export { default as TextFieldRoot } from "./components/textfield/TextField.vue";
export {
default as Form,
default as FormRoot,
} from "./components/form/Form.vue";
export {
fieldContextKey,
formContextKey,
@@ -185,11 +213,15 @@ export { useFieldPart } from "./components/field/useFieldPart";
export type {
TextFieldProps,
FormProps,
FormRootProps,
FormSlots,
FormExpose,
DescriptionProps,
FieldErrorProps,
} from "./types";
export { default as InputGroup } from "./components/input-group/InputGroup.vue";
export { default as InputGroupRoot } from "./components/input-group/InputGroup.vue";
export { default as InputGroupInput } from "./components/input-group/InputGroupInput.vue";
export { default as InputGroupTextArea } from "./components/input-group/InputGroupTextArea.vue";
export { default as InputGroupPrefix } from "./components/input-group/InputGroupPrefix.vue";
@@ -201,6 +233,7 @@ export {
} from "./components/input-group/context";
export { default as Fieldset } from "./components/fieldset/Fieldset.vue";
export { default as FieldsetRoot } from "./components/fieldset/Fieldset.vue";
export type { FieldsetProps } from "./types";
export { default as FieldsetLegend } from "./components/fieldset/FieldsetLegend.vue";
@@ -213,6 +246,7 @@ export { default as FieldsetActions } from "./components/fieldset/FieldsetAction
export type { FieldsetActionsProps } from "./types";
export { default as SearchField } from "./components/search-field/SearchField.vue";
export { default as SearchFieldRoot } from "./components/search-field/SearchField.vue";
export type { SearchFieldProps } from "./types";
export { default as SearchFieldGroup } from "./components/search-field/SearchFieldGroup.vue";
@@ -235,7 +269,12 @@ export {
} from "@heroui-vue/styles";
export { Checkbox, Radio } from "./components/choice/item";
export {
Checkbox as CheckboxRoot,
Radio as RadioRoot,
} from "./components/choice/item";
export { CheckboxGroup, RadioGroup } from "./components/choice/group";
export { RadioGroup as RadioGroupRoot } from "./components/choice/group";
export type { CheckboxProps } from "./types";
export type { RadioProps } from "./types";
export type { CheckboxGroupProps } from "./types";
@@ -264,6 +303,7 @@ export {
} from "@heroui-vue/styles";
export { default as Typography } from "./components/typography/Typography.vue";
export { default as TypographyRoot } from "./components/typography/Typography.vue";
export { default as TypographyHeading } from "./components/typography/TypographyHeading.vue";
export { default as TypographyParagraph } from "./components/typography/TypographyParagraph.vue";
export { default as TypographyCode } from "./components/typography/TypographyCode.vue";
@@ -277,9 +317,11 @@ export type {
} from "./types";
export { default as EmptyState } from "./components/empty-state/EmptyState.vue";
export { default as EmptyStateRoot } from "./components/empty-state/EmptyState.vue";
export type { EmptyStateProps } from "./types";
export { default as Breadcrumbs } from "./components/breadcrumbs/Breadcrumbs.vue";
export { default as BreadcrumbsRoot } from "./components/breadcrumbs/Breadcrumbs.vue";
export { default as BreadcrumbsItem } from "./components/breadcrumbs/BreadcrumbsItem.vue";
export type { BreadcrumbsProps, BreadcrumbsItemProps } from "./types";
@@ -293,6 +335,7 @@ export {
} from "@heroui-vue/styles";
export { default as ProgressBar } from "./components/progress-bar/ProgressBar.vue";
export { default as ProgressBarRoot } from "./components/progress-bar/ProgressBar.vue";
export { default as ProgressBarOutput } from "./components/progress-bar/ProgressBarOutput.vue";
export { default as ProgressBarTrack } from "./components/progress-bar/ProgressBarTrack.vue";
export { default as ProgressBarFill } from "./components/progress-bar/ProgressBarFill.vue";
@@ -304,6 +347,7 @@ export type {
} from "./types";
export { default as ProgressCircle } from "./components/progress-circle/ProgressCircle.vue";
export { default as ProgressCircleRoot } from "./components/progress-circle/ProgressCircle.vue";
export { default as ProgressCircleTrack } from "./components/progress-circle/ProgressCircleTrack.vue";
export { default as ProgressCircleTrackCircle } from "./components/progress-circle/ProgressCircleTrackCircle.vue";
export { default as ProgressCircleFillCircle } from "./components/progress-circle/ProgressCircleFillCircle.vue";
@@ -315,6 +359,7 @@ export type {
} from "./types";
export { default as Meter } from "./components/meter/Meter.vue";
export { default as MeterRoot } from "./components/meter/Meter.vue";
export { default as MeterOutput } from "./components/meter/MeterOutput.vue";
export { default as MeterTrack } from "./components/meter/MeterTrack.vue";
export { default as MeterFill } from "./components/meter/MeterFill.vue";
@@ -335,6 +380,7 @@ export {
} from "@heroui-vue/styles";
export { default as Disclosure } from "./components/disclosure/Disclosure.vue";
export { default as DisclosureRoot } from "./components/disclosure/Disclosure.vue";
export { default as DisclosureHeading } from "./components/disclosure/DisclosureHeading.vue";
export { default as DisclosureTrigger } from "./components/disclosure/DisclosureTrigger.vue";
export { default as DisclosureContent } from "./components/disclosure/DisclosureContent.vue";
@@ -350,6 +396,7 @@ export type {
} from "./types";
export { default as DisclosureGroup } from "./components/disclosure-group/DisclosureGroup.vue";
export { default as DisclosureGroupRoot } from "./components/disclosure-group/DisclosureGroup.vue";
export type { DisclosureGroupProps } from "./types";
export { useDisclosureGroupNavigation } from "./components/disclosure-group/useDisclosureGroupNavigation";
export type {
@@ -359,6 +406,7 @@ export type {
export type { DisclosureKey } from "./components/disclosure-group/context";
export { default as Accordion } from "./components/accordion/Accordion.vue";
export { default as AccordionRoot } from "./components/accordion/Accordion.vue";
export { default as AccordionItem } from "./components/accordion/AccordionItem.vue";
export { default as AccordionHeading } from "./components/accordion/AccordionHeading.vue";
export { default as AccordionTrigger } from "./components/accordion/AccordionTrigger.vue";
@@ -393,6 +441,7 @@ export { default as ConfigProvider } from "./providers/ConfigProvider.vue";
export type { ConfigProviderProps } from "./types";
export { default as Modal } from "./components/modal/Modal";
export { default as ModalRoot } from "./components/modal/Modal";
export type { ModalProps } from "./types";
export { default as ModalTrigger } from "./components/modal/ModalTrigger.vue";
@@ -432,6 +481,7 @@ export { modalVariants, type ModalVariants } from "@heroui-vue/styles";
export type { ModalPlacement } from "./components/modal/context";
export { default as Popover } from "./components/popover/Popover";
export { default as PopoverRoot } from "./components/popover/Popover";
export type { PopoverProps } from "./types";
export { default as PopoverTrigger } from "./components/popover/PopoverTrigger.vue";
@@ -452,6 +502,7 @@ export type { PopoverArrowProps } from "./types";
export { popoverVariants, type PopoverVariants } from "@heroui-vue/styles";
export { default as Tooltip } from "./components/tooltip/Tooltip";
export { default as TooltipRoot } from "./components/tooltip/Tooltip";
export type { TooltipProps } from "./types";
export { default as TooltipTrigger } from "./components/tooltip/TooltipTrigger.vue";
@@ -468,6 +519,7 @@ export { tooltipVariants, type TooltipVariants } from "@heroui-vue/styles";
export type { OverlayPlacement } from "./components/overlay/placement";
export { default as ScrollShadow } from "./components/scroll-shadow/ScrollShadow.vue";
export { default as ScrollShadowRoot } from "./components/scroll-shadow/ScrollShadow.vue";
export type { ScrollShadowVisibility } from "./components/scroll-shadow/types";
export {
scrollShadowVariants,
@@ -476,6 +528,7 @@ export {
type TabsVariants,
} from "@heroui-vue/styles";
export { default as Tabs } from "./components/tabs/Tabs";
export { default as TabsRoot } from "./components/tabs/Tabs";
export { default as TabsListContainer } from "./components/tabs/TabsListContainer.vue";
export { default as TabsList } from "./components/tabs/TabsList.vue";
export { default as TabsTab } from "./components/tabs/TabsTab.vue";
@@ -501,6 +554,7 @@ export type {
} from "./types";
export { default as ButtonGroup } from "./components/button-group/ButtonGroup.vue";
export { default as ButtonGroupRoot } from "./components/button-group/ButtonGroup.vue";
export { default as ButtonGroupSeparator } from "./components/button-group/ButtonGroupSeparator.vue";
export type { ButtonGroupContextValue } from "./components/button-group/context";
export {
@@ -513,7 +567,9 @@ export {
} from "@heroui-vue/styles";
export { default as ToggleButton } from "./components/toggle-button/ToggleButton.vue";
export { default as ToggleButtonRoot } from "./components/toggle-button/ToggleButton.vue";
export { default as ToggleButtonGroup } from "./components/toggle-button-group/ToggleButtonGroup.vue";
export { default as ToggleButtonGroupRoot } from "./components/toggle-button-group/ToggleButtonGroup.vue";
export { default as ToggleButtonGroupSeparator } from "./components/toggle-button-group/ToggleButtonGroupSeparator.vue";
export type {
ToggleButtonGroupKey,
@@ -529,6 +585,7 @@ export type {
} from "./types";
export { default as Toolbar } from "./components/toolbar/Toolbar.vue";
export { default as ToolbarRoot } from "./components/toolbar/Toolbar.vue";
export type {
ToolbarOrientation,
ToolbarDir,
@@ -636,8 +693,10 @@ export {
default as ListBoxRoot,
} from "./components/list-box/ListBox.vue";
export { default as ListBoxItem } from "./components/list-box/ListBoxItem.vue";
export { default as ListBoxItemRoot } from "./components/list-box/ListBoxItem.vue";
export { default as ListBoxItemIndicator } from "./components/list-box/ListBoxItemIndicator.vue";
export { default as ListBoxSection } from "./components/list-box/ListBoxSection.vue";
export { default as ListBoxSectionRoot } from "./components/list-box/ListBoxSection.vue";
export type {
ListBoxKey,
ListBoxDataItem,
@@ -758,6 +817,9 @@ export {
default as DateInputGroup,
default as DateFieldGroup,
} from "./components/date-field/DateInputGroup.vue";
export {
default as DateInputGroupRoot,
} from "./components/date-field/DateInputGroup.vue";
export {
default as DateInputGroupInput,
default as DateFieldInput,
@@ -1007,10 +1069,15 @@ export type { CalendarYearState as CalendarYearPickerCellRenderProps } from "./c
export { default as Menu } from "./components/menu/Menu.vue";
export { default as MenuRoot } from "./components/menu/Menu.vue";
export { default as MenuItem } from "./components/menu-item/MenuItem.vue";
export { default as MenuItemRoot } from "./components/menu-item/MenuItem.vue";
export { default as MenuItemIndicator } from "./components/menu-item/MenuItemIndicator.vue";
export { default as MenuItemSubmenuIndicator } from "./components/menu-item/MenuItemSubmenuIndicator.vue";
export { default as MenuSection } from "./components/menu-section/MenuSection.vue";
export { default as DropdownRoot } from "./components/dropdown/DropdownRoot.vue";
export { default as MenuSectionRoot } from "./components/menu-section/MenuSection.vue";
export {
default as Dropdown,
default as DropdownRoot,
} from "./components/dropdown/DropdownRoot.vue";
export { default as DropdownTrigger } from "./components/dropdown/DropdownTrigger.vue";
export { default as DropdownPopover } from "./components/dropdown/DropdownPopover.vue";
export { default as DropdownMenu } from "./components/dropdown/DropdownMenu.vue";
@@ -1047,9 +1114,17 @@ export type {
DropdownSubmenuIndicatorProps,
DropdownSubmenuTriggerProps,
} from "./types-menu";
export type {
MenuItemRootProps,
MenuSectionRootProps,
MenuProps,
DropdownProps,
} from "./types-menu";
export { default as Tag } from "./components/tag/Tag.vue";
export { default as TagRoot } from "./components/tag/Tag.vue";
export { default as TagGroup } from "./components/tag/TagGroup.vue";
export { default as TagGroupRoot } from "./components/tag/TagGroup.vue";
export { default as TagGroupList } from "./components/tag/TagGroupList.vue";
export { default as TagRemoveButton } from "./components/tag/TagRemoveButton.vue";
export type {
@@ -1066,6 +1141,7 @@ export type {
} from "./components/tag/context";
export { default as ErrorMessage } from "./components/error-message/ErrorMessage.vue";
export { default as ErrorMessageRoot } from "./components/error-message/ErrorMessage.vue";
export type { ErrorMessageProps } from "./types";
export {
@@ -1078,6 +1154,7 @@ export {
} from "@heroui-vue/styles";
export { default as ComboBox } from "./components/combo-box/ComboBox.vue";
export { default as ComboBoxRoot } from "./components/combo-box/ComboBox.vue";
export { default as ComboBoxInputGroup } from "./components/combo-box/ComboBoxInputGroup.vue";
export { default as ComboBoxTrigger } from "./components/combo-box/ComboBoxTrigger.vue";
export { default as ComboBoxValue } from "./components/combo-box/ComboBoxValue.vue";
@@ -1105,6 +1182,7 @@ export type { ComboBoxModelValue };
export { comboBoxVariants, type ComboBoxVariants } from "@heroui-vue/styles";
export { default as Autocomplete } from "./components/autocomplete/Autocomplete.vue";
export { default as AutocompleteRoot } from "./components/autocomplete/Autocomplete.vue";
export { default as AutocompleteTrigger } from "./components/autocomplete/AutocompleteTrigger.vue";
export { default as AutocompleteValue } from "./components/autocomplete/AutocompleteValue.vue";
export { default as AutocompleteIndicator } from "./components/autocomplete/AutocompleteIndicator.vue";
@@ -1368,3 +1446,62 @@ export {
export type * from "./components/color-picker/types";
export { colorPickerVariants } from "@heroui-vue/styles";
export type { ColorPickerVariants } from "@heroui-vue/styles";
/* Root 别名类型:对齐固定上游公开的 XxxRootProps 命名,与同名 XxxProps 为同一类型。 */
export type {
AccordionRootProps,
AlertRootProps,
AlertDialogRootProps,
AutocompleteRootProps,
AvatarGroupRootProps,
BadgeRootProps,
BreadcrumbsRootProps,
ButtonRootProps,
ButtonGroupRootProps,
CardRootProps,
CheckboxRootProps,
ChipRootProps,
CloseButtonRootProps,
ComboBoxRootProps,
DateInputGroupRootProps,
DescriptionRootProps,
DisclosureRootProps,
DisclosureGroupRootProps,
DrawerRootProps,
EmptyStateRootProps,
ErrorMessageRootProps,
FieldErrorRootProps,
FieldsetRootProps,
InputRootProps,
InputGroupRootProps,
KbdRootProps,
LabelRootProps,
LinkRootProps,
ListBoxItemRootProps,
ListBoxSectionRootProps,
MeterRootProps,
ModalRootProps,
PopoverRootProps,
ProgressBarRootProps,
ProgressCircleRootProps,
RadioRootProps,
RadioGroupRootProps,
ScrollShadowRootProps,
SearchFieldRootProps,
SeparatorRootProps,
SkeletonRootProps,
SpinnerRootProps,
SurfaceRootProps,
SwitchRootProps,
SwitchGroupRootProps,
TabsRootProps,
TagRootProps,
TagGroupRootProps,
TextAreaRootProps,
TextFieldRootProps,
ToggleButtonRootProps,
ToggleButtonGroupRootProps,
ToolbarRootProps,
TooltipRootProps,
TypographyRootProps,
} from "./types";
+6
View File
@@ -38,3 +38,9 @@ export type DropdownSubmenuIndicatorProps = MenuItemSubmenuIndicatorProps;
export type DropdownSubmenuTriggerProps = InstanceType<
typeof DropdownSubmenuTrigger
>["$props"];
/** Root 别名类型:对齐上游 MenuRootProps/MenuProps、DropdownRootProps/DropdownProps 双名导出。 */
export type MenuItemRootProps = MenuItemProps;
export type MenuSectionRootProps = MenuSectionProps;
export type MenuProps = MenuRootProps;
export type DropdownProps = DropdownRootProps;
+73 -1
View File
@@ -55,6 +55,7 @@ export type SpinnerProps = InstanceType<typeof Spinner>["$props"];
export type TextAreaProps = InstanceType<typeof TextArea>["$props"];
export type CloseButtonProps = InstanceType<typeof CloseButton>["$props"];
export type AvatarProps = InstanceType<typeof Avatar>["$props"];
export type AvatarRootProps = AvatarProps;
export type AvatarImageProps = InstanceType<typeof AvatarImage>["$props"];
export type AvatarFallbackProps = InstanceType<typeof AvatarFallback>["$props"];
export type AvatarGroupProps = InstanceType<typeof AvatarGroup>["$props"];
@@ -107,7 +108,20 @@ import type Form from "./components/form/Form.vue";
import type Description from "./components/description/Description.vue";
import type FieldError from "./components/field/FieldError.vue";
export type TextFieldProps = InstanceType<typeof TextField>["$props"];
export type FormProps = InstanceType<typeof Form>["$props"];
export type FormProps = InstanceType<typeof Form>["$props"] &
Omit<import("vue").FormHTMLAttributes, "onSubmit" | "onReset" | "onInvalid"> & {
noValidate?: boolean;
onSubmit?: (event: SubmitEvent) => void;
onReset?: (event: Event) => void;
};
export type FormRootProps = FormProps;
export interface FormSlots {
default?: () => import("vue").VNodeChild;
}
export type FormExpose = Pick<
InstanceType<typeof Form>,
"element" | "checkValidity" | "reportValidity" | "reset"
>;
export type DescriptionProps = InstanceType<typeof Description>["$props"];
export type FieldErrorProps = InstanceType<typeof FieldError>["$props"];
@@ -964,3 +978,61 @@ export type RangeCalendarGridBodyProps = CalendarGridBodyProps;
export type RangeCalendarHeaderCellProps = CalendarHeaderCellProps;
export type RangeCalendarCellProps = CalendarCellProps;
export type RangeCalendarCellIndicatorProps = CalendarCellIndicatorProps;
/* Root 别名类型:与固定上游 ce90ea3 公开导出的 XxxRootProps 同名,与 XxxProps 为同一类型。
Toast 上游只导出 ToastProps、Tag 上游只导出 TagRootProps,不额外杜撰对侧别名。 */
export type AccordionRootProps = AccordionProps;
export type AlertRootProps = AlertProps;
export type AlertDialogRootProps = AlertDialogProps;
export type AutocompleteRootProps = AutocompleteProps;
export type AvatarGroupRootProps = AvatarGroupProps;
export type BadgeRootProps = BadgeProps;
export type BreadcrumbsRootProps = BreadcrumbsProps;
export type ButtonRootProps = ButtonProps;
export type ButtonGroupRootProps = ButtonGroupProps;
export type CardRootProps = CardProps;
export type CheckboxRootProps = CheckboxProps;
export type ChipRootProps = ChipProps;
export type CloseButtonRootProps = CloseButtonProps;
export type ComboBoxRootProps = ComboBoxProps;
export type DateInputGroupRootProps = DateInputGroupProps;
export type DescriptionRootProps = DescriptionProps;
export type DisclosureRootProps = DisclosureProps;
export type DisclosureGroupRootProps = DisclosureGroupProps;
export type DrawerRootProps = DrawerProps;
export type EmptyStateRootProps = EmptyStateProps;
export type ErrorMessageRootProps = ErrorMessageProps;
export type FieldErrorRootProps = FieldErrorProps;
export type FieldsetRootProps = FieldsetProps;
export type InputRootProps = InputProps;
export type InputGroupRootProps = InputGroupProps;
export type KbdRootProps = KbdProps;
export type LabelRootProps = LabelProps;
export type LinkRootProps = LinkProps;
export type ListBoxItemRootProps = ListBoxItemProps;
export type ListBoxSectionRootProps = ListBoxSectionProps;
export type MeterRootProps = MeterProps;
export type ModalRootProps = ModalProps;
export type PopoverRootProps = PopoverProps;
export type ProgressBarRootProps = ProgressBarProps;
export type ProgressCircleRootProps = ProgressCircleProps;
export type RadioRootProps = RadioProps;
export type RadioGroupRootProps = RadioGroupProps;
export type ScrollShadowRootProps = ScrollShadowProps;
export type SearchFieldRootProps = SearchFieldProps;
export type SeparatorRootProps = SeparatorProps;
export type SkeletonRootProps = SkeletonProps;
export type SpinnerRootProps = SpinnerProps;
export type SurfaceRootProps = SurfaceProps;
export type SwitchRootProps = SwitchProps;
export type SwitchGroupRootProps = SwitchGroupProps;
export type TabsRootProps = TabsProps;
export type TagRootProps = TagProps;
export type TagGroupRootProps = TagGroupProps;
export type TextAreaRootProps = TextAreaProps;
export type TextFieldRootProps = TextFieldProps;
export type ToggleButtonRootProps = ToggleButtonProps;
export type ToggleButtonGroupRootProps = ToggleButtonGroupProps;
export type ToolbarRootProps = ToolbarProps;
export type TooltipRootProps = TooltipProps;
export type TypographyRootProps = TypographyProps;
+226
View File
@@ -0,0 +1,226 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { flushPromises, mount } from "@vue/test-utils";
import { defineComponent, h, nextTick, ref } from "vue";
import { Avatar, AvatarImage, AvatarFallback } from "../packages/vue/src";
import CustomImageDemo from "../apps/docs/demos/avatar-custom-image-component.vue";
const wrappers: ReturnType<typeof mount>[] = [];
afterEach(() => {
wrappers.splice(0).forEach((w) => w.unmount());
vi.unstubAllGlobals();
vi.useRealTimers();
});
function mockImages() {
const images: PreloadImage[] = [];
class PreloadImage extends EventTarget {
source = "";
get src() {
return this.source;
}
set src(value: string) {
this.source = value;
this.complete = false;
this.naturalWidth = 0;
}
complete = false;
naturalWidth = 0;
constructor() {
super();
images.push(this);
}
finish(type: "load" | "error") {
this.complete = true;
this.naturalWidth = type === "load" ? 40 : 0;
this.dispatchEvent(new Event(type));
}
}
vi.stubGlobal("Image", PreloadImage);
return images;
}
function renderAvatar(
imageProps: Record<string, unknown> = {},
fallbackProps = {},
) {
const w = mount(Avatar, {
slots: {
default: () => [
h(AvatarImage, imageProps),
h(AvatarFallback, fallbackProps, { default: () => "JD" }),
],
},
});
wrappers.push(w);
return w;
}
describe("Avatar public loading composition", () => {
it("renders the fixed-source custom image demo through asChild", async () => {
const images = mockImages();
const w = mount(CustomImageDemo, { attachTo: document.body });
wrappers.push(w);
await flushPromises();
expect(w.findAll("img")).toHaveLength(1);
const img = w.get("img");
expect(img.attributes("alt")).toBe("约翰·多伊");
expect(img.attributes("width")).toBe("40");
expect(img.classes()).toContain("hv-avatar__image");
images[0].finish("load");
await flushPromises();
expect(img.isVisible()).toBe(true);
expect(w.find("[data-slot=avatar-fallback]").exists()).toBe(false);
});
it("keeps native events and dynamic attrs on the custom image", async () => {
mockImages();
const load = vi.fn();
const error = vi.fn();
const title = ref("first");
const w = mount(
defineComponent({
setup: () => () =>
h(
Avatar,
{},
{
default: () =>
h(
AvatarImage,
{
src: "/a.png",
asChild: true,
title: title.value,
onLoad: load,
onError: error,
srcSet: "/a.png 1x, /b.png 2x",
sizes: "40px",
},
{
default: () =>
h("img", { alt: "custom", class: "child-image" }),
},
),
},
),
}),
{ attachTo: document.body },
);
wrappers.push(w);
const img = w.get("img");
expect(img.attributes("srcset")).toContain("2x");
expect(img.attributes("sizes")).toBe("40px");
expect(img.classes()).toContain("child-image");
await img.trigger("load");
await img.trigger("error");
expect(load).toHaveBeenCalledTimes(1);
expect(error).toHaveBeenCalledTimes(1);
title.value = "second";
await nextTick();
expect(img.attributes("title")).toBe("second");
});
it("returns to fallback for a changed failed source and can recover", async () => {
const images = mockImages();
const src = ref("/first.png");
const w = mount(
defineComponent({
setup: () => () =>
h(
Avatar,
{},
{
default: () => [
h(AvatarImage, { src: src.value, alt: "profile" }),
h(AvatarFallback, {}, { default: () => "JD" }),
],
},
),
}),
{ attachTo: document.body },
);
wrappers.push(w);
await flushPromises();
expect(w.get("[data-slot=avatar-fallback]").text()).toBe("JD");
images[0].finish("load");
await flushPromises();
expect(w.get("img").isVisible()).toBe(true);
expect(w.find("[data-slot=avatar-fallback]").exists()).toBe(false);
images[0].complete = false;
src.value = "/missing.png";
await flushPromises();
expect(w.get("img").isVisible()).toBe(false);
images[0].finish("error");
await flushPromises();
expect(w.get("[data-slot=avatar-fallback]").text()).toBe("JD");
images[0].complete = false;
src.value = "/recovered.png";
await flushPromises();
images[0].finish("load");
await flushPromises();
expect(w.get("img").attributes("src")).toBe("/recovered.png");
expect(w.get("img").isVisible()).toBe(true);
expect(w.find("[data-slot=avatar-fallback]").exists()).toBe(false);
});
it("shows fallback with an omitted src and zero delay", async () => {
mockImages();
vi.useFakeTimers();
const w = renderAvatar({}, { delayMs: 0 });
await vi.runAllTimersAsync();
await flushPromises();
expect(w.get("[data-slot=avatar-fallback]").text()).toBe("JD");
});
it("updates a pending delay to zero and supports root/fallback asChild", async () => {
vi.useFakeTimers();
const delay = ref(600);
const w = mount(
defineComponent({
setup: () => () =>
h(
Avatar,
{ asChild: true },
{
default: () =>
h("div", { "data-custom-root": "" }, [
h(
AvatarFallback,
{ asChild: true, delayMs: delay.value },
{
default: () =>
h("strong", { "aria-label": "initials" }, "JD"),
},
),
]),
},
),
}),
{ attachTo: document.body },
);
wrappers.push(w);
expect(w.get("[data-slot=avatar]").element.tagName).toBe("DIV");
expect(w.find("strong").exists()).toBe(false);
delay.value = 0;
await nextTick();
expect(w.get("strong").text()).toBe("JD");
expect(w.get("strong").attributes("aria-label")).toBe("initials");
expect(w.get("strong").classes()).toContain("hv-avatar__fallback");
expect(vi.getTimerCount()).toBe(0);
});
it("honors positive delay and cancels the pending fallback on unmount", async () => {
mockImages();
vi.useFakeTimers();
const w = renderAvatar({ src: "/pending.png" }, { delayMs: 600 });
expect(w.find("[data-slot=avatar-fallback]").exists()).toBe(false);
await vi.advanceTimersByTimeAsync(599);
expect(w.find("[data-slot=avatar-fallback]").exists()).toBe(false);
await vi.advanceTimersByTimeAsync(1);
expect(w.get("[data-slot=avatar-fallback]").text()).toBe("JD");
const pending = renderAvatar({}, { delayMs: 1000 });
pending.unmount();
wrappers.splice(wrappers.indexOf(pending), 1);
expect(vi.getTimerCount()).toBe(0);
});
});
+84
View File
@@ -134,6 +134,90 @@ it("uses a native version trigger, button-styled source anchor and detached them
);
});
describe("documentation structure", () => {
it("keeps component pages in the pinned HeroUI meta.json order", () => {
// Upstream apps/docs/content/docs/cn/react/components/meta.json at
// ce90ea3ab49d58f6c428f71bfd6fe8ae2a87b960, plus the two real Vue pages
// (empty-state, header) at their alphabetical positions.
const pinned = [
"accordion",
"alert",
"alert-dialog",
"autocomplete",
"avatar",
"avatar-group",
"badge",
"breadcrumbs",
"button",
"button-group",
"calendar",
"card",
"checkbox",
"checkbox-group",
"chip",
"close-button",
"color-area",
"color-field",
"color-picker",
"color-slider",
"color-swatch",
"color-swatch-picker",
"combo-box",
"date-field",
"date-picker",
"date-range-picker",
"description",
"disclosure",
"disclosure-group",
"drawer",
"dropdown",
"empty-state",
"error-message",
"field-error",
"fieldset",
"form",
"header",
"input",
"input-group",
"input-otp",
"kbd",
"label",
"link",
"list-box",
"meter",
"modal",
"number-field",
"pagination",
"popover",
"progress-bar",
"progress-circle",
"radio-group",
"range-calendar",
"scroll-shadow",
"search-field",
"select",
"separator",
"skeleton",
"slider",
"spinner",
"surface",
"switch",
"table",
"tabs",
"tag-group",
"textarea",
"text-field",
"time-field",
"toast",
"toggle-button",
"toggle-button-group",
"toolbar",
"tooltip",
"typography",
];
expect(componentItems.map((item) => item.url)).toEqual(
pinned.map((slug) => "/components/" + slug),
);
});
it("makes every existing component page reachable exactly once in navigation and its category overview", () => {
const pages = readdirSync("apps/docs/components")
.filter((name) => name.endsWith(".md"))
+313
View File
@@ -0,0 +1,313 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { mount } from "@vue/test-utils";
import { defineComponent, h, nextTick, ref } from "vue";
import {
Form,
TextField,
Input,
FieldError,
CheckboxGroup,
Switch,
} from "../packages/vue/src";
import FormBasic from "../apps/docs/demos/form-basic.vue";
import FormRenderFunction from "../apps/docs/demos/form-render-function.vue";
import FormCustomStyles from "../apps/docs/demos/form-custom-styles.vue";
const wrappers: ReturnType<typeof mount>[] = [];
// Submit occurs after mounting, as with real user input. Keep Vue's listener
// timestamp guard deterministic without changing private event properties.
beforeEach(() => vi.useFakeTimers({ toFake: ["Date"] }));
afterEach(() => {
wrappers.splice(0).forEach((w) => w.unmount());
vi.useRealTimers();
});
function render(content: () => unknown, attrs: Record<string, unknown> = {}) {
const w = mount(Form, {
attrs,
slots: { default: content as () => ReturnType<typeof h> },
attachTo: document.body,
});
wrappers.push(w);
return w;
}
function submit(form: HTMLFormElement, submitter?: HTMLButtonElement) {
vi.setSystemTime(Date.now() + 1);
const event = new SubmitEvent("submit", {
bubbles: true,
cancelable: true,
submitter,
});
form.dispatchEvent(event);
return event;
}
const settle = async () => {
await nextTick();
await nextTick();
};
describe("Form public validation", () => {
it.each(["", "true", "false", true, false])(
"uses native boolean-attribute semantics for novalidate=%s",
(value) => {
const submitted = vi.fn((event: Event) => event.preventDefault());
const w = render(() => h("input", { required: true }), {
novalidate: value,
onSubmit: submitted,
});
submit(w.element as HTMLFormElement);
expect(submitted).toHaveBeenCalledTimes(value === false ? 0 : 1);
},
);
it.each([
() => h(CheckboxGroup, { isRequired: true }),
() => h(Switch, { isRequired: true }),
])(
"cancels composite focus and preserves the first invalid field across mixed controls",
async (Control) => {
const w = render(() => [h("input", { required: true }), Control()]);
submit(w.element as HTMLFormElement);
await settle();
expect(document.activeElement).toBe(w.get("input").element);
w.unmount();
wrappers.splice(wrappers.indexOf(w), 1);
const canceled = render(() => [Control(), h("button", "anchor")], {
onInvalid: (e: Event) => e.preventDefault(),
});
const button = canceled.get("button").element as HTMLButtonElement;
button.focus();
submit(canceled.element as HTMLFormElement);
await settle();
expect(document.activeElement).toBe(button);
canceled.vm.checkValidity();
await settle();
expect(document.activeElement).toBe(button);
},
);
it("notifies once per invalid control and allows canceling default focus", async () => {
const invalid = vi.fn((e: Event) => e.preventDefault());
const submitted = vi.fn();
const w = render(
() => [
h("input", { required: true, name: "one" }),
h("input", { required: true, name: "two" }),
h("button", { type: "submit" }, "submit"),
],
{ onInvalid: invalid, onSubmit: submitted },
);
const button = w.get("button").element as HTMLButtonElement;
button.focus();
const event = submit(w.element as HTMLFormElement, button);
await settle();
expect(event.defaultPrevented).toBe(true);
expect(submitted).not.toHaveBeenCalled();
expect(invalid).toHaveBeenCalledTimes(2);
expect(invalid.mock.calls[0][0].target).toBe(w.get("input").element);
expect(document.activeElement).toBe(button);
});
it("focuses the first invalid control and updates associated field errors", async () => {
const invalid = vi.fn();
const w = render(
() => [
h(TextField, { name: "email", isRequired: true }, () => [
h(Input),
h(FieldError),
]),
h("input", { required: true, name: "second" }),
],
{ onInvalid: invalid },
);
await settle();
expect(submit(w.element as HTMLFormElement).defaultPrevented).toBe(true);
await settle();
expect(document.activeElement).toBe(w.get("input").element);
expect(invalid).toHaveBeenCalledTimes(2);
expect(w.get("input").attributes("aria-describedby")).toContain(
w.get("[data-slot=field-error]").attributes("id"),
);
});
it("honors invalid cancellation on the field itself", async () => {
const w = render(() => [
h("input", {
required: true,
onInvalid: (e: Event) => e.preventDefault(),
}),
h("button", "anchor"),
]);
const button = w.get("button").element as HTMLButtonElement;
button.focus();
expect(submit(w.element as HTMLFormElement).defaultPrevented).toBe(true);
expect(document.activeElement).toBe(button);
});
it("validates externally associated controls and can cancel their default focus", async () => {
const invalid = vi.fn((e: Event) => e.preventDefault());
const w = mount(
defineComponent({
render: () =>
h("div", [
h(Form, { id: "external-form", onInvalid: invalid }),
h("input", { form: "external-form", required: true }),
h("button", "anchor"),
]),
}),
{ attachTo: document.body },
);
wrappers.push(w);
const button = w.get("button").element as HTMLButtonElement;
button.focus();
expect(
submit(w.get("form").element as HTMLFormElement).defaultPrevented,
).toBe(true);
expect(invalid).toHaveBeenCalledTimes(1);
expect(document.activeElement).toBe(button);
});
it("skips validation for formnovalidate and respects canceled submission/reset", async () => {
const invalid = vi.fn();
const submitted = vi.fn((event: Event) => event.preventDefault());
const reset = vi.fn((event: Event) => event.preventDefault());
const w = render(
() => [
h(Input, { name: "value", defaultValue: "initial", required: true }),
h("button", { formnovalidate: true, type: "submit" }, "skip"),
],
{ onInvalid: invalid, onSubmit: submitted, onReset: reset },
);
await w.get("input").setValue("");
const event = submit(
w.element as HTMLFormElement,
w.get("button").element as HTMLButtonElement,
);
expect(event.defaultPrevented).toBe(true);
expect(submitted).toHaveBeenCalledTimes(1);
expect(invalid).not.toHaveBeenCalled();
(w.element as HTMLFormElement).reset();
await settle();
expect(reset).toHaveBeenCalledTimes(1);
expect((w.get("input").element as HTMLInputElement).value).toBe("");
});
it("exposes native form access and policy-aware validation without duplicate invalid events", async () => {
const invalid = vi.fn();
const w = render(() => h("input", { name: "value", required: true }), {
onInvalid: invalid,
});
expect(w.vm.element).toBe(w.element);
expect(w.vm.checkValidity()).toBe(false);
expect(invalid).toHaveBeenCalledTimes(1);
invalid.mockClear();
expect(w.vm.reportValidity()).toBe(false);
expect(invalid).toHaveBeenCalledTimes(1);
expect(document.activeElement).toBe(w.get("input").element);
await w.get("input").setValue("valid");
expect(w.vm.checkValidity()).toBe(true);
w.vm.reset();
await settle();
expect((w.get("input").element as HTMLInputElement).value).toBe("");
});
it("keeps dynamic native attrs and policy overrides on the real form", async () => {
const method = ref("post");
const submitted = vi.fn();
const w = mount(
defineComponent({
setup: () => () =>
h(
Form,
{
action: "/submit",
method: method.value,
validationBehavior: "aria",
onSubmit: submitted,
"data-custom": "foo",
},
() => h("input", { required: true }),
),
}),
{ attachTo: document.body },
);
wrappers.push(w);
expect(w.get("form").attributes("action")).toBe("/submit");
expect(w.get("form").attributes("data-custom")).toBe("foo");
method.value = "get";
await settle();
expect(w.get("form").attributes("method")).toBe("get");
submit(w.get("form").element as HTMLFormElement);
expect(submitted).toHaveBeenCalledTimes(1);
});
});
describe("Form fixed-source demos", () => {
it.each([FormBasic, FormRenderFunction])(
"validates both fields, submits exact data, and resets values/errors/results",
async (Demo) => {
const w = mount(Demo, { attachTo: document.body });
wrappers.push(w);
const form = w.get("form").element as HTMLFormElement;
await settle();
expect(submit(form).defaultPrevented).toBe(true);
await settle();
expect(w.findAll("[data-slot=field-error]")).toHaveLength(2);
const email = w.get('input[name="email"]');
const password = w.get('input[name="password"]');
expect(document.activeElement).toBe(email.element);
expect(w.get("[data-slot=field-error]").text()).toBe(
"请输入有效的邮箱地址",
);
await email.setValue("john@example.com");
for (const [value, error] of [
["short", "密码至少需要 8 个字符"],
["lowercase1", "密码至少需要包含一个大写字母"],
["Password", "密码至少需要包含一个数字"],
]) {
await password.setValue(value);
await settle();
submit(form);
await settle();
expect(w.get("[data-slot=field-error]").text()).toBe(error);
expect(w.find('[role="status"]').exists()).toBe(false);
}
await password.setValue("Password1");
await settle();
submit(form);
await settle();
expect(w.get('[role="status"]').text()).toContain("表单提交数据:");
expect(w.get('[role="status"]').text()).toContain(
'"email": "john@example.com"',
);
expect(w.get('[role="status"]').text()).toContain(
'"password": "Password1"',
);
expect([...new FormData(form)]).toEqual([
["email", "john@example.com"],
["password", "Password1"],
]);
form.reset();
await settle();
expect((email.element as HTMLInputElement).value).toBe("");
expect((password.element as HTMLInputElement).value).toBe("");
expect(w.find("[data-slot=field-error]").exists()).toBe(false);
expect(w.find('[role="status"]').exists()).toBe(false);
if (Demo === FormRenderFunction) expect(form.dataset.custom).toBe("foo");
},
);
it("keeps the custom-styles example as a native validated form", async () => {
const w = mount(FormCustomStyles, { attachTo: document.body });
wrappers.push(w);
const form = w.get("form").element as HTMLFormElement;
expect(w.get("label").text()).toBe("工作邮箱");
expect(w.get("button").text()).toBe("继续");
expect(submit(form).defaultPrevented).toBe(true);
await settle();
expect(document.activeElement).toBe(w.get("input").element);
await w.get("input").setValue("you@company.com");
await settle();
expect(form.checkValidity()).toBe(true);
expect(submit(form).defaultPrevented).toBe(true);
expect([...new FormData(form)]).toEqual([["email", "you@company.com"]]);
});
});
+26
View File
@@ -191,6 +191,32 @@ describe("NumberField public contracts", () => {
expect((input.element as HTMLInputElement).value).toBe("4");
}
});
it("keeps characters typed after keydown instead of restoring committed text", async () => {
const update = vi.fn();
const w = fixture(
`<NumberField :model-value="4" @update:model-value="update">${parts}</NumberField>`,
() => ({ update }),
);
const input = w.get('input[role="spinbutton"]');
for (const [key, text] of [
["9", "49"],
["0", "490"],
] as const) {
// Keep keydown and text insertion in one task: awaiting trigger() here
// would flush the old nextTick(restore) before typing and hide the bug.
input.element.dispatchEvent(
new KeyboardEvent("keydown", { key, bubbles: true, cancelable: true }),
);
(input.element as HTMLInputElement).value = text;
input.element.dispatchEvent(new Event("input", { bubbles: true }));
await nextTick();
await nextTick();
expect((input.element as HTMLInputElement).value).toBe(text);
}
await input.trigger("blur");
await flushPromises();
expect(update).toHaveBeenCalledWith(490);
});
it("blocks readonly Home End wheel click and typing", async () => {
const update = vi.fn();
const w = fixture(
+840
View File
@@ -0,0 +1,840 @@
// Root 别名公共契约:完整 82 对具名导入、Props/事件/插槽/实例类型等价与正反例。
// Toast 上游不导出 ToastRootProps,只有值别名与实例等价,不杜撰类型别名。
import { h } from "vue";
import {
Accordion,
AccordionRoot,
Alert,
AlertRoot,
AlertDialog,
AlertDialogRoot,
Autocomplete,
AutocompleteRoot,
Avatar,
AvatarRoot,
AvatarGroup,
AvatarGroupRoot,
Badge,
BadgeRoot,
Breadcrumbs,
BreadcrumbsRoot,
Button,
ButtonRoot,
ButtonGroup,
ButtonGroupRoot,
Calendar,
CalendarRoot,
Card,
CardRoot,
Checkbox,
CheckboxRoot,
Chip,
ChipRoot,
CloseButton,
CloseButtonRoot,
ColorArea,
ColorAreaRoot,
ColorField,
ColorFieldRoot,
ColorInputGroup,
ColorInputGroupRoot,
ColorPicker,
ColorPickerRoot,
ColorSlider,
ColorSliderRoot,
ColorSwatch,
ColorSwatchRoot,
ColorSwatchPicker,
ColorSwatchPickerRoot,
ComboBox,
ComboBoxRoot,
DateField,
DateFieldRoot,
DateInputGroup,
DateInputGroupRoot,
DatePicker,
DatePickerRoot,
DateRangePicker,
DateRangePickerRoot,
Description,
DescriptionRoot,
Disclosure,
DisclosureRoot,
DisclosureGroup,
DisclosureGroupRoot,
Drawer,
DrawerRoot,
Dropdown,
DropdownRoot,
EmptyState,
EmptyStateRoot,
ErrorMessage,
ErrorMessageRoot,
FieldError,
FieldErrorRoot,
Fieldset,
FieldsetRoot,
Form,
FormRoot,
Header,
HeaderRoot,
Input,
InputRoot,
InputGroup,
InputGroupRoot,
InputOTP,
InputOTPRoot,
Kbd,
KbdRoot,
Label,
LabelRoot,
Link,
LinkRoot,
ListBox,
ListBoxRoot,
ListBoxItem,
ListBoxItemRoot,
ListBoxSection,
ListBoxSectionRoot,
Menu,
MenuRoot,
MenuItem,
MenuItemRoot,
MenuSection,
MenuSectionRoot,
Meter,
MeterRoot,
Modal,
ModalRoot,
NumberField,
NumberFieldRoot,
Pagination,
PaginationRoot,
Popover,
PopoverRoot,
ProgressBar,
ProgressBarRoot,
ProgressCircle,
ProgressCircleRoot,
Radio,
RadioRoot,
RadioGroup,
RadioGroupRoot,
RangeCalendar,
RangeCalendarRoot,
ScrollShadow,
ScrollShadowRoot,
SearchField,
SearchFieldRoot,
Select,
SelectRoot,
Separator,
SeparatorRoot,
Skeleton,
SkeletonRoot,
Slider,
SliderRoot,
Spinner,
SpinnerRoot,
Surface,
SurfaceRoot,
Switch,
SwitchRoot,
SwitchGroup,
SwitchGroupRoot,
Table,
TableRoot,
Tabs,
TabsRoot,
Tag,
TagRoot,
TagGroup,
TagGroupRoot,
TextArea,
TextAreaRoot,
TextField,
TextFieldRoot,
TimeField,
TimeFieldRoot,
ToggleButton,
ToggleButtonRoot,
ToggleButtonGroup,
ToggleButtonGroupRoot,
Toolbar,
ToolbarRoot,
Tooltip,
TooltipRoot,
Typography,
TypographyRoot,
} from "@heroui-vue/components";
import type { AccordionProps, AccordionRootProps } from "@heroui-vue/components";
import type { AlertProps, AlertRootProps } from "@heroui-vue/components";
import type { AlertDialogProps, AlertDialogRootProps } from "@heroui-vue/components";
import type { AutocompleteProps, AutocompleteRootProps } from "@heroui-vue/components";
import type { AvatarProps, AvatarRootProps } from "@heroui-vue/components";
import type { AvatarGroupProps, AvatarGroupRootProps } from "@heroui-vue/components";
import type { BadgeProps, BadgeRootProps } from "@heroui-vue/components";
import type { BreadcrumbsProps, BreadcrumbsRootProps } from "@heroui-vue/components";
import type { ButtonProps, ButtonRootProps } from "@heroui-vue/components";
import type { ButtonGroupProps, ButtonGroupRootProps } from "@heroui-vue/components";
import type { CalendarProps, CalendarRootProps } from "@heroui-vue/components";
import type { CardProps, CardRootProps } from "@heroui-vue/components";
import type { CheckboxProps, CheckboxRootProps } from "@heroui-vue/components";
import type { ChipProps, ChipRootProps } from "@heroui-vue/components";
import type { CloseButtonProps, CloseButtonRootProps } from "@heroui-vue/components";
import type { ColorAreaProps, ColorAreaRootProps } from "@heroui-vue/components";
import type { ColorFieldProps, ColorFieldRootProps } from "@heroui-vue/components";
import type { ColorInputGroupProps, ColorInputGroupRootProps } from "@heroui-vue/components";
import type { ColorPickerProps, ColorPickerRootProps } from "@heroui-vue/components";
import type { ColorSliderProps, ColorSliderRootProps } from "@heroui-vue/components";
import type { ColorSwatchProps, ColorSwatchRootProps } from "@heroui-vue/components";
import type { ColorSwatchPickerProps, ColorSwatchPickerRootProps } from "@heroui-vue/components";
import type { ComboBoxProps, ComboBoxRootProps } from "@heroui-vue/components";
import type { DateFieldProps, DateFieldRootProps } from "@heroui-vue/components";
import type { DateInputGroupProps, DateInputGroupRootProps } from "@heroui-vue/components";
import type { DatePickerProps, DatePickerRootProps } from "@heroui-vue/components";
import type { DateRangePickerProps, DateRangePickerRootProps } from "@heroui-vue/components";
import type { DescriptionProps, DescriptionRootProps } from "@heroui-vue/components";
import type { DisclosureProps, DisclosureRootProps } from "@heroui-vue/components";
import type { DisclosureGroupProps, DisclosureGroupRootProps } from "@heroui-vue/components";
import type { DrawerProps, DrawerRootProps } from "@heroui-vue/components";
import type { DropdownProps, DropdownRootProps } from "@heroui-vue/components";
import type { EmptyStateProps, EmptyStateRootProps } from "@heroui-vue/components";
import type { ErrorMessageProps, ErrorMessageRootProps } from "@heroui-vue/components";
import type { FieldErrorProps, FieldErrorRootProps } from "@heroui-vue/components";
import type { FieldsetProps, FieldsetRootProps } from "@heroui-vue/components";
import type { FormProps, FormRootProps } from "@heroui-vue/components";
import type { HeaderProps, HeaderRootProps } from "@heroui-vue/components";
import type { InputProps, InputRootProps } from "@heroui-vue/components";
import type { InputGroupProps, InputGroupRootProps } from "@heroui-vue/components";
import type { InputOTPProps, InputOTPRootProps } from "@heroui-vue/components";
import type { KbdProps, KbdRootProps } from "@heroui-vue/components";
import type { LabelProps, LabelRootProps } from "@heroui-vue/components";
import type { LinkProps, LinkRootProps } from "@heroui-vue/components";
import type { ListBoxProps, ListBoxRootProps } from "@heroui-vue/components";
import type { ListBoxItemProps, ListBoxItemRootProps } from "@heroui-vue/components";
import type { ListBoxSectionProps, ListBoxSectionRootProps } from "@heroui-vue/components";
import type { MenuProps, MenuRootProps } from "@heroui-vue/components";
import type { MenuItemProps, MenuItemRootProps } from "@heroui-vue/components";
import type { MenuSectionProps, MenuSectionRootProps } from "@heroui-vue/components";
import type { MeterProps, MeterRootProps } from "@heroui-vue/components";
import type { ModalProps, ModalRootProps } from "@heroui-vue/components";
import type { NumberFieldProps, NumberFieldRootProps } from "@heroui-vue/components";
import type { PaginationProps, PaginationRootProps } from "@heroui-vue/components";
import type { PopoverProps, PopoverRootProps } from "@heroui-vue/components";
import type { ProgressBarProps, ProgressBarRootProps } from "@heroui-vue/components";
import type { ProgressCircleProps, ProgressCircleRootProps } from "@heroui-vue/components";
import type { RadioProps, RadioRootProps } from "@heroui-vue/components";
import type { RadioGroupProps, RadioGroupRootProps } from "@heroui-vue/components";
import type { RangeCalendarProps, RangeCalendarRootProps } from "@heroui-vue/components";
import type { ScrollShadowProps, ScrollShadowRootProps } from "@heroui-vue/components";
import type { SearchFieldProps, SearchFieldRootProps } from "@heroui-vue/components";
import type { SelectProps, SelectRootProps } from "@heroui-vue/components";
import type { SeparatorProps, SeparatorRootProps } from "@heroui-vue/components";
import type { SkeletonProps, SkeletonRootProps } from "@heroui-vue/components";
import type { SliderProps, SliderRootProps } from "@heroui-vue/components";
import type { SpinnerProps, SpinnerRootProps } from "@heroui-vue/components";
import type { SurfaceProps, SurfaceRootProps } from "@heroui-vue/components";
import type { SwitchProps, SwitchRootProps } from "@heroui-vue/components";
import type { SwitchGroupProps, SwitchGroupRootProps } from "@heroui-vue/components";
import type { TableProps, TableRootProps } from "@heroui-vue/components";
import type { TabsProps, TabsRootProps } from "@heroui-vue/components";
import type { TagProps, TagRootProps } from "@heroui-vue/components";
import type { TagGroupProps, TagGroupRootProps } from "@heroui-vue/components";
import type { TextAreaProps, TextAreaRootProps } from "@heroui-vue/components";
import type { TextFieldProps, TextFieldRootProps } from "@heroui-vue/components";
import type { TimeFieldProps, TimeFieldRootProps } from "@heroui-vue/components";
import type { ToggleButtonProps, ToggleButtonRootProps } from "@heroui-vue/components";
import type { ToggleButtonGroupProps, ToggleButtonGroupRootProps } from "@heroui-vue/components";
import type { ToolbarProps, ToolbarRootProps } from "@heroui-vue/components";
import type { TooltipProps, TooltipRootProps } from "@heroui-vue/components";
import type { TypographyProps, TypographyRootProps } from "@heroui-vue/components";
type Same<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;
const AccordionRootPropsEq: Same<AccordionProps, AccordionRootProps> = true;
const AccordionRootCompEq: Same<typeof Accordion, typeof AccordionRoot> = true;
const AccordionRootInstanceEq: Same<InstanceType<typeof Accordion>, InstanceType<typeof AccordionRoot>> = true;
const AccordionRootEmitsEq: Same<InstanceType<typeof Accordion>["$emit"], InstanceType<typeof AccordionRoot>["$emit"]> = true;
const AccordionRootSlotsEq: Same<InstanceType<typeof Accordion>["$slots"], InstanceType<typeof AccordionRoot>["$slots"]> = true;
const AlertRootPropsEq: Same<AlertProps, AlertRootProps> = true;
const AlertRootCompEq: Same<typeof Alert, typeof AlertRoot> = true;
const AlertRootInstanceEq: Same<InstanceType<typeof Alert>, InstanceType<typeof AlertRoot>> = true;
const AlertRootEmitsEq: Same<InstanceType<typeof Alert>["$emit"], InstanceType<typeof AlertRoot>["$emit"]> = true;
const AlertRootSlotsEq: Same<InstanceType<typeof Alert>["$slots"], InstanceType<typeof AlertRoot>["$slots"]> = true;
const AlertDialogRootPropsEq: Same<AlertDialogProps, AlertDialogRootProps> = true;
const AlertDialogRootCompEq: Same<typeof AlertDialog, typeof AlertDialogRoot> = true;
const AlertDialogRootInstanceEq: Same<InstanceType<typeof AlertDialog>, InstanceType<typeof AlertDialogRoot>> = true;
const AlertDialogRootEmitsEq: Same<InstanceType<typeof AlertDialog>["$emit"], InstanceType<typeof AlertDialogRoot>["$emit"]> = true;
const AlertDialogRootSlotsEq: Same<InstanceType<typeof AlertDialog>["$slots"], InstanceType<typeof AlertDialogRoot>["$slots"]> = true;
const AutocompleteRootPropsEq: Same<AutocompleteProps, AutocompleteRootProps> = true;
const AutocompleteRootCompEq: Same<typeof Autocomplete, typeof AutocompleteRoot> = true;
const AutocompleteRootInstanceEq: Same<InstanceType<typeof Autocomplete>, InstanceType<typeof AutocompleteRoot>> = true;
const AutocompleteRootEmitsEq: Same<InstanceType<typeof Autocomplete>["$emit"], InstanceType<typeof AutocompleteRoot>["$emit"]> = true;
const AutocompleteRootSlotsEq: Same<InstanceType<typeof Autocomplete>["$slots"], InstanceType<typeof AutocompleteRoot>["$slots"]> = true;
const AvatarRootPropsEq: Same<AvatarProps, AvatarRootProps> = true;
const AvatarRootCompEq: Same<typeof Avatar, typeof AvatarRoot> = true;
const AvatarRootInstanceEq: Same<InstanceType<typeof Avatar>, InstanceType<typeof AvatarRoot>> = true;
const AvatarRootEmitsEq: Same<InstanceType<typeof Avatar>["$emit"], InstanceType<typeof AvatarRoot>["$emit"]> = true;
const AvatarRootSlotsEq: Same<InstanceType<typeof Avatar>["$slots"], InstanceType<typeof AvatarRoot>["$slots"]> = true;
const AvatarGroupRootPropsEq: Same<AvatarGroupProps, AvatarGroupRootProps> = true;
const AvatarGroupRootCompEq: Same<typeof AvatarGroup, typeof AvatarGroupRoot> = true;
const AvatarGroupRootInstanceEq: Same<InstanceType<typeof AvatarGroup>, InstanceType<typeof AvatarGroupRoot>> = true;
const AvatarGroupRootEmitsEq: Same<InstanceType<typeof AvatarGroup>["$emit"], InstanceType<typeof AvatarGroupRoot>["$emit"]> = true;
const AvatarGroupRootSlotsEq: Same<InstanceType<typeof AvatarGroup>["$slots"], InstanceType<typeof AvatarGroupRoot>["$slots"]> = true;
const BadgeRootPropsEq: Same<BadgeProps, BadgeRootProps> = true;
const BadgeRootCompEq: Same<typeof Badge, typeof BadgeRoot> = true;
const BadgeRootInstanceEq: Same<InstanceType<typeof Badge>, InstanceType<typeof BadgeRoot>> = true;
const BadgeRootEmitsEq: Same<InstanceType<typeof Badge>["$emit"], InstanceType<typeof BadgeRoot>["$emit"]> = true;
const BadgeRootSlotsEq: Same<InstanceType<typeof Badge>["$slots"], InstanceType<typeof BadgeRoot>["$slots"]> = true;
const BreadcrumbsRootPropsEq: Same<BreadcrumbsProps, BreadcrumbsRootProps> = true;
const BreadcrumbsRootCompEq: Same<typeof Breadcrumbs, typeof BreadcrumbsRoot> = true;
const BreadcrumbsRootInstanceEq: Same<InstanceType<typeof Breadcrumbs>, InstanceType<typeof BreadcrumbsRoot>> = true;
const BreadcrumbsRootEmitsEq: Same<InstanceType<typeof Breadcrumbs>["$emit"], InstanceType<typeof BreadcrumbsRoot>["$emit"]> = true;
const BreadcrumbsRootSlotsEq: Same<InstanceType<typeof Breadcrumbs>["$slots"], InstanceType<typeof BreadcrumbsRoot>["$slots"]> = true;
const ButtonRootPropsEq: Same<ButtonProps, ButtonRootProps> = true;
const ButtonRootCompEq: Same<typeof Button, typeof ButtonRoot> = true;
const ButtonRootInstanceEq: Same<InstanceType<typeof Button>, InstanceType<typeof ButtonRoot>> = true;
const ButtonRootEmitsEq: Same<InstanceType<typeof Button>["$emit"], InstanceType<typeof ButtonRoot>["$emit"]> = true;
const ButtonRootSlotsEq: Same<InstanceType<typeof Button>["$slots"], InstanceType<typeof ButtonRoot>["$slots"]> = true;
const ButtonGroupRootPropsEq: Same<ButtonGroupProps, ButtonGroupRootProps> = true;
const ButtonGroupRootCompEq: Same<typeof ButtonGroup, typeof ButtonGroupRoot> = true;
const ButtonGroupRootInstanceEq: Same<InstanceType<typeof ButtonGroup>, InstanceType<typeof ButtonGroupRoot>> = true;
const ButtonGroupRootEmitsEq: Same<InstanceType<typeof ButtonGroup>["$emit"], InstanceType<typeof ButtonGroupRoot>["$emit"]> = true;
const ButtonGroupRootSlotsEq: Same<InstanceType<typeof ButtonGroup>["$slots"], InstanceType<typeof ButtonGroupRoot>["$slots"]> = true;
const CalendarRootPropsEq: Same<CalendarProps, CalendarRootProps> = true;
const CalendarRootCompEq: Same<typeof Calendar, typeof CalendarRoot> = true;
// Calendar 为泛型函数式组件类型,InstanceType 不适用;组件对象等价已覆盖实例/事件/插槽成员。
const CardRootPropsEq: Same<CardProps, CardRootProps> = true;
const CardRootCompEq: Same<typeof Card, typeof CardRoot> = true;
const CardRootInstanceEq: Same<InstanceType<typeof Card>, InstanceType<typeof CardRoot>> = true;
const CardRootEmitsEq: Same<InstanceType<typeof Card>["$emit"], InstanceType<typeof CardRoot>["$emit"]> = true;
const CardRootSlotsEq: Same<InstanceType<typeof Card>["$slots"], InstanceType<typeof CardRoot>["$slots"]> = true;
const CheckboxRootPropsEq: Same<CheckboxProps, CheckboxRootProps> = true;
const CheckboxRootCompEq: Same<typeof Checkbox, typeof CheckboxRoot> = true;
const CheckboxRootInstanceEq: Same<InstanceType<typeof Checkbox>, InstanceType<typeof CheckboxRoot>> = true;
const CheckboxRootEmitsEq: Same<InstanceType<typeof Checkbox>["$emit"], InstanceType<typeof CheckboxRoot>["$emit"]> = true;
const CheckboxRootSlotsEq: Same<InstanceType<typeof Checkbox>["$slots"], InstanceType<typeof CheckboxRoot>["$slots"]> = true;
const ChipRootPropsEq: Same<ChipProps, ChipRootProps> = true;
const ChipRootCompEq: Same<typeof Chip, typeof ChipRoot> = true;
const ChipRootInstanceEq: Same<InstanceType<typeof Chip>, InstanceType<typeof ChipRoot>> = true;
const ChipRootEmitsEq: Same<InstanceType<typeof Chip>["$emit"], InstanceType<typeof ChipRoot>["$emit"]> = true;
const ChipRootSlotsEq: Same<InstanceType<typeof Chip>["$slots"], InstanceType<typeof ChipRoot>["$slots"]> = true;
const CloseButtonRootPropsEq: Same<CloseButtonProps, CloseButtonRootProps> = true;
const CloseButtonRootCompEq: Same<typeof CloseButton, typeof CloseButtonRoot> = true;
const CloseButtonRootInstanceEq: Same<InstanceType<typeof CloseButton>, InstanceType<typeof CloseButtonRoot>> = true;
const CloseButtonRootEmitsEq: Same<InstanceType<typeof CloseButton>["$emit"], InstanceType<typeof CloseButtonRoot>["$emit"]> = true;
const CloseButtonRootSlotsEq: Same<InstanceType<typeof CloseButton>["$slots"], InstanceType<typeof CloseButtonRoot>["$slots"]> = true;
const ColorAreaRootPropsEq: Same<ColorAreaProps, ColorAreaRootProps> = true;
const ColorAreaRootCompEq: Same<typeof ColorArea, typeof ColorAreaRoot> = true;
const ColorAreaRootInstanceEq: Same<InstanceType<typeof ColorArea>, InstanceType<typeof ColorAreaRoot>> = true;
const ColorAreaRootEmitsEq: Same<InstanceType<typeof ColorArea>["$emit"], InstanceType<typeof ColorAreaRoot>["$emit"]> = true;
const ColorAreaRootSlotsEq: Same<InstanceType<typeof ColorArea>["$slots"], InstanceType<typeof ColorAreaRoot>["$slots"]> = true;
const ColorFieldRootPropsEq: Same<ColorFieldProps, ColorFieldRootProps> = true;
const ColorFieldRootCompEq: Same<typeof ColorField, typeof ColorFieldRoot> = true;
const ColorFieldRootInstanceEq: Same<InstanceType<typeof ColorField>, InstanceType<typeof ColorFieldRoot>> = true;
const ColorFieldRootEmitsEq: Same<InstanceType<typeof ColorField>["$emit"], InstanceType<typeof ColorFieldRoot>["$emit"]> = true;
const ColorFieldRootSlotsEq: Same<InstanceType<typeof ColorField>["$slots"], InstanceType<typeof ColorFieldRoot>["$slots"]> = true;
const ColorInputGroupRootPropsEq: Same<ColorInputGroupProps, ColorInputGroupRootProps> = true;
const ColorInputGroupRootCompEq: Same<typeof ColorInputGroup, typeof ColorInputGroupRoot> = true;
const ColorInputGroupRootInstanceEq: Same<InstanceType<typeof ColorInputGroup>, InstanceType<typeof ColorInputGroupRoot>> = true;
const ColorInputGroupRootEmitsEq: Same<InstanceType<typeof ColorInputGroup>["$emit"], InstanceType<typeof ColorInputGroupRoot>["$emit"]> = true;
const ColorInputGroupRootSlotsEq: Same<InstanceType<typeof ColorInputGroup>["$slots"], InstanceType<typeof ColorInputGroupRoot>["$slots"]> = true;
const ColorPickerRootPropsEq: Same<ColorPickerProps, ColorPickerRootProps> = true;
const ColorPickerRootCompEq: Same<typeof ColorPicker, typeof ColorPickerRoot> = true;
const ColorPickerRootInstanceEq: Same<InstanceType<typeof ColorPicker>, InstanceType<typeof ColorPickerRoot>> = true;
const ColorPickerRootEmitsEq: Same<InstanceType<typeof ColorPicker>["$emit"], InstanceType<typeof ColorPickerRoot>["$emit"]> = true;
const ColorPickerRootSlotsEq: Same<InstanceType<typeof ColorPicker>["$slots"], InstanceType<typeof ColorPickerRoot>["$slots"]> = true;
const ColorSliderRootPropsEq: Same<ColorSliderProps, ColorSliderRootProps> = true;
const ColorSliderRootCompEq: Same<typeof ColorSlider, typeof ColorSliderRoot> = true;
const ColorSliderRootInstanceEq: Same<InstanceType<typeof ColorSlider>, InstanceType<typeof ColorSliderRoot>> = true;
const ColorSliderRootEmitsEq: Same<InstanceType<typeof ColorSlider>["$emit"], InstanceType<typeof ColorSliderRoot>["$emit"]> = true;
const ColorSliderRootSlotsEq: Same<InstanceType<typeof ColorSlider>["$slots"], InstanceType<typeof ColorSliderRoot>["$slots"]> = true;
const ColorSwatchRootPropsEq: Same<ColorSwatchProps, ColorSwatchRootProps> = true;
const ColorSwatchRootCompEq: Same<typeof ColorSwatch, typeof ColorSwatchRoot> = true;
const ColorSwatchRootInstanceEq: Same<InstanceType<typeof ColorSwatch>, InstanceType<typeof ColorSwatchRoot>> = true;
const ColorSwatchRootEmitsEq: Same<InstanceType<typeof ColorSwatch>["$emit"], InstanceType<typeof ColorSwatchRoot>["$emit"]> = true;
const ColorSwatchRootSlotsEq: Same<InstanceType<typeof ColorSwatch>["$slots"], InstanceType<typeof ColorSwatchRoot>["$slots"]> = true;
const ColorSwatchPickerRootPropsEq: Same<ColorSwatchPickerProps, ColorSwatchPickerRootProps> = true;
const ColorSwatchPickerRootCompEq: Same<typeof ColorSwatchPicker, typeof ColorSwatchPickerRoot> = true;
const ColorSwatchPickerRootInstanceEq: Same<InstanceType<typeof ColorSwatchPicker>, InstanceType<typeof ColorSwatchPickerRoot>> = true;
const ColorSwatchPickerRootEmitsEq: Same<InstanceType<typeof ColorSwatchPicker>["$emit"], InstanceType<typeof ColorSwatchPickerRoot>["$emit"]> = true;
const ColorSwatchPickerRootSlotsEq: Same<InstanceType<typeof ColorSwatchPicker>["$slots"], InstanceType<typeof ColorSwatchPickerRoot>["$slots"]> = true;
const ComboBoxRootPropsEq: Same<ComboBoxProps, ComboBoxRootProps> = true;
const ComboBoxRootCompEq: Same<typeof ComboBox, typeof ComboBoxRoot> = true;
const ComboBoxRootInstanceEq: Same<InstanceType<typeof ComboBox>, InstanceType<typeof ComboBoxRoot>> = true;
const ComboBoxRootEmitsEq: Same<InstanceType<typeof ComboBox>["$emit"], InstanceType<typeof ComboBoxRoot>["$emit"]> = true;
const ComboBoxRootSlotsEq: Same<InstanceType<typeof ComboBox>["$slots"], InstanceType<typeof ComboBoxRoot>["$slots"]> = true;
const DateFieldRootPropsEq: Same<DateFieldProps, DateFieldRootProps> = true;
const DateFieldRootCompEq: Same<typeof DateField, typeof DateFieldRoot> = true;
const DateFieldRootInstanceEq: Same<InstanceType<typeof DateField>, InstanceType<typeof DateFieldRoot>> = true;
const DateFieldRootEmitsEq: Same<InstanceType<typeof DateField>["$emit"], InstanceType<typeof DateFieldRoot>["$emit"]> = true;
const DateFieldRootSlotsEq: Same<InstanceType<typeof DateField>["$slots"], InstanceType<typeof DateFieldRoot>["$slots"]> = true;
const DateInputGroupRootPropsEq: Same<DateInputGroupProps, DateInputGroupRootProps> = true;
const DateInputGroupRootCompEq: Same<typeof DateInputGroup, typeof DateInputGroupRoot> = true;
const DateInputGroupRootInstanceEq: Same<InstanceType<typeof DateInputGroup>, InstanceType<typeof DateInputGroupRoot>> = true;
const DateInputGroupRootEmitsEq: Same<InstanceType<typeof DateInputGroup>["$emit"], InstanceType<typeof DateInputGroupRoot>["$emit"]> = true;
const DateInputGroupRootSlotsEq: Same<InstanceType<typeof DateInputGroup>["$slots"], InstanceType<typeof DateInputGroupRoot>["$slots"]> = true;
const DatePickerRootPropsEq: Same<DatePickerProps, DatePickerRootProps> = true;
const DatePickerRootCompEq: Same<typeof DatePicker, typeof DatePickerRoot> = true;
const DatePickerRootInstanceEq: Same<InstanceType<typeof DatePicker>, InstanceType<typeof DatePickerRoot>> = true;
const DatePickerRootEmitsEq: Same<InstanceType<typeof DatePicker>["$emit"], InstanceType<typeof DatePickerRoot>["$emit"]> = true;
const DatePickerRootSlotsEq: Same<InstanceType<typeof DatePicker>["$slots"], InstanceType<typeof DatePickerRoot>["$slots"]> = true;
const DateRangePickerRootPropsEq: Same<DateRangePickerProps, DateRangePickerRootProps> = true;
const DateRangePickerRootCompEq: Same<typeof DateRangePicker, typeof DateRangePickerRoot> = true;
const DateRangePickerRootInstanceEq: Same<InstanceType<typeof DateRangePicker>, InstanceType<typeof DateRangePickerRoot>> = true;
const DateRangePickerRootEmitsEq: Same<InstanceType<typeof DateRangePicker>["$emit"], InstanceType<typeof DateRangePickerRoot>["$emit"]> = true;
const DateRangePickerRootSlotsEq: Same<InstanceType<typeof DateRangePicker>["$slots"], InstanceType<typeof DateRangePickerRoot>["$slots"]> = true;
const DescriptionRootPropsEq: Same<DescriptionProps, DescriptionRootProps> = true;
const DescriptionRootCompEq: Same<typeof Description, typeof DescriptionRoot> = true;
const DescriptionRootInstanceEq: Same<InstanceType<typeof Description>, InstanceType<typeof DescriptionRoot>> = true;
const DescriptionRootEmitsEq: Same<InstanceType<typeof Description>["$emit"], InstanceType<typeof DescriptionRoot>["$emit"]> = true;
const DescriptionRootSlotsEq: Same<InstanceType<typeof Description>["$slots"], InstanceType<typeof DescriptionRoot>["$slots"]> = true;
const DisclosureRootPropsEq: Same<DisclosureProps, DisclosureRootProps> = true;
const DisclosureRootCompEq: Same<typeof Disclosure, typeof DisclosureRoot> = true;
const DisclosureRootInstanceEq: Same<InstanceType<typeof Disclosure>, InstanceType<typeof DisclosureRoot>> = true;
const DisclosureRootEmitsEq: Same<InstanceType<typeof Disclosure>["$emit"], InstanceType<typeof DisclosureRoot>["$emit"]> = true;
const DisclosureRootSlotsEq: Same<InstanceType<typeof Disclosure>["$slots"], InstanceType<typeof DisclosureRoot>["$slots"]> = true;
const DisclosureGroupRootPropsEq: Same<DisclosureGroupProps, DisclosureGroupRootProps> = true;
const DisclosureGroupRootCompEq: Same<typeof DisclosureGroup, typeof DisclosureGroupRoot> = true;
const DisclosureGroupRootInstanceEq: Same<InstanceType<typeof DisclosureGroup>, InstanceType<typeof DisclosureGroupRoot>> = true;
const DisclosureGroupRootEmitsEq: Same<InstanceType<typeof DisclosureGroup>["$emit"], InstanceType<typeof DisclosureGroupRoot>["$emit"]> = true;
const DisclosureGroupRootSlotsEq: Same<InstanceType<typeof DisclosureGroup>["$slots"], InstanceType<typeof DisclosureGroupRoot>["$slots"]> = true;
const DrawerRootPropsEq: Same<DrawerProps, DrawerRootProps> = true;
const DrawerRootCompEq: Same<typeof Drawer, typeof DrawerRoot> = true;
const DrawerRootInstanceEq: Same<InstanceType<typeof Drawer>, InstanceType<typeof DrawerRoot>> = true;
const DrawerRootEmitsEq: Same<InstanceType<typeof Drawer>["$emit"], InstanceType<typeof DrawerRoot>["$emit"]> = true;
const DrawerRootSlotsEq: Same<InstanceType<typeof Drawer>["$slots"], InstanceType<typeof DrawerRoot>["$slots"]> = true;
const DropdownRootPropsEq: Same<DropdownProps, DropdownRootProps> = true;
const DropdownRootCompEq: Same<typeof Dropdown, typeof DropdownRoot> = true;
const DropdownRootInstanceEq: Same<InstanceType<typeof Dropdown>, InstanceType<typeof DropdownRoot>> = true;
const DropdownRootEmitsEq: Same<InstanceType<typeof Dropdown>["$emit"], InstanceType<typeof DropdownRoot>["$emit"]> = true;
const DropdownRootSlotsEq: Same<InstanceType<typeof Dropdown>["$slots"], InstanceType<typeof DropdownRoot>["$slots"]> = true;
const EmptyStateRootPropsEq: Same<EmptyStateProps, EmptyStateRootProps> = true;
const EmptyStateRootCompEq: Same<typeof EmptyState, typeof EmptyStateRoot> = true;
const EmptyStateRootInstanceEq: Same<InstanceType<typeof EmptyState>, InstanceType<typeof EmptyStateRoot>> = true;
const EmptyStateRootEmitsEq: Same<InstanceType<typeof EmptyState>["$emit"], InstanceType<typeof EmptyStateRoot>["$emit"]> = true;
const EmptyStateRootSlotsEq: Same<InstanceType<typeof EmptyState>["$slots"], InstanceType<typeof EmptyStateRoot>["$slots"]> = true;
const ErrorMessageRootPropsEq: Same<ErrorMessageProps, ErrorMessageRootProps> = true;
const ErrorMessageRootCompEq: Same<typeof ErrorMessage, typeof ErrorMessageRoot> = true;
const ErrorMessageRootInstanceEq: Same<InstanceType<typeof ErrorMessage>, InstanceType<typeof ErrorMessageRoot>> = true;
const ErrorMessageRootEmitsEq: Same<InstanceType<typeof ErrorMessage>["$emit"], InstanceType<typeof ErrorMessageRoot>["$emit"]> = true;
const ErrorMessageRootSlotsEq: Same<InstanceType<typeof ErrorMessage>["$slots"], InstanceType<typeof ErrorMessageRoot>["$slots"]> = true;
const FieldErrorRootPropsEq: Same<FieldErrorProps, FieldErrorRootProps> = true;
const FieldErrorRootCompEq: Same<typeof FieldError, typeof FieldErrorRoot> = true;
const FieldErrorRootInstanceEq: Same<InstanceType<typeof FieldError>, InstanceType<typeof FieldErrorRoot>> = true;
const FieldErrorRootEmitsEq: Same<InstanceType<typeof FieldError>["$emit"], InstanceType<typeof FieldErrorRoot>["$emit"]> = true;
const FieldErrorRootSlotsEq: Same<InstanceType<typeof FieldError>["$slots"], InstanceType<typeof FieldErrorRoot>["$slots"]> = true;
const FieldsetRootPropsEq: Same<FieldsetProps, FieldsetRootProps> = true;
const FieldsetRootCompEq: Same<typeof Fieldset, typeof FieldsetRoot> = true;
const FieldsetRootInstanceEq: Same<InstanceType<typeof Fieldset>, InstanceType<typeof FieldsetRoot>> = true;
const FieldsetRootEmitsEq: Same<InstanceType<typeof Fieldset>["$emit"], InstanceType<typeof FieldsetRoot>["$emit"]> = true;
const FieldsetRootSlotsEq: Same<InstanceType<typeof Fieldset>["$slots"], InstanceType<typeof FieldsetRoot>["$slots"]> = true;
const FormRootPropsEq: Same<FormProps, FormRootProps> = true;
const FormRootCompEq: Same<typeof Form, typeof FormRoot> = true;
const FormRootInstanceEq: Same<InstanceType<typeof Form>, InstanceType<typeof FormRoot>> = true;
const FormRootEmitsEq: Same<InstanceType<typeof Form>["$emit"], InstanceType<typeof FormRoot>["$emit"]> = true;
const FormRootSlotsEq: Same<InstanceType<typeof Form>["$slots"], InstanceType<typeof FormRoot>["$slots"]> = true;
const HeaderRootPropsEq: Same<HeaderProps, HeaderRootProps> = true;
const HeaderRootCompEq: Same<typeof Header, typeof HeaderRoot> = true;
const HeaderRootInstanceEq: Same<InstanceType<typeof Header>, InstanceType<typeof HeaderRoot>> = true;
const HeaderRootEmitsEq: Same<InstanceType<typeof Header>["$emit"], InstanceType<typeof HeaderRoot>["$emit"]> = true;
const HeaderRootSlotsEq: Same<InstanceType<typeof Header>["$slots"], InstanceType<typeof HeaderRoot>["$slots"]> = true;
const InputRootPropsEq: Same<InputProps, InputRootProps> = true;
const InputRootCompEq: Same<typeof Input, typeof InputRoot> = true;
const InputRootInstanceEq: Same<InstanceType<typeof Input>, InstanceType<typeof InputRoot>> = true;
const InputRootEmitsEq: Same<InstanceType<typeof Input>["$emit"], InstanceType<typeof InputRoot>["$emit"]> = true;
const InputRootSlotsEq: Same<InstanceType<typeof Input>["$slots"], InstanceType<typeof InputRoot>["$slots"]> = true;
const InputGroupRootPropsEq: Same<InputGroupProps, InputGroupRootProps> = true;
const InputGroupRootCompEq: Same<typeof InputGroup, typeof InputGroupRoot> = true;
const InputGroupRootInstanceEq: Same<InstanceType<typeof InputGroup>, InstanceType<typeof InputGroupRoot>> = true;
const InputGroupRootEmitsEq: Same<InstanceType<typeof InputGroup>["$emit"], InstanceType<typeof InputGroupRoot>["$emit"]> = true;
const InputGroupRootSlotsEq: Same<InstanceType<typeof InputGroup>["$slots"], InstanceType<typeof InputGroupRoot>["$slots"]> = true;
const InputOTPRootPropsEq: Same<InputOTPProps, InputOTPRootProps> = true;
const InputOTPRootCompEq: Same<typeof InputOTP, typeof InputOTPRoot> = true;
const InputOTPRootInstanceEq: Same<InstanceType<typeof InputOTP>, InstanceType<typeof InputOTPRoot>> = true;
const InputOTPRootEmitsEq: Same<InstanceType<typeof InputOTP>["$emit"], InstanceType<typeof InputOTPRoot>["$emit"]> = true;
const InputOTPRootSlotsEq: Same<InstanceType<typeof InputOTP>["$slots"], InstanceType<typeof InputOTPRoot>["$slots"]> = true;
const KbdRootPropsEq: Same<KbdProps, KbdRootProps> = true;
const KbdRootCompEq: Same<typeof Kbd, typeof KbdRoot> = true;
const KbdRootInstanceEq: Same<InstanceType<typeof Kbd>, InstanceType<typeof KbdRoot>> = true;
const KbdRootEmitsEq: Same<InstanceType<typeof Kbd>["$emit"], InstanceType<typeof KbdRoot>["$emit"]> = true;
const KbdRootSlotsEq: Same<InstanceType<typeof Kbd>["$slots"], InstanceType<typeof KbdRoot>["$slots"]> = true;
const LabelRootPropsEq: Same<LabelProps, LabelRootProps> = true;
const LabelRootCompEq: Same<typeof Label, typeof LabelRoot> = true;
const LabelRootInstanceEq: Same<InstanceType<typeof Label>, InstanceType<typeof LabelRoot>> = true;
const LabelRootEmitsEq: Same<InstanceType<typeof Label>["$emit"], InstanceType<typeof LabelRoot>["$emit"]> = true;
const LabelRootSlotsEq: Same<InstanceType<typeof Label>["$slots"], InstanceType<typeof LabelRoot>["$slots"]> = true;
const LinkRootPropsEq: Same<LinkProps, LinkRootProps> = true;
const LinkRootCompEq: Same<typeof Link, typeof LinkRoot> = true;
const LinkRootInstanceEq: Same<InstanceType<typeof Link>, InstanceType<typeof LinkRoot>> = true;
const LinkRootEmitsEq: Same<InstanceType<typeof Link>["$emit"], InstanceType<typeof LinkRoot>["$emit"]> = true;
const LinkRootSlotsEq: Same<InstanceType<typeof Link>["$slots"], InstanceType<typeof LinkRoot>["$slots"]> = true;
// ListBox 为泛型函数式组件类型,InstanceType 不适用;Props 与组件对象等价已覆盖实例成员。
const ListBoxRootPropsEq: Same<ListBoxProps, ListBoxRootProps> = true;
const ListBoxRootCompEq: Same<typeof ListBox, typeof ListBoxRoot> = true;
const ListBoxItemRootPropsEq: Same<ListBoxItemProps, ListBoxItemRootProps> = true;
const ListBoxItemRootCompEq: Same<typeof ListBoxItem, typeof ListBoxItemRoot> = true;
const ListBoxItemRootInstanceEq: Same<InstanceType<typeof ListBoxItem>, InstanceType<typeof ListBoxItemRoot>> = true;
const ListBoxItemRootEmitsEq: Same<InstanceType<typeof ListBoxItem>["$emit"], InstanceType<typeof ListBoxItemRoot>["$emit"]> = true;
const ListBoxItemRootSlotsEq: Same<InstanceType<typeof ListBoxItem>["$slots"], InstanceType<typeof ListBoxItemRoot>["$slots"]> = true;
const ListBoxSectionRootPropsEq: Same<ListBoxSectionProps, ListBoxSectionRootProps> = true;
const ListBoxSectionRootCompEq: Same<typeof ListBoxSection, typeof ListBoxSectionRoot> = true;
const ListBoxSectionRootInstanceEq: Same<InstanceType<typeof ListBoxSection>, InstanceType<typeof ListBoxSectionRoot>> = true;
const ListBoxSectionRootEmitsEq: Same<InstanceType<typeof ListBoxSection>["$emit"], InstanceType<typeof ListBoxSectionRoot>["$emit"]> = true;
const ListBoxSectionRootSlotsEq: Same<InstanceType<typeof ListBoxSection>["$slots"], InstanceType<typeof ListBoxSectionRoot>["$slots"]> = true;
const MenuRootPropsEq: Same<MenuProps, MenuRootProps> = true;
const MenuRootCompEq: Same<typeof Menu, typeof MenuRoot> = true;
const MenuRootInstanceEq: Same<InstanceType<typeof Menu>, InstanceType<typeof MenuRoot>> = true;
const MenuRootEmitsEq: Same<InstanceType<typeof Menu>["$emit"], InstanceType<typeof MenuRoot>["$emit"]> = true;
const MenuRootSlotsEq: Same<InstanceType<typeof Menu>["$slots"], InstanceType<typeof MenuRoot>["$slots"]> = true;
const MenuItemRootPropsEq: Same<MenuItemProps, MenuItemRootProps> = true;
const MenuItemRootCompEq: Same<typeof MenuItem, typeof MenuItemRoot> = true;
const MenuItemRootInstanceEq: Same<InstanceType<typeof MenuItem>, InstanceType<typeof MenuItemRoot>> = true;
const MenuItemRootEmitsEq: Same<InstanceType<typeof MenuItem>["$emit"], InstanceType<typeof MenuItemRoot>["$emit"]> = true;
const MenuItemRootSlotsEq: Same<InstanceType<typeof MenuItem>["$slots"], InstanceType<typeof MenuItemRoot>["$slots"]> = true;
const MenuSectionRootPropsEq: Same<MenuSectionProps, MenuSectionRootProps> = true;
const MenuSectionRootCompEq: Same<typeof MenuSection, typeof MenuSectionRoot> = true;
const MenuSectionRootInstanceEq: Same<InstanceType<typeof MenuSection>, InstanceType<typeof MenuSectionRoot>> = true;
const MenuSectionRootEmitsEq: Same<InstanceType<typeof MenuSection>["$emit"], InstanceType<typeof MenuSectionRoot>["$emit"]> = true;
const MenuSectionRootSlotsEq: Same<InstanceType<typeof MenuSection>["$slots"], InstanceType<typeof MenuSectionRoot>["$slots"]> = true;
const MeterRootPropsEq: Same<MeterProps, MeterRootProps> = true;
const MeterRootCompEq: Same<typeof Meter, typeof MeterRoot> = true;
const MeterRootInstanceEq: Same<InstanceType<typeof Meter>, InstanceType<typeof MeterRoot>> = true;
const MeterRootEmitsEq: Same<InstanceType<typeof Meter>["$emit"], InstanceType<typeof MeterRoot>["$emit"]> = true;
const MeterRootSlotsEq: Same<InstanceType<typeof Meter>["$slots"], InstanceType<typeof MeterRoot>["$slots"]> = true;
const ModalRootPropsEq: Same<ModalProps, ModalRootProps> = true;
const ModalRootCompEq: Same<typeof Modal, typeof ModalRoot> = true;
const ModalRootInstanceEq: Same<InstanceType<typeof Modal>, InstanceType<typeof ModalRoot>> = true;
const ModalRootEmitsEq: Same<InstanceType<typeof Modal>["$emit"], InstanceType<typeof ModalRoot>["$emit"]> = true;
const ModalRootSlotsEq: Same<InstanceType<typeof Modal>["$slots"], InstanceType<typeof ModalRoot>["$slots"]> = true;
const NumberFieldRootPropsEq: Same<NumberFieldProps, NumberFieldRootProps> = true;
const NumberFieldRootCompEq: Same<typeof NumberField, typeof NumberFieldRoot> = true;
const NumberFieldRootInstanceEq: Same<InstanceType<typeof NumberField>, InstanceType<typeof NumberFieldRoot>> = true;
const NumberFieldRootEmitsEq: Same<InstanceType<typeof NumberField>["$emit"], InstanceType<typeof NumberFieldRoot>["$emit"]> = true;
const NumberFieldRootSlotsEq: Same<InstanceType<typeof NumberField>["$slots"], InstanceType<typeof NumberFieldRoot>["$slots"]> = true;
const PaginationRootPropsEq: Same<PaginationProps, PaginationRootProps> = true;
const PaginationRootCompEq: Same<typeof Pagination, typeof PaginationRoot> = true;
const PaginationRootInstanceEq: Same<InstanceType<typeof Pagination>, InstanceType<typeof PaginationRoot>> = true;
const PaginationRootEmitsEq: Same<InstanceType<typeof Pagination>["$emit"], InstanceType<typeof PaginationRoot>["$emit"]> = true;
const PaginationRootSlotsEq: Same<InstanceType<typeof Pagination>["$slots"], InstanceType<typeof PaginationRoot>["$slots"]> = true;
const PopoverRootPropsEq: Same<PopoverProps, PopoverRootProps> = true;
const PopoverRootCompEq: Same<typeof Popover, typeof PopoverRoot> = true;
const PopoverRootInstanceEq: Same<InstanceType<typeof Popover>, InstanceType<typeof PopoverRoot>> = true;
const PopoverRootEmitsEq: Same<InstanceType<typeof Popover>["$emit"], InstanceType<typeof PopoverRoot>["$emit"]> = true;
const PopoverRootSlotsEq: Same<InstanceType<typeof Popover>["$slots"], InstanceType<typeof PopoverRoot>["$slots"]> = true;
const ProgressBarRootPropsEq: Same<ProgressBarProps, ProgressBarRootProps> = true;
const ProgressBarRootCompEq: Same<typeof ProgressBar, typeof ProgressBarRoot> = true;
const ProgressBarRootInstanceEq: Same<InstanceType<typeof ProgressBar>, InstanceType<typeof ProgressBarRoot>> = true;
const ProgressBarRootEmitsEq: Same<InstanceType<typeof ProgressBar>["$emit"], InstanceType<typeof ProgressBarRoot>["$emit"]> = true;
const ProgressBarRootSlotsEq: Same<InstanceType<typeof ProgressBar>["$slots"], InstanceType<typeof ProgressBarRoot>["$slots"]> = true;
const ProgressCircleRootPropsEq: Same<ProgressCircleProps, ProgressCircleRootProps> = true;
const ProgressCircleRootCompEq: Same<typeof ProgressCircle, typeof ProgressCircleRoot> = true;
const ProgressCircleRootInstanceEq: Same<InstanceType<typeof ProgressCircle>, InstanceType<typeof ProgressCircleRoot>> = true;
const ProgressCircleRootEmitsEq: Same<InstanceType<typeof ProgressCircle>["$emit"], InstanceType<typeof ProgressCircleRoot>["$emit"]> = true;
const ProgressCircleRootSlotsEq: Same<InstanceType<typeof ProgressCircle>["$slots"], InstanceType<typeof ProgressCircleRoot>["$slots"]> = true;
const RadioRootPropsEq: Same<RadioProps, RadioRootProps> = true;
const RadioRootCompEq: Same<typeof Radio, typeof RadioRoot> = true;
const RadioRootInstanceEq: Same<InstanceType<typeof Radio>, InstanceType<typeof RadioRoot>> = true;
const RadioRootEmitsEq: Same<InstanceType<typeof Radio>["$emit"], InstanceType<typeof RadioRoot>["$emit"]> = true;
const RadioRootSlotsEq: Same<InstanceType<typeof Radio>["$slots"], InstanceType<typeof RadioRoot>["$slots"]> = true;
const RadioGroupRootPropsEq: Same<RadioGroupProps, RadioGroupRootProps> = true;
const RadioGroupRootCompEq: Same<typeof RadioGroup, typeof RadioGroupRoot> = true;
const RadioGroupRootInstanceEq: Same<InstanceType<typeof RadioGroup>, InstanceType<typeof RadioGroupRoot>> = true;
const RadioGroupRootEmitsEq: Same<InstanceType<typeof RadioGroup>["$emit"], InstanceType<typeof RadioGroupRoot>["$emit"]> = true;
const RadioGroupRootSlotsEq: Same<InstanceType<typeof RadioGroup>["$slots"], InstanceType<typeof RadioGroupRoot>["$slots"]> = true;
const RangeCalendarRootPropsEq: Same<RangeCalendarProps, RangeCalendarRootProps> = true;
const RangeCalendarRootCompEq: Same<typeof RangeCalendar, typeof RangeCalendarRoot> = true;
const RangeCalendarRootInstanceEq: Same<InstanceType<typeof RangeCalendar>, InstanceType<typeof RangeCalendarRoot>> = true;
const RangeCalendarRootEmitsEq: Same<InstanceType<typeof RangeCalendar>["$emit"], InstanceType<typeof RangeCalendarRoot>["$emit"]> = true;
const RangeCalendarRootSlotsEq: Same<InstanceType<typeof RangeCalendar>["$slots"], InstanceType<typeof RangeCalendarRoot>["$slots"]> = true;
const ScrollShadowRootPropsEq: Same<ScrollShadowProps, ScrollShadowRootProps> = true;
const ScrollShadowRootCompEq: Same<typeof ScrollShadow, typeof ScrollShadowRoot> = true;
const ScrollShadowRootInstanceEq: Same<InstanceType<typeof ScrollShadow>, InstanceType<typeof ScrollShadowRoot>> = true;
const ScrollShadowRootEmitsEq: Same<InstanceType<typeof ScrollShadow>["$emit"], InstanceType<typeof ScrollShadowRoot>["$emit"]> = true;
const ScrollShadowRootSlotsEq: Same<InstanceType<typeof ScrollShadow>["$slots"], InstanceType<typeof ScrollShadowRoot>["$slots"]> = true;
const SearchFieldRootPropsEq: Same<SearchFieldProps, SearchFieldRootProps> = true;
const SearchFieldRootCompEq: Same<typeof SearchField, typeof SearchFieldRoot> = true;
const SearchFieldRootInstanceEq: Same<InstanceType<typeof SearchField>, InstanceType<typeof SearchFieldRoot>> = true;
const SearchFieldRootEmitsEq: Same<InstanceType<typeof SearchField>["$emit"], InstanceType<typeof SearchFieldRoot>["$emit"]> = true;
const SearchFieldRootSlotsEq: Same<InstanceType<typeof SearchField>["$slots"], InstanceType<typeof SearchFieldRoot>["$slots"]> = true;
const SelectRootPropsEq: Same<SelectProps, SelectRootProps> = true;
const SelectRootCompEq: Same<typeof Select, typeof SelectRoot> = true;
const SelectRootInstanceEq: Same<InstanceType<typeof Select>, InstanceType<typeof SelectRoot>> = true;
const SelectRootEmitsEq: Same<InstanceType<typeof Select>["$emit"], InstanceType<typeof SelectRoot>["$emit"]> = true;
const SelectRootSlotsEq: Same<InstanceType<typeof Select>["$slots"], InstanceType<typeof SelectRoot>["$slots"]> = true;
const SeparatorRootPropsEq: Same<SeparatorProps, SeparatorRootProps> = true;
const SeparatorRootCompEq: Same<typeof Separator, typeof SeparatorRoot> = true;
const SeparatorRootInstanceEq: Same<InstanceType<typeof Separator>, InstanceType<typeof SeparatorRoot>> = true;
const SeparatorRootEmitsEq: Same<InstanceType<typeof Separator>["$emit"], InstanceType<typeof SeparatorRoot>["$emit"]> = true;
const SeparatorRootSlotsEq: Same<InstanceType<typeof Separator>["$slots"], InstanceType<typeof SeparatorRoot>["$slots"]> = true;
const SkeletonRootPropsEq: Same<SkeletonProps, SkeletonRootProps> = true;
const SkeletonRootCompEq: Same<typeof Skeleton, typeof SkeletonRoot> = true;
const SkeletonRootInstanceEq: Same<InstanceType<typeof Skeleton>, InstanceType<typeof SkeletonRoot>> = true;
const SkeletonRootEmitsEq: Same<InstanceType<typeof Skeleton>["$emit"], InstanceType<typeof SkeletonRoot>["$emit"]> = true;
const SkeletonRootSlotsEq: Same<InstanceType<typeof Skeleton>["$slots"], InstanceType<typeof SkeletonRoot>["$slots"]> = true;
const SliderRootPropsEq: Same<SliderProps, SliderRootProps> = true;
const SliderRootCompEq: Same<typeof Slider, typeof SliderRoot> = true;
const SliderRootInstanceEq: Same<InstanceType<typeof Slider>, InstanceType<typeof SliderRoot>> = true;
const SliderRootEmitsEq: Same<InstanceType<typeof Slider>["$emit"], InstanceType<typeof SliderRoot>["$emit"]> = true;
const SliderRootSlotsEq: Same<InstanceType<typeof Slider>["$slots"], InstanceType<typeof SliderRoot>["$slots"]> = true;
const SpinnerRootPropsEq: Same<SpinnerProps, SpinnerRootProps> = true;
const SpinnerRootCompEq: Same<typeof Spinner, typeof SpinnerRoot> = true;
const SpinnerRootInstanceEq: Same<InstanceType<typeof Spinner>, InstanceType<typeof SpinnerRoot>> = true;
const SpinnerRootEmitsEq: Same<InstanceType<typeof Spinner>["$emit"], InstanceType<typeof SpinnerRoot>["$emit"]> = true;
const SpinnerRootSlotsEq: Same<InstanceType<typeof Spinner>["$slots"], InstanceType<typeof SpinnerRoot>["$slots"]> = true;
const SurfaceRootPropsEq: Same<SurfaceProps, SurfaceRootProps> = true;
const SurfaceRootCompEq: Same<typeof Surface, typeof SurfaceRoot> = true;
const SurfaceRootInstanceEq: Same<InstanceType<typeof Surface>, InstanceType<typeof SurfaceRoot>> = true;
const SurfaceRootEmitsEq: Same<InstanceType<typeof Surface>["$emit"], InstanceType<typeof SurfaceRoot>["$emit"]> = true;
const SurfaceRootSlotsEq: Same<InstanceType<typeof Surface>["$slots"], InstanceType<typeof SurfaceRoot>["$slots"]> = true;
const SwitchRootPropsEq: Same<SwitchProps, SwitchRootProps> = true;
const SwitchRootCompEq: Same<typeof Switch, typeof SwitchRoot> = true;
const SwitchRootInstanceEq: Same<InstanceType<typeof Switch>, InstanceType<typeof SwitchRoot>> = true;
const SwitchRootEmitsEq: Same<InstanceType<typeof Switch>["$emit"], InstanceType<typeof SwitchRoot>["$emit"]> = true;
const SwitchRootSlotsEq: Same<InstanceType<typeof Switch>["$slots"], InstanceType<typeof SwitchRoot>["$slots"]> = true;
const SwitchGroupRootPropsEq: Same<SwitchGroupProps, SwitchGroupRootProps> = true;
const SwitchGroupRootCompEq: Same<typeof SwitchGroup, typeof SwitchGroupRoot> = true;
const SwitchGroupRootInstanceEq: Same<InstanceType<typeof SwitchGroup>, InstanceType<typeof SwitchGroupRoot>> = true;
const SwitchGroupRootEmitsEq: Same<InstanceType<typeof SwitchGroup>["$emit"], InstanceType<typeof SwitchGroupRoot>["$emit"]> = true;
const SwitchGroupRootSlotsEq: Same<InstanceType<typeof SwitchGroup>["$slots"], InstanceType<typeof SwitchGroupRoot>["$slots"]> = true;
const TableRootPropsEq: Same<TableProps, TableRootProps> = true;
const TableRootCompEq: Same<typeof Table, typeof TableRoot> = true;
const TableRootInstanceEq: Same<InstanceType<typeof Table>, InstanceType<typeof TableRoot>> = true;
const TableRootEmitsEq: Same<InstanceType<typeof Table>["$emit"], InstanceType<typeof TableRoot>["$emit"]> = true;
const TableRootSlotsEq: Same<InstanceType<typeof Table>["$slots"], InstanceType<typeof TableRoot>["$slots"]> = true;
const TabsRootPropsEq: Same<TabsProps, TabsRootProps> = true;
const TabsRootCompEq: Same<typeof Tabs, typeof TabsRoot> = true;
const TabsRootInstanceEq: Same<InstanceType<typeof Tabs>, InstanceType<typeof TabsRoot>> = true;
const TabsRootEmitsEq: Same<InstanceType<typeof Tabs>["$emit"], InstanceType<typeof TabsRoot>["$emit"]> = true;
const TabsRootSlotsEq: Same<InstanceType<typeof Tabs>["$slots"], InstanceType<typeof TabsRoot>["$slots"]> = true;
const TagRootPropsEq: Same<TagProps, TagRootProps> = true;
const TagRootCompEq: Same<typeof Tag, typeof TagRoot> = true;
const TagRootInstanceEq: Same<InstanceType<typeof Tag>, InstanceType<typeof TagRoot>> = true;
const TagRootEmitsEq: Same<InstanceType<typeof Tag>["$emit"], InstanceType<typeof TagRoot>["$emit"]> = true;
const TagRootSlotsEq: Same<InstanceType<typeof Tag>["$slots"], InstanceType<typeof TagRoot>["$slots"]> = true;
const TagGroupRootPropsEq: Same<TagGroupProps, TagGroupRootProps> = true;
const TagGroupRootCompEq: Same<typeof TagGroup, typeof TagGroupRoot> = true;
const TagGroupRootInstanceEq: Same<InstanceType<typeof TagGroup>, InstanceType<typeof TagGroupRoot>> = true;
const TagGroupRootEmitsEq: Same<InstanceType<typeof TagGroup>["$emit"], InstanceType<typeof TagGroupRoot>["$emit"]> = true;
const TagGroupRootSlotsEq: Same<InstanceType<typeof TagGroup>["$slots"], InstanceType<typeof TagGroupRoot>["$slots"]> = true;
const TextAreaRootPropsEq: Same<TextAreaProps, TextAreaRootProps> = true;
const TextAreaRootCompEq: Same<typeof TextArea, typeof TextAreaRoot> = true;
const TextAreaRootInstanceEq: Same<InstanceType<typeof TextArea>, InstanceType<typeof TextAreaRoot>> = true;
const TextAreaRootEmitsEq: Same<InstanceType<typeof TextArea>["$emit"], InstanceType<typeof TextAreaRoot>["$emit"]> = true;
const TextAreaRootSlotsEq: Same<InstanceType<typeof TextArea>["$slots"], InstanceType<typeof TextAreaRoot>["$slots"]> = true;
const TextFieldRootPropsEq: Same<TextFieldProps, TextFieldRootProps> = true;
const TextFieldRootCompEq: Same<typeof TextField, typeof TextFieldRoot> = true;
const TextFieldRootInstanceEq: Same<InstanceType<typeof TextField>, InstanceType<typeof TextFieldRoot>> = true;
const TextFieldRootEmitsEq: Same<InstanceType<typeof TextField>["$emit"], InstanceType<typeof TextFieldRoot>["$emit"]> = true;
const TextFieldRootSlotsEq: Same<InstanceType<typeof TextField>["$slots"], InstanceType<typeof TextFieldRoot>["$slots"]> = true;
const TimeFieldRootPropsEq: Same<TimeFieldProps, TimeFieldRootProps> = true;
const TimeFieldRootCompEq: Same<typeof TimeField, typeof TimeFieldRoot> = true;
const TimeFieldRootInstanceEq: Same<InstanceType<typeof TimeField>, InstanceType<typeof TimeFieldRoot>> = true;
const TimeFieldRootEmitsEq: Same<InstanceType<typeof TimeField>["$emit"], InstanceType<typeof TimeFieldRoot>["$emit"]> = true;
const TimeFieldRootSlotsEq: Same<InstanceType<typeof TimeField>["$slots"], InstanceType<typeof TimeFieldRoot>["$slots"]> = true;
const ToggleButtonRootPropsEq: Same<ToggleButtonProps, ToggleButtonRootProps> = true;
const ToggleButtonRootCompEq: Same<typeof ToggleButton, typeof ToggleButtonRoot> = true;
const ToggleButtonRootInstanceEq: Same<InstanceType<typeof ToggleButton>, InstanceType<typeof ToggleButtonRoot>> = true;
const ToggleButtonRootEmitsEq: Same<InstanceType<typeof ToggleButton>["$emit"], InstanceType<typeof ToggleButtonRoot>["$emit"]> = true;
const ToggleButtonRootSlotsEq: Same<InstanceType<typeof ToggleButton>["$slots"], InstanceType<typeof ToggleButtonRoot>["$slots"]> = true;
const ToggleButtonGroupRootPropsEq: Same<ToggleButtonGroupProps, ToggleButtonGroupRootProps> = true;
const ToggleButtonGroupRootCompEq: Same<typeof ToggleButtonGroup, typeof ToggleButtonGroupRoot> = true;
const ToggleButtonGroupRootInstanceEq: Same<InstanceType<typeof ToggleButtonGroup>, InstanceType<typeof ToggleButtonGroupRoot>> = true;
const ToggleButtonGroupRootEmitsEq: Same<InstanceType<typeof ToggleButtonGroup>["$emit"], InstanceType<typeof ToggleButtonGroupRoot>["$emit"]> = true;
const ToggleButtonGroupRootSlotsEq: Same<InstanceType<typeof ToggleButtonGroup>["$slots"], InstanceType<typeof ToggleButtonGroupRoot>["$slots"]> = true;
const ToolbarRootPropsEq: Same<ToolbarProps, ToolbarRootProps> = true;
const ToolbarRootCompEq: Same<typeof Toolbar, typeof ToolbarRoot> = true;
const ToolbarRootInstanceEq: Same<InstanceType<typeof Toolbar>, InstanceType<typeof ToolbarRoot>> = true;
const ToolbarRootEmitsEq: Same<InstanceType<typeof Toolbar>["$emit"], InstanceType<typeof ToolbarRoot>["$emit"]> = true;
const ToolbarRootSlotsEq: Same<InstanceType<typeof Toolbar>["$slots"], InstanceType<typeof ToolbarRoot>["$slots"]> = true;
const TooltipRootPropsEq: Same<TooltipProps, TooltipRootProps> = true;
const TooltipRootCompEq: Same<typeof Tooltip, typeof TooltipRoot> = true;
const TooltipRootInstanceEq: Same<InstanceType<typeof Tooltip>, InstanceType<typeof TooltipRoot>> = true;
const TooltipRootEmitsEq: Same<InstanceType<typeof Tooltip>["$emit"], InstanceType<typeof TooltipRoot>["$emit"]> = true;
const TooltipRootSlotsEq: Same<InstanceType<typeof Tooltip>["$slots"], InstanceType<typeof TooltipRoot>["$slots"]> = true;
const TypographyRootPropsEq: Same<TypographyProps, TypographyRootProps> = true;
const TypographyRootCompEq: Same<typeof Typography, typeof TypographyRoot> = true;
const TypographyRootInstanceEq: Same<InstanceType<typeof Typography>, InstanceType<typeof TypographyRoot>> = true;
const TypographyRootEmitsEq: Same<InstanceType<typeof Typography>["$emit"], InstanceType<typeof TypographyRoot>["$emit"]> = true;
const TypographyRootSlotsEq: Same<InstanceType<typeof Typography>["$slots"], InstanceType<typeof TypographyRoot>["$slots"]> = true;
// 实际渲染的属性、事件与插槽随 Root 别名走同一组件。
h(ButtonRoot, { type: "submit", onClick: (event: MouseEvent) => event.type }, { default: () => "提交" });
h(NumberFieldRoot, { modelValue: 1, "onUpdate:modelValue": (value: number | null) => value, minValue: 0 }, { default: () => null });
h(AvatarRoot, { size: "lg" }, { default: () => null });
// 反例:别名不放宽既有变体与事件负载类型。
// @ts-expect-error baseline size only
const badSize: AvatarRootProps = { size: "xl" };
// @ts-expect-error number field commits numbers or null
const badEvent: NumberFieldRootProps = { onChange: (value: string) => value };
void [
Accordion,
AccordionRoot,
Alert,
AlertRoot,
AlertDialog,
AlertDialogRoot,
Autocomplete,
AutocompleteRoot,
Avatar,
AvatarRoot,
AvatarGroup,
AvatarGroupRoot,
Badge,
BadgeRoot,
Breadcrumbs,
BreadcrumbsRoot,
Button,
ButtonRoot,
ButtonGroup,
ButtonGroupRoot,
Calendar,
CalendarRoot,
Card,
CardRoot,
Checkbox,
CheckboxRoot,
Chip,
ChipRoot,
CloseButton,
CloseButtonRoot,
ColorArea,
ColorAreaRoot,
ColorField,
ColorFieldRoot,
ColorInputGroup,
ColorInputGroupRoot,
ColorPicker,
ColorPickerRoot,
ColorSlider,
ColorSliderRoot,
ColorSwatch,
ColorSwatchRoot,
ColorSwatchPicker,
ColorSwatchPickerRoot,
ComboBox,
ComboBoxRoot,
DateField,
DateFieldRoot,
DateInputGroup,
DateInputGroupRoot,
DatePicker,
DatePickerRoot,
DateRangePicker,
DateRangePickerRoot,
Description,
DescriptionRoot,
Disclosure,
DisclosureRoot,
DisclosureGroup,
DisclosureGroupRoot,
Drawer,
DrawerRoot,
Dropdown,
DropdownRoot,
EmptyState,
EmptyStateRoot,
ErrorMessage,
ErrorMessageRoot,
FieldError,
FieldErrorRoot,
Fieldset,
FieldsetRoot,
Form,
FormRoot,
Header,
HeaderRoot,
Input,
InputRoot,
InputGroup,
InputGroupRoot,
InputOTP,
InputOTPRoot,
Kbd,
KbdRoot,
Label,
LabelRoot,
Link,
LinkRoot,
ListBox,
ListBoxRoot,
ListBoxItem,
ListBoxItemRoot,
ListBoxSection,
ListBoxSectionRoot,
Menu,
MenuRoot,
MenuItem,
MenuItemRoot,
MenuSection,
MenuSectionRoot,
Meter,
MeterRoot,
Modal,
ModalRoot,
NumberField,
NumberFieldRoot,
Pagination,
PaginationRoot,
Popover,
PopoverRoot,
ProgressBar,
ProgressBarRoot,
ProgressCircle,
ProgressCircleRoot,
Radio,
RadioRoot,
RadioGroup,
RadioGroupRoot,
RangeCalendar,
RangeCalendarRoot,
ScrollShadow,
ScrollShadowRoot,
SearchField,
SearchFieldRoot,
Select,
SelectRoot,
Separator,
SeparatorRoot,
Skeleton,
SkeletonRoot,
Slider,
SliderRoot,
Spinner,
SpinnerRoot,
Surface,
SurfaceRoot,
Switch,
SwitchRoot,
SwitchGroup,
SwitchGroupRoot,
Table,
TableRoot,
Tabs,
TabsRoot,
Tag,
TagRoot,
TagGroup,
TagGroupRoot,
TextArea,
TextAreaRoot,
TextField,
TextFieldRoot,
TimeField,
TimeFieldRoot,
ToggleButton,
ToggleButtonRoot,
ToggleButtonGroup,
ToggleButtonGroupRoot,
Toolbar,
ToolbarRoot,
Tooltip,
TooltipRoot,
Typography,
TypographyRoot,
badSize,
badEvent,
];
+47
View File
@@ -0,0 +1,47 @@
import { h } from "vue";
import {
Avatar,
AvatarRoot,
AvatarImage,
AvatarFallback,
avatarVariants,
type AvatarProps,
type AvatarRootProps,
type AvatarImageProps,
type AvatarFallbackProps,
} from "@heroui-vue/components";
const root: AvatarProps = {
size: "lg",
color: "accent",
variant: "soft",
as: "div",
asChild: true,
};
const image: AvatarImageProps = {
asChild: true,
srcSet: "/a.png 2x",
sizes: "40px",
loading: "lazy",
crossOrigin: "anonymous",
referrerPolicy: "no-referrer",
onLoad: (event: Event) => event.type,
onError: (event: Event) => event.type,
};
const fallback: AvatarFallbackProps = {
delayMs: 0,
color: "danger",
asChild: true,
};
const rootAlias: AvatarRootProps = root;
h(AvatarRoot, rootAlias);
h(AvatarImage, image);
h(AvatarFallback, fallback);
// @ts-expect-error baseline size only
const badRoot: AvatarProps = { size: "xl" };
// @ts-expect-error baseline color only
const badFallback: AvatarFallbackProps = { color: "blue" };
// @ts-expect-error native loading policy
const badImage: AvatarImageProps = { loading: "immediate" };
// @ts-expect-error native referrer policy
const badPolicy: AvatarImageProps = { referrerPolicy: "secret" };
void [Avatar, avatarVariants, badRoot, badFallback, badImage, badPolicy];
+12
View File
@@ -334,5 +334,17 @@ for (const id of process.argv.slice(2)) {
);
assert(lib.errorMessageVariants().includes("hv-error-message"));
}
if (id === "api-root-aliases") {
assert(
spec.aliases.length === 82,
"Root alias inventory must cover all 82 upstream root pairs",
);
for (const [plain, root] of spec.aliases) {
assert(
lib[plain] === lib[root],
`${root} must be the same component object as ${plain}`,
);
}
}
console.log(`${id}: packed ESM exports and CSS passed (client scope)`);
}
+274
View File
@@ -532,5 +532,279 @@
"background-color:var(--overlay)",
"data-exiting"
]
},
"avatar": {
"exports": [
"Avatar",
"AvatarRoot",
"AvatarImage",
"AvatarFallback",
"avatarVariants"
],
"css": [
".hv-avatar",
".hv-avatar__image",
".hv-avatar__fallback",
".hv-avatar--sm",
".hv-avatar--lg",
".hv-avatar--soft"
]
},
"form": {
"exports": ["Form", "FormRoot", "TextField", "Input", "Label", "FieldError", "Button"],
"css": [".hv-textfield", ".hv-input", ".hv-field-error", ".hv-button"]
},
"api-root-aliases": {
"exports": [
"Accordion",
"AccordionRoot",
"Alert",
"AlertRoot",
"AlertDialog",
"AlertDialogRoot",
"Autocomplete",
"AutocompleteRoot",
"Avatar",
"AvatarRoot",
"AvatarGroup",
"AvatarGroupRoot",
"Badge",
"BadgeRoot",
"Breadcrumbs",
"BreadcrumbsRoot",
"Button",
"ButtonRoot",
"ButtonGroup",
"ButtonGroupRoot",
"Calendar",
"CalendarRoot",
"Card",
"CardRoot",
"Checkbox",
"CheckboxRoot",
"Chip",
"ChipRoot",
"CloseButton",
"CloseButtonRoot",
"ColorArea",
"ColorAreaRoot",
"ColorField",
"ColorFieldRoot",
"ColorInputGroup",
"ColorInputGroupRoot",
"ColorPicker",
"ColorPickerRoot",
"ColorSlider",
"ColorSliderRoot",
"ColorSwatch",
"ColorSwatchRoot",
"ColorSwatchPicker",
"ColorSwatchPickerRoot",
"ComboBox",
"ComboBoxRoot",
"DateField",
"DateFieldRoot",
"DateInputGroup",
"DateInputGroupRoot",
"DatePicker",
"DatePickerRoot",
"DateRangePicker",
"DateRangePickerRoot",
"Description",
"DescriptionRoot",
"Disclosure",
"DisclosureRoot",
"DisclosureGroup",
"DisclosureGroupRoot",
"Drawer",
"DrawerRoot",
"Dropdown",
"DropdownRoot",
"EmptyState",
"EmptyStateRoot",
"ErrorMessage",
"ErrorMessageRoot",
"FieldError",
"FieldErrorRoot",
"Fieldset",
"FieldsetRoot",
"Form",
"FormRoot",
"Header",
"HeaderRoot",
"Input",
"InputRoot",
"InputGroup",
"InputGroupRoot",
"InputOTP",
"InputOTPRoot",
"Kbd",
"KbdRoot",
"Label",
"LabelRoot",
"Link",
"LinkRoot",
"ListBox",
"ListBoxRoot",
"ListBoxItem",
"ListBoxItemRoot",
"ListBoxSection",
"ListBoxSectionRoot",
"Menu",
"MenuRoot",
"MenuItem",
"MenuItemRoot",
"MenuSection",
"MenuSectionRoot",
"Meter",
"MeterRoot",
"Modal",
"ModalRoot",
"NumberField",
"NumberFieldRoot",
"Pagination",
"PaginationRoot",
"Popover",
"PopoverRoot",
"ProgressBar",
"ProgressBarRoot",
"ProgressCircle",
"ProgressCircleRoot",
"Radio",
"RadioRoot",
"RadioGroup",
"RadioGroupRoot",
"RangeCalendar",
"RangeCalendarRoot",
"ScrollShadow",
"ScrollShadowRoot",
"SearchField",
"SearchFieldRoot",
"Select",
"SelectRoot",
"Separator",
"SeparatorRoot",
"Skeleton",
"SkeletonRoot",
"Slider",
"SliderRoot",
"Spinner",
"SpinnerRoot",
"Surface",
"SurfaceRoot",
"Switch",
"SwitchRoot",
"SwitchGroup",
"SwitchGroupRoot",
"Table",
"TableRoot",
"Tabs",
"TabsRoot",
"Tag",
"TagRoot",
"TagGroup",
"TagGroupRoot",
"TextArea",
"TextAreaRoot",
"TextField",
"TextFieldRoot",
"TimeField",
"TimeFieldRoot",
"ToggleButton",
"ToggleButtonRoot",
"ToggleButtonGroup",
"ToggleButtonGroupRoot",
"Toolbar",
"ToolbarRoot",
"Tooltip",
"TooltipRoot",
"Typography",
"TypographyRoot"
],
"aliases": [
["Accordion", "AccordionRoot"],
["Alert", "AlertRoot"],
["AlertDialog", "AlertDialogRoot"],
["Autocomplete", "AutocompleteRoot"],
["Avatar", "AvatarRoot"],
["AvatarGroup", "AvatarGroupRoot"],
["Badge", "BadgeRoot"],
["Breadcrumbs", "BreadcrumbsRoot"],
["Button", "ButtonRoot"],
["ButtonGroup", "ButtonGroupRoot"],
["Calendar", "CalendarRoot"],
["Card", "CardRoot"],
["Checkbox", "CheckboxRoot"],
["Chip", "ChipRoot"],
["CloseButton", "CloseButtonRoot"],
["ColorArea", "ColorAreaRoot"],
["ColorField", "ColorFieldRoot"],
["ColorInputGroup", "ColorInputGroupRoot"],
["ColorPicker", "ColorPickerRoot"],
["ColorSlider", "ColorSliderRoot"],
["ColorSwatch", "ColorSwatchRoot"],
["ColorSwatchPicker", "ColorSwatchPickerRoot"],
["ComboBox", "ComboBoxRoot"],
["DateField", "DateFieldRoot"],
["DateInputGroup", "DateInputGroupRoot"],
["DatePicker", "DatePickerRoot"],
["DateRangePicker", "DateRangePickerRoot"],
["Description", "DescriptionRoot"],
["Disclosure", "DisclosureRoot"],
["DisclosureGroup", "DisclosureGroupRoot"],
["Drawer", "DrawerRoot"],
["Dropdown", "DropdownRoot"],
["EmptyState", "EmptyStateRoot"],
["ErrorMessage", "ErrorMessageRoot"],
["FieldError", "FieldErrorRoot"],
["Fieldset", "FieldsetRoot"],
["Form", "FormRoot"],
["Header", "HeaderRoot"],
["Input", "InputRoot"],
["InputGroup", "InputGroupRoot"],
["InputOTP", "InputOTPRoot"],
["Kbd", "KbdRoot"],
["Label", "LabelRoot"],
["Link", "LinkRoot"],
["ListBox", "ListBoxRoot"],
["ListBoxItem", "ListBoxItemRoot"],
["ListBoxSection", "ListBoxSectionRoot"],
["Menu", "MenuRoot"],
["MenuItem", "MenuItemRoot"],
["MenuSection", "MenuSectionRoot"],
["Meter", "MeterRoot"],
["Modal", "ModalRoot"],
["NumberField", "NumberFieldRoot"],
["Pagination", "PaginationRoot"],
["Popover", "PopoverRoot"],
["ProgressBar", "ProgressBarRoot"],
["ProgressCircle", "ProgressCircleRoot"],
["Radio", "RadioRoot"],
["RadioGroup", "RadioGroupRoot"],
["RangeCalendar", "RangeCalendarRoot"],
["ScrollShadow", "ScrollShadowRoot"],
["SearchField", "SearchFieldRoot"],
["Select", "SelectRoot"],
["Separator", "SeparatorRoot"],
["Skeleton", "SkeletonRoot"],
["Slider", "SliderRoot"],
["Spinner", "SpinnerRoot"],
["Surface", "SurfaceRoot"],
["Switch", "SwitchRoot"],
["SwitchGroup", "SwitchGroupRoot"],
["Table", "TableRoot"],
["Tabs", "TabsRoot"],
["Tag", "TagRoot"],
["TagGroup", "TagGroupRoot"],
["TextArea", "TextAreaRoot"],
["TextField", "TextFieldRoot"],
["TimeField", "TimeFieldRoot"],
["ToggleButton", "ToggleButtonRoot"],
["ToggleButtonGroup", "ToggleButtonGroupRoot"],
["Toolbar", "ToolbarRoot"],
["Tooltip", "TooltipRoot"],
["Typography", "TypographyRoot"]
],
"css": []
}
}
+48
View File
@@ -0,0 +1,48 @@
import { h } from "vue";
import {
Form,
FormRoot,
type FormProps,
type FormRootProps,
type FormSlots,
type FormExpose,
} from "@heroui-vue/components";
const props: FormProps = {
validationBehavior: "native",
validationErrors: { email: ["Invalid"] },
action: "/submit",
method: "post",
enctype: "multipart/form-data",
target: "_self",
noValidate: true,
"aria-label": "Account",
class: ["flex", { compact: true }],
onSubmit: (event: SubmitEvent) => event.preventDefault(),
onReset: (event: Event) => event.preventDefault(),
onInvalid: (event: Event) => event.preventDefault(),
};
const rootProps: FormRootProps = props;
const slots: FormSlots = { default: () => h("input", { name: "email" }) };
h(Form, rootProps, { default: slots.default });
h(FormRoot, { validationBehavior: "aria" });
declare const form: FormExpose;
const valid: boolean = form.checkValidity();
const reported: boolean = form.reportValidity();
form.reset();
form.element?.requestSubmit();
// @ts-expect-error validation mode is constrained
const invalidMode: FormProps = { validationBehavior: "automatic" };
// @ts-expect-error field errors accept strings or string arrays
const invalidErrors: FormProps = { validationErrors: { email: 42 } };
// @ts-expect-error no React render function API
const invalidRender: FormProps = { render: () => h("form") };
// @ts-expect-error submit receives native SubmitEvent, not a field value
const invalidSubmit: FormProps = { onSubmit: (value: string) => value };
void [
valid,
reported,
invalidMode,
invalidErrors,
invalidRender,
invalidSubmit,
];
+191 -1
View File
@@ -1,7 +1,7 @@
import { componentItems } from "../apps/docs/.vitepress/theme/navigation";
import { describe, it, expect, afterEach } from "vitest";
import { readFileSync } from "node:fs";
import { mount } from "@vue/test-utils";
import { flushPromises, mount } from "@vue/test-utils";
import { defineComponent, h, nextTick, ref } from "vue";
import {
Label,
@@ -761,3 +761,193 @@ it("isolates indicator labels from both surrounding and nested field scopes", as
);
w.unmount();
});
describe("progress-bar custom-value demo with public NumberField/Select", () => {
async function setup() {
const mod = await import("../apps/docs/demos/progress-bar-custom-value.vue");
const w = mount(mod.default as never, { attachTo: document.body });
await flushPromises();
return w;
}
const field = (w: ReturnType<typeof mount>, index: number) =>
w.findAll('[data-slot="number-field"]')[index];
const inputOf = (w: ReturnType<typeof mount>, index: number) =>
field(w, index).get("input[role=spinbutton]");
const progress = (w: ReturnType<typeof mount>) =>
w.get("[data-slot=progress-bar]");
const output = (w: ReturnType<typeof mount>) =>
w.get("[data-slot=progress-bar-output]");
const fill = (w: ReturnType<typeof mount>) =>
w.get("[data-slot=progress-bar-fill]").element as HTMLElement;
const text = (options: Intl.NumberFormatOptions, value: number) =>
new Intl.NumberFormat(undefined, options).format(value);
const percent = (value: number, min: number, max: number) =>
text({ style: "percent" }, (value - min) / (max - min));
it("keeps the fixed source values and renders NumberField/Select parts", async () => {
const w = await setup();
expect(w.findAll('[data-slot="number-field"]')).toHaveLength(3);
expect(w.findAll("input[role=spinbutton]")).toHaveLength(3);
expect(w.findAll('[data-slot="select-trigger"]')).toHaveLength(1);
expect(
w.findAll('[data-slot="number-field-increment-button"]'),
).toHaveLength(3);
const bar = progress(w);
expect(bar.attributes("aria-label")).toBe("收入");
expect(bar.attributes("aria-valuenow")).toBe("750");
expect(bar.attributes("aria-valuemin")).toBe("0");
expect(bar.attributes("aria-valuemax")).toBe("1000");
expect(output(w).text()).toBe("75%");
expect(fill(w).style.width).toBe("75%");
const labels = w.findAll("[data-slot=label]").map((n) => n.text());
expect(labels).toEqual(["进度", "选项", "值", "最小值", "最大值", "格式"]);
w.unmount();
});
it("synchronizes typed input, stepping and bounds with progress text and fill", async () => {
const w = await setup();
const valueInput = inputOf(w, 0);
await valueInput.setValue("500");
await valueInput.trigger("blur");
await flushPromises();
expect(progress(w).attributes("aria-valuenow")).toBe("500");
expect(output(w).text()).toBe("50%");
expect(fill(w).style.width).toBe("50%");
await field(w, 0)
.get('[data-slot="number-field-increment-button"]')
.trigger("click");
await flushPromises();
expect(progress(w).attributes("aria-valuenow")).toBe("501");
expect(output(w).text()).toBe(percent(501, 0, 1000));
expect(fill(w).style.width).toBe("50.1%");
await field(w, 0)
.get('[data-slot="number-field-decrement-button"]')
.trigger("click");
await flushPromises();
expect(progress(w).attributes("aria-valuenow")).toBe("500");
await valueInput.setValue("1000");
await valueInput.trigger("blur");
await flushPromises();
expect(
(
field(w, 0)
.get('[data-slot="number-field-increment-button"]')
.element as HTMLButtonElement
).disabled,
).toBe(true);
expect(output(w).text()).toBe("100%");
w.unmount();
});
it("rejects cleared and invalid drafts without NaN or display mismatch", async () => {
const w = await setup();
const valueInput = inputOf(w, 0);
for (const draft of ["", "abc", "-"]) {
await valueInput.setValue(draft);
await valueInput.trigger("blur");
await flushPromises();
expect(progress(w).attributes("aria-valuenow")).toBe("750");
expect(output(w).text()).toBe("75%");
expect(fill(w).style.width).toBe("75%");
expect((valueInput.element as HTMLInputElement).value).not.toBe("");
expect(w.text()).not.toContain("NaN");
}
w.unmount();
});
it("clamps out-of-range commits into the current range", async () => {
const w = await setup();
const valueInput = inputOf(w, 0);
await valueInput.setValue("5000");
await valueInput.trigger("blur");
await flushPromises();
expect(progress(w).attributes("aria-valuenow")).toBe("1000");
expect(output(w).text()).toBe("100%");
expect(fill(w).style.width).toBe("100%");
await valueInput.setValue("-20");
await valueInput.trigger("blur");
await flushPromises();
expect(progress(w).attributes("aria-valuenow")).toBe("0");
expect(output(w).text()).toBe("0%");
expect(fill(w).style.width).toBe("0%");
w.unmount();
});
it("re-syncs value when the dynamic bounds change", async () => {
const w = await setup();
const minInput = inputOf(w, 1);
await minInput.setValue("800");
await minInput.trigger("blur");
await flushPromises();
expect(progress(w).attributes("aria-valuemin")).toBe("800");
expect(progress(w).attributes("aria-valuenow")).toBe("800");
expect(output(w).text()).toBe("0%");
await minInput.setValue("2000");
await minInput.trigger("blur");
await flushPromises();
expect(progress(w).attributes("aria-valuemin")).toBe("999");
expect(progress(w).attributes("aria-valuenow")).toBe("999");
const maxInput = inputOf(w, 2);
await maxInput.setValue("400");
await maxInput.trigger("blur");
await flushPromises();
expect(progress(w).attributes("aria-valuemax")).toBe("1000");
expect(progress(w).attributes("aria-valuenow")).toBe("999");
w.unmount();
const fresh = await setup();
const freshMax = inputOf(fresh, 2);
await freshMax.setValue("600");
await freshMax.trigger("blur");
await flushPromises();
expect(progress(fresh).attributes("aria-valuemax")).toBe("600");
expect(progress(fresh).attributes("aria-valuenow")).toBe("600");
expect(output(fresh).text()).toBe("100%");
await freshMax.setValue("0");
await freshMax.trigger("blur");
await flushPromises();
expect(progress(fresh).attributes("aria-valuemax")).toBe("1");
expect(progress(fresh).attributes("aria-valuenow")).toBe("1");
fresh.unmount();
});
it("switches all four formats through the Select panel", async () => {
const w = await setup();
const cases: [string, Intl.NumberFormatOptions, number, number][] = [
["货币", { currency: "USD", style: "currency" }, 750, 1000],
["小数", { style: "decimal" }, 750, 1000],
["单位", { style: "unit", unit: "mile" }, 750, 1000],
["百分比", { style: "percent" }, 750, 1000],
];
for (const [label, options, value, max] of cases) {
await w.get('[data-slot="select-trigger"]').trigger("keydown", {
key: "ArrowDown",
});
await flushPromises();
const panelOptions = [
...document.querySelectorAll<HTMLElement>('[role="option"]'),
];
expect(panelOptions.map((n) => n.textContent?.trim())).toEqual([
"货币",
"百分比",
"小数",
"单位",
]);
const target = panelOptions.find((n) => n.textContent?.trim() === label)!;
target.click();
await flushPromises();
expect(document.querySelector('[role="listbox"]')).toBeNull();
expect(w.get('[data-slot="select-value"]').text()).toContain(label);
const expected =
options.style === "percent"
? percent(value, 0, max)
: text(options, value);
expect(output(w).text()).toBe(expected);
}
w.unmount();
});
});