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 {
|
||||
}
|
||||
Reference in New Issue
Block a user