index.less 8.7 KB

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