|
1 | 1 | @import '../../style/themes/index'; |
2 | 2 | @import '../../style/mixins/index'; |
3 | 3 |
|
| 4 | +@input-affix-margin: 4px; |
4 | 5 | @input-affix-width: 19px; |
5 | 6 | @input-affix-with-clear-btn-width: 38px; |
6 | 7 |
|
7 | 8 | // size mixins for input |
8 | 9 | .input-lg() { |
9 | | - height: @input-height-lg; |
10 | 10 | padding: @input-padding-vertical-lg @input-padding-horizontal-lg; |
11 | 11 | font-size: @font-size-lg; |
12 | 12 | } |
13 | 13 |
|
14 | 14 | .input-sm() { |
15 | | - height: @input-height-sm; |
16 | 15 | padding: @input-padding-vertical-sm @input-padding-horizontal-sm; |
17 | 16 | } |
18 | 17 |
|
|
47 | 46 | position: relative; |
48 | 47 | display: inline-block; |
49 | 48 | width: 100%; |
50 | | - height: @input-height-base; |
51 | 49 | padding: @input-padding-vertical-base @input-padding-horizontal-base; |
52 | 50 | color: @input-color; |
53 | 51 | font-size: @font-size-base; |
|
264 | 262 | height: @input-height-sm; |
265 | 263 | } |
266 | 264 |
|
267 | | - .@{inputClass}-affix-wrapper { |
268 | | - display: table-cell; |
269 | | - float: left; |
270 | | - width: 100%; |
271 | | - } |
272 | | - |
273 | 265 | &&-compact { |
274 | 266 | display: block; |
275 | 267 | .clearfix; |
|
297 | 289 | border-radius: 0; |
298 | 290 | } |
299 | 291 |
|
| 292 | + & > .@{inputClass}-affix-wrapper { |
| 293 | + display: inline-flex; |
| 294 | + } |
| 295 | + |
300 | 296 | & > *:not(:last-child) { |
301 | 297 | margin-right: -@border-width-base; |
302 | 298 | border-right-width: @border-width-base; |
|
364 | 360 |
|
365 | 361 | .input-affix-wrapper(@inputClass) { |
366 | 362 | position: relative; |
367 | | - display: inline-block; |
| 363 | + display: inline-flex; |
| 364 | + border: @border-width-base @border-style-base @input-border-color; |
| 365 | + border-radius: @border-radius-base; |
| 366 | + padding: @input-padding-vertical-base @input-padding-horizontal-base; |
368 | 367 | width: 100%; |
369 | 368 | text-align: start; |
370 | 369 |
|
371 | | - &:hover .@{inputClass}:not(.@{inputClass}-disabled) { |
| 370 | + &:hover { |
372 | 371 | .hover(); |
373 | 372 | } |
374 | 373 |
|
| 374 | + &-disabled { |
| 375 | + .disabled(); |
| 376 | + } |
| 377 | + |
| 378 | + &-focused { |
| 379 | + .active(); |
| 380 | + } |
| 381 | + |
| 382 | + // Size |
| 383 | + &-lg { |
| 384 | + .input-lg(); |
| 385 | + } |
| 386 | + |
| 387 | + &-sm { |
| 388 | + .input-sm(); |
| 389 | + } |
| 390 | + |
375 | 391 | .@{inputClass} { |
376 | 392 | position: relative; |
377 | 393 | text-align: inherit; |
| 394 | + border: none; |
| 395 | + padding: 0; |
| 396 | + &:focus { |
| 397 | + border: none; |
| 398 | + outline: none; |
| 399 | + box-shadow: none; |
| 400 | + } |
378 | 401 | } |
379 | 402 |
|
380 | 403 | // Should not break align of icon & text |
|
385 | 408 | // https://codesandbox.io/embed/nifty-benz-gb7ml |
386 | 409 | .@{inputClass}-prefix, |
387 | 410 | .@{inputClass}-suffix { |
388 | | - position: absolute; |
389 | | - top: 50%; |
390 | | - z-index: 2; |
391 | 411 | display: flex; |
392 | 412 | align-items: center; |
393 | 413 | color: @input-color; |
394 | | - line-height: 0; |
395 | | - transform: translateY(-50%); |
| 414 | + white-space: nowrap; |
396 | 415 |
|
397 | 416 | :not(.anticon) { |
398 | 417 | line-height: @line-height-base; |
|
407 | 426 | } |
408 | 427 |
|
409 | 428 | .@{inputClass}-prefix { |
410 | | - left: @input-padding-horizontal-base + 1px; |
| 429 | + margin-right: @input-affix-margin; |
411 | 430 | } |
412 | 431 |
|
413 | 432 | .@{inputClass}-suffix { |
414 | | - right: @input-padding-horizontal-base + 1px; |
415 | | - } |
416 | | - |
417 | | - .@{inputClass}:not(:first-child) { |
418 | | - padding-left: @input-padding-horizontal-base + @input-affix-width; |
419 | | - } |
420 | | - |
421 | | - .@{inputClass}:not(:last-child) { |
422 | | - padding-right: @input-padding-horizontal-base + @input-affix-width; |
423 | | - } |
424 | | - |
425 | | - &.@{inputClass}-affix-wrapper-input-with-clear-btn .@{inputClass}:not(:last-child) { |
426 | | - padding-right: @input-padding-horizontal-base + @input-affix-with-clear-btn-width; |
427 | | - } |
428 | | - |
429 | | - &.@{inputClass}-affix-wrapper-textarea-with-clear-btn .@{inputClass} { |
430 | | - padding-right: 22px; |
| 433 | + margin-left: @input-affix-margin; |
431 | 434 | } |
432 | 435 | } |
433 | 436 |
|
|
438 | 441 | // https://codesandbox.io/s/wizardly-sun-u10br |
439 | 442 | cursor: pointer; |
440 | 443 | transition: color 0.3s; |
441 | | - |
| 444 | + margin: 0 @input-affix-margin; |
442 | 445 | &:hover { |
443 | 446 | color: @text-color-secondary; |
444 | 447 | } |
|
0 commit comments