index.less 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. @import '../../input/style/mixin';
  4. @import './affix';
  5. @import './status';
  6. @input-number-prefix-cls: ~'@{ant-prefix}-input-number';
  7. @form-item-prefix-cls: ~'@{ant-prefix}-form-item';
  8. .@{input-number-prefix-cls} {
  9. .reset-component();
  10. .input();
  11. //== Style for input-group: input with label, with button or dropdown...
  12. &-group {
  13. .reset-component();
  14. .input-group(~'@{input-number-prefix-cls}');
  15. &-wrapper {
  16. display: inline-block;
  17. text-align: start;
  18. vertical-align: top; // https://github.com/ant-design/ant-design/issues/6403
  19. }
  20. }
  21. display: inline-block;
  22. width: 90px;
  23. margin: 0;
  24. padding: 0;
  25. border: @border-width-base @border-style-base @input-border-color;
  26. border-radius: @control-border-radius;
  27. &-handler {
  28. position: relative;
  29. display: block;
  30. width: 100%;
  31. height: 50%;
  32. overflow: hidden;
  33. color: @text-color-secondary;
  34. font-weight: bold;
  35. line-height: 0;
  36. text-align: center;
  37. border-left: @border-width-base @border-style-base @input-number-handler-border-color;
  38. transition: all 0.1s linear;
  39. &:active {
  40. background: @input-number-handler-active-bg;
  41. }
  42. &:hover &-up-inner,
  43. &:hover &-down-inner {
  44. color: @input-number-handler-hover-bg;
  45. }
  46. }
  47. &-handler-up-inner,
  48. &-handler-down-inner {
  49. .iconfont-mixin();
  50. position: absolute;
  51. right: 4px;
  52. width: 12px;
  53. height: 12px;
  54. color: @text-color-secondary;
  55. line-height: 12px;
  56. transition: all 0.1s linear;
  57. user-select: none;
  58. }
  59. &:hover {
  60. .hover(@input-number-hover-border-color);
  61. & + .@{form-item-prefix-cls}-children-icon {
  62. opacity: 0;
  63. transition: opacity 0.24s linear 0.24s;
  64. }
  65. }
  66. &-focused {
  67. .active();
  68. }
  69. &-disabled {
  70. .disabled();
  71. .@{input-number-prefix-cls}-input {
  72. cursor: not-allowed;
  73. }
  74. .@{input-number-prefix-cls}-handler-wrap {
  75. display: none;
  76. }
  77. }
  78. &-readonly {
  79. .@{input-number-prefix-cls}-handler-wrap {
  80. display: none;
  81. }
  82. }
  83. &-input {
  84. width: 100%;
  85. height: @input-height-base - 2px;
  86. padding: 0 @control-padding-horizontal - 1px;
  87. text-align: left;
  88. background-color: transparent;
  89. border: 0;
  90. border-radius: @control-border-radius;
  91. outline: 0;
  92. transition: all 0.3s linear;
  93. appearance: textfield !important;
  94. .placeholder();
  95. &[type='number']::-webkit-inner-spin-button,
  96. &[type='number']::-webkit-outer-spin-button {
  97. margin: 0;
  98. /* stylelint-disable-next-line property-no-vendor-prefix */
  99. -webkit-appearance: none;
  100. appearance: none;
  101. }
  102. }
  103. &-lg {
  104. padding: 0;
  105. font-size: @font-size-lg;
  106. input {
  107. height: @input-height-lg - 2px;
  108. }
  109. }
  110. &-sm {
  111. padding: 0;
  112. input {
  113. height: @input-height-sm - 2px;
  114. padding: 0 @control-padding-horizontal-sm - 1px;
  115. }
  116. }
  117. &-handler-wrap {
  118. position: absolute;
  119. top: 0;
  120. right: 0;
  121. width: 22px;
  122. height: 100%;
  123. background: @input-number-handler-bg;
  124. border-radius: 0 @control-border-radius @control-border-radius 0;
  125. opacity: 0;
  126. transition: opacity 0.24s linear 0.1s;
  127. // Fix input number inside Menu makes icon too large
  128. // We arise the selector priority by nest selector here
  129. // https://github.com/ant-design/ant-design/issues/14367
  130. .@{input-number-prefix-cls}-handler {
  131. .@{input-number-prefix-cls}-handler-up-inner,
  132. .@{input-number-prefix-cls}-handler-down-inner {
  133. display: flex;
  134. align-items: center;
  135. justify-content: center;
  136. min-width: auto;
  137. margin-right: 0;
  138. font-size: 7px;
  139. }
  140. }
  141. .@{input-number-prefix-cls}-borderless & {
  142. border-left-width: 0;
  143. }
  144. }
  145. &-handler-wrap:hover &-handler {
  146. height: 40%;
  147. }
  148. &:hover &-handler-wrap,
  149. &-focused &-handler-wrap {
  150. opacity: 1;
  151. }
  152. &-handler-up {
  153. border-top-right-radius: @control-border-radius;
  154. cursor: pointer;
  155. &-inner {
  156. top: 50%;
  157. margin-top: -5px;
  158. text-align: center;
  159. }
  160. &:hover {
  161. height: 60% !important;
  162. }
  163. }
  164. &-handler-down {
  165. top: 0;
  166. border-top: @border-width-base @border-style-base @input-number-handler-border-color;
  167. border-bottom-right-radius: @control-border-radius;
  168. cursor: pointer;
  169. &-inner {
  170. top: 50%;
  171. text-align: center;
  172. transform: translateY(-50%);
  173. }
  174. &:hover {
  175. height: 60% !important;
  176. }
  177. .@{input-number-prefix-cls}-borderless & {
  178. border-top-width: 0;
  179. }
  180. }
  181. &:hover:not(.@{input-number-prefix-cls}-borderless) &-handler-down,
  182. &-focused:not(.@{input-number-prefix-cls}-borderless) &-handler-down {
  183. border-top: @border-width-base @border-style-base @input-number-handler-border-color;
  184. }
  185. &-handler-up-disabled,
  186. &-handler-down-disabled {
  187. cursor: not-allowed;
  188. }
  189. &-handler-up-disabled:hover &-handler-up-inner,
  190. &-handler-down-disabled:hover &-handler-down-inner {
  191. color: @disabled-color;
  192. }
  193. &-borderless {
  194. box-shadow: none;
  195. }
  196. // ===================== Out Of Range =====================
  197. &-out-of-range {
  198. input {
  199. color: @error-color;
  200. }
  201. }
  202. // ===================== Compact Item Styles =====================
  203. .compact-item(@input-number-prefix-cls, null, ~'@{input-number-prefix-cls}-focused');
  204. .compact-item(~'@{input-number-prefix-cls}-affix-wrapper', null, ~'@{input-number-prefix-cls}-focused');
  205. .compact-item(~'@{input-number-prefix-cls}-group-wrapper', ~'@{input-number-prefix-cls}-group-addon', ~'@{input-number-prefix-cls}-focused');
  206. }
  207. @import './rtl';