DropdownMenu group label 样式对齐 Select(WEB-1116)
版本: 0.6.0 · 类型: 🐛 缺陷修复
问题
DropdownMenuLabel 样式与 Select grouped header 不一致:
| 属性 | 修复前 | 修复后(对齐 Select) |
|---|---|---|
| font-weight | font-semibold | font-normal |
| color | text-(--Labels-Secondary) | text-(--Labels-Tertiary) |
| padding | py-(--Spacing_8)(上下各 8px) | pt-(--Spacing_8)(仅上方 8px) |
根因: ui/dropdown-menu.tsx 的 DropdownMenuLabel 带有 shadcn 默认样式 py-1.5。设计层未使用 unstyledVisual,tailwind-merge 只覆盖了 pt,保留了 py-1.5 的底部一半,导致实际渲染多出 6px 底部 padding。
改动文件
packages/design/src/components/DropdownMenu/styles.tspackages/design/src/components/DropdownMenu/DropdownMenu.tsxpackages/design/src/components/ui/dropdown-menu.tsx
改动内容
DROPDOWN_LABEL_TOKEN_CLASS:py-(--Spacing_8)→pt-(--Spacing_8),font-semibold→font-normal,text-(--Labels-Secondary)→text-(--Labels-Tertiary)ui/DropdownMenuLabel新增unstyledVisual?: booleanprop,为true时清除 shadcn 默认视觉类(px-2 py-1.5 text-sm font-semibold)- 设计层
DropdownMenuLabel传入unstyledVisual,与 Select 对同一 primitive 的处理方式一致