@radio-group-prefix-cls: ant-radio-group; @radio-prefix-cls: ant-radio; @radio-inner-prefix-cls: ~"@{radio-prefix-cls}-inner"; @radio-duration: .3s; .@{radio-group-prefix-cls} { display: inline-block; vertical-align: middle; label { margin-right: 16px; } } // 一般状态 .@{radio-prefix-cls} { white-space: nowrap; outline: none; display: inline-block; position: relative; line-height: 1; vertical-align: middle; &:hover { .@{radio-inner-prefix-cls} { border-color: #bcbcbc; } } &-inner { &:after { position: absolute; width: 6px; height: 6px; left: 3px; top: 3px; border-radius: 6px; display: table; border-top: 0; border-left: 0; content: ' '; background-color: @primary-color; transform: scale(0); opacity: 0; transition: transform @radio-duration @ease-in-out-circ, opacity @radio-duration @ease-in-out-circ, background-color @radio-duration @ease-in-out-circ; } position: relative; top: 0; left: 0; display: inline-block; width: 14px; height: 14px; border-width: 1px; border-style: solid; border-radius: 14px; border-color: #d9d9d9; background-color: #fff; transition: border-color @radio-duration @ease-in-out-circ, background-color @radio-duration @ease-in-out-circ; } &-input { position: absolute; left: 0; z-index: 1; cursor: pointer; opacity: 0; top: 0; bottom: 0; right: 0; } } // 选中状态 .@{radio-prefix-cls}-checked { .@{radio-inner-prefix-cls} { border-color: #d9d9d9; &:after { transform: scale(1); opacity: 1; transition: transform @radio-duration @ease-out-back, opacity @radio-duration @ease-in-out-circ, background-color @radio-duration @ease-in-out-circ; } } } .@{radio-prefix-cls}-disabled { &:hover { .@{radio-inner-prefix-cls} { border-color: #d9d9d9; } } .@{radio-inner-prefix-cls} { border-color: #d9d9d9; background-color: #f3f3f3; &:after { background-color: #cccccc; } } .@{radio-inner-prefix-cls}-input { cursor: default; } } .@{radio-prefix-cls} + span { margin-left: 8px; } .@{radio-prefix-cls} { label&-button { background: #fff; padding: 0 15px; margin: 0; height: 28px; line-height: 26px; color: #666; display: inline-block; transition: all 0.3s ease; cursor: pointer; border: 1px solid #d9d9d9; border-left: 0; > span { margin-left: 0; } &:before { transition: all 0.3s ease; position: absolute; width: 1px; height: 100%; left: -1px; background: #d9d9d9; content: ''; visibility: hidden; } &:first-child { border-radius: @border-radius-base 0 0 @border-radius-base; border-left: 1px solid #d9d9d9; &:before { display: none; } } &:last-child { border-radius: 0 @border-radius-base @border-radius-base 0; } &:first-child:last-child { border-radius: @border-radius-base; } &:hover { border-color: #aaa; position: relative; &:before { background: #aaa; visibility: visible; } } .@{radio-prefix-cls}-inner, input { .opacity(0); width: 0; height: 0; } &-checked { background: @primary-color; border-color: @primary-color; color: #fff; box-shadow: -1px 0 0 0 @primary-color; &:before { display: none; } &:first-child { border-color: @primary-color; } &:hover { background: tint(@primary-color, 20%); border-color: tint(@primary-color, 20%); box-shadow: -1px 0 0 0 tint(@primary-color, 20%); } &:active { background: shade(@primary-color, 5%); border-color: shade(@primary-color, 5%); box-shadow: -1px 0 0 0 shade(@primary-color, 5%); } } &-disabled { border-color: #d9d9d9; background-color: #f3f3f3; cursor: not-allowed; color: #ccc; &:first-child, &:hover { border-color: #d9d9d9; background-color: #f3f3f3; &:before { display: none; } } &:first-child { box-shadow: none; border-left-color: #d9d9d9; } } &-disabled.@{radio-prefix-cls}-button-checked { color: #fff; background-color: #ccc; box-shadow: -1px 0px 0px 0px #ccc; border-color: #ccc; } } }