fix: align Dropdown/Menu with the HeroUI baseline after fidelity audit

- menu-item.css keys disabled styling off the presence attribute Reka emits.
- Dropdown surfaces drive the ported enter/exit animations and use data-side
  for placement-specific motion.
- One role=menu per popup; items render their key as DOM id; submenu surfaces
  point aria-labelledby at the real trigger; MenuSection names its group from a
  nested Header.
- Custom (asChild) triggers stay keyboard focusable; library Button/Avatar keep
  their own layout instead of the custom-trigger rules.
- Items emit data-focused/data-hovered/data-pressed, expose the upstream render
  props to slots, and merge caller classes through tailwind-variants.
- Submenu triggers declare hasSubmenu explicitly and forward class/ARIA; the
  default submenu indicator uses the baseline chevron artwork.
- Demos restore Kbd slot="keyboard" (27x), IconSquarePlus, and remove the added
  comment, stray space and duplicated indicator SVGs.
- Document the page after the official structure and API tables, including
  renamed props, Vue extensions and remaining gaps.
This commit is contained in:
maoyingjie
2026-10-24 22:14:10 +08:00
parent 64aaf5e53f
commit 043a5418f3
27 changed files with 1124 additions and 254 deletions
+18 -7
View File
@@ -40,6 +40,17 @@
}
}
/* Library Button/Avatar keep their own layout when used as a Vue trigger.
The custom-trigger affordances above only need to apply to plain elements,
so the base layout utilities of those components win back. */
.hv-dropdown__trigger.hv-button {
display: inline-flex;
}
.hv-dropdown__trigger.hv-avatar {
display: flex;
}
/* Similar to select popover styles */
.hv-dropdown__popover {
@apply max-w-[48svw] origin-(--trigger-anchor-point) scroll-py-1 scrollbar overflow-y-auto overscroll-contain bg-overlay p-0 text-sm md:min-w-55;
@@ -55,19 +66,19 @@
&[data-entering="true"] {
@apply animate-in duration-150 ease-smooth fade-in-0 zoom-in-90;
&[data-placement="top"] {
&[data-side="top"] {
@apply slide-in-from-bottom-1;
}
&[data-placement="bottom"] {
&[data-side="bottom"] {
@apply slide-in-from-top-1;
}
&[data-placement="left"] {
&[data-side="left"] {
@apply slide-in-from-right-1;
}
&[data-placement="right"] {
&[data-side="right"] {
@apply slide-in-from-left-1;
}
}
@@ -88,15 +99,15 @@
fill: var(--overlay);
}
&[data-placement="bottom"] [data-slot="popover-overlay-arrow"] {
&[data-side="bottom"] [data-slot="popover-overlay-arrow"] {
rotate: 180deg;
}
&[data-placement="left"] [data-slot="popover-overlay-arrow"] {
&[data-side="left"] [data-slot="popover-overlay-arrow"] {
rotate: -90deg;
}
&[data-placement="right"] [data-slot="popover-overlay-arrow"] {
&[data-side="right"] [data-slot="popover-overlay-arrow"] {
rotate: 90deg;
}