UNPKG

winbox-ui-next

Version:

We Design Vue 2.0: A Vue.js 3 UI Library

187 lines (157 loc) 4.4 kB
@import '../../style/mixins/index.less'; @import './token.less'; .@{checkbox-prefix-cls} { position: relative; display: inline-flex; align-items: center; box-sizing: border-box; font-size: @checkbox-text-font-size; line-height: unset; cursor: pointer; > input[type='checkbox'] { position: absolute; top: 0; left: 0; width: 0; height: 0; opacity: 0; } &:hover { .@{checkbox-prefix-cls}-icon-hover::before { width: 0; height: 0; background-color: var(~'@{winbox-cssvars-prefix}-color-fill-2'); border-radius: 2px; } .@{checkbox-prefix-cls}-icon { border-color: var(--color-neutral-5); } } &-label { margin-left: @checkbox-text-mask-spacing; color: @checkbox-color-text; } &-icon { position: relative; box-sizing: border-box; width: @checkbox-mask-height; height: @checkbox-mask-height; background-color: @checkbox-mask-color-bg; border: @checkbox-mask-border-width @checkbox-mask-border-style @checkbox-mask-color-border; border-radius: @checkbox-mask-border-radius; user-select: none; // 半选 &::after { position: absolute; top: 50%; left: 50%; display: block; width: @checkbox-color-indeterminate-icon-width; height: @checkbox-color-indeterminate-icon-height; background: @checkbox-color-indeterminate-icon; border-radius: 0.5px; transform: translateX(-50%) translateY(-50%) scale(0); content: ''; } &-check { position: relative; display: block; width: @checkbox-size-check-icon - 2; height: 100%; margin: 0 auto; color: @checkbox-color-check-icon; transform: scale(0); transform-origin: center 75%; } &:hover { border-color: @checkbox-mask-color-border_hover; transition: border-color @transition-duration-1 @transition-timing-function-linear, transform @transition-duration-3 @transition-timing-function-overshoot; } } &-checked:hover &-icon, &-indeterminate:hover &-icon { transition: transform @transition-duration-3 @transition-timing-function-overshoot; } &-checked &-icon { background-color: @checkbox-mask-color-bg_checked; border-color: @checkbox-mask-color-border_checked; &-check { transform: scale(1); transition: transform @transition-duration-3 @transition-timing-function-overshoot; } } &-indeterminate &-icon { background-color: @checkbox-mask-color-bg_checked; border-color: @checkbox-mask-color-border_checked; svg { transform: scale(0); } &::after { transform: translateX(-50%) translateY(-50%) scale(1); transition: transform @transition-duration-3 @transition-timing-function-overshoot; } } &&-disabled { cursor: not-allowed; .@{checkbox-prefix-cls}-icon-hover { cursor: not-allowed; } &:hover .@{checkbox-prefix-cls}-mask { border-color: @checkbox-mask-color-border_disabled; } } &-checked:hover &-icon, &-indeterminate:hover &-icon { border-color: @checkbox-mask-color-border_checked; } &-disabled &-icon { background-color: @checkbox-mask-color-bg_disabled; border-color: @checkbox-mask-color-border_disabled; } &-disabled&-checked &-icon, &-disabled&-checked:hover &-icon { background-color: @checkbox-mask-color-bg_checked_disabled; border-color: @checkbox-mask-color-border_checked_disabled; } &-disabled:hover, &-indeterminate:hover { .@{checkbox-prefix-cls}-icon-hover::before { background-color: @color-transparent; } .@{checkbox-prefix-cls}-icon { border-color: var(--color-neutral-3); } } &-checked:hover { .@{checkbox-prefix-cls}-icon { border-color: @color-primary-6; } } &-disabled &-label { color: @checkbox-color-text_disabled; } &-disabled &-icon-check { color: @checkbox-color-check-icon_disabled; } } // checkbox group .@{checkbox-prefix-cls}-group { display: inline-block; .@{checkbox-prefix-cls} { margin-right: @checkbox-group-spacing - 2; } } // vertical direction .@{checkbox-prefix-cls}-group-direction-vertical { .@{checkbox-prefix-cls} { display: flex; margin-right: 0; line-height: @checkbox-group-size-line-height_vertical; } }