_selectgroup.scss 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. .selectgroup {
  2. display: -ms-inline-flexbox;
  3. display: inline-flex;
  4. }
  5. .selectgroup-item {
  6. -ms-flex-positive: 1;
  7. flex-grow: 1;
  8. position: relative;
  9. font-weight: $font-weight-normal !important;
  10. + .selectgroup-item {
  11. margin-left: -1px;
  12. }
  13. &:not(:first-child) .selectgroup-button {
  14. border-top-left-radius: 0;
  15. border-bottom-left-radius: 0;
  16. }
  17. &:not(:last-child) .selectgroup-button {
  18. border-top-right-radius: 0;
  19. border-bottom-right-radius: 0;
  20. }
  21. }
  22. .selectgroup-input {
  23. opacity: 0;
  24. position: absolute;
  25. z-index: -1;
  26. top: 0;
  27. left: 0;
  28. }
  29. .selectgroup-button {
  30. display: block;
  31. border: 1px solid rgba(0, 40, 100, 0.12);
  32. text-align: center;
  33. padding: 0.375rem 1rem;
  34. position: relative;
  35. cursor: pointer;
  36. border-radius: 3px;
  37. color: #9aa0ac;
  38. -webkit-user-select: none;
  39. -moz-user-select: none;
  40. -ms-user-select: none;
  41. user-select: none;
  42. font-size: 14px;
  43. line-height: 1.5rem;
  44. min-width: 2.375rem;
  45. }
  46. .selectgroup-button-icon {
  47. padding-left: .5rem;
  48. padding-right: .5rem;
  49. font-size: 1rem;
  50. }
  51. .selectgroup-input {
  52. &:checked + .selectgroup-button {
  53. border-color: $primary-color;
  54. z-index: 1;
  55. color: $primary-color;
  56. background: rgba($primary-color, .15);
  57. }
  58. &:focus + .selectgroup-button {
  59. border-color: $primary-color;
  60. z-index: 2;
  61. color: $primary-color;
  62. box-shadow: 0 0 0 2px rgba($primary-color, .25);
  63. }
  64. }
  65. .selectgroup-pills {
  66. -ms-flex-wrap: wrap;
  67. flex-wrap: wrap;
  68. -ms-flex-align: start;
  69. align-items: flex-start;
  70. .selectgroup-item {
  71. margin-right: .5rem;
  72. -ms-flex-positive: 0;
  73. flex-grow: 0;
  74. }
  75. .selectgroup-button {
  76. border-radius: 50px !important;
  77. }
  78. }
  79. @mixin select-group-state-style($color) {
  80. .selectgroup-input {
  81. &:checked + .selectgroup-button {
  82. border-color: $color;
  83. color: $color;
  84. background: rgba($color, .15);
  85. }
  86. &:focus + .selectgroup-button {
  87. border-color: $color;
  88. color: $color;
  89. box-shadow: 0 0 0 2px rgba($color, .25);
  90. }
  91. }
  92. }
  93. .selectgroup {
  94. &.selectgroup-primary {
  95. @include select-group-state-style($primary-color);
  96. }
  97. &.selectgroup-secondary {
  98. @include select-group-state-style($secondary-color);
  99. }
  100. &.selectgroup-info {
  101. @include select-group-state-style($info-color);
  102. }
  103. &.selectgroup-success {
  104. @include select-group-state-style($success-color);
  105. }
  106. &.selectgroup-warning {
  107. @include select-group-state-style($warning-color);
  108. }
  109. &.selectgroup-danger {
  110. @include select-group-state-style($danger-color);
  111. }
  112. }