fix(pickers): rework B02 against the public review

Restore native clearing, unify the form/field protocol with the other choice
families (per-key entries, disabled and removed keys omitted, shared form
owner), synchronise ComboBox text by key identity, keep filtering out of open
composition sessions, and stop stealing focus when a controlled close is
rejected. Also merge caller refs/ARIA/disabled, implement asChild, autoFocus
and ComboBox variant, use a locale-aware base matcher, and put the indicator
class and slot on the icon element the ported CSS selects.
This commit is contained in:
maoyingjie
2026-10-25 20:40:24 +08:00
parent 3e9be13b19
commit e34b9debdf
24 changed files with 1808 additions and 236 deletions
+10
View File
@@ -1043,3 +1043,13 @@ Tag/TagGroup/ErrorMessage 的最新验收见 [B03 复核记录](migrations/B03-r
- `pnpm typecheck` 通过;`pnpm test` **81 文件 / 1078 项**通过(比 B02c 多 5 项:ComboBox 自定义值回车两例、两族 `data-slot` 契约、Autocomplete 示例搜索框壳层契约);`pnpm build:docs`、`pnpm build:playground`、`pnpm format`、`git diff --check` 通过。
- 编译产物证据(`pnpm build:docs` 输出 `apps/docs/.vitepress/dist/assets/style.*.css`):`data-slot` 属性值已全部去掉误加的 `hv-` 前缀,`data-slot="hv-` 计数为 0;存在 `.hv-combo-box__trigger[data-open=true] [data-slot=combo-box-trigger-default-icon]{rotate:180deg}`、`.hv-autocomplete__indicator[data-slot=autocomplete-default-indicator]`(1rem)与 `.hv-autocomplete__clear-button [data-slot=autocomplete-clear-button-icon]`(0.875rem)。
- 浏览器复验本轮未完成:IAB 在 `Page.enable`(20s)与 `Runtime.evaluate`(10s)连续超时,`tabs.new()` 报 `renderer timed out handling IAB create`,`agent.browsers.list()` 仅有 IAB 一个后端、无扩展 Chrome 可切换。因此本轮不声称已完成浏览器视觉复验;B02b/B02c 那两轮的浏览器结果仍有效,但早于本轮 CSS 与自定义值修复,待 IAB 恢复后需补验触发器图标旋转、弹层搜索框 secondary 变体与自定义值展示。
## 2026-10-25 B02 整批退回返修(评审 R1–R10)
逐项映射见 [B02 报告](migrations/B02-combobox-autocomplete.md) 第 14 节;本段只记录本轮命令与证据。
- 探针固化:`tests/b02-review.probe.test.ts`(30 项,已加入 `test:unit`)。修复前 29 失败 / 1 通过,修复后 30 通过。
- `pnpm typecheck` 通过;`pnpm test` **82 文件 / 1123 项**通过;`pnpm test:unit` 72 文件 / 1087 项通过;`pnpm build:docs`、`pnpm build:playground`、`pnpm format`、`git diff --check` 通过。
- 独立产物消费:`/private/tmp/heroui-b02-consumer` 用两份新 tarball 安装,`node consume-b02-pickers.mjs` 通过;`b02-pickers-contract.ts` 在 NodeNext 与 bundler 两种解析模式下 tsc 通过(含 `@ts-expect-error` 反例)。
- 浏览器 5182(Chromium/IAB):原生点击清除按钮后值回到占位符;指示器与 ComboBox 触发器图标计算尺寸 16px、展开时 `rotate: 180deg`;`on-surface` 输入类名为 `hv-input--secondary` 且 `box-shadow` 全零;自定义值输入后回车文本保留并关闭;搜索框 `Tab` 与页面外部点击都不会把焦点抢回触发器。
- 未验证:真实系统输入法、读屏软件、逐像素对比、独立工程内的浏览器 ESM/CSS 运行、浮层选项真实鼠标点击、嵌套 Modal 逐层 Escape、快速重开。