feat: migrate Pagination Header and InputOTP with field and event regressions

This commit is contained in:
maoyingjie
2026-10-23 13:49:44 +08:00
parent b2525bb04d
commit 1fa2929a24
72 changed files with 5784 additions and 16 deletions
+9
View File
@@ -0,0 +1,9 @@
/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix. */
/* ==========================================================================
Base header styles (collection / group section heading)
========================================================================== */
.hv-header {
@apply w-full px-2 pt-1.5 pb-1 text-start text-xs font-medium text-muted;
}
+135
View File
@@ -0,0 +1,135 @@
/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix; Vue state adapters. */
/* ==========================================================================
InputOTP - one-time password input
========================================================================== */
/* Base container */
.hv-input-otp {
@apply relative flex w-full items-center gap-2;
&[data-disabled="true"] {
@apply cursor-not-allowed opacity-50;
}
}
/* Group - slots separated with gap */
.hv-input-otp__group {
@apply flex min-w-0 items-center gap-2;
}
/* Individual slot box - fully rounded, standalone */
.hv-input-otp__slot {
@apply relative flex h-10 w-9.5 min-w-0 flex-1 items-center justify-center;
@apply border bg-field text-field-foreground shadow-field;
@apply rounded-field text-sm font-semibold outline-none;
border-width: var(--border-width-field);
border-color: var(--field-border);
/**
* Transitions
* CRITICAL: motion-reduce must be AFTER transition for correct override specificity
*/
transition:
background-color 150ms var(--ease-smooth),
border-color 150ms var(--ease-smooth),
box-shadow 150ms var(--ease-out);
@apply motion-reduce:transition-none;
/* Hover */
@media (hover: hover) {
&:hover,
&[data-hovered="true"] {
@apply bg-field-hover;
border-color: var(--field-border-hover);
}
}
/* Active/Focus */
&[data-active="true"] {
@apply z-10 bg-field-focus status-focused-field;
}
/* Filled */
&[data-filled="true"] {
@apply bg-field-focus;
}
/* Disabled */
&[data-disabled="true"] {
@apply status-disabled;
}
/* Invalid */
&[data-invalid="true"] {
@apply status-invalid-field;
background-color: var(--field-focus);
}
}
/* Real inputs sit transparently over the visual slot */
.hv-input-otp__input {
@apply absolute inset-0 z-10 h-full w-full cursor-text bg-transparent text-transparent caret-transparent outline-none;
}
/* Slot value */
.hv-input-otp__slot-value {
@apply text-lg leading-6 tracking-[-0.27px];
/**
* Animations
* CRITICAL: motion-reduce must be AFTER animation for correct override specificity
*/
animation: hv-slot-value-in 250ms var(--ease-smooth) both;
transform-origin: bottom center;
@apply motion-reduce:animate-none;
}
/* Caret */
.hv-input-otp__caret {
@apply absolute h-4 w-[2px] animate-caret-blink rounded-sm bg-field-placeholder;
}
/* Separator */
.hv-input-otp__separator {
@apply h-[2px] w-[6px] shrink-0 rounded-sm bg-separator;
}
/* Variant property definitions */
.hv-input-otp--primary {
/* Default styles */
}
.hv-input-otp--secondary .hv-input-otp__slot {
@apply shadow-none;
background-color: var(--input-otp-slot-bg);
--input-otp-slot-bg: var(--default);
--input-otp-slot-bg-hover: var(--default-hover);
--input-otp-slot-bg-focus: var(--default);
@media (hover: hover) {
&:hover,
&[data-hovered="true"] {
background-color: var(--input-otp-slot-bg-hover);
}
}
&[data-active="true"],
&[data-filled="true"] {
background-color: var(--input-otp-slot-bg-focus);
}
}
/* Animations */
@keyframes hv-slot-value-in {
0% {
opacity: 0;
transform: translateY(8px) scale(0.8);
}
100% {
opacity: 1;
transform: translateY(0) scale(1);
}
}
+154
View File
@@ -0,0 +1,154 @@
/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix. */
/* ==========================================================================
Pagination - Page navigation component
========================================================================== */
/* Base styles */
.hv-pagination {
@apply flex w-full flex-col items-center justify-between gap-4 sm:flex-row;
}
/* Summary - left side info container */
.hv-pagination__summary {
@apply flex items-center gap-2 self-start text-sm text-muted sm:self-center;
}
/* Content - container for pagination items */
.hv-pagination__content {
@apply flex items-center gap-1 self-start sm:self-center;
}
/* Item - list item wrapper */
.hv-pagination__item {
@apply inline-flex;
}
/* Link - page number button (ghost button style) */
.hv-pagination__link {
@apply relative isolate inline-flex size-9 origin-center items-center justify-center rounded-3xl text-sm font-medium whitespace-nowrap outline-none select-none no-highlight md:size-8;
cursor: var(--cursor-interactive);
/**
* Transitions
* CRITICAL: motion-reduce must be AFTER transition for correct override specificity
*/
transition:
transform 250ms var(--ease-smooth),
background-color 100ms var(--ease-out),
box-shadow 100ms var(--ease-out);
@apply transform-gpu motion-reduce:transition-none;
/* Ghost button tokens */
--pagination-link-bg: transparent;
--pagination-link-bg-hover: var(--default-hover);
--pagination-link-bg-pressed: var(--default-hover);
--pagination-link-fg: var(--default-foreground);
background-color: var(--pagination-link-bg);
color: var(--pagination-link-fg);
/* Focus state */
&:focus-visible,
&[data-focus-visible="true"] {
@apply status-focused;
}
/* Disabled state */
&:disabled,
&[aria-disabled="true"] {
@apply status-disabled;
}
/* Hover state */
@media (hover: hover) {
&:hover,
&[data-hovered="true"] {
background-color: var(--pagination-link-bg-hover);
}
}
/* Active / pressed */
&:active,
&[data-pressed="true"] {
background-color: var(--pagination-link-bg-pressed);
transform: scale(0.97);
}
/* Active page - tertiary button style */
&[data-active="true"] {
--pagination-link-bg: var(--default);
--pagination-link-bg-hover: var(--default-hover);
--pagination-link-bg-pressed: var(--default-hover);
}
}
/* Ellipsis */
.hv-pagination__ellipsis {
@apply inline-flex size-9 items-center justify-center text-sm text-muted select-none md:size-8;
}
/* Navigation buttons (Previous / Next) */
.hv-pagination__link--nav {
@apply w-auto gap-1.5 px-2.5;
& [data-slot="pagination-previous-icon"],
& [data-slot="pagination-next-icon"] {
@apply rtl:rotate-180;
}
}
/* ==========================================================================
Size variants
========================================================================== */
.hv-pagination--sm {
.hv-pagination__link {
@apply size-8 text-xs md:size-7;
&:active,
&[data-pressed="true"] {
transform: scale(0.98);
}
}
.hv-pagination__link--nav {
@apply w-auto px-2;
}
.hv-pagination__ellipsis {
@apply size-8 text-xs md:size-7;
}
.hv-pagination__summary {
@apply text-xs;
}
}
.hv-pagination--md {
/* No styles as this is the default size */
}
.hv-pagination--lg {
.hv-pagination__link {
@apply size-10 text-base md:size-9;
&:active,
&[data-pressed="true"] {
transform: scale(0.96);
}
}
.hv-pagination__link--nav {
@apply w-auto px-3;
}
.hv-pagination__ellipsis {
@apply size-10 text-base md:size-9;
}
.hv-pagination__summary {
@apply text-base;
}
}