feat: 新增 BbSelect 组件,实现下拉选择功能

This commit is contained in:
2026-01-18 13:07:54 +08:00
parent 00ca4c1b0d
commit 6eb3c730bb
21 changed files with 1346 additions and 163 deletions

View File

@@ -1,12 +1,24 @@
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Inter:wght@300;400;500;600;700&display=swap");
:root {
--bb-bg: #f8fafc;
--bb-text: #1e293b;
--bb-primary: #3b82f6;
--bb-primary-weak: #60a5fa;
--bb-cta: #f97316;
--bb-border: #e5e7eb;
/* Educational-platform claymorphism palette (vibrant + friendly) */
--bb-bg: #f0fdfa;
--bb-text: #134e4a;
--bb-primary: #0d9488;
--bb-primary-weak: #2dd4bf;
--bb-cta: #ea580c;
--bb-border: rgba(19, 78, 74, 0.12);
--bb-border-strong: rgba(19, 78, 74, 0.20);
--bb-font-heading: "Baloo 2", Inter, ui-sans-serif, system-ui;
--bb-gradient: radial-gradient(1100px 520px at 12% 10%, rgba(13, 148, 136, 0.30), transparent 55%),
radial-gradient(920px 620px at 92% 18%, rgba(45, 212, 191, 0.22), transparent 56%),
radial-gradient(900px 600px at 45% 92%, rgba(234, 88, 12, 0.20), transparent 55%),
linear-gradient(180deg, #f0fdfa 0%, #f8fafc 60%, #ffffff 100%);
--bb-clay: linear-gradient(145deg, rgba(255,255,255,0.96), rgba(255,255,255,0.70));
--bb-shadow-clay: 0 22px 60px rgba(19, 78, 74, 0.16), 0 2px 0 rgba(255,255,255,0.92) inset, 0 -2px 0 rgba(19, 78, 74, 0.05) inset;
font-family: Inter, ui-sans-serif, system-ui;
line-height: 1.5;
@@ -23,7 +35,7 @@ body {
margin: 0;
min-width: 320px;
min-height: 100vh;
background: var(--bb-bg);
background: var(--bb-gradient);
color: var(--bb-text);
}
@@ -37,13 +49,13 @@ a {
}
a:hover {
color: var(--bb-primary-weak);
color: var(--bb-cta);
}
a:focus-visible,
button:focus-visible,
input:focus-visible {
outline: 2px solid rgba(59, 130, 246, 0.6);
outline: 2px solid rgba(13, 148, 136, 0.55);
outline-offset: 2px;
}
@@ -73,7 +85,7 @@ input:focus-visible {
}
.bb-muted {
color: #475569;
color: rgba(19, 78, 74, 0.72);
font-size: 12px;
}
@@ -81,12 +93,133 @@ input:focus-visible {
.bb-select {
width: 100%;
padding: 10px 12px;
border: 1px solid var(--bb-border);
border-radius: 10px;
background: white;
border: 1px solid rgba(255,255,255,0.55);
border-radius: 16px;
background: rgba(255,255,255,0.55);
backdrop-filter: blur(10px);
color: var(--bb-text);
}
/* Hide native file control (we use styled buttons) */
.bb-fileInput {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.bb-fileName {
flex: 1;
min-width: 180px;
padding: 10px 12px;
border: 1px solid rgba(255,255,255,0.55);
border-radius: 16px;
background: rgba(255,255,255,0.55);
backdrop-filter: blur(10px);
color: var(--bb-text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.bb-fileName.is-empty {
color: rgba(19, 78, 74, 0.55);
}
/* Custom select (consistent dropdown menu styling) */
.bb-selectWrap {
position: relative;
width: 100%;
}
.bb-selectWrap--sm .bb-selectTrigger {
padding: 8px 10px;
}
.bb-selectTrigger {
width: 100%;
padding: 10px 12px;
border: 1px solid rgba(255,255,255,0.55);
border-radius: 16px;
background: rgba(255,255,255,0.55);
backdrop-filter: blur(10px);
color: var(--bb-text);
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
cursor: pointer;
text-align: left;
}
.bb-selectTrigger:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.bb-selectValue {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.bb-selectPlaceholder {
color: rgba(19, 78, 74, 0.55);
}
.bb-selectChevron {
flex: 0 0 auto;
opacity: 0.85;
}
.bb-selectMenu {
position: absolute;
top: calc(100% + 8px);
left: 0;
right: 0;
z-index: 50;
border-radius: 18px;
padding: 6px;
border: 1px solid rgba(255,255,255,0.65);
background: rgba(255,255,255,0.70);
backdrop-filter: blur(14px);
box-shadow: 0 22px 60px rgba(19, 78, 74, 0.16);
max-height: 320px;
overflow: auto;
}
.bb-selectOption {
width: 100%;
border: 1px solid transparent;
background: transparent;
color: var(--bb-text);
padding: 10px 10px;
border-radius: 14px;
cursor: pointer;
text-align: left;
display: flex;
align-items: center;
}
.bb-selectOption:hover {
background: rgba(13, 148, 136, 0.10);
}
.bb-selectOption.is-selected {
background: rgba(234, 88, 12, 0.12);
border-color: rgba(234, 88, 12, 0.22);
}
.bb-selectOption.is-disabled {
opacity: 0.45;
cursor: not-allowed;
}
.bb-input--sm,
.bb-select--sm {
padding: 8px 10px;
@@ -94,9 +227,9 @@ input:focus-visible {
.bb-btn {
padding: 10px 12px;
border: 1px solid var(--bb-primary);
border-radius: 10px;
background: var(--bb-primary);
border: 1px solid rgba(255,255,255,0.25);
border-radius: 16px;
background: linear-gradient(135deg, var(--bb-primary), var(--bb-cta));
color: white;
cursor: pointer;
transition: transform 120ms ease, filter 120ms ease, background 120ms ease;
@@ -111,8 +244,8 @@ input:focus-visible {
}
.bb-btn--secondary {
border-color: var(--bb-border);
background: rgba(59, 130, 246, 0.08);
border-color: rgba(255,255,255,0.45);
background: rgba(255,255,255,0.35);
color: var(--bb-text);
}
@@ -129,10 +262,11 @@ input:focus-visible {
}
.bb-card {
border: 1px solid var(--bb-border);
border-radius: 14px;
border: 1px solid rgba(255,255,255,0.55);
border-radius: 18px;
padding: 12px;
background: white;
background: rgba(255,255,255,0.55);
backdrop-filter: blur(12px);
}
.bb-card--interactive {
@@ -164,10 +298,430 @@ input:focus-visible {
}
.bb-empty {
border: 1px dashed var(--bb-border);
border-radius: 14px;
border: 1px dashed rgba(15, 23, 42, 0.18);
border-radius: 18px;
padding: 18px 14px;
background: rgba(255, 255, 255, 0.65);
background: rgba(255, 255, 255, 0.55);
}
/* --- Landing page (ui-ux-pro-max) --- */
.bb-landing {
max-width: 1100px;
margin: 0 auto;
padding: 18px 16px 28px;
}
.bb-hero {
display: grid;
grid-template-columns: 1fr;
gap: 14px;
align-items: stretch;
}
@media (min-width: 960px) {
.bb-hero {
grid-template-columns: 1.25fr 0.75fr;
gap: 16px;
}
}
.bb-pill {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
border-radius: 999px;
border: 1px solid rgba(255,255,255,0.6);
background: rgba(255,255,255,0.55);
box-shadow: 0 12px 32px rgba(15, 23, 42, 0.10);
font-weight: 800;
font-size: 12px;
}
.bb-pillDot {
width: 10px;
height: 10px;
border-radius: 999px;
background: linear-gradient(135deg, var(--bb-primary), var(--bb-cta));
box-shadow: 0 10px 24px rgba(13, 148, 136, 0.18);
}
.bb-heroTitle {
margin: 12px 0 8px;
font-family: var(--bb-font-heading);
font-size: 34px;
line-height: 1.05;
letter-spacing: -0.03em;
}
@media (min-width: 960px) {
.bb-heroTitle { font-size: 44px; }
}
.bb-heroSub {
margin: 0;
font-size: 14px;
color: rgba(19, 78, 74, 0.78);
}
.bb-heroCtaRow {
display: flex;
gap: 10px;
align-items: center;
flex-wrap: wrap;
margin-top: 14px;
}
.bb-ctaPrimary {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 16px;
border-radius: 18px;
color: white;
text-decoration: none;
font-weight: 900;
border: 1px solid rgba(255,255,255,0.25);
background: linear-gradient(135deg, var(--bb-primary), var(--bb-cta));
box-shadow: 0 18px 45px rgba(13, 148, 136, 0.20);
}
.bb-ctaGhost {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 16px;
border-radius: 18px;
color: var(--bb-text);
text-decoration: none;
font-weight: 900;
border: 1px solid rgba(255,255,255,0.55);
background: rgba(255,255,255,0.45);
}
.bb-miniStats {
margin-top: 14px;
display: grid;
grid-template-columns: 1fr;
gap: 10px;
}
@media (min-width: 768px) {
.bb-miniStats { grid-template-columns: repeat(3, 1fr); }
}
.bb-miniStat {
border-radius: 18px;
border: 1px solid rgba(255,255,255,0.6);
background: rgba(255,255,255,0.45);
padding: 12px;
box-shadow: 0 14px 40px rgba(19, 78, 74, 0.10);
}
.bb-miniStat .k { font-weight: 900; font-size: 12px; }
.bb-miniStat .v { margin-top: 6px; font-size: 12px; color: rgba(19,78,74,0.72); }
.bb-clayCard {
border-radius: 22px;
border: 2px solid rgba(255,255,255,0.78);
background: var(--bb-clay);
box-shadow: var(--bb-shadow-clay);
padding: 14px;
}
.bb-statRow {
margin-top: 14px;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
}
.bb-stat {
border-radius: 18px;
border: 2px solid rgba(255,255,255,0.72);
background: rgba(255,255,255,0.48);
padding: 12px;
box-shadow: 0 16px 44px rgba(19, 78, 74, 0.12);
}
.bb-stat .n {
font-family: var(--bb-font-heading);
font-size: 20px;
letter-spacing: -0.02em;
font-weight: 800;
}
.bb-stat .t {
margin-top: 4px;
font-size: 12px;
font-weight: 800;
color: rgba(19, 78, 74, 0.72);
}
.bb-cardTitle { font-weight: 950; letter-spacing: -0.02em; }
.bb-cardSub { margin-top: 6px; font-size: 12px; color: rgba(19,78,74,0.72); }
.bb-tag {
display: inline-flex;
align-items: center;
padding: 6px 10px;
border-radius: 999px;
font-weight: 950;
font-size: 11px;
background: rgba(124, 58, 237, 0.14);
border: 1px solid rgba(124, 58, 237, 0.28);
width: fit-content;
}
.bb-tag2 { background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.28); }
.bb-tag3 { background: rgba(251, 113, 133, 0.14); border-color: rgba(251, 113, 133, 0.28); }
.bb-bullets { margin: 10px 0 0; padding-left: 18px; }
.bb-bullets li { margin: 6px 0; font-weight: 700; color: rgba(19,78,74,0.78); }
.bb-section { margin-top: 18px; }
.bb-sectionHeader h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; font-family: var(--bb-font-heading); }
.bb-grid3 {
display: grid;
grid-template-columns: 1fr;
gap: 12px;
margin-top: 12px;
}
@media (min-width: 960px) {
.bb-grid3 { grid-template-columns: repeat(3, 1fr); }
}
.bb-courseGrid {
margin-top: 12px;
display: grid;
grid-template-columns: 1fr;
gap: 12px;
}
@media (min-width: 720px) {
.bb-courseGrid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1100px) {
.bb-courseGrid { grid-template-columns: repeat(4, 1fr); }
}
.bb-courseCard {
border-radius: 22px;
border: 2px solid rgba(255,255,255,0.78);
background: var(--bb-clay);
box-shadow: var(--bb-shadow-clay);
padding: 14px;
display: grid;
gap: 10px;
}
.bb-courseTitle {
font-weight: 950;
letter-spacing: -0.02em;
}
.bb-courseBy {
margin-top: 6px;
font-size: 12px;
font-weight: 900;
color: rgba(19, 78, 74, 0.72);
}
.bb-courseMeta {
font-size: 12px;
color: rgba(19, 78, 74, 0.78);
font-weight: 800;
}
.bb-courseCtaRow {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
}
.bb-courseCtaRow .bb-btn {
width: 100%;
display: inline-flex;
justify-content: center;
}
.bb-centerRow {
display: flex;
justify-content: center;
}
.bb-featureCard {
display: grid;
gap: 8px;
}
.bb-iconBubble {
width: 42px;
height: 42px;
border-radius: 16px;
display: grid;
place-items: center;
color: var(--bb-text);
border: 2px solid rgba(255,255,255,0.78);
background: rgba(255,255,255,0.55);
box-shadow: 0 14px 40px rgba(19, 78, 74, 0.12);
}
.bb-progressDemo .bb-tip { margin-top: 10px; font-size: 12px; color: rgba(19,78,74,0.72); }
.bb-progressItem { margin-top: 10px; }
.bb-progressItem .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 800; font-size: 12px; }
.bb-progressItem .pct { font-weight: 950; }
.bb-progressItem .bar { margin-top: 8px; height: 12px; border-radius: 999px; background: rgba(15,23,42,0.08); overflow: hidden; border: 1px solid rgba(255,255,255,0.55); }
.bb-progressItem .fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--bb-primary), var(--bb-cta)); }
.bb-progressItem .fill2 { background: linear-gradient(90deg, #22c55e, #06b6d4); }
.bb-progressItem .fill3 { background: linear-gradient(90deg, #fb7185, #f59e0b); }
.bb-quote { font-weight: 800; line-height: 1.35; }
.bb-quoteBy { margin-top: 10px; font-size: 12px; color: rgba(15,23,42,0.72); font-weight: 900; }
.bb-story { position: relative; }
.bb-stars {
display: flex;
gap: 3px;
color: rgba(234, 179, 8, 0.95);
font-weight: 900;
}
.bb-star {
width: 16px;
height: 16px;
}
.bb-ctaBand {
margin-top: 18px;
border-radius: 24px;
border: 1px solid rgba(255,255,255,0.6);
background: linear-gradient(135deg, rgba(13, 148, 136, 0.22), rgba(45, 212, 191, 0.18), rgba(234, 88, 12, 0.16));
padding: 14px;
box-shadow: 0 24px 80px rgba(19, 78, 74, 0.14);
}
.bb-ctaBandInner {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
.bb-ctaBandTitle { font-weight: 950; letter-spacing: -0.02em; }
.bb-ctaBandSub { margin-top: 4px; font-size: 12px; color: rgba(15,23,42,0.78); }
.bb-ctaBandHint {
margin-top: 8px;
font-size: 12px;
font-weight: 900;
color: rgba(19, 78, 74, 0.78);
}
.bb-ctaBandActions {
display: flex;
gap: 10px;
align-items: center;
flex-wrap: wrap;
}
/* Footer (educational platform style) */
.bb-footer {
margin-top: 18px;
padding: 18px 0 28px;
}
.bb-footerInner {
border-radius: 24px;
border: 2px solid rgba(255,255,255,0.68);
background: rgba(255,255,255,0.55);
backdrop-filter: blur(14px);
box-shadow: 0 24px 80px rgba(19, 78, 74, 0.14);
padding: 16px;
}
.bb-footerBrand {
display: flex;
align-items: center;
gap: 12px;
}
.bb-footerLogo {
width: 42px;
height: 42px;
border-radius: 16px;
display: grid;
place-items: center;
font-family: var(--bb-font-heading);
font-weight: 800;
border: 2px solid rgba(255,255,255,0.78);
background: var(--bb-clay);
box-shadow: var(--bb-shadow-clay);
}
.bb-footerTitle {
font-family: var(--bb-font-heading);
font-weight: 800;
}
.bb-footerCols {
margin-top: 14px;
display: grid;
grid-template-columns: 1fr;
gap: 12px;
}
@media (min-width: 900px) {
.bb-footerCols { grid-template-columns: repeat(3, 1fr); }
}
.bb-footerCol {
display: grid;
gap: 8px;
}
.bb-footerCol .h {
font-weight: 950;
color: rgba(19, 78, 74, 0.88);
}
.bb-footerCol a {
color: rgba(19, 78, 74, 0.78);
font-weight: 800;
}
.bb-footerCol a:hover {
color: var(--bb-cta);
}
.bb-footerBottom {
margin-top: 14px;
padding-top: 12px;
border-top: 1px solid rgba(19, 78, 74, 0.10);
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
.bb-footerSocial {
display: flex;
gap: 8px;
}
.bb-footerSocial .s {
width: 34px;
height: 34px;
border-radius: 14px;
display: grid;
place-items: center;
border: 2px solid rgba(255,255,255,0.72);
background: rgba(255,255,255,0.45);
color: rgba(19, 78, 74, 0.88);
font-weight: 950;
}
.bb-grid2 {
@@ -181,3 +735,125 @@ input:focus-visible {
grid-template-columns: 1fr 1fr;
}
}
/* --- Auth / segmented controls / subtle motion --- */
.bb-auth {
max-width: 1100px;
padding-top: 22px;
padding-bottom: 28px;
display: grid;
grid-template-columns: 1fr;
gap: 12px;
}
@media (min-width: 960px) {
.bb-auth {
grid-template-columns: 1.05fr 0.95fr;
align-items: start;
}
}
.bb-authCard {
position: relative;
overflow: hidden;
}
.bb-authCard::before,
.bb-authCard::after {
content: "";
position: absolute;
width: 320px;
height: 320px;
border-radius: 999px;
filter: blur(22px);
opacity: 0.55;
pointer-events: none;
}
.bb-authCard::before {
background: radial-gradient(circle at 30% 30%, rgba(13,148,136,0.42), transparent 60%);
top: -160px;
left: -140px;
}
.bb-authCard::after {
background: radial-gradient(circle at 40% 40%, rgba(234,88,12,0.34), transparent 62%);
bottom: -170px;
right: -160px;
}
.bb-authHeader {
position: relative;
z-index: 1;
}
.bb-seg {
margin-top: 12px;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
padding: 8px;
border-radius: 18px;
border: 1px solid rgba(255,255,255,0.65);
background: rgba(255,255,255,0.45);
backdrop-filter: blur(12px);
position: relative;
z-index: 1;
}
.bb-segBtn {
padding: 10px 12px;
border-radius: 14px;
border: 1px solid rgba(255,255,255,0.30);
background: rgba(255,255,255,0.38);
color: var(--bb-text);
font-weight: 950;
cursor: pointer;
transition: transform 120ms ease, filter 120ms ease, background 120ms ease;
}
.bb-segBtn:hover {
filter: brightness(1.03);
}
.bb-segBtn:active {
transform: translateY(1px);
}
.bb-segBtn.active {
background: linear-gradient(135deg, rgba(124,58,237,0.92), rgba(251,113,133,0.92));
color: white;
border-color: rgba(255,255,255,0.45);
}
.bb-field {
display: grid;
gap: 6px;
}
.bb-label {
font-size: 12px;
font-weight: 900;
color: rgba(15,23,42,0.78);
}
.bb-authAside {
box-shadow: 0 18px 55px rgba(15, 23, 42, 0.10);
}
.bb-authBadges {
display: flex;
gap: 8px;
flex-wrap: wrap;
margin-top: 10px;
}
@keyframes bb-float {
0% { transform: translate3d(0, 0, 0); }
50% { transform: translate3d(0, -8px, 0); }
100% { transform: translate3d(0, 0, 0); }
}
.bb-card--interactive:hover {
animation: bb-float 2.8s ease-in-out infinite;
}