# M12 InputGroup 交接报告 实施日期:2026-10-21。状态:实施者自测完成,待集成人复核。**未提交、未推送、未宣布集成验收通过。** ## 1. 起点与范围 | 项 | 值 | | ---------- | ----------------------------------------------------------------------------------------------------- | | 起始 HEAD | `7f11afe`(feat: establish shared field and form foundation,FORM-01) | | 工作区起点 | 干净;未改动 field/context.ts、useFieldPart.ts、useTextControl.ts、TextField、Form guard、Switch 协议 | | 上游基线 | HeroUI 3.2.6 / `ce90ea3ab49d58f6c428f71bfd6fe8ae2a87b960`(`../heroui` 只读) | | 范围 | InputGroup、InputGroupInput、InputGroupTextArea、InputGroupPrefix、InputGroupSuffix | ### 新增 - 样式:`packages/styles/components/input-group.css` - 变体:`inputGroupVariants`(`packages/styles/src/index.ts`) - 组件:`packages/vue/src/components/input-group/{InputGroup,InputGroupInput,InputGroupTextArea,InputGroupPrefix,InputGroupSuffix}.vue` + `context.ts` - 演示 21:`apps/docs/demos/input-group-*.vue` - 文档:`apps/docs/components/input-group.md` - 测试:`tests/input-group.test.ts`(17 项) ### 修改(共享) - `packages/styles/index.css`、`packages/vue/src/{index.ts,types.ts}` - `apps/docs/.vitepress/theme/Layout.vue`、`apps/docs/components.md` - `package.json`(test:unit 增加 input-group.test.ts) - `docs/{compatibility,upstream,verification}.md` ## 2. 上游来源 | 路径 | 用途 | | -------------------------------------------------------------------- | ---------------------------------- | | `packages/react/src/components/input-group/*` | 部件结构、点击聚焦、变体继承 | | `packages/styles/components/input-group.css` | BEM、状态、autofill、textarea 对齐 | | `packages/styles/src/components/input-group/*.styles.ts` | tv 变体 | | `apps/docs/content/docs/cn/react/components/(forms)/input-group.mdx` | 中文结构与示例次序 | | `apps/docs/src/demos/cn/input-group/` | 21 个示例文案与布局 | | `third-party/HEROUI-LICENSE` | Apache-2.0 | ## 3. API 对照(Vue 契约) | 上游 | Vue | 差异 | | ---------------------------------------------- | ------------------------------------------ | ------------------------ | | `InputGroup.Root/Input/TextArea/Prefix/Suffix` | `InputGroup` 等命名导出 | 不用对象式 | | GroupRenderProps / render 函数 children | 默认插槽 | render prop 不搬入 | | `className` / `ReactNode` | `class`(string\|Array\|Object)/ 插槽 | 无 className 别名 | | `variant` 默认 primary | 默认继承 TextField,否则 primary;显式优先 | 对齐上游 resolvedVariant | | RAC Group hover/focus-within | `data-hovered`/`data-focus-within` | Vue 事件驱动 | | RAC Input/TextArea | `useTextControl` + 真实 input/textarea | 复用 FORM-01 协议 | | `role` 默认 group | 同;可选 region/presentation | 一致 | 值/reset/ARIA/FormData 由 TextField + useTextControl 管理;前后缀不是表单字段。 ## 4. 示例逐项对照(21 / 21) 与 CN `input-group.mdx` 的 `` 顺序一致: 1. default 2. variants 3. on-surface 4. with-loading-suffix 5. required 6. disabled 7. full-width 8. with-text-prefix 9. with-text-suffix 10. with-icon-prefix-and-text-suffix 11. with-copy-suffix 12. with-icon-prefix-and-copy-suffix 13. password-with-toggle 14. with-keyboard-shortcut 15. with-badge-suffix 16. invalid 17. with-prefix-icon 18. with-suffix-icon 19. with-prefix-and-suffix 20. with-textarea 21. custom-styles 图标:Tabler(IconMail/IconWorld/IconCopy/IconEye/IconEyeOff/IconAt/IconPlus/IconPlugConnected/IconMicrophone/IconArrowUp)。with-textarea 的 Tooltip 以 `title`+`aria-label` 适配并已在文档注明。 ## 5. 回归场景 | 要求 | 适用性 | 测试 | 结果 | | ---------------------------------------------------- | ------ | -------------------------------------------------------------- | ------ | | 复用 TextField/useTextControl,不第二份值/错误/reset | 适用 | FormData、reset、受控拒绝(field-foundation)+ InputGroup 集成 | 通过 | | 前后缀非表单字段、按钮 type=button 不误提交 | 适用 | FormData 仅含 name;copy 按钮 type=button 不触发 submit | 通过 | | 显式 variant 优先于 TextField | 适用 | 动态切换 | 通过 | | 动态前后缀/加载不破坏焦点和值 | 适用 | 点击聚焦真实 input;loading 后缀示例 | 通过 | | attrs 空→新增→修改→删除→再次新增 | 适用 | group 透传 | 通过 | | class 合并 | 适用 | group + input | 通过 | | 描述/错误关联、native/aria、SSR | 适用 | field-foundation 既有 19 项未改动仍通过 | 通过 | | 文档契约 class≠className | 适用 | 文档断言 | 通过 | | 键盘激活适配 | 不适用 | 展示/组合容器 | 未添加 | ## 6. 命令结果 | 命令 | 文件数 | 通过 | 含 SSR | | ----------------- | ------ | ---- | ------- | | `pnpm test` | 12 | 185 | 是(2) | | `pnpm test:unit` | 11 | 183 | 否 | | `pnpm typecheck` | — | 通过 | — | | `pnpm build:docs` | — | 通过 | — | | `pnpm format` | — | 通过 | — | ## 7. 浏览器证据(Playwright CLI,5173) 视口 1280 与 390。26 组/25 input/1 textarea;disabled 2、invalid 2;后缀按钮均为 type=button;点击组空白聚焦 input;密码切换生效;API 表 736/350 无溢出。控制台仅 favicon 404。 ## 8. 未验证项 浅/深切换交互、位图截图、Nuxt 水合、RTL、读屏、触屏、独立安装 dist、复制按钮实际写入剪贴板、自动视觉对比。 ## 9. 最短复核路径 1. `pnpm test && pnpm test:unit && pnpm typecheck && pnpm build:docs` 2. `/components/input-group`:默认/变体/Surface/加载/必填/禁用/全宽/前后缀/复制/密码/Kbd/Chip/校验/textarea/自定义,共 21 例。 3. 在默认或价格示例输入并提交 Form(或看 `tests/input-group.test.ts` FormData/reset)。 4. 点击组合空白应聚焦输入框;点复制按钮不应提交。 5. 人工补测浅/深与窄屏交互。 ## 10. 需集成人确认 - with-textarea 用 title/aria-label 代替未迁移的 Tooltip 是否可接受。 - 导航中 InputGroup 插在 Input 与 Kbd 之间。 - 点击聚焦扩展到 textarea(上游仅 querySelector('input')),已记录为 Vue 适配。 实施者只记自测,验收结论留给集成人。 ## 集成人后续结论 独立复核与共享协议修正见 [M12-review.md](../history.md)。本报告前文命令与浏览器结果保留为实施者自测阶段记录;最终计数及审查边界以独立报告为准。