hyapp-deploly/src/shared/ui/Checkbox/Checkbox.module.css
2026-05-20 16:49:19 +08:00

152 lines
3.3 KiB
CSS

.root {
position: relative;
display: inline-flex;
min-height: 36px;
align-items: center;
gap: var(--space-2);
padding: 7px 10px 7px 8px;
border: 1px solid transparent;
border-radius: 999px;
color: var(--color-text-secondary);
cursor: pointer;
transition:
background var(--duration-fast) var(--ease-standard),
border-color var(--duration-fast) var(--ease-standard),
box-shadow var(--duration-fast) var(--ease-standard),
color var(--duration-fast) var(--ease-standard);
}
.root::before {
position: absolute;
inset: 0;
z-index: -1;
border-radius: inherit;
background:
linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(241, 248, 255, 0.28)),
rgba(255, 255, 255, 0.2);
opacity: 0;
content: "";
transition: opacity var(--duration-fast) var(--ease-standard);
}
.root:hover:not(.disabled) {
color: var(--color-text-primary);
border-color: rgba(255, 255, 255, 0.72);
box-shadow: var(--shadow-liquid-control-hover);
}
.root:hover:not(.disabled)::before,
.root:focus-within::before {
opacity: 1;
}
.input {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
clip-path: inset(50%);
white-space: nowrap;
}
.control {
display: inline-flex;
width: 20px;
height: 20px;
flex: 0 0 auto;
align-items: center;
justify-content: center;
border: 1px solid rgba(255, 255, 255, 0.74);
border-radius: 7px;
color: #fff;
background:
linear-gradient(135deg, rgba(255, 255, 255, 0.64), rgba(241, 248, 255, 0.24)),
rgba(255, 255, 255, 0.28);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.86),
inset 0 -1px 0 rgba(75, 108, 148, 0.1);
backdrop-filter: blur(18px) saturate(170%);
-webkit-backdrop-filter: blur(18px) saturate(170%);
transition:
background var(--duration-fast) var(--ease-standard),
border-color var(--duration-fast) var(--ease-standard),
box-shadow var(--duration-fast) var(--ease-standard),
transform var(--duration-fast) var(--ease-standard);
}
.icon {
opacity: 0;
transform: scale(0.72);
transition:
opacity var(--duration-fast) var(--ease-standard),
transform var(--duration-fast) var(--ease-standard);
}
.content {
display: grid;
gap: 1px;
min-width: 0;
}
.label {
font-size: 13px;
font-weight: 800;
line-height: 18px;
}
.description {
color: var(--color-text-tertiary);
font-size: 12px;
font-weight: 600;
line-height: 16px;
}
.input:focus-visible + .control {
box-shadow: var(--shadow-focus);
}
.input:checked + .control {
border-color: rgba(47, 125, 246, 0.28);
background:
linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 44%),
linear-gradient(180deg, #5fa2ff, var(--color-brand));
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.62),
0 8px 18px rgba(47, 125, 246, 0.24);
animation: checkbox-check 180ms var(--ease-press);
}
.input:checked + .control .icon {
opacity: 1;
transform: scale(1);
}
.root:hover:not(.disabled) .control {
transform: translateY(-1px);
}
.root:active:not(.disabled) .control {
transform: scale(0.92);
}
.disabled {
color: var(--color-text-disabled);
cursor: not-allowed;
opacity: 0.62;
}
@keyframes checkbox-check {
0% {
transform: scale(0.86);
}
70% {
transform: scale(1.08);
}
100% {
transform: scale(1);
}
}