feat: add CloseButton Avatar and Skeleton components
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
|
||||
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix. */
|
||||
/* ==========================================================================
|
||||
AvatarGroup - Stacked or grid layout for multiple avatars
|
||||
========================================================================== */
|
||||
|
||||
.hv-avatar-group {
|
||||
--avatar-group-overlap: 0.5rem;
|
||||
--avatar-group-seam: 2px;
|
||||
|
||||
@apply inline-flex items-center;
|
||||
}
|
||||
|
||||
/* Grid */
|
||||
.hv-avatar-group--grid {
|
||||
@apply flex-wrap gap-3;
|
||||
}
|
||||
|
||||
.hv-avatar-group:not(.hv-avatar-group--grid) > .hv-avatar + .hv-avatar,
|
||||
.hv-avatar-group:not(.hv-avatar-group--grid)
|
||||
> .hv-avatar
|
||||
+ .hv-avatar-group__count {
|
||||
margin-inline-start: calc(-1 * var(--avatar-group-overlap, 0.5rem));
|
||||
}
|
||||
|
||||
.hv-avatar-group__count {
|
||||
@apply shrink-0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Overlap: ring
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-avatar-group--ring:not(.hv-avatar-group--grid) > .hv-avatar,
|
||||
.hv-avatar-group--ring:not(.hv-avatar-group--grid) > .hv-avatar-group__count {
|
||||
position: relative;
|
||||
box-shadow: 0 0 0 var(--avatar-group-seam, 2px) var(--background);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Overlap: clip
|
||||
Cut sits on the inline-end edge (LTR: right / RTL: left). Optical nudge uses
|
||||
padding-inline-end so fallback glyphs stay logical in both directions.
|
||||
-------------------------------------------------------------------------- */
|
||||
.hv-avatar-group--clip:not(.hv-avatar-group--grid)
|
||||
> .hv-avatar:not(:last-child) {
|
||||
--avatar-group-cut-center: calc(
|
||||
100% + (var(--avatar-size, 2.5rem) / 2) -
|
||||
var(--avatar-group-overlap, 0.5rem)
|
||||
);
|
||||
--avatar-group-cut-radius: calc(
|
||||
(var(--avatar-size, 2.5rem) / 2) + var(--avatar-group-seam, 2px)
|
||||
);
|
||||
|
||||
-webkit-mask-image: radial-gradient(
|
||||
circle at var(--avatar-group-cut-center) 50%,
|
||||
transparent var(--avatar-group-cut-radius),
|
||||
#000 var(--avatar-group-cut-radius)
|
||||
);
|
||||
mask-image: radial-gradient(
|
||||
circle at var(--avatar-group-cut-center) 50%,
|
||||
transparent var(--avatar-group-cut-radius),
|
||||
#000 var(--avatar-group-cut-radius)
|
||||
);
|
||||
}
|
||||
|
||||
.hv-avatar-group--clip:not(.hv-avatar-group--grid):dir(rtl)
|
||||
> .hv-avatar:not(:last-child),
|
||||
:dir(rtl)
|
||||
.hv-avatar-group--clip:not(.hv-avatar-group--grid)
|
||||
> .hv-avatar:not(:last-child) {
|
||||
--avatar-group-cut-center: calc(
|
||||
0% - (var(--avatar-size, 2.5rem) / 2) + var(--avatar-group-overlap, 0.5rem)
|
||||
);
|
||||
}
|
||||
|
||||
.hv-avatar-group--clip:not(.hv-avatar-group--grid)
|
||||
> .hv-avatar:not(:last-child)
|
||||
.hv-avatar__fallback {
|
||||
box-sizing: border-box;
|
||||
padding-inline-end: calc(var(--avatar-group-overlap, 0.5rem) * 0.35);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
|
||||
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix. */
|
||||
/* Base avatar styles */
|
||||
.hv-avatar {
|
||||
@apply relative flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-3xl bg-default;
|
||||
}
|
||||
|
||||
/* Avatar fallback element */
|
||||
.hv-avatar__fallback {
|
||||
@apply flex size-full items-center justify-center bg-default text-sm font-medium;
|
||||
}
|
||||
|
||||
/* Avatar image element */
|
||||
.hv-avatar__image {
|
||||
@apply absolute inset-0 aspect-square size-full;
|
||||
|
||||
/**
|
||||
* Transitions
|
||||
*/
|
||||
@apply transition-opacity duration-250 motion-reduce:transition-none;
|
||||
}
|
||||
|
||||
/* Size modifiers */
|
||||
.hv-avatar--sm {
|
||||
--avatar-size: 2rem; /* size-8 */
|
||||
|
||||
@apply size-8 rounded-2xl;
|
||||
|
||||
.hv-avatar__fallback {
|
||||
@apply text-xs;
|
||||
}
|
||||
}
|
||||
|
||||
.hv-avatar--md {
|
||||
--avatar-size: 2.5rem; /* size-10 — same as base */
|
||||
|
||||
/* No layout styles as this is the default size */
|
||||
}
|
||||
|
||||
.hv-avatar--lg {
|
||||
--avatar-size: 3rem; /* size-12 */
|
||||
|
||||
@apply size-12 rounded-3xl;
|
||||
|
||||
.hv-avatar__fallback {
|
||||
@apply text-base;
|
||||
}
|
||||
}
|
||||
|
||||
/* Color modifiers for fallback */
|
||||
.hv-avatar__fallback--accent {
|
||||
@apply text-accent-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-avatar__fallback--default {
|
||||
@apply text-default-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-avatar__fallback--success {
|
||||
@apply text-success-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-avatar__fallback--warning {
|
||||
@apply text-warning-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-avatar__fallback--danger {
|
||||
@apply text-danger-soft-foreground;
|
||||
}
|
||||
|
||||
/* Variant modifiers */
|
||||
.hv-avatar--soft {
|
||||
@apply bg-transparent;
|
||||
}
|
||||
|
||||
.hv-avatar--soft .hv-avatar__fallback--accent {
|
||||
@apply bg-accent-soft text-accent-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-avatar--soft .hv-avatar__fallback--success {
|
||||
@apply bg-success-soft text-success-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-avatar--soft .hv-avatar__fallback--warning {
|
||||
@apply bg-warning-soft text-warning-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-avatar--soft .hv-avatar__fallback--default {
|
||||
@apply bg-default-soft text-default-soft-foreground;
|
||||
}
|
||||
|
||||
.hv-avatar--soft .hv-avatar__fallback--danger {
|
||||
@apply bg-danger-soft text-danger-soft-foreground;
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
|
||||
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix. */
|
||||
.hv-skeleton {
|
||||
@apply pointer-events-none relative overflow-hidden rounded-sm bg-surface-tertiary/70;
|
||||
}
|
||||
|
||||
/* Animation types */
|
||||
.hv-skeleton--shimmer {
|
||||
&::after {
|
||||
@apply absolute inset-0 -translate-x-full animate-skeleton bg-linear-to-r from-transparent via-surface-tertiary to-transparent content-[''];
|
||||
}
|
||||
|
||||
/* When applied to a parent container with multiple skeletons */
|
||||
&:has(.hv-skeleton) {
|
||||
&::after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
/* Single synchronized shimmer that passes over all children */
|
||||
&::before {
|
||||
@apply absolute inset-0 -translate-x-full animate-skeleton content-[''];
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
transparent 0%,
|
||||
rgba(255, 255, 255, 0.5) 50%,
|
||||
transparent 100%
|
||||
);
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
/* Use mix-blend-mode to only show over skeleton elements */
|
||||
mix-blend-mode: overlay;
|
||||
}
|
||||
|
||||
/* Ensure children don't have their own shimmer */
|
||||
& .hv-skeleton {
|
||||
&::after {
|
||||
content: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hv-skeleton--pulse {
|
||||
@apply animate-pulse;
|
||||
}
|
||||
|
||||
.hv-skeleton--none {
|
||||
}
|
||||
@@ -17,6 +17,9 @@
|
||||
@import "./components/surface.css" layer(components);
|
||||
@import "./components/link.css" layer(components);
|
||||
@import "./components/spinner.css" layer(components);
|
||||
@import "./components/avatar.css" layer(components);
|
||||
@import "./components/avatar-group.css" layer(components);
|
||||
@import "./components/skeleton.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 {
|
||||
|
||||
@@ -198,3 +198,100 @@ export const textAreaVariants = tv({
|
||||
});
|
||||
|
||||
export type TextAreaVariants = VariantProps<typeof textAreaVariants>;
|
||||
|
||||
export const avatarVariants = tv({
|
||||
defaultVariants: {
|
||||
color: "default",
|
||||
size: "md",
|
||||
},
|
||||
slots: {
|
||||
base: "hv-avatar",
|
||||
fallback: "hv-avatar__fallback",
|
||||
image: "hv-avatar__image",
|
||||
},
|
||||
variants: {
|
||||
color: {
|
||||
accent: {
|
||||
fallback: "hv-avatar__fallback--accent",
|
||||
},
|
||||
danger: {
|
||||
fallback: "hv-avatar__fallback--danger",
|
||||
},
|
||||
default: {
|
||||
fallback: "hv-avatar__fallback--default",
|
||||
},
|
||||
success: {
|
||||
fallback: "hv-avatar__fallback--success",
|
||||
},
|
||||
warning: {
|
||||
fallback: "hv-avatar__fallback--warning",
|
||||
},
|
||||
},
|
||||
size: {
|
||||
lg: {
|
||||
base: "hv-avatar--lg",
|
||||
},
|
||||
md: {
|
||||
base: "hv-avatar--md",
|
||||
},
|
||||
sm: {
|
||||
base: "hv-avatar--sm",
|
||||
},
|
||||
},
|
||||
variant: {
|
||||
default: {},
|
||||
soft: {
|
||||
base: "hv-avatar--soft",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export type AvatarVariants = VariantProps<typeof avatarVariants>;
|
||||
|
||||
export const avatarGroupVariants = tv({
|
||||
defaultVariants: {
|
||||
isGrid: false,
|
||||
overlap: "clip",
|
||||
},
|
||||
slots: {
|
||||
base: "hv-avatar-group",
|
||||
count: "hv-avatar-group__count",
|
||||
},
|
||||
variants: {
|
||||
isGrid: {
|
||||
false: {},
|
||||
true: {
|
||||
base: "hv-avatar-group--grid",
|
||||
},
|
||||
},
|
||||
overlap: {
|
||||
clip: {
|
||||
base: "hv-avatar-group--clip",
|
||||
},
|
||||
ring: {
|
||||
base: "hv-avatar-group--ring",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export type AvatarGroupVariants = VariantProps<typeof avatarGroupVariants>;
|
||||
|
||||
export const skeletonVariants = tv({
|
||||
defaultVariants: {
|
||||
animationType: "shimmer",
|
||||
},
|
||||
slots: {
|
||||
base: "hv-skeleton",
|
||||
},
|
||||
variants: {
|
||||
animationType: {
|
||||
none: "hv-skeleton--none",
|
||||
pulse: "hv-skeleton--pulse",
|
||||
shimmer: "hv-skeleton--shimmer",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export type SkeletonVariants = VariantProps<typeof skeletonVariants>;
|
||||
|
||||
Reference in New Issue
Block a user