merge: integrate reviewed AlertDialog Drawer with ListBox main
This commit is contained in:
@@ -0,0 +1,219 @@
|
||||
/* Adapted from HeroUI ce90ea3. Copyright 2025 NextUI Inc.
|
||||
* Apache-2.0; see third-party/HEROUI-LICENSE. hv- namespace and Vue/Reka adapters. */
|
||||
/* -------------------------------------------------------------------------------------------------
|
||||
* AlertDialog Component Styles
|
||||
* Block: alert-dialog
|
||||
* -----------------------------------------------------------------------------------------------*/
|
||||
|
||||
.hv-alert-dialog__trigger {
|
||||
@apply inline-block cursor-(--cursor-interactive);
|
||||
|
||||
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-visible:not([data-focused]),
|
||||
&[data-focus-visible="true"] {
|
||||
@apply status-focused;
|
||||
}
|
||||
|
||||
&:disabled,
|
||||
&[aria-disabled="true"] {
|
||||
@apply status-disabled;
|
||||
}
|
||||
|
||||
&:active,
|
||||
&[data-pressed="true"] {
|
||||
transform: scale(0.97);
|
||||
}
|
||||
}
|
||||
|
||||
.hv-alert-dialog__backdrop {
|
||||
@apply fixed inset-0 z-(--z-index-overlay);
|
||||
@apply flex flex-row items-center justify-center;
|
||||
@apply h-(--visual-viewport-height) w-full;
|
||||
|
||||
&[data-entering="true"] {
|
||||
@apply animate-in duration-150 ease-out fade-in-0;
|
||||
}
|
||||
|
||||
&[data-exiting="true"] {
|
||||
@apply animate-out duration-100 ease-out fade-out-0;
|
||||
}
|
||||
|
||||
&[data-exiting="true"],
|
||||
&[data-entering="true"] {
|
||||
@apply will-change-[opacity];
|
||||
@apply motion-reduce:animate-none;
|
||||
}
|
||||
}
|
||||
|
||||
.hv-alert-dialog__backdrop--transparent {
|
||||
@apply bg-transparent;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__backdrop--opaque {
|
||||
@apply bg-backdrop;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__backdrop--blur {
|
||||
@apply bg-backdrop backdrop-blur-md;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__container {
|
||||
@apply flex flex-col items-center;
|
||||
@apply h-(--visual-viewport-height) w-full min-w-0 flex-1;
|
||||
@apply p-4;
|
||||
@apply sm:w-fit sm:p-10;
|
||||
@apply pointer-events-none;
|
||||
|
||||
&[data-entering="true"] {
|
||||
@apply animate-in duration-250 ease-out-quad fade-in-0 zoom-in-105;
|
||||
|
||||
&[data-placement="auto"] {
|
||||
@apply slide-in-from-bottom-1;
|
||||
@apply sm:slide-in-from-bottom-0;
|
||||
}
|
||||
|
||||
&[data-placement="top"] {
|
||||
@apply slide-in-from-top-1;
|
||||
}
|
||||
|
||||
&[data-placement="center"] {
|
||||
@apply slide-in-from-top-0;
|
||||
}
|
||||
|
||||
&[data-placement="bottom"] {
|
||||
@apply slide-in-from-bottom-1;
|
||||
}
|
||||
}
|
||||
|
||||
&[data-exiting="true"] {
|
||||
@apply animate-out duration-100 ease-out-quad fade-out-0 zoom-out-95;
|
||||
}
|
||||
|
||||
&[data-exiting="true"],
|
||||
&[data-entering="true"] {
|
||||
@apply will-change-[opacity,transform];
|
||||
@apply motion-reduce:animate-none;
|
||||
}
|
||||
}
|
||||
|
||||
.hv-alert-dialog__dialog {
|
||||
@apply relative;
|
||||
@apply flex min-h-0 w-full flex-col;
|
||||
@apply max-h-full;
|
||||
@apply bg-overlay shadow-overlay outline-none;
|
||||
border-radius: min(32px, var(--radius-3xl));
|
||||
@apply p-6;
|
||||
@apply overflow-clip;
|
||||
@apply pointer-events-auto;
|
||||
|
||||
&[data-placement="auto"] {
|
||||
@apply mt-auto;
|
||||
@apply sm:my-auto;
|
||||
}
|
||||
|
||||
&[data-placement="center"] {
|
||||
@apply my-auto;
|
||||
}
|
||||
|
||||
&[data-placement="bottom"] {
|
||||
@apply mt-auto;
|
||||
}
|
||||
|
||||
&[data-placement="top"] {
|
||||
@apply mt-0;
|
||||
}
|
||||
}
|
||||
|
||||
.hv-alert-dialog__dialog--xs {
|
||||
@apply max-w-xs;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__dialog--sm {
|
||||
@apply max-w-sm;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__dialog--md {
|
||||
@apply max-w-md;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__dialog--lg {
|
||||
@apply max-w-lg;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__dialog--cover {
|
||||
@apply h-full min-h-full w-full;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__header {
|
||||
@apply flex flex-col gap-3;
|
||||
@apply mb-0;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__heading {
|
||||
@apply align-middle;
|
||||
@apply text-base font-medium text-foreground;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__icon {
|
||||
@apply flex items-center justify-center;
|
||||
@apply size-10 shrink-0;
|
||||
@apply rounded-3xl select-none;
|
||||
|
||||
[data-slot="alert-dialog-default-icon"] {
|
||||
@apply box-content size-5;
|
||||
}
|
||||
}
|
||||
|
||||
.hv-alert-dialog__icon--default {
|
||||
@apply bg-default text-foreground;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__icon--accent {
|
||||
@apply bg-accent-soft text-accent-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__icon--success {
|
||||
@apply bg-success-soft text-success-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__icon--warning {
|
||||
@apply bg-warning-soft text-warning-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__icon--danger {
|
||||
@apply bg-danger-soft text-danger-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__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;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__footer {
|
||||
@apply flex flex-row items-center justify-end gap-2;
|
||||
@apply mt-0;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__close-trigger {
|
||||
@apply absolute end-4 top-4;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__header + .hv-alert-dialog__body {
|
||||
@apply mt-2;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__header + .hv-alert-dialog__footer {
|
||||
@apply mt-5;
|
||||
}
|
||||
|
||||
.hv-alert-dialog__body + .hv-alert-dialog__footer {
|
||||
@apply mt-5;
|
||||
}
|
||||
@@ -0,0 +1,414 @@
|
||||
/* 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 the direction-specific animation rules above. */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.hv-drawer__dialog[data-entering="true"],
|
||||
.hv-drawer__dialog[data-exiting="true"],
|
||||
.hv-drawer__dialog[data-entering="true"][data-placement="left"],
|
||||
.hv-drawer__dialog[data-entering="true"][data-placement="right"],
|
||||
.hv-drawer__dialog[data-entering="true"][data-placement="top"],
|
||||
.hv-drawer__dialog[data-entering="true"][data-placement="bottom"],
|
||||
.hv-drawer__dialog[data-exiting="true"][data-placement="left"],
|
||||
.hv-drawer__dialog[data-exiting="true"][data-placement="right"],
|
||||
.hv-drawer__dialog[data-exiting="true"][data-placement="top"],
|
||||
.hv-drawer__dialog[data-exiting="true"][data-placement="bottom"] {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.hv-drawer__backdrop[data-entering="true"],
|
||||
.hv-drawer__backdrop[data-exiting="true"] {
|
||||
animation: 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;
|
||||
}
|
||||
Reference in New Issue
Block a user