UNPKG

yyzone

Version:

yyzone vue components and utils

252 lines (222 loc) 5.71 kB
@prefixCheckboxCls: ~"@{yy-css-prefix}checkbox"; @prefixCheckboxGroupCls: ~"@{prefixCheckboxCls}-group"; @prefixCheckboxInnerCls: ~"@{prefixCheckboxCls}-inner"; .@{prefixCheckboxCls}-wrapper+span, .@{prefixCheckboxCls}+span { vertical-align: middle; .@{prefixCheckboxCls}-group-vertical & { vertical-align: unset; } } .@{prefixCheckboxCls} { display: inline-block; vertical-align: middle; white-space: nowrap; cursor: pointer; line-height: 1; position: relative; font-size: 0; &-disabled { .cursor(not-allowed) } &-inner { display: inline-block; width: 14px; height: 14px; box-sizing: border-box; position: relative; top: 0; left: 0; border: 1px solid @yy-check-border; border-radius: 2px; background-color: @yy-background-component; transition: border-color @yy-transition-time @yy-ease-in-out, background-color @yy-transition-time @yy-ease-in-out, box-shadow @yy-transition-time @yy-ease-in-out; &:after { content: ''; display: inline-block; box-sizing: border-box; width: 4px; height: 8px; position: absolute; top: 1px; left: 4px; border: 2px solid #fff; border-top: 0; border-left: 0; transform: rotate(45deg) scale(0); transition: all @yy-transition-time @yy-ease-in-out; } } &-input { width: 100%; height: 100%; position: absolute; top: 0; bottom: 0; left: 0; right: 0; z-index: 1; cursor: pointer; opacity: 0; &[disabled] { .cursor(not-allowed) } } .@{prefixCheckboxGroupCls}-vertical & { float: right; margin-top: 13px; margin-right: 0; } } // 选中状态 .@{prefixCheckboxCls}-checked { .@{prefixCheckboxInnerCls} { border-color: @yy-check-border; background-color: @yy-background-component; &:after { content: ''; display: inline-block; width: 4px; height: 8px; position: absolute; top: 1px; left: 4px; border: 2px solid @yy-primary-color; border-top: 0; border-left: 0; transform: rotate(45deg) scale(1); transition: all @yy-transition-time @yy-ease-in-out; } } } // 禁用 .@{prefixCheckboxCls}-disabled { &.@{prefixCheckboxCls}-checked { .@{prefixCheckboxInnerCls} { border-color: @yy-border-color-disabled; background-color: @yy-background-color-disabled; &:after { animation-name: none; border-color: @yy-text-disabled-color; } } } .@{prefixCheckboxInnerCls} { border-color: @yy-border-color-disabled; background-color: @yy-background-color-disabled; &:after { animation-name: none; border-color:@yy-text-disabled-color; } } .@{prefixCheckboxInnerCls}-input { cursor: default; } &+span { .cursor(not-allowed) } } // 半选状态 .@{prefixCheckboxCls}-indeterminate { .@{prefixCheckboxInnerCls}:after { content: ''; width: 8px; height: 1px; transform: scale(1); position: absolute; left: 2px; top: 5px; } &:hover { .@{prefixCheckboxInnerCls} { border-color: @yy-text-primary-color; } } .@{prefixCheckboxInnerCls} { background-color: @yy-text-primary-color; border-color: @yy-text-primary-color; } &.@{prefixCheckboxCls}-disabled { .@{prefixCheckboxInnerCls} { background-color: #f3f3f3; border-color: @yy-border-color-base; } .@{prefixCheckboxInnerCls}:after { border-color: @yy-text-disabled-color; } } } // 普通状态 .@{prefixCheckboxCls}-wrapper { cursor: pointer; font-size: @yy-font-size-small; display: inline-block; margin-right: 10px; color: @yy-text-primary-color; &-disabled { .cursor(not-allowed) } &-large { font-size: @yy-font-size-base; } &-large { & .@{prefixCheckboxInnerCls} { width: 16px; height: 16px; &:after{ width: 5px; height: 9px; } } } &-small{ font-size: 12px; & .@{prefixCheckboxInnerCls} { width: 12px; height: 12px; &:after{ top: 0; left: 3px; } } } } // 组 .@{prefixCheckboxGroupCls} { font-size: 0; &-vertical &-item { display: block; height: 40px; line-height: 40px; padding: 0 10px; margin-right: 0; .clearfix(); &:hover { background-color: @yy-select-hover-bg; } } &-large { & .@{prefixCheckboxCls}-wrapper { font-size: @yy-font-size-base; } & .@{prefixCheckboxInnerCls} { width: 16px; height: 16px; &:after{ width: 5px; height: 9px; } } } &-small{ font-size: 12px; & .@{prefixCheckboxInnerCls} { width: 12px; height: 12px; &:after{ top: 0; left: 3px; } } } }