403 lines
8.1 KiB
CSS
403 lines
8.1 KiB
CSS
/* Adapted from HeroUI ce90ea3. Copyright 2025 NextUI Inc.
|
|
* Apache-2.0; see third-party/HEROUI-LICENSE. hv- namespace and Vue/Reka adapters. */
|
|
/**
|
|
* Element: trigger - the element that opens the drawer
|
|
*/
|
|
.hv-drawer__trigger {
|
|
@apply inline-block cursor-(--cursor-interactive);
|
|
|
|
/**
|
|
* Transitions
|
|
* CRITICAL: motion-reduce must be AFTER transition for correct override specificity
|
|
*/
|
|
transition:
|
|
transform 250ms var(--ease-out-quart),
|
|
background-color 150ms var(--ease-smooth),
|
|
box-shadow 150ms var(--ease-out);
|
|
@apply motion-reduce:transition-none;
|
|
|
|
/* Focus state */
|
|
&:focus-visible:not([data-focused]),
|
|
&[data-focus-visible="true"] {
|
|
@apply status-focused;
|
|
}
|
|
|
|
/* Disabled state */
|
|
&:disabled,
|
|
&[aria-disabled="true"] {
|
|
@apply status-disabled;
|
|
}
|
|
|
|
/* Active/pressed state */
|
|
&:active,
|
|
&[data-pressed="true"] {
|
|
transform: scale(0.97);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Element: backdrop - the overlay behind the drawer
|
|
* Enter/exit use CSS animations (not transitions) so Reka Presence
|
|
* keeps the node until animationend instead of unmounting immediately.
|
|
*/
|
|
.hv-drawer__backdrop {
|
|
@apply fixed inset-0 z-(--z-index-overlay);
|
|
@apply h-(--visual-viewport-height) w-full;
|
|
opacity: 1;
|
|
|
|
&[data-entering="true"] {
|
|
animation: hv-drawer-backdrop-in 250ms cubic-bezier(0.32, 0.72, 0, 1);
|
|
}
|
|
|
|
&[data-exiting="true"] {
|
|
animation: hv-drawer-backdrop-out 200ms cubic-bezier(0.32, 0.72, 0, 1);
|
|
}
|
|
|
|
&[data-exiting="true"],
|
|
&[data-entering="true"] {
|
|
will-change: opacity;
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
animation: none;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Modifier: backdrop--transparent
|
|
*/
|
|
.hv-drawer__backdrop--transparent {
|
|
@apply bg-transparent;
|
|
}
|
|
|
|
/**
|
|
* Modifier: backdrop--opaque
|
|
*/
|
|
.hv-drawer__backdrop--opaque {
|
|
@apply bg-backdrop;
|
|
}
|
|
|
|
/**
|
|
* Modifier: backdrop--blur
|
|
*/
|
|
.hv-drawer__backdrop--blur {
|
|
@apply bg-backdrop backdrop-blur-md;
|
|
}
|
|
|
|
/**
|
|
* Element: content - the positioning wrapper for the drawer panel
|
|
*/
|
|
.hv-drawer__content {
|
|
@apply pointer-events-none;
|
|
@apply fixed inset-0 z-(--z-index-overlay) flex;
|
|
@apply h-(--visual-viewport-height) w-full min-w-0;
|
|
}
|
|
|
|
/**
|
|
* Modifier: content--bottom (default)
|
|
* Slides up from the bottom edge
|
|
*/
|
|
.hv-drawer__content--bottom {
|
|
@apply items-end;
|
|
}
|
|
|
|
/**
|
|
* Modifier: content--top
|
|
* Slides down from the top edge
|
|
*/
|
|
.hv-drawer__content--top {
|
|
@apply items-start;
|
|
}
|
|
|
|
/**
|
|
* Modifier: content--left
|
|
* Slides in from the left edge
|
|
*/
|
|
.hv-drawer__content--left {
|
|
@apply justify-start;
|
|
}
|
|
|
|
/**
|
|
* Modifier: content--right
|
|
* Slides in from the right edge
|
|
*/
|
|
.hv-drawer__content--right {
|
|
@apply justify-end;
|
|
}
|
|
|
|
/**
|
|
* Element: dialog - the drawer panel itself
|
|
* Enter/exit animate the `translate` property so drag can compose via `transform`.
|
|
*/
|
|
.hv-drawer__dialog {
|
|
@apply relative;
|
|
@apply flex flex-col;
|
|
@apply bg-overlay shadow-overlay outline-none;
|
|
@apply p-6;
|
|
@apply pointer-events-auto;
|
|
|
|
--drawer-enter-duration: 250ms;
|
|
--drawer-exit-duration: 200ms;
|
|
--drawer-enter-ease: cubic-bezier(0.32, 0.72, 0, 1);
|
|
--drawer-exit-ease: cubic-bezier(0.32, 0.72, 0, 1);
|
|
|
|
will-change: translate;
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
animation: none;
|
|
}
|
|
|
|
/* Bottom/top placement: full width, auto height */
|
|
&[data-placement="bottom"] {
|
|
@apply w-full;
|
|
@apply max-h-[85vh];
|
|
border-start-start-radius: min(32px, var(--radius-2xl));
|
|
border-start-end-radius: min(32px, var(--radius-2xl));
|
|
}
|
|
|
|
&[data-placement="top"] {
|
|
@apply w-full;
|
|
@apply max-h-[85vh];
|
|
border-end-start-radius: min(32px, var(--radius-2xl));
|
|
border-end-end-radius: min(32px, var(--radius-2xl));
|
|
}
|
|
|
|
/* Left/right placement: auto width, full height */
|
|
&[data-placement="left"] {
|
|
@apply h-full rounded-none;
|
|
@apply w-80 max-w-[85vw] sm:w-96;
|
|
}
|
|
|
|
&[data-placement="right"] {
|
|
@apply h-full rounded-none;
|
|
@apply w-80 max-w-[85vw] sm:w-96;
|
|
}
|
|
}
|
|
|
|
/* Enter/exit animations live on the dialog node (the real animation owner). */
|
|
.hv-drawer__dialog[data-entering="true"][data-placement="left"] {
|
|
animation: hv-drawer-in-from-left var(--drawer-enter-duration)
|
|
var(--drawer-enter-ease);
|
|
}
|
|
|
|
.hv-drawer__dialog[data-entering="true"][data-placement="right"] {
|
|
animation: hv-drawer-in-from-right var(--drawer-enter-duration)
|
|
var(--drawer-enter-ease);
|
|
}
|
|
|
|
.hv-drawer__dialog[data-entering="true"][data-placement="top"] {
|
|
animation: hv-drawer-in-from-top var(--drawer-enter-duration)
|
|
var(--drawer-enter-ease);
|
|
}
|
|
|
|
.hv-drawer__dialog[data-entering="true"][data-placement="bottom"] {
|
|
animation: hv-drawer-in-from-bottom var(--drawer-enter-duration)
|
|
var(--drawer-enter-ease);
|
|
}
|
|
|
|
.hv-drawer__dialog[data-exiting="true"][data-placement="left"] {
|
|
animation: hv-drawer-out-to-left var(--drawer-exit-duration)
|
|
var(--drawer-exit-ease);
|
|
}
|
|
|
|
.hv-drawer__dialog[data-exiting="true"][data-placement="right"] {
|
|
animation: hv-drawer-out-to-right var(--drawer-exit-duration)
|
|
var(--drawer-exit-ease);
|
|
}
|
|
|
|
.hv-drawer__dialog[data-exiting="true"][data-placement="top"] {
|
|
animation: hv-drawer-out-to-top var(--drawer-exit-duration)
|
|
var(--drawer-exit-ease);
|
|
}
|
|
|
|
.hv-drawer__dialog[data-exiting="true"][data-placement="bottom"] {
|
|
animation: hv-drawer-out-to-bottom var(--drawer-exit-duration)
|
|
var(--drawer-exit-ease);
|
|
}
|
|
|
|
/* Reduced motion must beat direction-specific animation rules, including
|
|
* explicit data-reduce-motion on the element or its portal ancestor. */
|
|
.hv-drawer__dialog[data-entering="true"][data-placement],
|
|
.hv-drawer__dialog[data-exiting="true"][data-placement],
|
|
.hv-drawer__backdrop[data-entering="true"],
|
|
.hv-drawer__backdrop[data-exiting="true"] {
|
|
@apply motion-reduce:animate-none;
|
|
}
|
|
|
|
@keyframes hv-drawer-backdrop-in {
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
@keyframes hv-drawer-backdrop-out {
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
}
|
|
|
|
@keyframes hv-drawer-in-from-left {
|
|
from {
|
|
translate: -100% 0;
|
|
}
|
|
to {
|
|
translate: 0 0;
|
|
}
|
|
}
|
|
|
|
@keyframes hv-drawer-in-from-right {
|
|
from {
|
|
translate: 100% 0;
|
|
}
|
|
to {
|
|
translate: 0 0;
|
|
}
|
|
}
|
|
|
|
@keyframes hv-drawer-in-from-top {
|
|
from {
|
|
translate: 0 -100%;
|
|
}
|
|
to {
|
|
translate: 0 0;
|
|
}
|
|
}
|
|
|
|
@keyframes hv-drawer-in-from-bottom {
|
|
from {
|
|
translate: 0 100%;
|
|
}
|
|
to {
|
|
translate: 0 0;
|
|
}
|
|
}
|
|
|
|
@keyframes hv-drawer-out-to-left {
|
|
from {
|
|
translate: 0 0;
|
|
}
|
|
to {
|
|
translate: -100% 0;
|
|
}
|
|
}
|
|
|
|
@keyframes hv-drawer-out-to-right {
|
|
from {
|
|
translate: 0 0;
|
|
}
|
|
to {
|
|
translate: 100% 0;
|
|
}
|
|
}
|
|
|
|
@keyframes hv-drawer-out-to-top {
|
|
from {
|
|
translate: 0 0;
|
|
}
|
|
to {
|
|
translate: 0 -100%;
|
|
}
|
|
}
|
|
|
|
@keyframes hv-drawer-out-to-bottom {
|
|
from {
|
|
translate: 0 0;
|
|
}
|
|
to {
|
|
translate: 0 100%;
|
|
}
|
|
}
|
|
|
|
.hv-drawer__dialog--top {
|
|
@apply pb-2;
|
|
.hv-drawer__handle {
|
|
@apply pb-0;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Element: header - the top section with the title
|
|
*/
|
|
.hv-drawer__header {
|
|
@apply flex flex-col gap-3;
|
|
@apply mb-0;
|
|
}
|
|
|
|
/**
|
|
* Element: heading - the main title text
|
|
*/
|
|
.hv-drawer__heading {
|
|
@apply align-middle;
|
|
@apply text-base font-medium text-foreground;
|
|
}
|
|
|
|
/**
|
|
* Element: body - the main content area
|
|
* touch-action: pan-y allows vertical scrolling while the dialog captures drag gestures
|
|
*/
|
|
.hv-drawer__body {
|
|
@apply min-h-0 flex-1 scrollbar;
|
|
@apply text-sm leading-[1.43] text-muted;
|
|
@apply -m-[3px] my-0 p-[3px];
|
|
@apply overflow-y-auto overscroll-contain;
|
|
-webkit-overflow-scrolling: touch;
|
|
}
|
|
|
|
/**
|
|
* Element: footer - the bottom action section
|
|
*/
|
|
.hv-drawer__footer {
|
|
@apply flex flex-row items-center justify-end gap-2;
|
|
@apply mt-0;
|
|
}
|
|
|
|
/**
|
|
* Element: handle - visual drag handle indicator
|
|
*/
|
|
.hv-drawer__handle {
|
|
@apply flex items-center justify-center;
|
|
@apply pb-2;
|
|
|
|
/* The handle bar */
|
|
& > [data-slot="drawer-handle-bar"] {
|
|
@apply h-1 w-9 rounded-xs;
|
|
@apply bg-separator;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Element: close-trigger - the close button
|
|
*/
|
|
.hv-drawer__close-trigger {
|
|
@apply absolute end-4 top-4;
|
|
}
|
|
|
|
/**
|
|
* Elements Spacing
|
|
*/
|
|
.hv-drawer__header + .hv-drawer__body {
|
|
@apply mt-2;
|
|
}
|
|
|
|
.hv-drawer__header + .hv-drawer__footer {
|
|
@apply mt-5;
|
|
}
|
|
|
|
.hv-drawer__body + .hv-drawer__footer {
|
|
@apply mt-5;
|
|
}
|
|
|
|
.hv-drawer__handle + .hv-drawer__header {
|
|
@apply mt-0;
|
|
}
|
|
|
|
.hv-drawer__handle + .hv-drawer__body {
|
|
@apply mt-0;
|
|
}
|