merge: integrate reviewed Toast and Table with Select and DateField main
This commit is contained in:
@@ -0,0 +1,407 @@
|
||||
/* Adapted from HeroUI ce90ea3. Copyright 2025 NextUI Inc.
|
||||
* Apache-2.0; see third-party/HEROUI-LICENSE. hv- namespace and Vue adapters. */
|
||||
/* ==========================================================================
|
||||
Table — Data display component for structured tabular data.
|
||||
========================================================================== */
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Table Root — Outer container for table + optional footer.
|
||||
Primary variant: gray background with the table body as a white card inside.
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table-root {
|
||||
@apply relative grid w-full overflow-clip;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Scroll Container — Allows the table to scroll horizontally while the
|
||||
wrapper and footer remain at full width. The parent grid with
|
||||
minmax(0, 1fr) creates a hard width boundary that table layout
|
||||
cannot push beyond.
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__scroll-container {
|
||||
@apply scrollbar overflow-x-auto;
|
||||
scrollbar-gutter: auto;
|
||||
}
|
||||
|
||||
.hv-table-root--primary {
|
||||
@apply bg-surface-secondary px-1 pb-1;
|
||||
border-radius: min(32px, calc(var(--radius) * 2.5));
|
||||
}
|
||||
|
||||
.hv-table-root--secondary {
|
||||
/* No background, padding, or rounding on the root */
|
||||
}
|
||||
|
||||
/* Secondary: header is a standalone rounded card.
|
||||
Background is on cells (not <thead>) because Firefox does not support */
|
||||
.hv-table-root--secondary .hv-table__header {
|
||||
@apply border-b-0 bg-transparent;
|
||||
}
|
||||
|
||||
.hv-table-root--secondary .hv-table__column {
|
||||
@apply bg-surface-secondary;
|
||||
}
|
||||
|
||||
/* Round only the truly first/last column header.
|
||||
Non-virtualized: column is a <th> child of <tr>.
|
||||
Virtualized: column is wrapped in a `VirtualizerItem` (role="presentation") so
|
||||
`:first-child` / `:last-child` on `.hv-table__column` would match every column
|
||||
(each is the only child of its wrapper). Walk up to the row instead. */
|
||||
.hv-table-root--secondary
|
||||
:is(
|
||||
th.hv-table__column:first-child,
|
||||
[role="row"] > [role="presentation"]:first-of-type > .hv-table__column
|
||||
) {
|
||||
border-start-start-radius: min(32px, var(--radius-2xl));
|
||||
border-end-start-radius: min(32px, var(--radius-2xl));
|
||||
}
|
||||
|
||||
.hv-table-root--secondary
|
||||
:is(
|
||||
th.hv-table__column:last-child,
|
||||
[role="row"] > [role="presentation"]:last-of-type > .hv-table__column
|
||||
) {
|
||||
border-start-end-radius: min(32px, var(--radius-2xl));
|
||||
border-end-end-radius: min(32px, var(--radius-2xl));
|
||||
}
|
||||
|
||||
/* Secondary: body has no shadow or rounded corners */
|
||||
.hv-table-root--secondary .hv-table__body {
|
||||
@apply shadow-none;
|
||||
|
||||
/* Non-virtualized */
|
||||
& tr:first-child :is(td, th.hv-table__cell):first-child,
|
||||
& tr:first-child :is(td, th.hv-table__cell):last-child,
|
||||
& tr:last-child :is(td, th.hv-table__cell):first-child,
|
||||
& tr:last-child :is(td, th.hv-table__cell):last-child {
|
||||
@apply rounded-none;
|
||||
}
|
||||
|
||||
/* Virtualized: undo the rounding applied by .hv-table__body:not(tbody) */
|
||||
&:not(tbody) {
|
||||
@apply overflow-visible rounded-none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Secondary: rows are transparent and keep bottom border on every row */
|
||||
.hv-table-root--secondary .hv-table__row {
|
||||
.hv-table__cell {
|
||||
@apply border-b border-separator-tertiary/50 bg-transparent;
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
&:hover .hv-table__cell,
|
||||
&[data-hovered="true"] .hv-table__cell {
|
||||
@apply bg-default/50;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Table Content (<table> element) — the white card inside the root
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__content {
|
||||
@apply w-full border-separate border-spacing-0 text-sm;
|
||||
}
|
||||
|
||||
/* Primary variant: table gets the white surface card look */
|
||||
.hv-table-root--primary .hv-table__content {
|
||||
@apply overflow-clip;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Table Header (<thead>)
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__header {
|
||||
@apply border-b border-separator/50 bg-surface-secondary;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Table Column (<th>)
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__column {
|
||||
@apply relative px-4 py-2.5 text-start text-xs font-medium text-muted;
|
||||
|
||||
/* Separator between columns — a short vertical line on the right edge */
|
||||
&::after {
|
||||
content: "";
|
||||
@apply pointer-events-none absolute end-0 top-1/2 h-4 w-px -translate-y-1/2 rounded-sm bg-separator;
|
||||
}
|
||||
|
||||
&:last-child:not(:only-child)::after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
/* Sortable columns */
|
||||
&[data-allows-sorting="true"] {
|
||||
cursor: var(--cursor-interactive);
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
&[data-allows-sorting="true"]:hover,
|
||||
&[data-allows-sorting="true"][data-hovered="true"] {
|
||||
@apply text-foreground;
|
||||
}
|
||||
}
|
||||
|
||||
/* Focus visible — inset shadow for consistent table focus styling */
|
||||
&:focus-visible,
|
||||
&[data-focus-visible="true"] {
|
||||
@apply rounded-lg outline-none;
|
||||
box-shadow: inset 0 0 0 2px var(--focus);
|
||||
}
|
||||
}
|
||||
|
||||
/* Virtualized: each column is wrapped in a `VirtualizerItem` (role="presentation"),
|
||||
so `.hv-table__column:last-child:not(:only-child)::after` above never matches.
|
||||
Hide the trailing separator on the rightmost wrapper instead. */
|
||||
[role="row"]
|
||||
> [role="presentation"]:last-of-type:not(:only-of-type)
|
||||
> .hv-table__column::after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Sortable Column Header — wraps the column label and an optional indicator
|
||||
icon. Rendered inside a sortable `Table.Column`'s render prop callback.
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__sortable-column-header {
|
||||
@apply flex items-center justify-between;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Sortable Column Indicator — chevron that flips based on `data-direction`.
|
||||
Defaults to pointing up (ascending) and rotates 180° for descending.
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__sortable-column-indicator {
|
||||
@apply inline-grid size-3 transform place-content-center transition-transform duration-100 ease-out;
|
||||
|
||||
&[data-direction="descending"] {
|
||||
@apply rotate-180;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Table Body (<tbody>)
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__body {
|
||||
/* Non-virtualized: round corners via first/last cells
|
||||
(border-radius on <tbody> itself has no effect).
|
||||
Logical properties so corners follow `dir` in RTL. */
|
||||
& tr:first-child :is(td, th.hv-table__cell):first-child {
|
||||
border-start-start-radius: min(32px, var(--radius-2xl));
|
||||
}
|
||||
& tr:first-child :is(td, th.hv-table__cell):last-child {
|
||||
border-start-end-radius: min(32px, var(--radius-2xl));
|
||||
}
|
||||
& tr:last-child :is(td, th.hv-table__cell):first-child {
|
||||
border-end-start-radius: min(32px, var(--radius-2xl));
|
||||
}
|
||||
& tr:last-child :is(td, th.hv-table__cell):last-child {
|
||||
border-end-end-radius: min(32px, var(--radius-2xl));
|
||||
}
|
||||
|
||||
/* Virtualized: elements are divs, not tr/td. VirtualizerItem wrappers
|
||||
break :first-child/:last-child on rows and cells, so round the body
|
||||
itself and clip overflow instead. */
|
||||
&:not(tbody) {
|
||||
@apply relative h-full overflow-clip;
|
||||
border-radius: min(32px, var(--radius-2xl));
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Table Row (<tr>)
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__row {
|
||||
@apply relative h-full;
|
||||
|
||||
/* Bottom separator */
|
||||
@apply border-b border-separator/50;
|
||||
|
||||
/* Last row in body has no bottom border */
|
||||
&:last-child {
|
||||
@apply border-b-0;
|
||||
}
|
||||
|
||||
/* Hover state — applied to cells so Firefox clips bg to border-radius */
|
||||
@media (hover: hover) {
|
||||
&:hover .hv-table__cell,
|
||||
&[data-hovered="true"] .hv-table__cell {
|
||||
@apply bg-surface/40;
|
||||
}
|
||||
}
|
||||
|
||||
/* Selected state */
|
||||
&[data-selected="true"] .hv-table__cell {
|
||||
@apply bg-surface/10;
|
||||
}
|
||||
|
||||
/* Disabled state */
|
||||
&[aria-disabled="true"],
|
||||
&[data-disabled="true"] {
|
||||
@apply status-disabled;
|
||||
}
|
||||
|
||||
/* Row focus ring: see “Table row focus ring” block below (after `.hv-table__cell`). */
|
||||
&:focus-visible,
|
||||
&[data-focus-visible="true"] {
|
||||
@apply outline-none;
|
||||
}
|
||||
|
||||
/* Dragging state */
|
||||
&[data-dragging="true"] {
|
||||
@apply opacity-50;
|
||||
}
|
||||
|
||||
/* Drop target state */
|
||||
&[data-drop-target="true"] .hv-table__cell {
|
||||
@apply bg-accent-soft;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Table Cell (<td>)
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__cell {
|
||||
/* Native row headers must preserve the baseline cell typography/alignment. */
|
||||
@apply text-start font-normal;
|
||||
@apply h-full bg-surface px-4 py-3 align-middle text-sm text-foreground;
|
||||
|
||||
@apply border-b border-separator-tertiary/50;
|
||||
|
||||
/* Focus visible — inset shadow so focus stays within the cell boundaries */
|
||||
&:focus-visible,
|
||||
&[data-focus-visible="true"] {
|
||||
@apply rounded-lg outline-none;
|
||||
box-shadow: inset 0 0 0 2px var(--focus);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Table row focus ring — must follow `.hv-table__cell` (cascade). One continuous
|
||||
inset ring split across cells; `:is(.hv-table__cell, .hv-table__column)` + direct vs
|
||||
`> *:…` covers virtualized wrappers. `:is(:focus-visible, [data-focus-visible])`
|
||||
matches row keyboard focus from RAC.
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__row:is(:focus-visible, [data-focus-visible="true"])
|
||||
:is(.hv-table__cell, .hv-table__column) {
|
||||
@apply shadow-none;
|
||||
}
|
||||
|
||||
.hv-table__row:is(:focus-visible, [data-focus-visible="true"])
|
||||
> :is(.hv-table__cell, .hv-table__column):only-child,
|
||||
.hv-table__row:is(:focus-visible, [data-focus-visible="true"])
|
||||
> *:only-child
|
||||
:is(.hv-table__cell, .hv-table__column) {
|
||||
@apply rounded-lg shadow-[inset_0_0_0_2px_var(--focus)] outline-none;
|
||||
}
|
||||
|
||||
.hv-table__row:is(:focus-visible, [data-focus-visible="true"])
|
||||
> :is(.hv-table__cell, .hv-table__column):first-child:not(:only-child),
|
||||
.hv-table__row:is(:focus-visible, [data-focus-visible="true"])
|
||||
> *:first-child:not(:only-child)
|
||||
:is(.hv-table__cell, .hv-table__column) {
|
||||
@apply rounded-s-lg shadow-[inset_2px_0_0_0_var(--focus),inset_0_2px_0_0_var(--focus),inset_0_-2px_0_0_var(--focus)] outline-none;
|
||||
}
|
||||
|
||||
.hv-table__row:is(:focus-visible, [data-focus-visible="true"])
|
||||
> :is(.hv-table__cell, .hv-table__column):last-child:not(:only-child),
|
||||
.hv-table__row:is(:focus-visible, [data-focus-visible="true"])
|
||||
> *:last-child:not(:only-child)
|
||||
:is(.hv-table__cell, .hv-table__column) {
|
||||
@apply rounded-e-lg shadow-[inset_-2px_0_0_0_var(--focus),inset_0_2px_0_0_var(--focus),inset_0_-2px_0_0_var(--focus)] outline-none;
|
||||
}
|
||||
|
||||
.hv-table__row:is(:focus-visible, [data-focus-visible="true"])
|
||||
> :is(.hv-table__cell, .hv-table__column):not(:first-child):not(
|
||||
:last-child
|
||||
):not(:only-child),
|
||||
.hv-table__row:is(:focus-visible, [data-focus-visible="true"])
|
||||
> *:not(:first-child):not(:last-child):not(:only-child)
|
||||
:is(.hv-table__cell, .hv-table__column) {
|
||||
@apply shadow-[inset_0_2px_0_0_var(--focus),inset_0_-2px_0_0_var(--focus)] outline-none;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Tree / expandable rows — indent the tree column by depth (any level).
|
||||
React Aria sets `--table-row-level` (1-based) on each body row and
|
||||
`data-level` on cells; tree column cells expose `[data-tree-column]`.
|
||||
The row custom property inherits onto cells (1rem per level).
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__cell[data-tree-column] {
|
||||
padding-inline-start: calc(1rem * var(--table-row-level, 1));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Table Footer (div outside <table>, sits on gray bg)
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__footer {
|
||||
@apply flex items-center px-4 py-2.5;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Resizable Container — wraps table to enable column resizing via React Aria.
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__resizable-container {
|
||||
@apply relative scrollbar overflow-auto;
|
||||
scrollbar-gutter: auto;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Column Resizer — drag handle between resizable columns.
|
||||
Replaces the ::after separator when present.
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__column-resizer {
|
||||
/* Keep the complete hit area above the adjacent native th. */
|
||||
z-index: 1;
|
||||
/* Match the ::after separator: absolute, right edge, short vertical line */
|
||||
@apply absolute end-0 top-1/2 h-4 w-px -translate-y-1/2 rounded-sm bg-separator;
|
||||
/* Make it interactive — wider hit area with transparent padding */
|
||||
@apply box-content translate-x-1/2 cursor-col-resize touch-none px-2;
|
||||
/* Reset appearance */
|
||||
@apply border-none bg-clip-content outline-none;
|
||||
|
||||
&[data-hovered="true"],
|
||||
&:hover {
|
||||
@apply h-full w-0.5 bg-accent;
|
||||
}
|
||||
|
||||
&[data-resizing="true"] {
|
||||
@apply h-full w-0.5 bg-accent;
|
||||
}
|
||||
|
||||
&[data-focus-visible="true"],
|
||||
&:focus-visible {
|
||||
@apply h-full w-0.5 bg-focus;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hide the ::after separator when a resizer is present in the column */
|
||||
.hv-table__column:has(.hv-table__column-resizer)::after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Load More Item — sentinel row for infinite scrolling.
|
||||
Non-virtualized: <tr> with <td colSpan=N> inside.
|
||||
Virtualized: <div> with <div role="rowheader"> inside.
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__load-more {
|
||||
& td,
|
||||
& [role="rowheader"] {
|
||||
@apply py-3 text-center;
|
||||
& > * {
|
||||
@apply mx-auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Load More Content — styled container for the loading indicator inside
|
||||
the load-more sentinel row.
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-table__load-more-content {
|
||||
@apply flex items-center justify-center gap-2 py-2;
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
/* Adapted from HeroUI ce90ea3. Copyright 2025 NextUI Inc.
|
||||
* Apache-2.0; see third-party/HEROUI-LICENSE. hv- namespace and Vue adapters. */
|
||||
/* Toast component styles */
|
||||
|
||||
/* Toast Region */
|
||||
.hv-toast-region {
|
||||
@apply pointer-events-none fixed z-(--z-index-toast) outline-none;
|
||||
@apply w-[calc(100vw-2rem)] sm:w-auto sm:min-w-(--toast-width);
|
||||
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Placement - Bottom */
|
||||
.hv-toast-region--bottom {
|
||||
/* left-1/2 + -translate-x-1/2 centers in both LTR and RTL */
|
||||
@apply bottom-4 left-1/2 -translate-x-1/2;
|
||||
}
|
||||
|
||||
.hv-toast-region--bottom-start {
|
||||
@apply start-4 bottom-4;
|
||||
}
|
||||
|
||||
.hv-toast-region--bottom-end {
|
||||
@apply end-4 bottom-4;
|
||||
}
|
||||
|
||||
/* Placement - Top */
|
||||
.hv-toast-region--top {
|
||||
@apply top-4 left-1/2 -translate-x-1/2;
|
||||
}
|
||||
|
||||
.hv-toast-region--top-start {
|
||||
@apply start-4 top-4;
|
||||
}
|
||||
|
||||
.hv-toast-region--top-end {
|
||||
@apply end-4 top-4;
|
||||
}
|
||||
|
||||
.hv-toast-region:focus-visible {
|
||||
@apply outline-2 outline-offset-2 outline-focus;
|
||||
}
|
||||
|
||||
/* Base */
|
||||
.hv-toast {
|
||||
position: absolute;
|
||||
inset-inline-start: 0;
|
||||
inset-inline-end: 0;
|
||||
border-radius: min(32px, var(--radius-3xl));
|
||||
|
||||
/* Motion state */
|
||||
--toast-y: var(--offset-collapsed, 0px);
|
||||
--toast-enter: 0%;
|
||||
--toast-scale: var(--scale-collapsed, 1);
|
||||
transform: translateY(
|
||||
calc(var(--dir, 1) * (var(--toast-y) + var(--toast-enter)))
|
||||
)
|
||||
scale(var(--toast-scale));
|
||||
height: var(--toast-height, auto);
|
||||
|
||||
@apply pointer-events-auto flex flex-row items-start justify-start gap-1.5 bg-surface px-4 py-3 shadow-overlay;
|
||||
|
||||
/* Timing tokens */
|
||||
--toast-ease: var(--ease-out-fluid);
|
||||
--toast-enter-duration: 350ms;
|
||||
--toast-exit-duration: 250ms;
|
||||
--toast-translate-duration: var(--toast-enter-duration);
|
||||
--toast-height-duration: var(--toast-enter-duration);
|
||||
--toast-opacity-duration: 150ms;
|
||||
|
||||
/**
|
||||
* Transitions
|
||||
* CRITICAL: motion-reduce must be AFTER animation/transition for correct override specificity
|
||||
*/
|
||||
transition:
|
||||
transform var(--toast-translate-duration) var(--toast-ease),
|
||||
height var(--toast-height-duration) var(--toast-ease),
|
||||
opacity var(--toast-opacity-duration) var(--toast-ease);
|
||||
|
||||
@apply motion-reduce:animate-none motion-reduce:transition-none;
|
||||
}
|
||||
|
||||
/* Enter */
|
||||
.hv-toast[data-entering="true"] {
|
||||
--toast-enter: -100%;
|
||||
}
|
||||
|
||||
/* Stacking direction */
|
||||
.hv-toast--bottom,
|
||||
.hv-toast--bottom-start,
|
||||
.hv-toast--bottom-end {
|
||||
--dir: -1;
|
||||
bottom: 0;
|
||||
transform-origin: bottom center;
|
||||
|
||||
&[data-expanded="true"]::after {
|
||||
top: calc(-1 * var(--gap, 12px) - 1px);
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.hv-toast--top,
|
||||
.hv-toast--top-start,
|
||||
.hv-toast--top-end {
|
||||
--dir: 1;
|
||||
top: 0;
|
||||
transform-origin: top center;
|
||||
|
||||
&[data-expanded="true"]::after {
|
||||
top: 0;
|
||||
bottom: calc(-1 * var(--gap, 12px) - 1px);
|
||||
}
|
||||
}
|
||||
|
||||
/* Content fade between collapsed / expanded */
|
||||
.hv-toast > :not([data-slot="toast-close"]) {
|
||||
/**
|
||||
* Transitions
|
||||
* CRITICAL: motion-reduce must be AFTER transition for correct override specificity
|
||||
*/
|
||||
transition: opacity 200ms var(--toast-ease);
|
||||
@apply motion-reduce:transition-none;
|
||||
}
|
||||
|
||||
/* Collapsed non-front: force height to front toast (Sonner-style unified stack height) */
|
||||
.hv-toast:not([data-frontmost="true"]):not([data-expanded="true"]) {
|
||||
--toast-y: var(--offset-collapsed, 0px);
|
||||
height: var(--front-height, 0px);
|
||||
overflow: hidden;
|
||||
|
||||
> :not([data-slot="toast-close"]) {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.hv-toast__close-button {
|
||||
@apply pointer-events-none opacity-0;
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Expanded */
|
||||
.hv-toast[data-expanded="true"] {
|
||||
--toast-y: var(--offset-expanded, 0px);
|
||||
--toast-scale: 1;
|
||||
height: var(--toast-height, auto);
|
||||
}
|
||||
|
||||
/* Expanded hit area that covers the gap between toasts */
|
||||
.hv-toast[data-expanded="true"]::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
inset-inline: 0;
|
||||
}
|
||||
|
||||
/* Exit */
|
||||
.hv-toast[data-exiting="true"] {
|
||||
@apply opacity-0;
|
||||
}
|
||||
|
||||
.hv-toast[data-exiting="true"][data-frontmost="true"] {
|
||||
--toast-translate-duration: var(--toast-exit-duration);
|
||||
--toast-opacity-duration: 150ms;
|
||||
--toast-enter: -100%;
|
||||
--toast-scale: 1;
|
||||
}
|
||||
|
||||
.hv-toast[data-exiting="true"][data-expanded="true"]:not(
|
||||
[data-frontmost="true"]
|
||||
) {
|
||||
--toast-translate-duration: 200ms;
|
||||
--toast-opacity-duration: 150ms;
|
||||
--toast-scale: 0.96;
|
||||
}
|
||||
|
||||
.hv-toast[data-exiting="true"]:not([data-expanded="true"]):not(
|
||||
[data-frontmost="true"]
|
||||
) {
|
||||
--toast-translate-duration: 200ms;
|
||||
--toast-opacity-duration: 150ms;
|
||||
--toast-scale: calc(var(--scale-collapsed, 1) * 0.96);
|
||||
}
|
||||
|
||||
/* Hidden (beyond maxVisibleToasts) */
|
||||
.hv-toast[data-hidden="true"] {
|
||||
@apply pointer-events-none flex opacity-0;
|
||||
}
|
||||
|
||||
.hv-toast:focus-visible {
|
||||
@apply outline-2 outline-offset-2 outline-focus;
|
||||
}
|
||||
|
||||
/* Content */
|
||||
.hv-toast__content {
|
||||
@apply flex grow flex-col items-start self-center;
|
||||
}
|
||||
|
||||
/* Indicator */
|
||||
.hv-toast__indicator {
|
||||
@apply flex shrink-0 items-center justify-center p-1 text-overlay-foreground select-none;
|
||||
|
||||
[data-slot="toast-default-icon"] {
|
||||
@apply box-content size-4;
|
||||
}
|
||||
|
||||
[data-slot="spinner"] {
|
||||
@apply size-4;
|
||||
}
|
||||
|
||||
[data-slot="spinner-icon"] {
|
||||
@apply size-4;
|
||||
}
|
||||
}
|
||||
|
||||
/* Settled promise icon (data-swapped skips first paint) */
|
||||
.hv-toast__indicator[data-swapped="true"] > :not([data-slot="spinner"]) {
|
||||
/**
|
||||
* Transitions
|
||||
* CRITICAL: motion-reduce must be AFTER animation/transition for correct override specificity
|
||||
*/
|
||||
animation:
|
||||
toast-indicator-fade 150ms var(--toast-ease),
|
||||
toast-indicator-scale 200ms var(--toast-ease);
|
||||
@apply motion-reduce:animate-none;
|
||||
}
|
||||
|
||||
/* Title */
|
||||
.hv-toast__title {
|
||||
@apply text-sm leading-5 font-medium text-overlay-foreground;
|
||||
}
|
||||
|
||||
/* Description */
|
||||
.hv-toast__description {
|
||||
@apply text-sm text-muted;
|
||||
}
|
||||
|
||||
/* Close button */
|
||||
.hv-toast__close-button {
|
||||
@apply pointer-events-none absolute -end-1 -top-1 size-5 border-border bg-default opacity-0 sm:border sm:bg-overlay;
|
||||
|
||||
/**
|
||||
* Transitions
|
||||
* CRITICAL: motion-reduce must be AFTER transition for correct override specificity
|
||||
*/
|
||||
transition: opacity 150ms var(--ease-smooth);
|
||||
@apply motion-reduce:transition-none;
|
||||
|
||||
[data-slot="close-button-icon"] {
|
||||
@apply size-3.5 sm:size-3;
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
&:hover,
|
||||
&[data-hovered="true"] {
|
||||
@apply bg-default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Reveal close button on hover */
|
||||
.hv-toast[data-frontmost="true"]:hover .hv-toast__close-button,
|
||||
.hv-toast[data-expanded="true"]:hover .hv-toast__close-button {
|
||||
@apply pointer-events-auto opacity-100;
|
||||
}
|
||||
|
||||
/* Exiting toasts never show the close button */
|
||||
.hv-toast[data-exiting="true"] .hv-toast__close-button {
|
||||
@apply pointer-events-none opacity-0;
|
||||
}
|
||||
|
||||
/* Action */
|
||||
.hv-toast__action {
|
||||
@apply mt-2 sm:mt-0;
|
||||
}
|
||||
|
||||
/* Variants */
|
||||
.hv-toast--accent .hv-toast__title {
|
||||
@apply text-accent-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-toast--success .hv-toast__title {
|
||||
@apply text-success-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-toast--success .hv-toast__indicator {
|
||||
@apply text-success-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-toast--warning .hv-toast__title {
|
||||
@apply text-warning-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-toast--warning .hv-toast__indicator {
|
||||
@apply text-warning-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-toast--danger .hv-toast__title {
|
||||
@apply text-danger-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-toast--danger .hv-toast__indicator {
|
||||
@apply text-danger-soft-foreground;
|
||||
}
|
||||
|
||||
@keyframes toast-indicator-fade {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes toast-indicator-scale {
|
||||
from {
|
||||
scale: 0.92;
|
||||
}
|
||||
}
|
||||
@@ -125,6 +125,8 @@
|
||||
@import "./components/modal.css" layer(components);
|
||||
@import "./components/alert-dialog.css" layer(components);
|
||||
@import "./components/drawer.css" layer(components);
|
||||
@import "./components/toast.css" layer(components);
|
||||
@import "./components/table.css" layer(components);
|
||||
|
||||
@import "./components/popover.css" layer(components);
|
||||
|
||||
|
||||
@@ -1481,3 +1481,102 @@ export const dateInputGroupVariants = tv({
|
||||
export type DateInputGroupVariants = VariantProps<
|
||||
typeof dateInputGroupVariants
|
||||
>;
|
||||
|
||||
export const toastVariants = tv({
|
||||
defaultVariants: {
|
||||
placement: "bottom",
|
||||
variant: "default",
|
||||
},
|
||||
slots: {
|
||||
action: "hv-toast__action",
|
||||
close: "hv-toast__close-button",
|
||||
content: "hv-toast__content",
|
||||
description: "hv-toast__description",
|
||||
indicator: "hv-toast__indicator",
|
||||
region: "hv-toast-region",
|
||||
title: "hv-toast__title",
|
||||
toast: "hv-toast",
|
||||
},
|
||||
variants: {
|
||||
placement: {
|
||||
bottom: {
|
||||
region: "hv-toast-region--bottom",
|
||||
toast: "hv-toast--bottom",
|
||||
},
|
||||
"bottom end": {
|
||||
region: "hv-toast-region--bottom-end",
|
||||
toast: "hv-toast--bottom-end",
|
||||
},
|
||||
"bottom start": {
|
||||
region: "hv-toast-region--bottom-start",
|
||||
toast: "hv-toast--bottom-start",
|
||||
},
|
||||
top: {
|
||||
region: "hv-toast-region--top",
|
||||
toast: "hv-toast--top",
|
||||
},
|
||||
"top end": {
|
||||
region: "hv-toast-region--top-end",
|
||||
toast: "hv-toast--top-end",
|
||||
},
|
||||
"top start": {
|
||||
region: "hv-toast-region--top-start",
|
||||
toast: "hv-toast--top-start",
|
||||
},
|
||||
},
|
||||
variant: {
|
||||
accent: {
|
||||
toast: "hv-toast--accent",
|
||||
},
|
||||
danger: {
|
||||
toast: "hv-toast--danger",
|
||||
},
|
||||
default: {
|
||||
toast: "hv-toast--default",
|
||||
},
|
||||
success: {
|
||||
toast: "hv-toast--success",
|
||||
},
|
||||
warning: {
|
||||
toast: "hv-toast--warning",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export type ToastVariants = VariantProps<typeof toastVariants>;
|
||||
|
||||
export const tableVariants = tv({
|
||||
defaultVariants: {
|
||||
variant: "primary",
|
||||
},
|
||||
slots: {
|
||||
base: "hv-table-root",
|
||||
body: "hv-table__body",
|
||||
cell: "hv-table__cell",
|
||||
column: "hv-table__column",
|
||||
columnResizer: "hv-table__column-resizer",
|
||||
content: "hv-table__content",
|
||||
footer: "hv-table__footer",
|
||||
header: "hv-table__header",
|
||||
loadMore: "hv-table__load-more",
|
||||
loadMoreContent: "hv-table__load-more-content",
|
||||
resizableContainer: "hv-table__resizable-container",
|
||||
row: "hv-table__row",
|
||||
scrollContainer: "hv-table__scroll-container",
|
||||
sortableColumnHeader: "hv-table__sortable-column-header",
|
||||
sortableColumnIndicator: "hv-table__sortable-column-indicator",
|
||||
},
|
||||
variants: {
|
||||
variant: {
|
||||
primary: {
|
||||
base: "hv-table-root--primary",
|
||||
},
|
||||
secondary: {
|
||||
base: "hv-table-root--secondary",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export type TableVariants = VariantProps<typeof tableVariants>;
|
||||
|
||||
Reference in New Issue
Block a user