You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 lines
4.2 KiB

4 years ago
  1. //
  2. // Input groups
  3. // --------------------------------------------------
  4. // Base styles
  5. // -------------------------
  6. .input-group {
  7. position: relative; // For dropdowns
  8. display: table;
  9. border-collapse: separate; // prevent input groups from inheriting border styles from table cells when placed within a table
  10. // Undo padding and float of grid classes
  11. &[class*="col-"] {
  12. float: none;
  13. padding-left: 0;
  14. padding-right: 0;
  15. }
  16. .form-control {
  17. // Ensure that the input is always above the *appended* addon button for
  18. // proper border colors.
  19. position: relative;
  20. z-index: 2;
  21. // IE9 fubars the placeholder attribute in text inputs and the arrows on
  22. // select elements in input groups. To fix it, we float the input. Details:
  23. // https://github.com/twbs/bootstrap/issues/11561#issuecomment-28936855
  24. float: left;
  25. width: 100%;
  26. margin-bottom: 0;
  27. &:focus {
  28. z-index: 3;
  29. }
  30. }
  31. }
  32. // Sizing options
  33. //
  34. // Remix the default form control sizing classes into new ones for easier
  35. // manipulation.
  36. .input-group-lg > .form-control,
  37. .input-group-lg > .input-group-addon,
  38. .input-group-lg > .input-group-btn > .btn {
  39. .input-lg();
  40. }
  41. .input-group-sm > .form-control,
  42. .input-group-sm > .input-group-addon,
  43. .input-group-sm > .input-group-btn > .btn {
  44. .input-sm();
  45. }
  46. // Display as table-cell
  47. // -------------------------
  48. .input-group-addon,
  49. .input-group-btn,
  50. .input-group .form-control {
  51. display: table-cell;
  52. &:not(:first-child):not(:last-child) {
  53. border-radius: 0;
  54. }
  55. }
  56. // Addon and addon wrapper for buttons
  57. .input-group-addon,
  58. .input-group-btn {
  59. width: 1%;
  60. white-space: nowrap;
  61. vertical-align: middle; // Match the inputs
  62. }
  63. // Text input groups
  64. // -------------------------
  65. .input-group-addon {
  66. padding: @padding-base-vertical @padding-base-horizontal;
  67. font-size: @font-size-base;
  68. font-weight: normal;
  69. line-height: 1;
  70. color: @input-color;
  71. text-align: center;
  72. background-color: @input-group-addon-bg;
  73. border: 1px solid @input-group-addon-border-color;
  74. border-radius: @input-border-radius;
  75. // Sizing
  76. &.input-sm {
  77. padding: @padding-small-vertical @padding-small-horizontal;
  78. font-size: @font-size-small;
  79. border-radius: @input-border-radius-small;
  80. }
  81. &.input-lg {
  82. padding: @padding-large-vertical @padding-large-horizontal;
  83. font-size: @font-size-large;
  84. border-radius: @input-border-radius-large;
  85. }
  86. // Nuke default margins from checkboxes and radios to vertically center within.
  87. input[type="radio"],
  88. input[type="checkbox"] {
  89. margin-top: 0;
  90. }
  91. }
  92. // Reset rounded corners
  93. .input-group .form-control:first-child,
  94. .input-group-addon:first-child,
  95. .input-group-btn:first-child > .btn,
  96. .input-group-btn:first-child > .btn-group > .btn,
  97. .input-group-btn:first-child > .dropdown-toggle,
  98. .input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),
  99. .input-group-btn:last-child > .btn-group:not(:last-child) > .btn {
  100. .border-right-radius(0);
  101. }
  102. .input-group-addon:first-child {
  103. border-right: 0;
  104. }
  105. .input-group .form-control:last-child,
  106. .input-group-addon:last-child,
  107. .input-group-btn:last-child > .btn,
  108. .input-group-btn:last-child > .btn-group > .btn,
  109. .input-group-btn:last-child > .dropdown-toggle,
  110. .input-group-btn:first-child > .btn:not(:first-child),
  111. .input-group-btn:first-child > .btn-group:not(:first-child) > .btn {
  112. .border-left-radius(0);
  113. }
  114. .input-group-addon:last-child {
  115. border-left: 0;
  116. }
  117. // Button input groups
  118. // -------------------------
  119. .input-group-btn {
  120. position: relative;
  121. // Jankily prevent input button groups from wrapping with `white-space` and
  122. // `font-size` in combination with `inline-block` on buttons.
  123. font-size: 0;
  124. white-space: nowrap;
  125. // Negative margin for spacing, position for bringing hovered/focused/actived
  126. // element above the siblings.
  127. > .btn {
  128. position: relative;
  129. + .btn {
  130. margin-left: -1px;
  131. }
  132. // Bring the "active" button to the front
  133. &:hover,
  134. &:focus,
  135. &:active {
  136. z-index: 2;
  137. }
  138. }
  139. // Negative margin to only have a 1px border between the two
  140. &:first-child {
  141. > .btn,
  142. > .btn-group {
  143. margin-right: -1px;
  144. }
  145. }
  146. &:last-child {
  147. > .btn,
  148. > .btn-group {
  149. z-index: 2;
  150. margin-left: -1px;
  151. }
  152. }
  153. }