feat: add Surface, Link and Spinner components

This commit is contained in:
maoyingjie
2026-10-21 13:04:06 +08:00
parent 9d40dc0ecb
commit 630963c652
52 changed files with 2683 additions and 162 deletions
+82
View File
@@ -0,0 +1,82 @@
/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix; Vue state adapters. */
/* Base link styles */
.hv-link {
@apply relative inline-flex h-fit w-fit items-center rounded-xl font-medium text-link no-underline decoration-separator-tertiary decoration-[1.5px] underline-offset-4 no-highlight;
/**
* Transitions
* CRITICAL: motion-reduce must be AFTER transition for correct override specificity
*/
transition:
color 100ms var(--ease-smooth),
background-color 150ms var(--ease-smooth),
box-shadow 150ms var(--ease-out),
opacity 100ms var(--ease-out);
@apply motion-reduce:transition-none;
/* Cursor */
cursor: var(--cursor-interactive);
/* Hover state */
@media (hover: hover) {
&:hover,
&[data-hovered="true"] {
@apply underline decoration-muted/50;
.hv-link__icon {
@apply opacity-100;
}
}
}
/* Pressed state */
&:active,
&[data-pressed="true"] {
@apply underline decoration-muted;
.hv-link__icon {
@apply opacity-100;
}
}
/* Focus state */
&:focus-visible:not([data-focused]),
&[data-focus-visible="true"] {
@apply status-focused;
.hv-link__icon {
@apply opacity-100;
}
}
/* Disabled state */
&[aria-disabled="true"] {
@apply status-disabled;
}
.hv-link__icon {
@apply pointer-events-none inline-flex size-[0.75em] shrink-0 items-center justify-center text-current opacity-60;
/**
* Transitions
* CRITICAL: motion-reduce must be AFTER transition for correct override specificity
*/
transition: opacity 150ms var(--ease-out);
@apply motion-reduce:transition-none;
& svg {
@apply transform-gpu;
}
}
.hv-link__icon[data-default-icon="true"] {
@apply ms-1 pb-1.5;
}
/* Handle Link with Button Variants */
&.hv-button {
@apply gap-0 no-underline;
}
}
+50
View File
@@ -0,0 +1,50 @@
/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix; Vue state adapters. */
/* Base spinner styles */
.hv-spinner {
@apply pointer-events-none inline-flex size-6 shrink-0 animate-spin-fast motion-reduce:animate-none;
}
/* Size variants */
.hv-spinner--sm {
@apply size-4;
}
.hv-spinner--md {
/* No styles as this is the default size */
}
.hv-spinner--lg {
@apply size-8;
}
.hv-spinner--xl {
@apply size-10;
}
/* Color variants */
.hv-spinner--current {
color: inherit;
}
.hv-spinner--accent {
color: var(--accent);
}
.hv-spinner--danger {
color: var(--danger);
}
.hv-spinner--success {
color: var(--success);
}
.hv-spinner--warning {
color: var(--warning);
}
/* Spinner icon fills the host box; excluded from generic button SVG sizing via data-slot. */
.hv-spinner > svg {
@apply size-full;
}
+26
View File
@@ -0,0 +1,26 @@
/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix; Vue state adapters. */
/* Surface component styles */
/* Block */
.hv-surface {
@apply relative text-foreground;
}
/* Modifier - variant */
.hv-surface--transparent {
@apply bg-transparent;
}
.hv-surface--default {
@apply bg-surface text-surface-foreground;
}
.hv-surface--secondary {
@apply bg-surface-secondary text-surface-secondary-foreground;
}
.hv-surface--tertiary {
@apply bg-surface-tertiary text-surface-tertiary-foreground;
}
+91
View File
@@ -0,0 +1,91 @@
/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix; Vue state adapters. */
/* use textarea instead of text-area to avoid conflict with Tailwind `text-` prefix */
.hv-textarea {
@apply rounded-field border bg-field px-3 py-2 text-base text-field-foreground shadow-field outline-none placeholder:text-field-placeholder sm:text-sm;
min-height: 38px;
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;
@media (hover: hover) {
&:hover:not(:focus):not(:focus-visible),
&[data-hovered="true"]:not([data-focused="true"]):not(
[data-focus-visible="true"]
) {
@apply bg-field-hover;
border-color: var(--field-border-hover);
}
}
/* Focus state */
&:focus,
&[data-focused="true"] {
@apply status-focused-field;
border-color: var(--field-border-focus);
background-color: var(--field-focus);
}
&[data-invalid="true"] {
@apply status-invalid-field;
background-color: var(--field-focus);
}
/* Disabled state */
&:disabled,
&[data-disabled="true"],
&[aria-disabled="true"] {
@apply status-disabled;
}
}
/* Variant property definitions */
.hv-textarea--primary {
/* Default styles */
}
.hv-textarea--secondary {
@apply shadow-none;
background-color: var(--textarea-bg);
--textarea-bg: var(--default);
--textarea-bg-hover: var(--default-hover);
--textarea-bg-focus: var(--default);
@media (hover: hover) {
&:hover:not(:focus):not(:focus-visible),
&[data-hovered="true"]:not([data-focused="true"]):not(
[data-focus-visible="true"]
) {
background-color: var(--textarea-bg-hover);
}
}
&:focus,
&[data-focused="true"] {
background-color: var(--textarea-bg-focus);
}
/* Invalid state */
&[data-invalid="true"] {
@apply status-invalid-field;
background-color: var(--textarea-bg-focus);
}
}
/* Full width modifier */
.hv-textarea--full-width {
@apply w-full;
}