index.less 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. @import './size';
  4. @import './rtl';
  5. @import './position';
  6. @import './dropdown';
  7. @import './card';
  8. @tab-prefix-cls: ~'@{ant-prefix}-tabs';
  9. .@{tab-prefix-cls} {
  10. .reset-component();
  11. display: flex;
  12. // ========================== Navigation ==========================
  13. > .@{tab-prefix-cls}-nav,
  14. > div > .@{tab-prefix-cls}-nav {
  15. position: relative;
  16. display: flex;
  17. flex: none;
  18. align-items: center;
  19. .@{tab-prefix-cls}-nav-wrap {
  20. position: relative;
  21. display: inline-block;
  22. display: flex;
  23. flex: auto;
  24. align-self: stretch;
  25. overflow: hidden;
  26. white-space: nowrap;
  27. transform: translate(0); // Fix chrome render bug
  28. // >>>>> Ping shadow
  29. &::before,
  30. &::after {
  31. position: absolute;
  32. z-index: 1;
  33. opacity: 0;
  34. transition: opacity @animation-duration-slow;
  35. content: '';
  36. pointer-events: none;
  37. }
  38. }
  39. .@{tab-prefix-cls}-nav-list {
  40. position: relative;
  41. display: flex;
  42. transition: transform @animation-duration-slow;
  43. }
  44. // >>>>>>>> Operations
  45. .@{tab-prefix-cls}-nav-operations {
  46. display: flex;
  47. align-self: stretch;
  48. &-hidden {
  49. position: absolute;
  50. visibility: hidden;
  51. pointer-events: none;
  52. }
  53. }
  54. .@{tab-prefix-cls}-nav-more {
  55. position: relative;
  56. padding: @tabs-card-horizontal-padding;
  57. background: transparent;
  58. border: 0;
  59. &::after {
  60. position: absolute;
  61. right: 0;
  62. bottom: 0;
  63. left: 0;
  64. height: 5px;
  65. transform: translateY(100%);
  66. content: '';
  67. }
  68. }
  69. .@{tab-prefix-cls}-nav-add {
  70. min-width: @tabs-card-height;
  71. margin-left: @tabs-card-gutter;
  72. padding: 0 @padding-xs;
  73. background: @tabs-card-head-background;
  74. border: @border-width-base @border-style-base @border-color-split;
  75. border-radius: @border-radius-base @border-radius-base 0 0;
  76. outline: none;
  77. cursor: pointer;
  78. transition: all @animation-duration-slow @ease-in-out;
  79. &:hover {
  80. color: @tabs-hover-color;
  81. }
  82. &:active,
  83. &:focus {
  84. color: @tabs-active-color;
  85. }
  86. }
  87. }
  88. &-extra-content {
  89. flex: none;
  90. }
  91. &-centered {
  92. > .@{tab-prefix-cls}-nav,
  93. > div > .@{tab-prefix-cls}-nav {
  94. .@{tab-prefix-cls}-nav-wrap {
  95. &:not([class*='@{tab-prefix-cls}-nav-wrap-ping']) {
  96. justify-content: center;
  97. }
  98. }
  99. }
  100. }
  101. // ============================ InkBar ============================
  102. &-ink-bar {
  103. position: absolute;
  104. background: @tabs-ink-bar-color;
  105. pointer-events: none;
  106. }
  107. // ============================= Tabs =============================
  108. &-tab {
  109. position: relative;
  110. display: inline-flex;
  111. align-items: center;
  112. padding: @tabs-horizontal-padding;
  113. font-size: @tabs-title-font-size;
  114. background: transparent;
  115. border: 0;
  116. outline: none;
  117. cursor: pointer;
  118. &-btn,
  119. &-remove {
  120. &:focus,
  121. &:active {
  122. color: @tabs-active-color;
  123. }
  124. }
  125. &-btn {
  126. outline: none;
  127. transition: all 0.3s;
  128. }
  129. &-remove {
  130. flex: none;
  131. margin-right: -@margin-xss;
  132. margin-left: @margin-xs;
  133. color: @text-color-secondary;
  134. font-size: @font-size-sm;
  135. background: transparent;
  136. border: none;
  137. outline: none;
  138. cursor: pointer;
  139. transition: all @animation-duration-slow;
  140. &:hover {
  141. color: @heading-color;
  142. }
  143. }
  144. &:hover {
  145. color: @tabs-hover-color;
  146. }
  147. &&-active &-btn {
  148. color: @tabs-highlight-color;
  149. text-shadow: 0 0 0.25px currentcolor;
  150. }
  151. &&-disabled {
  152. color: @disabled-color;
  153. cursor: not-allowed;
  154. }
  155. &&-disabled &-btn,
  156. &&-disabled &-remove {
  157. &:focus,
  158. &:active {
  159. color: @disabled-color;
  160. }
  161. }
  162. & &-remove .@{iconfont-css-prefix} {
  163. margin: 0;
  164. }
  165. .@{iconfont-css-prefix} {
  166. margin-right: @margin-sm;
  167. }
  168. }
  169. &-tab + &-tab {
  170. margin: @tabs-horizontal-margin;
  171. }
  172. // =========================== TabPanes ===========================
  173. &-content {
  174. &-holder {
  175. flex: auto;
  176. min-width: 0;
  177. min-height: 0;
  178. }
  179. position: relative;
  180. width: 100%;
  181. }
  182. &-tabpane {
  183. outline: none;
  184. &-hidden {
  185. display: none;
  186. }
  187. }
  188. // Motion
  189. &-switch {
  190. &-appear,
  191. &-enter {
  192. transition: none;
  193. &-start {
  194. opacity: 0;
  195. }
  196. &-active {
  197. opacity: 1;
  198. transition: opacity @animation-duration-slow;
  199. }
  200. }
  201. &-leave {
  202. position: absolute;
  203. transition: none;
  204. inset: 0;
  205. &-start {
  206. opacity: 1;
  207. }
  208. &-active {
  209. opacity: 0;
  210. transition: opacity @animation-duration-slow;
  211. }
  212. }
  213. }
  214. }