Files
heroui-vue/packages/styles/components/disclosure.css
T
2026-10-22 18:25:08 +08:00

94 lines
2.3 KiB
CSS

/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix; Vue state adapters. */
/* Base disclosure styles */
.hv-disclosure {
@apply relative;
}
.hv-disclosure__heading {
@apply flex;
}
.hv-disclosure__trigger {
cursor: var(--cursor-interactive);
/*
* Baseline uses inline-block. Button is inline-flex; a later inline-block
* would override it and break icon/text/indicator row layout when asChild
* merges trigger styles onto Button. inline-flex keeps both cases aligned.
*/
@apply inline-flex items-center no-highlight;
/* Focus state */
&:focus-visible:not([data-focused]),
&[data-focus-visible="true"] {
@apply status-focused;
}
/* Disabled state */
&:disabled,
&[aria-disabled="true"] {
@apply status-disabled;
}
}
.hv-disclosure__indicator {
@apply ms-auto size-4 shrink-0 text-inherit;
/**
* Transitions
*/
@apply transition duration-250 motion-reduce:transition-none;
/* Expanded state for indicator rotation */
&[data-expanded="true"] {
@apply -rotate-180;
}
}
/*
* Button's generic svg rule (specificity 0,2,2) sets margin-inline/-size on
* every svg except spinner/link-icon. Beat it and restore end-alignment when
* asChild merges the trigger onto Button.
*/
.hv-button svg.hv-disclosure__indicator[data-slot="disclosure-indicator"] {
margin-block: 0;
margin-inline: 0;
margin-inline-start: auto;
width: 1rem;
height: 1rem;
}
/*
* Height is always var(--disclosure-panel-height). The variable is driven
* by useDisclosurePanelHeight (0px ↔ scrollHeight px → auto) so the CSS
* transition matches React Aria / HeroUI. data-expanded only changes opacity.
*/
.hv-disclosure__content {
opacity: 0;
height: var(--disclosure-panel-height);
overflow: clip;
/**
* Transitions
* CRITICAL: motion-reduce must be AFTER transition for correct override specificity
*/
transition:
height 200ms var(--ease-out-quad),
opacity 200ms var(--ease-out);
@apply motion-reduce:transition-none;
&[data-expanded="true"] {
will-change: height, opacity;
opacity: 1;
}
}
.hv-disclosure__body {
@apply p-2;
}
.hv-disclosure__body-inner {
/* Inner wrapper keeps caller class on the scrolling/inner box. */
}