feat: add Surface, Link and Spinner components
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -9,10 +9,14 @@
|
||||
@import "./components/close-button.css" layer(components);
|
||||
@import "./components/card.css" layer(components);
|
||||
@import "./components/input.css" layer(components);
|
||||
@import "./components/textarea.css" layer(components);
|
||||
@import "./components/switch.css" layer(components);
|
||||
@import "./components/switch-group.css" layer(components);
|
||||
@import "./components/label.css" layer(components);
|
||||
@import "./components/description.css" layer(components);
|
||||
@import "./components/surface.css" layer(components);
|
||||
@import "./components/link.css" layer(components);
|
||||
@import "./components/spinner.css" layer(components);
|
||||
/* The Vue Switch uses Reka's native button for its clickable content. */
|
||||
@layer components {
|
||||
.hv-switch:has(.hv-switch__content:focus-visible) .hv-switch__control {
|
||||
@@ -24,24 +28,6 @@
|
||||
padding: 0;
|
||||
font: inherit;
|
||||
}
|
||||
.hv-spinner {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
border: 2px solid currentColor;
|
||||
border-right-color: transparent;
|
||||
border-radius: 50%;
|
||||
animation: hv-spin 0.75s linear infinite;
|
||||
}
|
||||
@keyframes hv-spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.hv-spinner {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@layer components {
|
||||
|
||||
@@ -127,3 +127,74 @@ export const closeButtonVariants = tv({
|
||||
variants: { variant: { default: "hv-close-button--default" } },
|
||||
});
|
||||
export type CloseButtonVariants = VariantProps<typeof closeButtonVariants>;
|
||||
|
||||
export const surfaceVariants = tv({
|
||||
base: "hv-surface",
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
},
|
||||
variants: {
|
||||
variant: {
|
||||
default: "hv-surface--default",
|
||||
secondary: "hv-surface--secondary",
|
||||
tertiary: "hv-surface--tertiary",
|
||||
transparent: "hv-surface--transparent",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export type SurfaceVariants = VariantProps<typeof surfaceVariants>;
|
||||
|
||||
export const linkVariants = tv({
|
||||
slots: {
|
||||
base: "hv-link",
|
||||
icon: "hv-link__icon",
|
||||
},
|
||||
});
|
||||
|
||||
export type LinkVariants = VariantProps<typeof linkVariants>;
|
||||
|
||||
export const spinnerVariants = tv({
|
||||
base: "hv-spinner",
|
||||
defaultVariants: {
|
||||
color: "accent",
|
||||
size: "md",
|
||||
},
|
||||
variants: {
|
||||
color: {
|
||||
accent: "hv-spinner--accent",
|
||||
current: "hv-spinner--current",
|
||||
danger: "hv-spinner--danger",
|
||||
success: "hv-spinner--success",
|
||||
warning: "hv-spinner--warning",
|
||||
},
|
||||
size: {
|
||||
lg: "hv-spinner--lg",
|
||||
md: "hv-spinner--md",
|
||||
sm: "hv-spinner--sm",
|
||||
xl: "hv-spinner--xl",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export type SpinnerVariants = VariantProps<typeof spinnerVariants>;
|
||||
|
||||
export const textAreaVariants = tv({
|
||||
base: "hv-textarea",
|
||||
defaultVariants: {
|
||||
fullWidth: false,
|
||||
variant: "primary",
|
||||
},
|
||||
variants: {
|
||||
fullWidth: {
|
||||
false: "",
|
||||
true: "hv-textarea--full-width",
|
||||
},
|
||||
variant: {
|
||||
primary: "hv-textarea--primary",
|
||||
secondary: "hv-textarea--secondary",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export type TextAreaVariants = VariantProps<typeof textAreaVariants>;
|
||||
|
||||
Reference in New Issue
Block a user