status.less 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. @import (reference) '../../style/themes/index';
  2. @form-prefix-cls: ~'@{ant-prefix}-form';
  3. @form-item-prefix-cls: ~'@{form-prefix-cls}-item';
  4. .@{form-item-prefix-cls} {
  5. // ================================================================
  6. // = Status =
  7. // ================================================================
  8. /* Some non-status related component style is in `components.less` */
  9. // ========================= Explain =========================
  10. /* To support leave along ErrorList. We add additional className to handle explain style */
  11. &-explain {
  12. &-error {
  13. color: @error-color;
  14. }
  15. &-warning {
  16. color: @warning-color;
  17. }
  18. }
  19. &-has-feedback {
  20. // ========================= Input =========================
  21. .@{ant-prefix}-input {
  22. padding-right: 24px;
  23. }
  24. // https://github.com/ant-design/ant-design/issues/19884
  25. .@{ant-prefix}-input-affix-wrapper {
  26. .@{ant-prefix}-input-suffix {
  27. padding-right: 18px;
  28. }
  29. }
  30. // Fix issue: https://github.com/ant-design/ant-design/issues/7854
  31. .@{ant-prefix}-input-search:not(.@{ant-prefix}-input-search-enter-button) {
  32. .@{ant-prefix}-input-suffix {
  33. right: 28px;
  34. }
  35. }
  36. // ======================== Switch =========================
  37. .@{ant-prefix}-switch {
  38. margin: 2px 0 4px;
  39. }
  40. // ======================== Select =========================
  41. // Fix overlapping between feedback icon and <Select>'s arrow.
  42. // https://github.com/ant-design/ant-design/issues/4431
  43. > .@{ant-prefix}-select .@{ant-prefix}-select-arrow,
  44. > .@{ant-prefix}-select .@{ant-prefix}-select-clear,
  45. :not(.@{ant-prefix}-input-group-addon) > .@{ant-prefix}-select .@{ant-prefix}-select-arrow,
  46. :not(.@{ant-prefix}-input-group-addon) > .@{ant-prefix}-select .@{ant-prefix}-select-clear,
  47. :not(.@{ant-prefix}-input-number-group-addon)
  48. > .@{ant-prefix}-select
  49. .@{ant-prefix}-select-arrow,
  50. :not(.@{ant-prefix}-input-number-group-addon)
  51. > .@{ant-prefix}-select
  52. .@{ant-prefix}-select-clear {
  53. right: 32px;
  54. }
  55. > .@{ant-prefix}-select .@{ant-prefix}-select-selection-selected-value,
  56. :not(.@{ant-prefix}-input-group-addon)
  57. > .@{ant-prefix}-select
  58. .@{ant-prefix}-select-selection-selected-value,
  59. :not(.@{ant-prefix}-input-number-group-addon)
  60. > .@{ant-prefix}-select
  61. .@{ant-prefix}-select-selection-selected-value {
  62. padding-right: 42px;
  63. }
  64. // ======================= Cascader ========================
  65. .@{ant-prefix}-cascader-picker {
  66. &-arrow {
  67. margin-right: 19px;
  68. }
  69. &-clear {
  70. right: 32px;
  71. }
  72. }
  73. // ======================== Picker =========================
  74. // Fix issue: https://github.com/ant-design/ant-design/issues/4783
  75. .@{ant-prefix}-picker {
  76. padding-right: @input-padding-horizontal-base + @font-size-base * 1.3;
  77. &-large {
  78. padding-right: @input-padding-horizontal-lg + @font-size-base * 1.3;
  79. }
  80. &-small {
  81. padding-right: @input-padding-horizontal-sm + @font-size-base * 1.3;
  82. }
  83. }
  84. // ===================== Status Group ======================
  85. &.@{form-item-prefix-cls} {
  86. &-has-success,
  87. &-has-warning,
  88. &-has-error,
  89. &-is-validating {
  90. // ====================== Icon ======================
  91. .@{form-item-prefix-cls}-children-icon {
  92. position: absolute;
  93. top: 50%;
  94. right: 0;
  95. z-index: 1;
  96. width: @input-height-base;
  97. height: 20px;
  98. margin-top: -10px;
  99. font-size: @font-size-base;
  100. line-height: 20px;
  101. text-align: center;
  102. visibility: visible;
  103. animation: zoomIn 0.3s @ease-out-back;
  104. pointer-events: none;
  105. }
  106. }
  107. }
  108. }
  109. // ======================== Success ========================
  110. &-has-success {
  111. &.@{form-item-prefix-cls}-has-feedback .@{form-item-prefix-cls}-children-icon {
  112. color: @success-color;
  113. animation-name: diffZoomIn1 !important;
  114. }
  115. }
  116. // ======================== Warning ========================
  117. &-has-warning {
  118. .form-control-validation(@warning-color; @warning-color; @form-warning-input-bg; @warning-color-hover; @warning-color-outline);
  119. &.@{form-item-prefix-cls}-has-feedback .@{form-item-prefix-cls}-children-icon {
  120. color: @warning-color;
  121. animation-name: diffZoomIn3 !important;
  122. }
  123. // Select
  124. .@{ant-prefix}-select:not(.@{ant-prefix}-select-disabled):not(.@{ant-prefix}-select-customize-input) {
  125. .@{ant-prefix}-select-selector {
  126. background-color: @form-warning-input-bg;
  127. border-color: @warning-color !important;
  128. }
  129. &.@{ant-prefix}-select-open .@{ant-prefix}-select-selector,
  130. &.@{ant-prefix}-select-focused .@{ant-prefix}-select-selector {
  131. .active(@warning-color, @warning-color-hover, @warning-color-outline);
  132. }
  133. }
  134. // InputNumber, TimePicker
  135. .@{ant-prefix}-input-number,
  136. .@{ant-prefix}-picker {
  137. background-color: @form-warning-input-bg;
  138. border-color: @warning-color;
  139. &-focused,
  140. &:focus {
  141. .active(@warning-color, @warning-color-hover, @warning-color-outline);
  142. }
  143. &:not([disabled]):hover {
  144. background-color: @form-warning-input-bg;
  145. border-color: @warning-color;
  146. }
  147. }
  148. .@{ant-prefix}-cascader-picker:focus .@{ant-prefix}-cascader-input {
  149. .active(@warning-color, @warning-color-hover, @warning-color-outline);
  150. }
  151. }
  152. // ========================= Error =========================
  153. &-has-error {
  154. .form-control-validation(@error-color; @error-color; @form-error-input-bg; @error-color-hover; @error-color-outline);
  155. &.@{form-item-prefix-cls}-has-feedback .@{form-item-prefix-cls}-children-icon {
  156. color: @error-color;
  157. animation-name: diffZoomIn2 !important;
  158. }
  159. // Select
  160. .@{ant-prefix}-select:not(.@{ant-prefix}-select-disabled):not(.@{ant-prefix}-select-customize-input) {
  161. .@{ant-prefix}-select-selector {
  162. background-color: @form-error-input-bg;
  163. border-color: @error-color !important;
  164. }
  165. &.@{ant-prefix}-select-open .@{ant-prefix}-select-selector,
  166. &.@{ant-prefix}-select-focused .@{ant-prefix}-select-selector {
  167. .active(@error-color, @error-color-hover, @error-color-outline);
  168. }
  169. }
  170. // fixes https://github.com/ant-design/ant-design/issues/20482
  171. .@{ant-prefix}-input-group-addon,
  172. .@{ant-prefix}-input-number-group-addon {
  173. .@{ant-prefix}-select {
  174. &.@{ant-prefix}-select-single:not(.@{ant-prefix}-select-customize-input)
  175. .@{ant-prefix}-select-selector {
  176. background-color: inherit;
  177. border: 0;
  178. box-shadow: none;
  179. }
  180. }
  181. }
  182. .@{ant-prefix}-select.@{ant-prefix}-select-auto-complete {
  183. .@{ant-prefix}-input:focus {
  184. border-color: @error-color;
  185. }
  186. }
  187. // InputNumber, TimePicker
  188. .@{ant-prefix}-input-number,
  189. .@{ant-prefix}-picker {
  190. background-color: @form-error-input-bg;
  191. border-color: @error-color;
  192. &-focused,
  193. &:focus {
  194. .active(@error-color, @error-color-hover, @error-color-outline);
  195. }
  196. &:not([disabled]):hover {
  197. background-color: @form-error-input-bg;
  198. border-color: @error-color;
  199. }
  200. }
  201. .@{ant-prefix}-mention-wrapper {
  202. .@{ant-prefix}-mention-editor {
  203. &,
  204. &:not([disabled]):hover {
  205. background-color: @form-error-input-bg;
  206. border-color: @error-color;
  207. }
  208. }
  209. &.@{ant-prefix}-mention-active:not([disabled]) .@{ant-prefix}-mention-editor,
  210. .@{ant-prefix}-mention-editor:not([disabled]):focus {
  211. .active(@error-color, @error-color-hover, @error-color-outline);
  212. }
  213. }
  214. // Cascader
  215. .@{ant-prefix}-cascader-picker {
  216. &:hover
  217. .@{ant-prefix}-cascader-picker-label:hover
  218. + .@{ant-prefix}-cascader-input.@{ant-prefix}-input {
  219. border-color: @error-color;
  220. }
  221. &:focus .@{ant-prefix}-cascader-input {
  222. background-color: @form-error-input-bg;
  223. .active(@error-color, @error-color-hover, @error-color-outline);
  224. }
  225. }
  226. // Transfer
  227. .@{ant-prefix}-transfer {
  228. &-list {
  229. border-color: @error-color;
  230. &-search:not([disabled]) {
  231. border-color: @input-border-color;
  232. &:hover {
  233. .hover();
  234. }
  235. &:focus {
  236. .active();
  237. }
  238. }
  239. }
  240. }
  241. // Radio.Group
  242. .@{ant-prefix}-radio-button-wrapper {
  243. border-color: @error-color !important;
  244. &:not(:first-child) {
  245. &::before {
  246. background-color: @error-color;
  247. }
  248. }
  249. }
  250. // Mentions
  251. .@{ant-prefix}-mentions {
  252. border-color: @error-color !important;
  253. &-focused,
  254. &:focus {
  255. .active(@error-color, @error-color-hover, @error-color-outline);
  256. }
  257. }
  258. }
  259. // ====================== Validating =======================
  260. &-is-validating {
  261. &.@{form-item-prefix-cls}-has-feedback .@{form-item-prefix-cls}-children-icon {
  262. display: inline-block;
  263. color: @primary-color;
  264. }
  265. }
  266. }