index-pure.less 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. @import '../../input/style/mixin';
  4. @picker-prefix-cls: ~'@{ant-prefix}-picker';
  5. .picker-padding(@input-height, @font-size, @padding-horizontal) {
  6. // font height probably 22.0001, So use floor better
  7. @font-height: floor(@font-size * @line-height-base) + 2;
  8. @padding-top: max(((@input-height - @font-height) / 2), 0);
  9. @padding-bottom: max(@input-height - @font-height - @padding-top, 0);
  10. padding: @padding-top @padding-horizontal @padding-bottom;
  11. }
  12. .@{picker-prefix-cls} {
  13. @arrow-size: 10px;
  14. .reset-component();
  15. .picker-padding(@input-height-base, @font-size-base, @input-padding-horizontal-base);
  16. position: relative;
  17. display: inline-flex;
  18. align-items: center;
  19. background: @picker-bg;
  20. border: @border-width-base @border-style-base @select-border-color;
  21. border-radius: @border-radius-base;
  22. transition: border @animation-duration-slow, box-shadow @animation-duration-slow;
  23. &:hover,
  24. &-focused {
  25. .hover();
  26. }
  27. &-focused {
  28. .active();
  29. }
  30. &&-disabled {
  31. background: @input-disabled-bg;
  32. border-color: @select-border-color;
  33. cursor: not-allowed;
  34. }
  35. &&-disabled &-suffix {
  36. color: @disabled-color;
  37. }
  38. &&-borderless {
  39. background-color: transparent !important;
  40. border-color: transparent !important;
  41. box-shadow: none !important;
  42. }
  43. // ======================== Input =========================
  44. &-input {
  45. position: relative;
  46. display: inline-flex;
  47. align-items: center;
  48. width: 100%;
  49. > input {
  50. .input();
  51. flex: auto;
  52. // Fix Firefox flex not correct:
  53. // https://github.com/ant-design/ant-design/pull/20023#issuecomment-564389553
  54. min-width: 1px;
  55. height: auto;
  56. padding: 0;
  57. background: transparent;
  58. border: 0;
  59. &:focus {
  60. box-shadow: none;
  61. }
  62. &[disabled] {
  63. background: transparent;
  64. }
  65. }
  66. &:hover {
  67. .@{picker-prefix-cls}-clear {
  68. opacity: 1;
  69. }
  70. }
  71. &-placeholder {
  72. > input {
  73. color: @input-placeholder-color;
  74. }
  75. }
  76. }
  77. // Size
  78. &-large {
  79. .picker-padding(@input-height-lg, @font-size-lg, @input-padding-horizontal-lg);
  80. .@{picker-prefix-cls}-input > input {
  81. font-size: @font-size-lg;
  82. }
  83. }
  84. &-small {
  85. .picker-padding(@input-height-sm, @font-size-base, @input-padding-horizontal-sm);
  86. }
  87. &-suffix {
  88. align-self: center;
  89. margin-left: (@padding-xs / 2);
  90. color: @disabled-color;
  91. line-height: 1;
  92. pointer-events: none;
  93. > * {
  94. vertical-align: top;
  95. }
  96. }
  97. &-clear {
  98. position: absolute;
  99. top: 50%;
  100. right: 0;
  101. color: @disabled-color;
  102. line-height: 1;
  103. background: @component-background;
  104. transform: translateY(-50%);
  105. cursor: pointer;
  106. opacity: 0;
  107. transition: opacity @animation-duration-slow, color @animation-duration-slow;
  108. > * {
  109. vertical-align: top;
  110. }
  111. &:hover {
  112. color: @text-color-secondary;
  113. }
  114. }
  115. &-separator {
  116. position: relative;
  117. display: inline-block;
  118. width: 1em;
  119. height: @font-size-lg;
  120. color: @disabled-color;
  121. font-size: @font-size-lg;
  122. vertical-align: top;
  123. cursor: default;
  124. .@{picker-prefix-cls}-focused & {
  125. color: @text-color-secondary;
  126. }
  127. .@{picker-prefix-cls}-range-separator & {
  128. .@{picker-prefix-cls}-disabled & {
  129. cursor: not-allowed;
  130. }
  131. }
  132. }
  133. // ======================== Range =========================
  134. &-range {
  135. position: relative;
  136. display: inline-flex;
  137. // Clear
  138. .@{picker-prefix-cls}-clear {
  139. right: @input-padding-horizontal-base;
  140. }
  141. &:hover {
  142. .@{picker-prefix-cls}-clear {
  143. opacity: 1;
  144. }
  145. }
  146. // Active bar
  147. .@{picker-prefix-cls}-active-bar {
  148. bottom: -@border-width-base;
  149. height: 2px;
  150. margin-left: @input-padding-horizontal-base;
  151. background: @primary-color;
  152. opacity: 0;
  153. transition: all @animation-duration-slow ease-out;
  154. pointer-events: none;
  155. }
  156. &.@{picker-prefix-cls}-focused {
  157. .@{picker-prefix-cls}-active-bar {
  158. opacity: 1;
  159. }
  160. }
  161. &-separator {
  162. align-items: center;
  163. padding: 0 @padding-xs;
  164. line-height: 1;
  165. }
  166. &.@{picker-prefix-cls}-small {
  167. .@{picker-prefix-cls}-clear {
  168. right: @input-padding-horizontal-sm;
  169. }
  170. .@{picker-prefix-cls}-active-bar {
  171. margin-left: @input-padding-horizontal-sm;
  172. }
  173. }
  174. }
  175. // ======================= Dropdown =======================
  176. &-dropdown {
  177. .reset-component();
  178. position: absolute;
  179. z-index: @zindex-picker;
  180. &-hidden {
  181. display: none;
  182. }
  183. &-placement-bottomLeft {
  184. .@{picker-prefix-cls}-range-arrow {
  185. top: (@arrow-size / 2) - (@arrow-size / 3);
  186. display: block;
  187. transform: rotate(-45deg);
  188. }
  189. }
  190. &-placement-topLeft {
  191. .@{picker-prefix-cls}-range-arrow {
  192. bottom: (@arrow-size / 2) - (@arrow-size / 3);
  193. display: block;
  194. transform: rotate(135deg);
  195. }
  196. }
  197. &.@{ant-prefix}-slide-up-enter.@{ant-prefix}-slide-up-enter-active&-placement-topLeft,
  198. &.@{ant-prefix}-slide-up-enter.@{ant-prefix}-slide-up-enter-active&-placement-topRight,
  199. &.@{ant-prefix}-slide-up-appear.@{ant-prefix}-slide-up-appear-active&-placement-topLeft,
  200. &.@{ant-prefix}-slide-up-appear.@{ant-prefix}-slide-up-appear-active&-placement-topRight {
  201. animation-name: antSlideDownIn;
  202. }
  203. &.@{ant-prefix}-slide-up-enter.@{ant-prefix}-slide-up-enter-active&-placement-bottomLeft,
  204. &.@{ant-prefix}-slide-up-enter.@{ant-prefix}-slide-up-enter-active&-placement-bottomRight,
  205. &.@{ant-prefix}-slide-up-appear.@{ant-prefix}-slide-up-appear-active&-placement-bottomLeft,
  206. &.@{ant-prefix}-slide-up-appear.@{ant-prefix}-slide-up-appear-active&-placement-bottomRight {
  207. animation-name: antSlideUpIn;
  208. }
  209. &.@{ant-prefix}-slide-up-leave.@{ant-prefix}-slide-up-leave-active&-placement-topLeft,
  210. &.@{ant-prefix}-slide-up-leave.@{ant-prefix}-slide-up-leave-active&-placement-topRight {
  211. animation-name: antSlideDownOut;
  212. }
  213. &.@{ant-prefix}-slide-up-leave.@{ant-prefix}-slide-up-leave-active&-placement-bottomLeft,
  214. &.@{ant-prefix}-slide-up-leave.@{ant-prefix}-slide-up-leave-active&-placement-bottomRight {
  215. animation-name: antSlideUpOut;
  216. }
  217. }
  218. &-dropdown-range {
  219. padding: (@arrow-size * 2 / 3) 0;
  220. &-hidden {
  221. display: none;
  222. }
  223. }
  224. // Time picker with additional style
  225. &-dropdown &-panel > &-time-panel {
  226. padding-top: (@padding-xs / 2);
  227. }
  228. // ======================== Ranges ========================
  229. &-ranges {
  230. margin-bottom: 0;
  231. padding: (@padding-xs / 2) @padding-sm;
  232. overflow: hidden;
  233. line-height: @picker-text-height - 2 * @border-width-base - (@padding-xs / 2);
  234. text-align: left;
  235. list-style: none;
  236. > li {
  237. display: inline-block;
  238. }
  239. // https://github.com/ant-design/ant-design/issues/23687
  240. .@{picker-prefix-cls}-preset > .@{ant-prefix}-tag-blue {
  241. color: @primary-color;
  242. background: @primary-1;
  243. border-color: @primary-3;
  244. cursor: pointer;
  245. }
  246. .@{picker-prefix-cls}-ok {
  247. float: right;
  248. margin-left: @padding-xs;
  249. }
  250. }
  251. &-range-wrapper {
  252. display: flex;
  253. }
  254. &-range-arrow {
  255. position: absolute;
  256. z-index: 1;
  257. display: none;
  258. width: @arrow-size;
  259. height: @arrow-size;
  260. margin-left: @input-padding-horizontal-base * 1.5;
  261. box-shadow: 2px -2px 6px fade(@black, 6%);
  262. transition: left @animation-duration-slow ease-out;
  263. &::after {
  264. position: absolute;
  265. top: @border-width-base;
  266. right: @border-width-base;
  267. width: @arrow-size;
  268. height: @arrow-size;
  269. border: (@arrow-size / 2) solid @border-color-split;
  270. border-color: @calendar-bg @calendar-bg transparent transparent;
  271. content: '';
  272. }
  273. }
  274. &-panel-container {
  275. overflow: hidden;
  276. vertical-align: top;
  277. background: @calendar-bg;
  278. border-radius: @border-radius-base;
  279. box-shadow: @box-shadow-base;
  280. transition: margin @animation-duration-slow;
  281. .@{picker-prefix-cls}-panels {
  282. display: inline-flex;
  283. flex-wrap: nowrap;
  284. direction: ltr;
  285. }
  286. .@{picker-prefix-cls}-panel {
  287. vertical-align: top;
  288. background: transparent;
  289. border-width: 0 0 @border-width-base 0;
  290. border-radius: 0;
  291. .@{picker-prefix-cls}-content,
  292. table {
  293. text-align: center;
  294. }
  295. &-focused {
  296. border-color: @border-color-split;
  297. }
  298. }
  299. }
  300. }
  301. @import './panel';
  302. @import './rtl';