input.scss 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. @import "mixins/mixins";
  2. @import "common/var";
  3. @include b(textarea) {
  4. position: relative;
  5. display: inline-block;
  6. width: 100%;
  7. vertical-align: bottom;
  8. font-size: $--font-size-base;
  9. @include e(inner) {
  10. display: block;
  11. resize: vertical;
  12. padding: 5px 15px;
  13. line-height: 1.5;
  14. box-sizing: border-box;
  15. width: 100%;
  16. font-size: inherit;
  17. color: $--input-font-color;
  18. background-color: $--input-background-color;
  19. background-image: none;
  20. border: $--input-border;
  21. border-radius: $--input-border-radius;
  22. transition: $--border-transition-base;
  23. &::placeholder {
  24. color: $--input-placeholder-color;
  25. }
  26. &:hover {
  27. border-color: $--input-hover-border;
  28. }
  29. &:focus {
  30. outline: none;
  31. border-color: $--input-focus-border;
  32. }
  33. }
  34. & .el-input__count {
  35. color: $--color-info;
  36. background: $--color-white;
  37. position: absolute;
  38. font-size: 12px;
  39. bottom: 5px;
  40. right: 10px;
  41. }
  42. @include when(disabled) {
  43. .el-textarea__inner {
  44. background-color: $--input-disabled-fill;
  45. border-color: $--input-disabled-border;
  46. color: $--input-disabled-color;
  47. cursor: not-allowed;
  48. &::placeholder {
  49. color: $--input-disabled-placeholder-color;
  50. }
  51. }
  52. }
  53. @include when(exceed) {
  54. .el-textarea__inner {
  55. border-color: $--color-danger;
  56. }
  57. .el-input__count {
  58. color: $--color-danger;
  59. }
  60. }
  61. }
  62. @include b(input) {
  63. position: relative;
  64. font-size: $--font-size-base;
  65. display: inline-block;
  66. width: 100%;
  67. @include scroll-bar;
  68. & .el-input__clear {
  69. color: $--input-icon-color;
  70. font-size: $--input-font-size;
  71. cursor: pointer;
  72. transition: $--color-transition-base;
  73. &:hover {
  74. color: $--input-clear-hover-color;
  75. }
  76. }
  77. & .el-input__count {
  78. height: 100%;
  79. display: inline-flex;
  80. align-items: center;
  81. color: $--color-info;
  82. font-size: 12px;
  83. .el-input__count-inner {
  84. background: $--color-white;
  85. line-height: initial;
  86. display: inline-block;
  87. padding: 0 5px;
  88. }
  89. }
  90. @include e(inner) {
  91. -webkit-appearance: none;
  92. background-color: $--input-background-color;
  93. background-image: none;
  94. border-radius: $--input-border-radius;
  95. border: $--input-border;
  96. box-sizing: border-box;
  97. color: $--input-font-color;
  98. display: inline-block;
  99. font-size: inherit;
  100. height: $--input-height;
  101. line-height: $--input-height;
  102. outline: none;
  103. padding: 0 15px;
  104. transition: $--border-transition-base;
  105. width: 100%;
  106. &::placeholder {
  107. color: $--input-placeholder-color;
  108. }
  109. &:hover {
  110. border-color: $--input-hover-border;
  111. }
  112. &:focus {
  113. outline: none;
  114. border-color: $--input-focus-border;
  115. }
  116. }
  117. @include e(suffix) {
  118. position: absolute;
  119. height: 100%;
  120. right: 5px;
  121. top: 0;
  122. text-align: center;
  123. color: $--input-icon-color;
  124. transition: all .3s;
  125. pointer-events: none;
  126. }
  127. @include e(suffix-inner) {
  128. pointer-events: all;
  129. }
  130. @include e(prefix) {
  131. position: absolute;
  132. height: 100%;
  133. left: 5px;
  134. top: 0;
  135. text-align: center;
  136. color: $--input-icon-color;
  137. transition: all .3s;
  138. }
  139. @include e(icon) {
  140. height: 100%;
  141. width: 25px;
  142. text-align: center;
  143. transition: all .3s;
  144. line-height: $--input-height;
  145. &:after {
  146. content: '';
  147. height: 100%;
  148. width: 0;
  149. display: inline-block;
  150. vertical-align: middle;
  151. }
  152. }
  153. @include e(validateIcon) {
  154. pointer-events: none;
  155. }
  156. @include when(active) {
  157. .el-input__inner {
  158. outline: none;
  159. border-color: $--input-focus-border;
  160. }
  161. }
  162. @include when(disabled) {
  163. .el-input__inner {
  164. background-color: $--input-disabled-fill;
  165. border-color: $--input-disabled-border;
  166. color: $--input-disabled-color;
  167. cursor: not-allowed;
  168. &::placeholder {
  169. color: $--input-disabled-placeholder-color;
  170. }
  171. }
  172. .el-input__icon {
  173. cursor: not-allowed;
  174. }
  175. }
  176. @include when(exceed) {
  177. .el-input__inner {
  178. border-color: $--color-danger;
  179. }
  180. .el-input__suffix {
  181. .el-input__count {
  182. color: $--color-danger;
  183. }
  184. }
  185. }
  186. @include m(suffix) {
  187. .el-input__inner {
  188. padding-right: 30px;
  189. }
  190. }
  191. @include m(prefix) {
  192. .el-input__inner {
  193. padding-left: 30px;
  194. }
  195. }
  196. @include m(medium) {
  197. font-size: $--input-medium-font-size;
  198. @include e(inner) {
  199. height: $--input-medium-height;
  200. line-height: $--input-medium-height;
  201. }
  202. .el-input__icon {
  203. line-height: $--input-medium-height;
  204. }
  205. }
  206. @include m(small) {
  207. font-size: $--input-small-font-size;
  208. @include e(inner) {
  209. height: $--input-small-height;
  210. line-height: $--input-small-height;
  211. }
  212. .el-input__icon {
  213. line-height: $--input-small-height;
  214. }
  215. }
  216. @include m(mini) {
  217. font-size: $--input-mini-font-size;
  218. @include e(inner) {
  219. height: $--input-mini-height;
  220. line-height: $--input-mini-height;
  221. }
  222. .el-input__icon {
  223. line-height: $--input-mini-height;
  224. }
  225. }
  226. }
  227. @include b(input-group) {
  228. line-height: normal;
  229. display: inline-table;
  230. width: 100%;
  231. border-collapse: separate;
  232. border-spacing:0;
  233. > .el-input__inner {
  234. vertical-align: middle;
  235. display: table-cell;
  236. }
  237. @include e((append, prepend)) {
  238. background-color: $--background-color-base;
  239. color: $--color-info;
  240. vertical-align: middle;
  241. display: table-cell;
  242. position: relative;
  243. border: $--border-base;
  244. border-radius: $--input-border-radius;
  245. padding: 0 20px;
  246. width: 1px;
  247. white-space: nowrap;
  248. &:focus {
  249. outline: none;
  250. }
  251. .el-select,
  252. .el-button {
  253. display: inline-block;
  254. margin: -10px -20px;
  255. }
  256. button.el-button,
  257. div.el-select .el-input__inner,
  258. div.el-select:hover .el-input__inner {
  259. border-color: transparent;
  260. background-color: transparent;
  261. color: inherit;
  262. border-top: 0;
  263. border-bottom: 0;
  264. }
  265. .el-button,
  266. .el-input {
  267. font-size: inherit;
  268. }
  269. }
  270. @include e(prepend) {
  271. border-right: 0;
  272. border-top-right-radius: 0;
  273. border-bottom-right-radius: 0;
  274. }
  275. @include e(append) {
  276. border-left: 0;
  277. border-top-left-radius: 0;
  278. border-bottom-left-radius: 0;
  279. }
  280. @include m(prepend) {
  281. .el-input__inner {
  282. border-top-left-radius: 0;
  283. border-bottom-left-radius: 0;
  284. }
  285. .el-select .el-input.is-focus .el-input__inner {
  286. border-color: transparent;
  287. }
  288. }
  289. @include m(append) {
  290. .el-input__inner {
  291. border-top-right-radius: 0;
  292. border-bottom-right-radius: 0;
  293. }
  294. .el-select .el-input.is-focus .el-input__inner {
  295. border-color: transparent;
  296. }
  297. }
  298. }
  299. /** disalbe default clear on IE */
  300. .el-input__inner::-ms-clear {
  301. display: none;
  302. width: 0;
  303. height: 0;
  304. }