mixins.scss 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. // Button
  2. @mixin ol-button-size(
  3. $font-size,
  4. $line-height,
  5. $padding-y,
  6. $padding-x: var(--spacing-06)
  7. ) {
  8. --bs-btn-font-size: #{$font-size};
  9. --bs-btn-line-height: #{$line-height};
  10. --bs-btn-padding-y: #{$padding-y};
  11. --bs-btn-padding-x: #{$padding-x};
  12. }
  13. @mixin ol-button-variant(
  14. $color,
  15. $background,
  16. $border: $background,
  17. $hover-background: $background,
  18. $hover-border: $hover-background,
  19. $borderless: true
  20. ) {
  21. --bs-btn-color: #{$color};
  22. --bs-btn-bg: #{$background};
  23. --bs-btn-border-color: #{$border};
  24. --bs-btn-hover-color: #{$color};
  25. --bs-btn-hover-bg: #{$hover-background};
  26. --bs-btn-hover-border-color: #{$hover-border};
  27. --bs-btn-active-color: #{$color};
  28. --bs-btn-active-bg: #{$hover-background};
  29. --bs-btn-active-border-color: #{$hover-border};
  30. --bs-btn-disabled-color: var(--content-disabled);
  31. --bs-btn-disabled-bg: var(--bg-light-disabled);
  32. --bs-btn-disabled-border-color: var(--bg-light-disabled);
  33. @if $borderless {
  34. --bs-btn-border-width: 0;
  35. }
  36. // Use the default state colors when in a loading state
  37. &[data-ol-loading='true'] {
  38. color: var(--bs-btn-color);
  39. background-color: var(--bs-btn-bg);
  40. border-color: var(--bs-btn-border-color);
  41. opacity: 1;
  42. }
  43. }
  44. @mixin action-button {
  45. font-size: 0;
  46. line-height: 1;
  47. border-radius: 50%;
  48. color: var(--content-primary);
  49. background-color: transparent;
  50. &:hover,
  51. &:active,
  52. &[aria-expanded='true'] {
  53. background-color: rgb($neutral-90, 0.08);
  54. }
  55. }
  56. @mixin labs-button {
  57. @include ol-button-variant(
  58. $color: var(--green-60),
  59. $background: var(--bg-accent-03),
  60. $border: var(--green-50),
  61. $hover-background: var(--bg-accent-03),
  62. $hover-border: var(--green-40),
  63. $borderless: false
  64. );
  65. }
  66. @mixin reset-button() {
  67. padding: 0;
  68. cursor: pointer;
  69. background: transparent;
  70. border: 0;
  71. appearance: none;
  72. }
  73. @mixin modal-lg {
  74. max-width: 960px;
  75. }
  76. @mixin modal-md {
  77. max-width: 640px;
  78. }
  79. @mixin modal-sm {
  80. max-width: 480px;
  81. }
  82. // Toolbar
  83. @mixin toolbar-sm-height {
  84. height: var(--toolbar-small-height);
  85. }
  86. @mixin toolbar-alt-bg() {
  87. background-color: var(--toolbar-alt-bg-color);
  88. }
  89. @mixin theme($name) {
  90. @if index($themes, $name) {
  91. [data-theme='#{$name}'] {
  92. @content;
  93. }
  94. } @else {
  95. @error 'Theme "#{$name}" is not supported. Supported themes are: #{$themes}.';
  96. }
  97. }
  98. @mixin box-shadow-button-input {
  99. box-shadow: 0 0 0 2px var(--blue-30);
  100. }
  101. @mixin animation($animation) {
  102. animation: $animation;
  103. }
  104. @mixin striped($color: rgba(255, 255, 255, 0.15), $angle: 45deg) {
  105. background-image: linear-gradient(
  106. $angle,
  107. $color 25%,
  108. transparent 25%,
  109. transparent 50%,
  110. $color 50%,
  111. $color 75%,
  112. transparent 75%,
  113. transparent
  114. );
  115. }
  116. @mixin mask-image($gradient) {
  117. // mask-image isn't supported without the -webkit prefix on all browsers we support yet
  118. -webkit-mask-image: $gradient;
  119. mask-image: $gradient;
  120. }
  121. @mixin premium-background {
  122. background-image: var(--premium-gradient);
  123. }
  124. @mixin premium-text {
  125. @include premium-background;
  126. background-clip: text;
  127. -webkit-text-fill-color: transparent;
  128. color: var(--white); // Fallback
  129. background-color: var(--blue-70); // Fallback
  130. }
  131. @mixin dark-bg {
  132. --link-color: var(--link-color-dark);
  133. --link-hover-color: var(--link-hover-color-dark);
  134. --link-visited-color: var(--link-visited-color-dark);
  135. }
  136. @mixin triangle($direction, $width, $height, $color) {
  137. position: absolute;
  138. border-color: transparent;
  139. border-style: solid;
  140. width: 0;
  141. height: 0;
  142. @if $direction == top {
  143. border-width: 0 calc(#{$width} / 2) #{$height} calc(#{$width} / 2);
  144. border-bottom-color: $color;
  145. border-left-color: transparent;
  146. border-right-color: transparent;
  147. } @else if $direction == bottom {
  148. border-width: #{$height} calc(#{$width} / 2) 0 calc(#{$width} / 2);
  149. border-top-color: $color;
  150. border-left-color: transparent;
  151. border-right-color: transparent;
  152. } @else if $direction == right {
  153. border-width: calc(#{$height} / 2) 0 calc(#{$height} / 2) #{$width};
  154. border-left-color: $color;
  155. border-top-color: transparent;
  156. border-bottom-color: transparent;
  157. } @else if $direction == left {
  158. border-width: calc(#{$height} / 2) #{$width} calc(#{$height} / 2) 0;
  159. border-right-color: $color;
  160. border-top-color: transparent;
  161. border-bottom-color: transparent;
  162. }
  163. }
  164. // Form validation states
  165. @mixin form-control-validation($color) {
  166. color: $color;
  167. // Color the label and help text
  168. .help-block,
  169. .control-label,
  170. .radio,
  171. .checkbox,
  172. .radio-inline,
  173. .checkbox-inline,
  174. .form-label {
  175. color: $color;
  176. }
  177. .form-control {
  178. border-color: $color;
  179. &:focus {
  180. border-color: $border-active;
  181. }
  182. }
  183. // Optional feedback icon
  184. .form-control-feedback {
  185. color: $color;
  186. }
  187. }
  188. @mixin input-disabled-styles {
  189. background-color: $input-disabled-bg;
  190. border-color: $input-disabled-border-color;
  191. }