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.

121 lines
3.3 KiB

  1. //
  2. // Base styles
  3. //
  4. .input-group {
  5. position: relative;
  6. display: flex;
  7. flex-wrap: wrap; // For form validation feedback
  8. align-items: stretch;
  9. width: 100%;
  10. > .form-control,
  11. > .form-select {
  12. position: relative; // For focus state's z-index
  13. flex: 1 1 auto;
  14. width: 1%;
  15. min-width: 0; // https://stackoverflow.com/questions/36247140/why-dont-flex-items-shrink-past-content-size
  16. }
  17. // Bring the "active" form control to the top of surrounding elements
  18. > .form-control:focus,
  19. > .form-select:focus {
  20. z-index: 3;
  21. }
  22. // Ensure buttons are always above inputs for more visually pleasing borders.
  23. // This isn't needed for `.input-group-text` since it shares the same border-color
  24. // as our inputs.
  25. .btn {
  26. position: relative;
  27. z-index: 2;
  28. &:focus {
  29. z-index: 3;
  30. }
  31. }
  32. }
  33. // Textual addons
  34. //
  35. // Serves as a catch-all element for any text or radio/checkbox input you wish
  36. // to prepend or append to an input.
  37. .input-group-text {
  38. display: flex;
  39. align-items: center;
  40. padding: $input-group-addon-padding-y $input-group-addon-padding-x;
  41. @include font-size($input-font-size); // Match inputs
  42. font-weight: $input-group-addon-font-weight;
  43. line-height: $input-line-height;
  44. color: $input-group-addon-color;
  45. text-align: center;
  46. white-space: nowrap;
  47. background-color: $input-group-addon-bg;
  48. border: $input-border-width solid $input-group-addon-border-color;
  49. @include border-radius($input-border-radius);
  50. }
  51. // Sizing
  52. //
  53. // Remix the default form control sizing classes into new ones for easier
  54. // manipulation.
  55. .input-group-lg > .form-control,
  56. .input-group-lg > .form-select,
  57. .input-group-lg > .input-group-text,
  58. .input-group-lg > .btn {
  59. padding: $input-padding-y-lg $input-padding-x-lg;
  60. @include font-size($input-font-size-lg);
  61. @include border-radius($input-border-radius-lg);
  62. }
  63. .input-group-sm > .form-control,
  64. .input-group-sm > .form-select,
  65. .input-group-sm > .input-group-text,
  66. .input-group-sm > .btn {
  67. padding: $input-padding-y-sm $input-padding-x-sm;
  68. @include font-size($input-font-size-sm);
  69. @include border-radius($input-border-radius-sm);
  70. }
  71. .input-group-lg > .form-select,
  72. .input-group-sm > .form-select {
  73. padding-right: $form-select-padding-x + $form-select-indicator-padding;
  74. }
  75. // Rounded corners
  76. //
  77. // These rulesets must come after the sizing ones to properly override sm and lg
  78. // border-radius values when extending. They're more specific than we'd like
  79. // with the `.input-group >` part, but without it, we cannot override the sizing.
  80. // stylelint-disable-next-line no-duplicate-selectors
  81. .input-group {
  82. &:not(.has-validation) {
  83. > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu),
  84. > .dropdown-toggle:nth-last-child(n + 3) {
  85. @include border-end-radius(0);
  86. }
  87. }
  88. &.has-validation {
  89. > :nth-last-child(n + 3):not(.dropdown-toggle):not(.dropdown-menu),
  90. > .dropdown-toggle:nth-last-child(n + 4) {
  91. @include border-end-radius(0);
  92. }
  93. }
  94. $validation-messages: "";
  95. @each $state in map-keys($form-validation-states) {
  96. $validation-messages: $validation-messages + ":not(." + unquote($state) + "-tooltip)" + ":not(." + unquote($state) + "-feedback)";
  97. }
  98. > :not(:first-child):not(.dropdown-menu)#{$validation-messages} {
  99. margin-left: -$input-border-width;
  100. @include border-start-radius(0);
  101. }
  102. }