diff --git a/components/radio/style/index.less b/components/radio/style/index.less index 9c69c3f657..63dfd66fb7 100644 --- a/components/radio/style/index.less +++ b/components/radio/style/index.less @@ -14,10 +14,6 @@ display: inline-block; line-height: unset; - &-rtl { - direction: rtl; - } - .@{ant-prefix}-badge-count { z-index: 1; } @@ -36,11 +32,6 @@ margin-right: 8px; white-space: nowrap; cursor: pointer; - - &-rtl { - margin-right: 0; - margin-left: 8px; - } } .@{radio-prefix-cls} { @@ -183,11 +174,6 @@ span.@{radio-prefix-cls} + * { cursor: pointer; transition: color 0.3s, background 0.3s, border-color 0.3s, box-shadow 0.3s; - &-rtl { - border-right-width: 0; - border-left-width: @border-width-base; - } - a { color: @radio-button-color; } @@ -224,30 +210,16 @@ span.@{radio-prefix-cls} + * { background-color: @border-color-base; transition: background-color 0.3s; content: ''; - - .@{radio-prefix-cls}-button-wrapper-rtl& { - right: -1px; - left: 0; - } } } &:first-child { border-left: @border-width-base @border-style-base @border-color-base; border-radius: @border-radius-base 0 0 @border-radius-base; - - .@{radio-prefix-cls}-button-wrapper-rtl& { - border-right: @border-width-base @border-style-base @border-color-base; - border-radius: 0 @border-radius-base @border-radius-base 0; - } } &:last-child { border-radius: 0 @border-radius-base @border-radius-base 0; - - .@{radio-prefix-cls}-button-wrapper-rtl& { - border-radius: @border-radius-base 0 0 @border-radius-base; - } } &:first-child:last-child { @@ -340,10 +312,6 @@ span.@{radio-prefix-cls} + * { } &:first-child { border-left-color: @border-color-base; - - .@{radio-prefix-cls}-button-wrapper-rtl& { - border-right-color: @border-color-base; - } } } @@ -372,3 +340,5 @@ span.@{radio-prefix-cls} + * { vertical-align: text-bottom; } } + +@import './rtl'; diff --git a/components/radio/style/rtl.less b/components/radio/style/rtl.less new file mode 100644 index 0000000000..3806645d14 --- /dev/null +++ b/components/radio/style/rtl.less @@ -0,0 +1,59 @@ +@import '../../style/themes/index'; +@import '../../style/mixins/index'; + +@radio-prefix-cls: ~'@{ant-prefix}-radio'; +@radio-group-prefix-cls: ~'@{radio-prefix-cls}-group'; + +.@{radio-group-prefix-cls} { + &-rtl { + direction: rtl; + } +} + +// 一般状态 +.@{radio-prefix-cls}-wrapper { + &-rtl { + margin-right: 0; + margin-left: 8px; + } +} + +.@{radio-prefix-cls}-button-wrapper { + &-rtl { + border-right-width: 0; + border-left-width: @border-width-base; + } + + &:not(:first-child) { + &::before { + .@{radio-prefix-cls}-button-wrapper-rtl& { + right: -1px; + left: 0; + } + } + } + + &:first-child { + .@{radio-prefix-cls}-button-wrapper-rtl& { + border-right: @border-width-base @border-style-base @border-color-base; + border-radius: 0 @border-radius-base @border-radius-base 0; + } + .@{radio-prefix-cls}-button-wrapper-checked:not([class*=~"' @{radio-prefix-cls}-button-wrapper-disabled'"])& { + border-right-color: @radio-button-hover-color; + } + } + + &:last-child { + .@{radio-prefix-cls}-button-wrapper-rtl& { + border-radius: @border-radius-base 0 0 @border-radius-base; + } + } + + &-disabled { + &:first-child { + .@{radio-prefix-cls}-button-wrapper-rtl& { + border-right-color: @border-color-base; + } + } + } +}