index.less 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. @badge-prefix-cls: ~'@{ant-prefix}-badge';
  4. @number-prefix-cls: ~'@{ant-prefix}-scroll-number';
  5. .@{badge-prefix-cls} {
  6. .reset-component();
  7. position: relative;
  8. display: inline-block;
  9. line-height: 1;
  10. &-count {
  11. z-index: @zindex-badge;
  12. min-width: @badge-height;
  13. height: @badge-height;
  14. padding: 0 6px;
  15. color: @badge-text-color;
  16. font-weight: @badge-font-weight;
  17. font-size: @badge-font-size;
  18. line-height: @badge-height;
  19. white-space: nowrap;
  20. text-align: center;
  21. background: @badge-color;
  22. border-radius: (@badge-height / 2);
  23. box-shadow: 0 0 0 1px @shadow-color-inverse;
  24. a,
  25. a:hover {
  26. color: @badge-text-color;
  27. }
  28. }
  29. &-count-sm {
  30. min-width: @badge-height-sm;
  31. height: @badge-height-sm;
  32. padding: 0;
  33. font-size: @badge-font-size-sm;
  34. line-height: @badge-height-sm;
  35. border-radius: (@badge-height-sm / 2);
  36. }
  37. &-multiple-words {
  38. padding: 0 8px;
  39. }
  40. &-dot {
  41. z-index: @zindex-badge;
  42. width: @badge-dot-size;
  43. min-width: @badge-dot-size;
  44. height: @badge-dot-size;
  45. background: @highlight-color;
  46. border-radius: 100%;
  47. box-shadow: 0 0 0 1px @shadow-color-inverse;
  48. }
  49. // Tricky way to resolve https://github.com/ant-design/ant-design/issues/30088
  50. &-dot.@{number-prefix-cls} {
  51. transition: background 1.5s;
  52. }
  53. &-count,
  54. &-dot,
  55. .@{number-prefix-cls}-custom-component {
  56. position: absolute;
  57. top: 0;
  58. right: 0;
  59. transform: translate(50%, -50%);
  60. transform-origin: 100% 0%;
  61. &.@{iconfont-css-prefix}-spin {
  62. animation: antBadgeLoadingCircle 1s infinite linear;
  63. }
  64. }
  65. &-status {
  66. line-height: inherit;
  67. vertical-align: baseline;
  68. &-dot {
  69. position: relative;
  70. top: -1px;
  71. display: inline-block;
  72. width: @badge-status-size;
  73. height: @badge-status-size;
  74. vertical-align: middle;
  75. border-radius: 50%;
  76. }
  77. &-success {
  78. background-color: @success-color;
  79. }
  80. &-processing {
  81. position: relative;
  82. background-color: @processing-color;
  83. &::after {
  84. position: absolute;
  85. top: 0;
  86. left: 0;
  87. width: 100%;
  88. height: 100%;
  89. border: 1px solid @processing-color;
  90. border-radius: 50%;
  91. animation: antStatusProcessing 1.2s infinite ease-in-out;
  92. content: '';
  93. }
  94. }
  95. &-default {
  96. background-color: @normal-color;
  97. }
  98. &-error {
  99. background-color: @error-color;
  100. }
  101. &-warning {
  102. background-color: @warning-color;
  103. }
  104. // mixin to iterate over colors and create CSS class for each one
  105. .make-color-classes(@i: length(@preset-colors)) when (@i > 0) {
  106. .make-color-classes(@i - 1);
  107. @color: extract(@preset-colors, @i);
  108. @darkColor: '@{color}-6';
  109. &-@{color} {
  110. background: @@darkColor;
  111. }
  112. }
  113. .make-color-classes();
  114. &-text {
  115. margin-left: 8px;
  116. color: @text-color;
  117. font-size: @font-size-base;
  118. }
  119. }
  120. &-zoom-appear,
  121. &-zoom-enter {
  122. animation: antZoomBadgeIn @animation-duration-slow @ease-out-back;
  123. animation-fill-mode: both;
  124. }
  125. &-zoom-leave {
  126. animation: antZoomBadgeOut @animation-duration-slow @ease-in-back;
  127. animation-fill-mode: both;
  128. }
  129. &-not-a-wrapper {
  130. .@{badge-prefix-cls}-zoom-appear,
  131. .@{badge-prefix-cls}-zoom-enter {
  132. animation: antNoWrapperZoomBadgeIn @animation-duration-slow @ease-out-back;
  133. }
  134. .@{badge-prefix-cls}-zoom-leave {
  135. animation: antNoWrapperZoomBadgeOut @animation-duration-slow @ease-in-back;
  136. }
  137. &:not(.@{badge-prefix-cls}-status) {
  138. vertical-align: middle;
  139. }
  140. .@{number-prefix-cls}-custom-component,
  141. .@{badge-prefix-cls}-count {
  142. transform: none;
  143. }
  144. .@{number-prefix-cls}-custom-component,
  145. .@{number-prefix-cls} {
  146. position: relative;
  147. top: auto;
  148. display: block;
  149. transform-origin: 50% 50%;
  150. }
  151. }
  152. }
  153. @keyframes antStatusProcessing {
  154. 0% {
  155. transform: scale(0.8);
  156. opacity: 0.5;
  157. }
  158. 100% {
  159. transform: scale(2.4);
  160. opacity: 0;
  161. }
  162. }
  163. // Safari will blink with transform when inner element has absolute style.
  164. .safari-fix-motion() {
  165. /* stylelint-disable property-no-vendor-prefix */
  166. -webkit-transform-style: preserve-3d;
  167. -webkit-backface-visibility: hidden;
  168. /* stylelint-enable property-no-vendor-prefix */
  169. }
  170. .@{number-prefix-cls} {
  171. overflow: hidden;
  172. direction: ltr;
  173. &-only {
  174. position: relative;
  175. display: inline-block;
  176. height: @badge-height;
  177. transition: all @animation-duration-slow @ease-in-out;
  178. .safari-fix-motion;
  179. > p.@{number-prefix-cls}-only-unit {
  180. height: @badge-height;
  181. margin: 0;
  182. .safari-fix-motion;
  183. }
  184. }
  185. &-symbol {
  186. vertical-align: top;
  187. }
  188. }
  189. @keyframes antZoomBadgeIn {
  190. 0% {
  191. transform: scale(0) translate(50%, -50%);
  192. opacity: 0;
  193. }
  194. 100% {
  195. transform: scale(1) translate(50%, -50%);
  196. }
  197. }
  198. @keyframes antZoomBadgeOut {
  199. 0% {
  200. transform: scale(1) translate(50%, -50%);
  201. }
  202. 100% {
  203. transform: scale(0) translate(50%, -50%);
  204. opacity: 0;
  205. }
  206. }
  207. @keyframes antNoWrapperZoomBadgeIn {
  208. 0% {
  209. transform: scale(0);
  210. opacity: 0;
  211. }
  212. 100% {
  213. transform: scale(1);
  214. }
  215. }
  216. @keyframes antNoWrapperZoomBadgeOut {
  217. 0% {
  218. transform: scale(1);
  219. }
  220. 100% {
  221. transform: scale(0);
  222. opacity: 0;
  223. }
  224. }
  225. @keyframes antBadgeLoadingCircle {
  226. 0% {
  227. transform-origin: 50%;
  228. }
  229. 100% {
  230. transform: translate(50%, -50%) rotate(360deg);
  231. transform-origin: 50%;
  232. }
  233. }
  234. @import './ribbon';
  235. @import './rtl';