fix(table): full-width empty state, sort focus ring and fr column widths
HD-08 scope, against heroui ce90ea3 table sources and their
react-aria/react-stately dependencies:
- TableBody empty state now spans every real leaf column by default
(self-registered TableColumns — selection and wrapper-rendered ones
included — reactively following column changes), explicit colspan
still wins, and the vnode-level empty detection keeps avoiding
unknown-component setup/render probing
- sorting keeps one activation per click/Enter/Space (single sort path
via the column) while the baseline focus ring returns: the trigger
button keeps keyboard focus and forwards its real :focus-visible
state to the th's existing [data-focus-visible] hook, so the inset
ring lands on the column header like the pinned source and the UA
outline is suppressed only inside a column; aria-sort="none" on
sortable unsorted columns matches useTableColumnHeader and stays
- defaultWidth="Nfr" distributes the remaining width by weight
instead of silently becoming auto: widths.ts ports react-stately's
calculateColumnSizes (static px/% first, fr flex-grow sharing,
min/max violation freezing, cascade rounding); fr mode locks
table-layout: fixed for exact geometry, re-shares on container
resize, freezes dragged columns to their pixel width and keeps
geometry (with flipped drag direction) in RTL; unmeasured
environments keep native widths
- .table__cell's text-start/font-normal verified to block caller
inheritance and narrowed to th.hv-table__cell { inherit }, keeping
the baseline td row-header typography while ancestor align/weight
cascade into cells again; th scope=row, corner selectors and the
resizer z-index fix are untouched
- tests/fixtures/table-layout.vue (playground) drives the real-browser
geometry/drag/RTL/theme verification; m35-m36 contract pins the two
new CSS markers in the final tarball
Full suite 111 files / 1657 tests, typecheck, build:docs and the
m35-m36 + handbook-styles tarball contracts pass.
This commit is contained in:
@@ -295,12 +295,14 @@ HD-01(2026-10-28):按钮/切换组与导航示例已恢复固定cn基线
|
||||
|
||||
`@heroui-vue/styles` 增量补齐固定源缺失的 5 个 tv 映射与类型:`labelVariants`/`descriptionVariants`/`fieldErrorVariants`/`textFieldVariants`/`switchGroupVariants`(hv- 命名空间,变体集合与默认值与 `heroui/packages/styles/src/components/{label,description,field-error,textfield,switch-group}/*.styles.ts` 逐键一致),`@heroui-vue/components` 再导出同一组函数与 `*Variants` 类型。Label/Description/FieldError/useTextField/SwitchGroup 改为消费同一映射,状态类只保留一处来源,渲染类输出不变(tests/shared-field-styles.test.ts 钉住映射输出与组件输出一致)。恢复 `base` 层全局边框色回退 `border-color: var(--border, currentColor)`(与固定源 base/base.css 同选择器、同层序:preflight 之后);独立 tarball 消费者真实浏览器验证浅/深 `--border`、显式边框色(含字段透明边框)、调用方普通 CSS 覆盖(含与库同选择器的注入规则)与 `--border` 缺失时的 currentColor 回退,CSSOM 确认规则位于 base 层且无 `!important`。`view-transition-name`/`::view-transition` 两条上游全局规则经核查无使用证据(库与文档站均未使用 View Transitions API),不迁移、不建专项。chip `size:"md"`、kbd `variant:"default"` 等效默认类、reduced-motion、Spinner 定尺、Table th 行头、定位补偿与 HD-01~HD-04 成果均未改动。见 [任务结果](tasks/results/HD-05-STYLES.md)。
|
||||
|
||||
|
||||
## HD-06 链接与日期焦点(2026-10-29)
|
||||
|
||||
禁用 Link 移除 href/target/download,包括 asChild 子节点的导航属性,保持 aria-disabled、tabindex=-1 与暴露的 focus;启用恢复,用户事件取消和子 ref 保留。Breadcrumbs 当前/禁用项原已用 span,不重复改写;新增按 ConfigProvider locale 的默认名称及 @action(key),保持 id/key 的数字0与空串身份,取消的激活不通知 action。两个日期触发器按实际 :focus-visible 更新状态标记,鼠标/Tab/关闭恢复由浏览器判定。证据见 [HD-06结果](tasks/results/HD-06-LINK-FOCUS.md)。
|
||||
|
||||
|
||||
## HD-07 字段与OTP公共能力(2026-10-29)
|
||||
|
||||
TextField/SearchField共享autoFocus、组内focus状态、字段级validationErrors与Form错误合并;SearchField槽value与文本值同源。FieldError按共享FieldContext可读取ValidityState快照,TextField/SearchField来自真实控件、OTP支持显式validationDetails或原生提交代理。OTP补autoFocus/pasteTransformer/textAlign,整值pattern与accepted complete对照固定input-otp1.5.0:非法整次编辑拒绝、受控拒绝不complete、满值替换不重复、清空重填再通知。PinInput索引空位与单字符串提交保留;视觉槽对齐、跨格选区、密码管理器策略等Vue边界见组件文档及[任务结果](tasks/results/HD-07-FIELD-OTP.md)。
|
||||
|
||||
## HD-08 Table 空状态、排序焦点与列宽(2026-10-29)
|
||||
|
||||
TableBody 空状态默认跨全部实际叶子列(含选择列与包装渲染的 TableColumn,随列增减响应式更新;未测量环境回退 1),显式 `colspan` 仍优先;保持 vnode 级空判定,不执行未知组件 setup/render 探测。排序保持列头单一激活路径:点击、Enter、Space 各一次(真实浏览器三手势逐一计数),触发按钮保留键盘焦点与 API,把真实 `:focus-visible` 转发到 `th` 的 `[data-focus-visible]` 钩子,焦点环回到基线位置(th 内嵌 2px 环,按钮 UA 轮廓在列内抑制),浅深主题均实测;`aria-sort="none"` 对可排序未排序列属基线行为(react-aria useTableColumnHeader 同款),维持不变。`defaultWidth="Nfr"` 按固定源权重语义实现(移植 react-stately TableColumnLayout/TableUtils 的 flex-grow 解析,Apache-2.0):px/百分比固定列先扣、fr 列按权重分享剩余宽度、min/max 以违规冻结+再分配收敛、整数级联取整保证列宽和等于表宽;存在 fr 列时未设宽度的列按 `1fr` 参与并启用 `table-layout: fixed` 精确几何,容器缩放重分配、拖动列冻结为像素宽度、RTL 几何一致且拖动方向相反,未测量环境(jsdom)保持原生宽度。保留原生 `th scope=row`、圆角选择器与 resizer `z-index` 修复;`.table__cell` 的 `text-start font-normal` 经实测确认会阻断调用方祖先继承(祖先 font-bold/text-center 不下传),收窄为 `th.hv-table__cell { text-align: inherit; font-weight: inherit }`:行头保持基线 td 排版同时保留调用方级联。真实浏览器几何/拖动/焦点验证见 [任务结果](tasks/results/HD-08-TABLE.md)。
|
||||
|
||||
Reference in New Issue
Block a user