_form_select_box.scss 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. $select-input-height: 35px;
  2. $select-menu-max-height: 300px;
  3. $select-item-font-size: $font-size-base;
  4. $select-item-bg: $dropdownBackground;
  5. $select-item-fg: $input-color;
  6. $select-option-bg: $menu-dropdown-bg;
  7. $select-option-color: $input-color;
  8. $select-noresults-color: $text-color;
  9. $select-input-bg: $input-bg;
  10. $select-input-border-color: $input-border-color;
  11. $select-menu-box-shadow: $menu-dropdown-shadow;
  12. $select-text-color: $text-color;
  13. $select-input-bg-disabled: $input-bg-disabled;
  14. $select-option-selected-bg: $dropdownLinkBackgroundActive;
  15. // @import '../../../node_modules/react-select/scss/default.scss';
  16. @mixin select-control() {
  17. width: 100%;
  18. margin-right: $gf-form-margin;
  19. @include border-radius($input-border-radius-sm);
  20. background-color: $input-bg;
  21. }
  22. @mixin select-control-focus() {
  23. border-color: $input-border-focus;
  24. outline: none;
  25. $shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px $input-box-shadow-focus;
  26. @include box-shadow($shadow);
  27. }
  28. // new react-select WIP
  29. .gf-form-select2__control {
  30. @include select-control();
  31. border-color: $dark-3;
  32. border: 1px solid #262628;
  33. color: #d8d9da;
  34. cursor: default;
  35. display: table;
  36. border-spacing: 0;
  37. border-collapse: separate;
  38. height: $select-input-height;
  39. outline: none;
  40. overflow: hidden;
  41. position: relative;
  42. }
  43. .gf-form-select2__control--is-focused {
  44. background-color: $input-bg;
  45. @include select-control-focus();
  46. }
  47. .gf-form-select2__control--is-disabled {
  48. background-color: $select-input-bg-disabled;
  49. }
  50. .gf-form-select2__control--menu-right {
  51. .gf-form-select2__menu {
  52. right: 0;
  53. left: unset;
  54. }
  55. }
  56. .gf-form-select2__input {
  57. position: absolute;
  58. z-index: 1;
  59. top: 0;
  60. left: 0;
  61. right: 0;
  62. padding: 8px 10px;
  63. }
  64. .gf-form-select2__menu {
  65. background: $select-input-bg-disabled;
  66. position: absolute;
  67. z-index: 2;
  68. }
  69. .gf-form-select2__option {
  70. border-left: 2px solid transparent;
  71. &.gf-form-select2__option--is-focused,
  72. &.gf-form-select2__option--is-selected {
  73. background-color: $dropdownLinkBackgroundHover;
  74. color: $dropdownLinkColorHover;
  75. @include left-brand-border-gradient();
  76. .fa {
  77. color: white;
  78. }
  79. }
  80. }
  81. .gf-form-select2__value-container {
  82. display: table-cell;
  83. padding: 8px 10px;
  84. }
  85. .gf-form-select2__indicators {
  86. display: table-cell;
  87. vertical-align: middle;
  88. padding-right: 5px;
  89. width: 25px;
  90. }
  91. .gf-form-select2__select-arrow {
  92. border-color: #999 transparent transparent;
  93. border-style: solid;
  94. border-width: 5px 5px 2.5px;
  95. display: inline-block;
  96. height: 0;
  97. width: 0;
  98. position: relative;
  99. &.gf-form-select2__select-arrow--reversed {
  100. border-color: transparent transparent #999;
  101. top: -2px;
  102. border-width: 0 5px 5px;
  103. }
  104. }
  105. // react-select tweaks
  106. .gf-form-input--form-dropdown {
  107. padding: 0;
  108. border: 0;
  109. overflow: visible;
  110. .Select-placeholder {
  111. color: $input-color-placeholder;
  112. }
  113. > .Select-control {
  114. @include select-control();
  115. border-color: $dark-3;
  116. input {
  117. min-width: 1rem;
  118. }
  119. .Select-clear,
  120. .Select-arrow {
  121. margin-right: 8px;
  122. }
  123. .Select-value {
  124. display: inline-block;
  125. padding: $input-padding-y $input-padding-x;
  126. font-size: $font-size-md;
  127. line-height: $input-line-height;
  128. vertical-align: baseline;
  129. white-space: nowrap;
  130. }
  131. }
  132. &.is-open > .Select-control {
  133. background: transparent;
  134. border-color: $dark-3;
  135. }
  136. &.is-focused > .Select-control {
  137. background-color: $input-bg;
  138. @include select-control-focus();
  139. }
  140. &.is-focused:not(.is-open) > .Select-control {
  141. background-color: $input-bg;
  142. @include select-control-focus();
  143. }
  144. .Select-menu-outer {
  145. border: 0;
  146. width: auto;
  147. }
  148. .Select-option {
  149. border-left: 2px solid transparent;
  150. }
  151. .Select-option.is-focused {
  152. background-color: $dropdownLinkBackgroundHover;
  153. color: $dropdownLinkColorHover;
  154. @include left-brand-border-gradient();
  155. }
  156. }
  157. .gf-form-input--form-dropdown-right {
  158. .Select-menu-outer {
  159. right: 0;
  160. left: unset;
  161. }
  162. }