index-pure.less 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. @import '../../input/style/mixin';
  4. @import './single';
  5. @import './multiple';
  6. @select-prefix-cls: ~'@{ant-prefix}-select';
  7. @select-height-without-border: @input-height-base - 2 * @border-width-base;
  8. @select-dropdown-edge-child-vertical-padding: @dropdown-edge-child-vertical-padding;
  9. .select-selector() {
  10. position: relative;
  11. background-color: @select-background;
  12. border: @border-width-base @border-style-base @select-border-color;
  13. border-radius: @border-radius-base;
  14. transition: all 0.3s @ease-in-out;
  15. input {
  16. cursor: pointer;
  17. }
  18. .@{select-prefix-cls}-show-search& {
  19. cursor: text;
  20. input {
  21. cursor: auto;
  22. }
  23. }
  24. .@{select-prefix-cls}-focused:not(.@{select-prefix-cls}-disabled)& {
  25. .active();
  26. }
  27. .@{select-prefix-cls}-disabled& {
  28. color: @disabled-color;
  29. background: @input-disabled-bg;
  30. cursor: not-allowed;
  31. .@{select-prefix-cls}-multiple& {
  32. background: @select-multiple-disabled-background;
  33. }
  34. input {
  35. cursor: not-allowed;
  36. }
  37. }
  38. }
  39. /* Reset search input style */
  40. .select-search-input-without-border() {
  41. .@{select-prefix-cls}-selection-search-input {
  42. margin: 0;
  43. padding: 0;
  44. background: transparent;
  45. border: none;
  46. outline: none;
  47. appearance: none;
  48. &::-webkit-search-cancel-button {
  49. display: none;
  50. /* stylelint-disable-next-line property-no-vendor-prefix */
  51. -webkit-appearance: none;
  52. }
  53. }
  54. }
  55. .@{select-prefix-cls} {
  56. .reset-component();
  57. position: relative;
  58. display: inline-block;
  59. cursor: pointer;
  60. &:not(&-customize-input) &-selector {
  61. .select-selector();
  62. .select-search-input-without-border();
  63. }
  64. &:not(&-disabled):hover &-selector {
  65. .hover();
  66. }
  67. // ======================== Selection ========================
  68. &-selection-item {
  69. flex: 1;
  70. overflow: hidden;
  71. font-weight: normal;
  72. white-space: nowrap;
  73. text-overflow: ellipsis;
  74. // IE11 css hack. `*::-ms-backdrop,` is a must have
  75. @media all and (-ms-high-contrast: none) {
  76. *::-ms-backdrop,
  77. & {
  78. flex: auto;
  79. }
  80. }
  81. }
  82. // ======================= Placeholder =======================
  83. &-selection-placeholder {
  84. flex: 1;
  85. overflow: hidden;
  86. color: @input-placeholder-color;
  87. white-space: nowrap;
  88. text-overflow: ellipsis;
  89. pointer-events: none;
  90. // IE11 css hack. `*::-ms-backdrop,` is a must have
  91. @media all and (-ms-high-contrast: none) {
  92. *::-ms-backdrop,
  93. & {
  94. flex: auto;
  95. }
  96. }
  97. }
  98. // ========================== Arrow ==========================
  99. &-arrow {
  100. .iconfont-mixin();
  101. position: absolute;
  102. top: 50%;
  103. right: @control-padding-horizontal - 1px;
  104. width: @font-size-sm;
  105. height: @font-size-sm;
  106. margin-top: (-@font-size-sm / 2);
  107. color: @disabled-color;
  108. font-size: @font-size-sm;
  109. line-height: 1;
  110. text-align: center;
  111. pointer-events: none;
  112. .@{iconfont-css-prefix} {
  113. vertical-align: top;
  114. transition: transform 0.3s;
  115. > svg {
  116. vertical-align: top;
  117. }
  118. &:not(.@{select-prefix-cls}-suffix) {
  119. pointer-events: auto;
  120. }
  121. }
  122. .@{select-prefix-cls}-disabled & {
  123. cursor: not-allowed;
  124. }
  125. }
  126. // ========================== Clear ==========================
  127. &-clear {
  128. position: absolute;
  129. top: 50%;
  130. right: @control-padding-horizontal - 1px;
  131. z-index: 1;
  132. display: inline-block;
  133. width: @font-size-sm;
  134. height: @font-size-sm;
  135. margin-top: (-@font-size-sm / 2);
  136. color: @disabled-color;
  137. font-size: @font-size-sm;
  138. font-style: normal;
  139. line-height: 1;
  140. text-align: center;
  141. text-transform: none;
  142. background: @select-clear-background;
  143. cursor: pointer;
  144. opacity: 0;
  145. transition: color 0.3s ease, opacity 0.15s ease;
  146. text-rendering: auto;
  147. &::before {
  148. display: block;
  149. }
  150. &:hover {
  151. color: @text-color-secondary;
  152. }
  153. .@{select-prefix-cls}:hover & {
  154. opacity: 1;
  155. }
  156. }
  157. // ========================== Popup ==========================
  158. &-dropdown {
  159. .reset-component();
  160. position: absolute;
  161. top: -9999px;
  162. left: -9999px;
  163. z-index: @zindex-dropdown;
  164. box-sizing: border-box;
  165. padding: @select-dropdown-edge-child-vertical-padding 0;
  166. overflow: hidden;
  167. font-size: @font-size-base;
  168. // Fix select render lag of long text in chrome
  169. // https://github.com/ant-design/ant-design/issues/11456
  170. // https://github.com/ant-design/ant-design/issues/11843
  171. font-variant: initial;
  172. background-color: @select-dropdown-bg;
  173. border-radius: @border-radius-base;
  174. outline: none;
  175. box-shadow: @box-shadow-base;
  176. &.@{ant-prefix}-slide-up-enter.@{ant-prefix}-slide-up-enter-active&-placement-bottomLeft,
  177. &.@{ant-prefix}-slide-up-appear.@{ant-prefix}-slide-up-appear-active&-placement-bottomLeft {
  178. animation-name: antSlideUpIn;
  179. }
  180. &.@{ant-prefix}-slide-up-enter.@{ant-prefix}-slide-up-enter-active&-placement-topLeft,
  181. &.@{ant-prefix}-slide-up-appear.@{ant-prefix}-slide-up-appear-active&-placement-topLeft {
  182. animation-name: antSlideDownIn;
  183. }
  184. &.@{ant-prefix}-slide-up-leave.@{ant-prefix}-slide-up-leave-active&-placement-bottomLeft {
  185. animation-name: antSlideUpOut;
  186. }
  187. &.@{ant-prefix}-slide-up-leave.@{ant-prefix}-slide-up-leave-active&-placement-topLeft {
  188. animation-name: antSlideDownOut;
  189. }
  190. &-hidden {
  191. display: none;
  192. }
  193. &-empty {
  194. color: @disabled-color;
  195. }
  196. }
  197. // ========================= Options =========================
  198. .item() {
  199. position: relative;
  200. display: block;
  201. min-height: @select-dropdown-height;
  202. padding: @select-dropdown-vertical-padding @control-padding-horizontal;
  203. color: @text-color;
  204. font-weight: normal;
  205. font-size: @select-dropdown-font-size;
  206. line-height: @select-dropdown-line-height;
  207. }
  208. &-item-empty {
  209. .item();
  210. color: @disabled-color;
  211. }
  212. &-item {
  213. .item();
  214. cursor: pointer;
  215. transition: background 0.3s ease;
  216. // =========== Group ============
  217. &-group {
  218. color: @text-color-secondary;
  219. font-size: @font-size-sm;
  220. cursor: default;
  221. }
  222. // =========== Option ===========
  223. &-option {
  224. display: flex;
  225. &-content {
  226. flex: auto;
  227. overflow: hidden;
  228. white-space: nowrap;
  229. text-overflow: ellipsis;
  230. }
  231. &-state {
  232. flex: none;
  233. }
  234. &-active:not(&-disabled) {
  235. background-color: @select-item-active-bg;
  236. }
  237. &-selected:not(&-disabled) {
  238. color: @select-item-selected-color;
  239. font-weight: @select-item-selected-font-weight;
  240. background-color: @select-item-selected-bg;
  241. .@{select-prefix-cls}-item-option-state {
  242. color: @primary-color;
  243. }
  244. }
  245. &-disabled {
  246. &.@{select-prefix-cls}-item-option-selected {
  247. background-color: @select-multiple-disabled-background;
  248. }
  249. color: @disabled-color;
  250. cursor: not-allowed;
  251. }
  252. &-grouped {
  253. padding-left: @control-padding-horizontal * 2;
  254. }
  255. }
  256. }
  257. // ============================================================
  258. // == Size ==
  259. // ============================================================
  260. &-lg {
  261. font-size: @font-size-lg;
  262. }
  263. // no border style
  264. &-borderless &-selector {
  265. background-color: transparent !important;
  266. border-color: transparent !important;
  267. box-shadow: none !important;
  268. }
  269. }
  270. @import './rtl';