diff --git a/apps/docs/.vitepress/theme/navigation.ts b/apps/docs/.vitepress/theme/navigation.ts index 22a85bc..742f96d 100644 --- a/apps/docs/.vitepress/theme/navigation.ts +++ b/apps/docs/.vitepress/theme/navigation.ts @@ -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", @@ -220,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", diff --git a/apps/docs/components/progress-bar.md b/apps/docs/components/progress-bar.md index 04b9e4a..562694d 100644 --- a/apps/docs/components/progress-bar.md +++ b/apps/docs/components/progress-bar.md @@ -85,7 +85,7 @@ import { -> 基线差异:上游示例使用 `NumberField` 与 `Select` 调节数值与格式;这两个组件尚未迁移。本示例以原生 `input[type=number]` / `select` 搭配 `hv-input` 样式临时替代,交互与布局对齐基线,控件本身不是本库已发布的 NumberField/Select。 +> 控件说明:该示例与上游一致,使用本库公共 `NumberField` 与 `Select` 调节数值与格式。清空或无效输入草稿被拒绝并恢复上一个接受值;越界输入收敛到当前最小/最大值范围内,不会产生 NaN 或进度显示失配。 ## 自定义样式 diff --git a/apps/docs/demos/progress-bar-custom-value.vue b/apps/docs/demos/progress-bar-custom-value.vue index 3fa63a0..36d30e0 100644 --- a/apps/docs/demos/progress-bar-custom-value.vue +++ b/apps/docs/demos/progress-bar-custom-value.vue @@ -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 = { 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; +} diff --git a/docs/compatibility.md b/docs/compatibility.md index b842738..6895075 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -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 触发;高度动画映射测量变量 | @@ -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 | diff --git a/docs/component-notes.md b/docs/component-notes.md index 875bafd..4556c6f 100644 --- a/docs/component-notes.md +++ b/docs/component-notes.md @@ -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)。 diff --git a/docs/tasks/API-ROOT-AND-PROGRESS-DEMO.md b/docs/tasks/API-ROOT-AND-PROGRESS-DEMO.md new file mode 100644 index 0000000..ae5e8e8 --- /dev/null +++ b/docs/tasks/API-ROOT-AND-PROGRESS-DEMO.md @@ -0,0 +1,60 @@ + + +# 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。 diff --git a/docs/tasks/README.md b/docs/tasks/README.md index a5b2a6d..460fd99 100644 --- a/docs/tasks/README.md +++ b/docs/tasks/README.md @@ -20,6 +20,7 @@ | 卡 | 用途 | | ----------------------------------------- | ----------------------------------------------------------- | +| [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 例、共享颜色与嵌套弹层验收 | diff --git a/packages/vue/src/components/number-field/NumberFieldInput.vue b/packages/vue/src/components/number-field/NumberFieldInput.vue index b25215d..8aea5f1 100644 --- a/packages/vue/src/components/number-field/NumberFieldInput.vue +++ b/packages/vue/src/components/number-field/NumberFieldInput.vue @@ -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) diff --git a/packages/vue/src/index.ts b/packages/vue/src/index.ts index 2ad94e9..4b34eb3 100644 --- a/packages/vue/src/index.ts +++ b/packages/vue/src/index.ts @@ -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, @@ -95,19 +101,26 @@ 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 CloseButtonRoot } from "./components/close-button/CloseButton.vue"; export { default as Avatar, default as AvatarRoot, @@ -115,6 +128,7 @@ export { 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, @@ -126,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 { @@ -142,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, @@ -150,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 { @@ -158,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"; @@ -170,6 +190,7 @@ export { } from "./components/alert/context"; export { default as TextField } from "./components/textfield/TextField.vue"; +export { default as TextFieldRoot } from "./components/textfield/TextField.vue"; export { default as Form, default as FormRoot, @@ -200,6 +221,7 @@ export type { } 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"; @@ -211,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"; @@ -223,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"; @@ -245,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"; @@ -274,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"; @@ -287,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"; @@ -303,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"; @@ -314,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"; @@ -325,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"; @@ -345,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"; @@ -360,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 { @@ -369,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"; @@ -403,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"; @@ -442,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"; @@ -462,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"; @@ -478,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, @@ -486,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"; @@ -511,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 { @@ -523,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, @@ -539,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, @@ -646,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, @@ -768,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, @@ -1017,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"; @@ -1057,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 { @@ -1076,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 { @@ -1088,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"; @@ -1115,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"; @@ -1378,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"; diff --git a/packages/vue/src/types-menu.ts b/packages/vue/src/types-menu.ts index f218287..e377f7d 100644 --- a/packages/vue/src/types-menu.ts +++ b/packages/vue/src/types-menu.ts @@ -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; diff --git a/packages/vue/src/types.ts b/packages/vue/src/types.ts index 4834b9f..44f6c71 100644 --- a/packages/vue/src/types.ts +++ b/packages/vue/src/types.ts @@ -978,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; diff --git a/tests/docs-shell.test.ts b/tests/docs-shell.test.ts index b57f7ed..664ce5e 100644 --- a/tests/docs-shell.test.ts +++ b/tests/docs-shell.test.ts @@ -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")) diff --git a/tests/number-field.test.ts b/tests/number-field.test.ts index d9f5108..0f3b534 100644 --- a/tests/number-field.test.ts +++ b/tests/number-field.test.ts @@ -191,6 +191,28 @@ 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( + `${parts}`, + () => ({ update }), + ); + const input = w.get('input[role="spinbutton"]'); + for (const [key, text] of [ + ["9", "49"], + ["0", "490"], + ] as const) { + await input.trigger("keydown", { key }); + await input.setValue(text); + await input.trigger("input"); + 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( diff --git a/tests/package/api-root-aliases-contract.ts b/tests/package/api-root-aliases-contract.ts new file mode 100644 index 0000000..c95bdf4 --- /dev/null +++ b/tests/package/api-root-aliases-contract.ts @@ -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] extends [B] ? ([B] extends [A] ? true : false) : false; + +const AccordionRootPropsEq: Same = true; +const AccordionRootCompEq: Same = true; +const AccordionRootInstanceEq: Same, InstanceType> = true; +const AccordionRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const AccordionRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const AlertRootPropsEq: Same = true; +const AlertRootCompEq: Same = true; +const AlertRootInstanceEq: Same, InstanceType> = true; +const AlertRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const AlertRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const AlertDialogRootPropsEq: Same = true; +const AlertDialogRootCompEq: Same = true; +const AlertDialogRootInstanceEq: Same, InstanceType> = true; +const AlertDialogRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const AlertDialogRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const AutocompleteRootPropsEq: Same = true; +const AutocompleteRootCompEq: Same = true; +const AutocompleteRootInstanceEq: Same, InstanceType> = true; +const AutocompleteRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const AutocompleteRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const AvatarRootPropsEq: Same = true; +const AvatarRootCompEq: Same = true; +const AvatarRootInstanceEq: Same, InstanceType> = true; +const AvatarRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const AvatarRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const AvatarGroupRootPropsEq: Same = true; +const AvatarGroupRootCompEq: Same = true; +const AvatarGroupRootInstanceEq: Same, InstanceType> = true; +const AvatarGroupRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const AvatarGroupRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const BadgeRootPropsEq: Same = true; +const BadgeRootCompEq: Same = true; +const BadgeRootInstanceEq: Same, InstanceType> = true; +const BadgeRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const BadgeRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const BreadcrumbsRootPropsEq: Same = true; +const BreadcrumbsRootCompEq: Same = true; +const BreadcrumbsRootInstanceEq: Same, InstanceType> = true; +const BreadcrumbsRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const BreadcrumbsRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ButtonRootPropsEq: Same = true; +const ButtonRootCompEq: Same = true; +const ButtonRootInstanceEq: Same, InstanceType> = true; +const ButtonRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ButtonRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ButtonGroupRootPropsEq: Same = true; +const ButtonGroupRootCompEq: Same = true; +const ButtonGroupRootInstanceEq: Same, InstanceType> = true; +const ButtonGroupRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ButtonGroupRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const CalendarRootPropsEq: Same = true; +const CalendarRootCompEq: Same = true; +// Calendar 为泛型函数式组件类型,InstanceType 不适用;组件对象等价已覆盖实例/事件/插槽成员。 +const CardRootPropsEq: Same = true; +const CardRootCompEq: Same = true; +const CardRootInstanceEq: Same, InstanceType> = true; +const CardRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const CardRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const CheckboxRootPropsEq: Same = true; +const CheckboxRootCompEq: Same = true; +const CheckboxRootInstanceEq: Same, InstanceType> = true; +const CheckboxRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const CheckboxRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ChipRootPropsEq: Same = true; +const ChipRootCompEq: Same = true; +const ChipRootInstanceEq: Same, InstanceType> = true; +const ChipRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ChipRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const CloseButtonRootPropsEq: Same = true; +const CloseButtonRootCompEq: Same = true; +const CloseButtonRootInstanceEq: Same, InstanceType> = true; +const CloseButtonRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const CloseButtonRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ColorAreaRootPropsEq: Same = true; +const ColorAreaRootCompEq: Same = true; +const ColorAreaRootInstanceEq: Same, InstanceType> = true; +const ColorAreaRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ColorAreaRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ColorFieldRootPropsEq: Same = true; +const ColorFieldRootCompEq: Same = true; +const ColorFieldRootInstanceEq: Same, InstanceType> = true; +const ColorFieldRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ColorFieldRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ColorInputGroupRootPropsEq: Same = true; +const ColorInputGroupRootCompEq: Same = true; +const ColorInputGroupRootInstanceEq: Same, InstanceType> = true; +const ColorInputGroupRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ColorInputGroupRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ColorPickerRootPropsEq: Same = true; +const ColorPickerRootCompEq: Same = true; +const ColorPickerRootInstanceEq: Same, InstanceType> = true; +const ColorPickerRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ColorPickerRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ColorSliderRootPropsEq: Same = true; +const ColorSliderRootCompEq: Same = true; +const ColorSliderRootInstanceEq: Same, InstanceType> = true; +const ColorSliderRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ColorSliderRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ColorSwatchRootPropsEq: Same = true; +const ColorSwatchRootCompEq: Same = true; +const ColorSwatchRootInstanceEq: Same, InstanceType> = true; +const ColorSwatchRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ColorSwatchRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ColorSwatchPickerRootPropsEq: Same = true; +const ColorSwatchPickerRootCompEq: Same = true; +const ColorSwatchPickerRootInstanceEq: Same, InstanceType> = true; +const ColorSwatchPickerRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ColorSwatchPickerRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ComboBoxRootPropsEq: Same = true; +const ComboBoxRootCompEq: Same = true; +const ComboBoxRootInstanceEq: Same, InstanceType> = true; +const ComboBoxRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ComboBoxRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const DateFieldRootPropsEq: Same = true; +const DateFieldRootCompEq: Same = true; +const DateFieldRootInstanceEq: Same, InstanceType> = true; +const DateFieldRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const DateFieldRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const DateInputGroupRootPropsEq: Same = true; +const DateInputGroupRootCompEq: Same = true; +const DateInputGroupRootInstanceEq: Same, InstanceType> = true; +const DateInputGroupRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const DateInputGroupRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const DatePickerRootPropsEq: Same = true; +const DatePickerRootCompEq: Same = true; +const DatePickerRootInstanceEq: Same, InstanceType> = true; +const DatePickerRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const DatePickerRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const DateRangePickerRootPropsEq: Same = true; +const DateRangePickerRootCompEq: Same = true; +const DateRangePickerRootInstanceEq: Same, InstanceType> = true; +const DateRangePickerRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const DateRangePickerRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const DescriptionRootPropsEq: Same = true; +const DescriptionRootCompEq: Same = true; +const DescriptionRootInstanceEq: Same, InstanceType> = true; +const DescriptionRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const DescriptionRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const DisclosureRootPropsEq: Same = true; +const DisclosureRootCompEq: Same = true; +const DisclosureRootInstanceEq: Same, InstanceType> = true; +const DisclosureRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const DisclosureRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const DisclosureGroupRootPropsEq: Same = true; +const DisclosureGroupRootCompEq: Same = true; +const DisclosureGroupRootInstanceEq: Same, InstanceType> = true; +const DisclosureGroupRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const DisclosureGroupRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const DrawerRootPropsEq: Same = true; +const DrawerRootCompEq: Same = true; +const DrawerRootInstanceEq: Same, InstanceType> = true; +const DrawerRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const DrawerRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const DropdownRootPropsEq: Same = true; +const DropdownRootCompEq: Same = true; +const DropdownRootInstanceEq: Same, InstanceType> = true; +const DropdownRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const DropdownRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const EmptyStateRootPropsEq: Same = true; +const EmptyStateRootCompEq: Same = true; +const EmptyStateRootInstanceEq: Same, InstanceType> = true; +const EmptyStateRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const EmptyStateRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ErrorMessageRootPropsEq: Same = true; +const ErrorMessageRootCompEq: Same = true; +const ErrorMessageRootInstanceEq: Same, InstanceType> = true; +const ErrorMessageRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ErrorMessageRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const FieldErrorRootPropsEq: Same = true; +const FieldErrorRootCompEq: Same = true; +const FieldErrorRootInstanceEq: Same, InstanceType> = true; +const FieldErrorRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const FieldErrorRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const FieldsetRootPropsEq: Same = true; +const FieldsetRootCompEq: Same = true; +const FieldsetRootInstanceEq: Same, InstanceType> = true; +const FieldsetRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const FieldsetRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const FormRootPropsEq: Same = true; +const FormRootCompEq: Same = true; +const FormRootInstanceEq: Same, InstanceType> = true; +const FormRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const FormRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const HeaderRootPropsEq: Same = true; +const HeaderRootCompEq: Same = true; +const HeaderRootInstanceEq: Same, InstanceType> = true; +const HeaderRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const HeaderRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const InputRootPropsEq: Same = true; +const InputRootCompEq: Same = true; +const InputRootInstanceEq: Same, InstanceType> = true; +const InputRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const InputRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const InputGroupRootPropsEq: Same = true; +const InputGroupRootCompEq: Same = true; +const InputGroupRootInstanceEq: Same, InstanceType> = true; +const InputGroupRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const InputGroupRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const InputOTPRootPropsEq: Same = true; +const InputOTPRootCompEq: Same = true; +const InputOTPRootInstanceEq: Same, InstanceType> = true; +const InputOTPRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const InputOTPRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const KbdRootPropsEq: Same = true; +const KbdRootCompEq: Same = true; +const KbdRootInstanceEq: Same, InstanceType> = true; +const KbdRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const KbdRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const LabelRootPropsEq: Same = true; +const LabelRootCompEq: Same = true; +const LabelRootInstanceEq: Same, InstanceType> = true; +const LabelRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const LabelRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const LinkRootPropsEq: Same = true; +const LinkRootCompEq: Same = true; +const LinkRootInstanceEq: Same, InstanceType> = true; +const LinkRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const LinkRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +// ListBox 为泛型函数式组件类型,InstanceType 不适用;Props 与组件对象等价已覆盖实例成员。 +const ListBoxRootPropsEq: Same = true; +const ListBoxRootCompEq: Same = true; +const ListBoxItemRootPropsEq: Same = true; +const ListBoxItemRootCompEq: Same = true; +const ListBoxItemRootInstanceEq: Same, InstanceType> = true; +const ListBoxItemRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ListBoxItemRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ListBoxSectionRootPropsEq: Same = true; +const ListBoxSectionRootCompEq: Same = true; +const ListBoxSectionRootInstanceEq: Same, InstanceType> = true; +const ListBoxSectionRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ListBoxSectionRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const MenuRootPropsEq: Same = true; +const MenuRootCompEq: Same = true; +const MenuRootInstanceEq: Same, InstanceType> = true; +const MenuRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const MenuRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const MenuItemRootPropsEq: Same = true; +const MenuItemRootCompEq: Same = true; +const MenuItemRootInstanceEq: Same, InstanceType> = true; +const MenuItemRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const MenuItemRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const MenuSectionRootPropsEq: Same = true; +const MenuSectionRootCompEq: Same = true; +const MenuSectionRootInstanceEq: Same, InstanceType> = true; +const MenuSectionRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const MenuSectionRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const MeterRootPropsEq: Same = true; +const MeterRootCompEq: Same = true; +const MeterRootInstanceEq: Same, InstanceType> = true; +const MeterRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const MeterRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ModalRootPropsEq: Same = true; +const ModalRootCompEq: Same = true; +const ModalRootInstanceEq: Same, InstanceType> = true; +const ModalRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ModalRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const NumberFieldRootPropsEq: Same = true; +const NumberFieldRootCompEq: Same = true; +const NumberFieldRootInstanceEq: Same, InstanceType> = true; +const NumberFieldRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const NumberFieldRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const PaginationRootPropsEq: Same = true; +const PaginationRootCompEq: Same = true; +const PaginationRootInstanceEq: Same, InstanceType> = true; +const PaginationRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const PaginationRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const PopoverRootPropsEq: Same = true; +const PopoverRootCompEq: Same = true; +const PopoverRootInstanceEq: Same, InstanceType> = true; +const PopoverRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const PopoverRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ProgressBarRootPropsEq: Same = true; +const ProgressBarRootCompEq: Same = true; +const ProgressBarRootInstanceEq: Same, InstanceType> = true; +const ProgressBarRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ProgressBarRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ProgressCircleRootPropsEq: Same = true; +const ProgressCircleRootCompEq: Same = true; +const ProgressCircleRootInstanceEq: Same, InstanceType> = true; +const ProgressCircleRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ProgressCircleRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const RadioRootPropsEq: Same = true; +const RadioRootCompEq: Same = true; +const RadioRootInstanceEq: Same, InstanceType> = true; +const RadioRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const RadioRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const RadioGroupRootPropsEq: Same = true; +const RadioGroupRootCompEq: Same = true; +const RadioGroupRootInstanceEq: Same, InstanceType> = true; +const RadioGroupRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const RadioGroupRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const RangeCalendarRootPropsEq: Same = true; +const RangeCalendarRootCompEq: Same = true; +const RangeCalendarRootInstanceEq: Same, InstanceType> = true; +const RangeCalendarRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const RangeCalendarRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ScrollShadowRootPropsEq: Same = true; +const ScrollShadowRootCompEq: Same = true; +const ScrollShadowRootInstanceEq: Same, InstanceType> = true; +const ScrollShadowRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ScrollShadowRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const SearchFieldRootPropsEq: Same = true; +const SearchFieldRootCompEq: Same = true; +const SearchFieldRootInstanceEq: Same, InstanceType> = true; +const SearchFieldRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const SearchFieldRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const SelectRootPropsEq: Same = true; +const SelectRootCompEq: Same = true; +const SelectRootInstanceEq: Same, InstanceType> = true; +const SelectRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const SelectRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const SeparatorRootPropsEq: Same = true; +const SeparatorRootCompEq: Same = true; +const SeparatorRootInstanceEq: Same, InstanceType> = true; +const SeparatorRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const SeparatorRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const SkeletonRootPropsEq: Same = true; +const SkeletonRootCompEq: Same = true; +const SkeletonRootInstanceEq: Same, InstanceType> = true; +const SkeletonRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const SkeletonRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const SliderRootPropsEq: Same = true; +const SliderRootCompEq: Same = true; +const SliderRootInstanceEq: Same, InstanceType> = true; +const SliderRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const SliderRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const SpinnerRootPropsEq: Same = true; +const SpinnerRootCompEq: Same = true; +const SpinnerRootInstanceEq: Same, InstanceType> = true; +const SpinnerRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const SpinnerRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const SurfaceRootPropsEq: Same = true; +const SurfaceRootCompEq: Same = true; +const SurfaceRootInstanceEq: Same, InstanceType> = true; +const SurfaceRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const SurfaceRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const SwitchRootPropsEq: Same = true; +const SwitchRootCompEq: Same = true; +const SwitchRootInstanceEq: Same, InstanceType> = true; +const SwitchRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const SwitchRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const SwitchGroupRootPropsEq: Same = true; +const SwitchGroupRootCompEq: Same = true; +const SwitchGroupRootInstanceEq: Same, InstanceType> = true; +const SwitchGroupRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const SwitchGroupRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const TableRootPropsEq: Same = true; +const TableRootCompEq: Same = true; +const TableRootInstanceEq: Same, InstanceType> = true; +const TableRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const TableRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const TabsRootPropsEq: Same = true; +const TabsRootCompEq: Same = true; +const TabsRootInstanceEq: Same, InstanceType> = true; +const TabsRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const TabsRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const TagRootPropsEq: Same = true; +const TagRootCompEq: Same = true; +const TagRootInstanceEq: Same, InstanceType> = true; +const TagRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const TagRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const TagGroupRootPropsEq: Same = true; +const TagGroupRootCompEq: Same = true; +const TagGroupRootInstanceEq: Same, InstanceType> = true; +const TagGroupRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const TagGroupRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const TextAreaRootPropsEq: Same = true; +const TextAreaRootCompEq: Same = true; +const TextAreaRootInstanceEq: Same, InstanceType> = true; +const TextAreaRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const TextAreaRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const TextFieldRootPropsEq: Same = true; +const TextFieldRootCompEq: Same = true; +const TextFieldRootInstanceEq: Same, InstanceType> = true; +const TextFieldRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const TextFieldRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const TimeFieldRootPropsEq: Same = true; +const TimeFieldRootCompEq: Same = true; +const TimeFieldRootInstanceEq: Same, InstanceType> = true; +const TimeFieldRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const TimeFieldRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ToggleButtonRootPropsEq: Same = true; +const ToggleButtonRootCompEq: Same = true; +const ToggleButtonRootInstanceEq: Same, InstanceType> = true; +const ToggleButtonRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ToggleButtonRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ToggleButtonGroupRootPropsEq: Same = true; +const ToggleButtonGroupRootCompEq: Same = true; +const ToggleButtonGroupRootInstanceEq: Same, InstanceType> = true; +const ToggleButtonGroupRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ToggleButtonGroupRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const ToolbarRootPropsEq: Same = true; +const ToolbarRootCompEq: Same = true; +const ToolbarRootInstanceEq: Same, InstanceType> = true; +const ToolbarRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const ToolbarRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const TooltipRootPropsEq: Same = true; +const TooltipRootCompEq: Same = true; +const TooltipRootInstanceEq: Same, InstanceType> = true; +const TooltipRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const TooltipRootSlotsEq: Same["$slots"], InstanceType["$slots"]> = true; +const TypographyRootPropsEq: Same = true; +const TypographyRootCompEq: Same = true; +const TypographyRootInstanceEq: Same, InstanceType> = true; +const TypographyRootEmitsEq: Same["$emit"], InstanceType["$emit"]> = true; +const TypographyRootSlotsEq: Same["$slots"], InstanceType["$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, +]; diff --git a/tests/package/check-client.mjs b/tests/package/check-client.mjs index e7efbd1..3be7eec 100644 --- a/tests/package/check-client.mjs +++ b/tests/package/check-client.mjs @@ -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)`); } diff --git a/tests/package/client-checks.json b/tests/package/client-checks.json index ed801c2..c613b30 100644 --- a/tests/package/client-checks.json +++ b/tests/package/client-checks.json @@ -553,5 +553,258 @@ "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": [] } } diff --git a/tests/progress-meter.test.ts b/tests/progress-meter.test.ts index 4621f4a..704487c 100644 --- a/tests/progress-meter.test.ts +++ b/tests/progress-meter.test.ts @@ -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, index: number) => + w.findAll('[data-slot="number-field"]')[index]; + const inputOf = (w: ReturnType, index: number) => + field(w, index).get("input[role=spinbutton]"); + const progress = (w: ReturnType) => + w.get("[data-slot=progress-bar]"); + const output = (w: ReturnType) => + w.get("[data-slot=progress-bar-output]"); + const fill = (w: ReturnType) => + 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('[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(); + }); +});