fix(dropdown): preserve grouped root attrs and events without breaking seams

This commit is contained in:
maoyingjie
2026-10-28 12:35:35 +08:00
parent 8b1505438e
commit f8de4529f6
12 changed files with 305 additions and 23 deletions
@@ -146,3 +146,73 @@
.hv-button-group--full-width {
@apply w-full;
}
/* Vue Dropdown keeps a root element for consumer attrs and capture events.
* Its trigger's position belongs to that wrapper, not to the trigger's own
* :first-child/:last-child. Scope the correction to marked direct members;
* ordinary buttons and standalone dropdowns retain the baseline rules. */
.hv-button-group > .hv-dropdown[data-button-group-child] > .hv-button {
@apply rounded-none;
}
.hv-button-group--horizontal
> .hv-dropdown[data-button-group-child]:first-child
> .hv-button {
@apply rounded-s-3xl;
}
.hv-button-group--horizontal
> .hv-dropdown[data-button-group-child]:last-child
> .hv-button {
@apply rounded-e-3xl;
}
.hv-button-group--vertical
> .hv-dropdown[data-button-group-child]:first-child
> .hv-button {
@apply rounded-t-3xl;
}
.hv-button-group--vertical
> .hv-dropdown[data-button-group-child]:last-child
> .hv-button {
@apply rounded-b-3xl;
}
/* Only the outer outline edges remain; utilities on the trigger may still
* override these component-layer defaults, as they do for direct Buttons. */
.hv-button-group--horizontal
> .hv-dropdown[data-button-group-child]
> .hv-button--outline {
@apply border-x-0;
}
.hv-button-group--horizontal
> .hv-dropdown[data-button-group-child]:first-child
> .hv-button--outline {
@apply border-s;
}
.hv-button-group--horizontal
> .hv-dropdown[data-button-group-child]:last-child
> .hv-button--outline {
@apply border-e;
}
.hv-button-group--vertical
> .hv-dropdown[data-button-group-child]
> .hv-button--outline {
@apply border-y-0;
}
.hv-button-group--vertical
> .hv-dropdown[data-button-group-child]:first-child
> .hv-button--outline {
@apply border-t;
}
.hv-button-group--vertical
> .hv-dropdown[data-button-group-child]:last-child
> .hv-button--outline {
@apply border-b;
}