iter(g29): 新增 carousel 轮播组件

This commit is contained in:
HIsheR
2026-10-26 11:40:07 +08:00
parent 84f83df615
commit e5ed297842
13 changed files with 312 additions and 9 deletions
+71
View File
@@ -2071,3 +2071,74 @@ button.ua-step-dot:hover {
transition: none;
}
}
/* —— 轮播 —— */
.ua-carousel {
position: relative;
overflow: hidden;
border-radius: var(--ua-radius-md);
background: var(--ua-color-surface);
outline: none;
}
.ua-carousel:focus-visible {
box-shadow: 0 0 0 2px color-mix(in srgb, var(--ua-color-accent) 45%, transparent);
}
.ua-carousel-track {
display: flex;
height: 100%;
transition: transform 0.32s ease;
}
.ua-carousel-slide {
flex: 0 0 100%;
display: flex;
}
.ua-carousel-arrow {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 28px;
height: 28px;
border: 1px solid var(--ua-color-border);
border-radius: 50%;
background: var(--ua-color-bg);
color: var(--ua-color-text);
font-size: var(--ua-font-size-lg);
line-height: 1;
cursor: pointer;
opacity: 0;
transition: opacity 0.15s ease;
}
.ua-carousel-prev { left: var(--ua-space-2); }
.ua-carousel-next { right: var(--ua-space-2); }
.ua-carousel:hover .ua-carousel-arrow,
.ua-carousel:focus-within .ua-carousel-arrow { opacity: 1; }
.ua-carousel-arrow:hover { background: var(--ua-color-surface); }
.ua-carousel-dots {
position: absolute;
left: 0;
right: 0;
bottom: var(--ua-space-2);
display: flex;
gap: var(--ua-space-1);
justify-content: center;
}
.ua-carousel-dot {
width: 6px;
height: 6px;
padding: 0;
border: none;
border-radius: 50%;
background: var(--ua-color-border);
cursor: pointer;
transition: width 0.2s ease, background 0.2s ease;
}
.ua-carousel-dot-active {
width: 16px;
border-radius: var(--ua-radius-sm);
background: var(--ua-color-accent);
}
@media (prefers-reduced-motion: reduce) {
.ua-carousel-track,
.ua-carousel-dot,
.ua-carousel-arrow { transition: none; }
}