Files

136 lines
3.3 KiB
CSS

/* 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);
}
}