| 1 |
@import "../utilities/controls" |
| 2 |
@import "../utilities/mixins" |
| 3 |
|
| 4 |
$button-color: $text-strong !default |
| 5 |
$button-background-color: $scheme-main !default |
| 6 |
$button-family: false !default |
| 7 |
|
| 8 |
$button-border-color: $border !default |
| 9 |
$button-border-width: $control-border-width !default |
| 10 |
|
| 11 |
$button-padding-vertical: calc(0.5em - #{$button-border-width}) !default |
| 12 |
$button-padding-horizontal: 1em !default |
| 13 |
|
| 14 |
$button-hover-color: $link-hover !default |
| 15 |
$button-hover-border-color: $link-hover-border !default |
| 16 |
|
| 17 |
$button-focus-color: $link-focus !default |
| 18 |
$button-focus-border-color: $link-focus-border !default |
| 19 |
$button-focus-box-shadow-size: 0 0 0 0.125em !default |
| 20 |
$button-focus-box-shadow-color: bulmaRgba($link, 0.25) !default |
| 21 |
|
| 22 |
$button-active-color: $link-active !default |
| 23 |
$button-active-border-color: $link-active-border !default |
| 24 |
|
| 25 |
$button-text-color: $text !default |
| 26 |
$button-text-decoration: underline !default |
| 27 |
$button-text-hover-background-color: $background !default |
| 28 |
$button-text-hover-color: $text-strong !default |
| 29 |
|
| 30 |
$button-ghost-background: none !default |
| 31 |
$button-ghost-border-color: transparent !default |
| 32 |
$button-ghost-color: $link !default |
| 33 |
$button-ghost-decoration: none !default |
| 34 |
$button-ghost-hover-color: $link !default |
| 35 |
$button-ghost-hover-decoration: underline !default |
| 36 |
|
| 37 |
$button-disabled-background-color: $scheme-main !default |
| 38 |
$button-disabled-border-color: $border !default |
| 39 |
$button-disabled-shadow: none !default |
| 40 |
$button-disabled-opacity: 0.5 !default |
| 41 |
|
| 42 |
$button-static-color: $text-light !default |
| 43 |
$button-static-background-color: $scheme-main-ter !default |
| 44 |
$button-static-border-color: $border !default |
| 45 |
|
| 46 |
$button-colors: $colors !default |
| 47 |
$button-responsive-sizes: ("mobile": ("small": ($size-small * 0.75), "normal": ($size-small * 0.875), "medium": $size-small, "large": $size-normal), "tablet-only": ("small": ($size-small * 0.875), "normal": ($size-small), "medium": $size-normal, "large": $size-medium)) !default |
| 48 |
|
| 49 |
// The button sizes use mixins so they can be used at different breakpoints |
| 50 |
=button-small |
| 51 |
&:not(.is-rounded) |
| 52 |
border-radius: $radius-small |
| 53 |
font-size: $size-small |
| 54 |
=button-normal |
| 55 |
font-size: $size-normal |
| 56 |
=button-medium |
| 57 |
font-size: $size-medium |
| 58 |
=button-large |
| 59 |
font-size: $size-large |
| 60 |
|
| 61 |
.button |
| 62 |
@extend %control |
| 63 |
@extend %unselectable |
| 64 |
background-color: $button-background-color |
| 65 |
border-color: $button-border-color |
| 66 |
border-width: $button-border-width |
| 67 |
color: $button-color |
| 68 |
cursor: pointer |
| 69 |
@if $button-family |
| 70 |
font-family: $button-family |
| 71 |
justify-content: center |
| 72 |
padding-bottom: $button-padding-vertical |
| 73 |
padding-left: $button-padding-horizontal |
| 74 |
padding-right: $button-padding-horizontal |
| 75 |
padding-top: $button-padding-vertical |
| 76 |
text-align: center |
| 77 |
white-space: nowrap |
| 78 |
strong |
| 79 |
color: inherit |
| 80 |
.icon |
| 81 |
&, |
| 82 |
&.is-small, |
| 83 |
&.is-medium, |
| 84 |
&.is-large |
| 85 |
height: 1.5em |
| 86 |
width: 1.5em |
| 87 |
&:first-child:not(:last-child) |
| 88 |
+ltr-property("margin", calc(#{-0.5 * $button-padding-horizontal} - #{$button-border-width}), false) |
| 89 |
+ltr-property("margin", $button-padding-horizontal * 0.25) |
| 90 |
&:last-child:not(:first-child) |
| 91 |
+ltr-property("margin", $button-padding-horizontal * 0.25, false) |
| 92 |
+ltr-property("margin", calc(#{-0.5 * $button-padding-horizontal} - #{$button-border-width})) |
| 93 |
&:first-child:last-child |
| 94 |
margin-left: calc(#{-0.5 * $button-padding-horizontal} - #{$button-border-width}) |
| 95 |
margin-right: calc(#{-0.5 * $button-padding-horizontal} - #{$button-border-width}) |
| 96 |
// States |
| 97 |
&:hover, |
| 98 |
&.is-hovered |
| 99 |
border-color: $button-hover-border-color |
| 100 |
color: $button-hover-color |
| 101 |
&:focus, |
| 102 |
&.is-focused |
| 103 |
border-color: $button-focus-border-color |
| 104 |
color: $button-focus-color |
| 105 |
&:not(:active) |
| 106 |
box-shadow: $button-focus-box-shadow-size $button-focus-box-shadow-color |
| 107 |
&:active, |
| 108 |
&.is-active |
| 109 |
border-color: $button-active-border-color |
| 110 |
color: $button-active-color |
| 111 |
// Colors |
| 112 |
&.is-text |
| 113 |
background-color: transparent |
| 114 |
border-color: transparent |
| 115 |
color: $button-text-color |
| 116 |
text-decoration: $button-text-decoration |
| 117 |
&:hover, |
| 118 |
&.is-hovered, |
| 119 |
&:focus, |
| 120 |
&.is-focused |
| 121 |
background-color: $button-text-hover-background-color |
| 122 |
color: $button-text-hover-color |
| 123 |
&:active, |
| 124 |
&.is-active |
| 125 |
background-color: bulmaDarken($button-text-hover-background-color, 5%) |
| 126 |
color: $button-text-hover-color |
| 127 |
&[disabled], |
| 128 |
fieldset[disabled] & |
| 129 |
background-color: transparent |
| 130 |
border-color: transparent |
| 131 |
box-shadow: none |
| 132 |
&.is-ghost |
| 133 |
background: $button-ghost-background |
| 134 |
border-color: $button-ghost-border-color |
| 135 |
color: $button-ghost-color |
| 136 |
text-decoration: $button-ghost-decoration |
| 137 |
&:hover, |
| 138 |
&.is-hovered |
| 139 |
color: $button-ghost-hover-color |
| 140 |
text-decoration: $button-ghost-hover-decoration |
| 141 |
@each $name, $pair in $button-colors |
| 142 |
$color: nth($pair, 1) |
| 143 |
$color-invert: nth($pair, 2) |
| 144 |
&.is-#{$name} |
| 145 |
background-color: $color |
| 146 |
border-color: transparent |
| 147 |
color: $color-invert |
| 148 |
&:hover, |
| 149 |
&.is-hovered |
| 150 |
background-color: bulmaDarken($color, 2.5%) |
| 151 |
border-color: transparent |
| 152 |
color: $color-invert |
| 153 |
&:focus, |
| 154 |
&.is-focused |
| 155 |
border-color: transparent |
| 156 |
color: $color-invert |
| 157 |
&:not(:active) |
| 158 |
box-shadow: $button-focus-box-shadow-size bulmaRgba($color, 0.25) |
| 159 |
&:active, |
| 160 |
&.is-active |
| 161 |
background-color: bulmaDarken($color, 5%) |
| 162 |
border-color: transparent |
| 163 |
color: $color-invert |
| 164 |
&[disabled], |
| 165 |
fieldset[disabled] & |
| 166 |
background-color: $color |
| 167 |
border-color: $color |
| 168 |
box-shadow: none |
| 169 |
&.is-inverted |
| 170 |
background-color: $color-invert |
| 171 |
color: $color |
| 172 |
&:hover, |
| 173 |
&.is-hovered |
| 174 |
background-color: bulmaDarken($color-invert, 5%) |
| 175 |
&[disabled], |
| 176 |
fieldset[disabled] & |
| 177 |
background-color: $color-invert |
| 178 |
border-color: transparent |
| 179 |
box-shadow: none |
| 180 |
color: $color |
| 181 |
&.is-loading |
| 182 |
&::after |
| 183 |
border-color: transparent transparent $color-invert $color-invert !important |
| 184 |
&.is-outlined |
| 185 |
background-color: transparent |
| 186 |
border-color: $color |
| 187 |
color: $color |
| 188 |
&:hover, |
| 189 |
&.is-hovered, |
| 190 |
&:focus, |
| 191 |
&.is-focused |
| 192 |
background-color: $color |
| 193 |
border-color: $color |
| 194 |
color: $color-invert |
| 195 |
&.is-loading |
| 196 |
&::after |
| 197 |
border-color: transparent transparent $color $color !important |
| 198 |
&:hover, |
| 199 |
&.is-hovered, |
| 200 |
&:focus, |
| 201 |
&.is-focused |
| 202 |
&::after |
| 203 |
border-color: transparent transparent $color-invert $color-invert !important |
| 204 |
&[disabled], |
| 205 |
fieldset[disabled] & |
| 206 |
background-color: transparent |
| 207 |
border-color: $color |
| 208 |
box-shadow: none |
| 209 |
color: $color |
| 210 |
&.is-inverted.is-outlined |
| 211 |
background-color: transparent |
| 212 |
border-color: $color-invert |
| 213 |
color: $color-invert |
| 214 |
&:hover, |
| 215 |
&.is-hovered, |
| 216 |
&:focus, |
| 217 |
&.is-focused |
| 218 |
background-color: $color-invert |
| 219 |
color: $color |
| 220 |
&.is-loading |
| 221 |
&:hover, |
| 222 |
&.is-hovered, |
| 223 |
&:focus, |
| 224 |
&.is-focused |
| 225 |
&::after |
| 226 |
border-color: transparent transparent $color $color !important |
| 227 |
&[disabled], |
| 228 |
fieldset[disabled] & |
| 229 |
background-color: transparent |
| 230 |
border-color: $color-invert |
| 231 |
box-shadow: none |
| 232 |
color: $color-invert |
| 233 |
// If light and dark colors are provided |
| 234 |
@if length($pair) >= 4 |
| 235 |
$color-light: nth($pair, 3) |
| 236 |
$color-dark: nth($pair, 4) |
| 237 |
&.is-light |
| 238 |
background-color: $color-light |
| 239 |
color: $color-dark |
| 240 |
&:hover, |
| 241 |
&.is-hovered |
| 242 |
background-color: bulmaDarken($color-light, 2.5%) |
| 243 |
border-color: transparent |
| 244 |
color: $color-dark |
| 245 |
&:active, |
| 246 |
&.is-active |
| 247 |
background-color: bulmaDarken($color-light, 5%) |
| 248 |
border-color: transparent |
| 249 |
color: $color-dark |
| 250 |
// Sizes |
| 251 |
&.is-small |
| 252 |
+button-small |
| 253 |
&.is-normal |
| 254 |
+button-normal |
| 255 |
&.is-medium |
| 256 |
+button-medium |
| 257 |
&.is-large |
| 258 |
+button-large |
| 259 |
// Modifiers |
| 260 |
&[disabled], |
| 261 |
fieldset[disabled] & |
| 262 |
background-color: $button-disabled-background-color |
| 263 |
border-color: $button-disabled-border-color |
| 264 |
box-shadow: $button-disabled-shadow |
| 265 |
opacity: $button-disabled-opacity |
| 266 |
&.is-fullwidth |
| 267 |
display: flex |
| 268 |
width: 100% |
| 269 |
&.is-loading |
| 270 |
color: transparent !important |
| 271 |
pointer-events: none |
| 272 |
&::after |
| 273 |
@extend %loader |
| 274 |
+center(1em) |
| 275 |
position: absolute !important |
| 276 |
&.is-static |
| 277 |
background-color: $button-static-background-color |
| 278 |
border-color: $button-static-border-color |
| 279 |
color: $button-static-color |
| 280 |
box-shadow: none |
| 281 |
pointer-events: none |
| 282 |
&.is-rounded |
| 283 |
border-radius: $radius-rounded |
| 284 |
padding-left: calc(#{$button-padding-horizontal} + 0.25em) |
| 285 |
padding-right: calc(#{$button-padding-horizontal} + 0.25em) |
| 286 |
|
| 287 |
.buttons |
| 288 |
align-items: center |
| 289 |
display: flex |
| 290 |
flex-wrap: wrap |
| 291 |
justify-content: flex-start |
| 292 |
.button |
| 293 |
margin-bottom: 0.5rem |
| 294 |
&:not(:last-child):not(.is-fullwidth) |
| 295 |
+ltr-property("margin", 0.5rem) |
| 296 |
&:last-child |
| 297 |
margin-bottom: -0.5rem |
| 298 |
&:not(:last-child) |
| 299 |
margin-bottom: 1rem |
| 300 |
// Sizes |
| 301 |
&.are-small |
| 302 |
.button:not(.is-normal):not(.is-medium):not(.is-large) |
| 303 |
+button-small |
| 304 |
&.are-medium |
| 305 |
.button:not(.is-small):not(.is-normal):not(.is-large) |
| 306 |
+button-medium |
| 307 |
&.are-large |
| 308 |
.button:not(.is-small):not(.is-normal):not(.is-medium) |
| 309 |
+button-large |
| 310 |
&.has-addons |
| 311 |
.button |
| 312 |
&:not(:first-child) |
| 313 |
border-bottom-left-radius: 0 |
| 314 |
border-top-left-radius: 0 |
| 315 |
&:not(:last-child) |
| 316 |
border-bottom-right-radius: 0 |
| 317 |
border-top-right-radius: 0 |
| 318 |
+ltr-property("margin", -1px) |
| 319 |
&:last-child |
| 320 |
+ltr-property("margin", 0) |
| 321 |
&:hover, |
| 322 |
&.is-hovered |
| 323 |
z-index: 2 |
| 324 |
&:focus, |
| 325 |
&.is-focused, |
| 326 |
&:active, |
| 327 |
&.is-active, |
| 328 |
&.is-selected |
| 329 |
z-index: 3 |
| 330 |
&:hover |
| 331 |
z-index: 4 |
| 332 |
&.is-expanded |
| 333 |
flex-grow: 1 |
| 334 |
flex-shrink: 1 |
| 335 |
&.is-centered |
| 336 |
justify-content: center |
| 337 |
&:not(.has-addons) |
| 338 |
.button:not(.is-fullwidth) |
| 339 |
margin-left: 0.25rem |
| 340 |
margin-right: 0.25rem |
| 341 |
&.is-right |
| 342 |
justify-content: flex-end |
| 343 |
&:not(.has-addons) |
| 344 |
.button:not(.is-fullwidth) |
| 345 |
margin-left: 0.25rem |
| 346 |
margin-right: 0.25rem |
| 347 |
|
| 348 |
@each $bp-name, $bp-sizes in $button-responsive-sizes |
| 349 |
+breakpoint($bp-name) |
| 350 |
@each $size, $value in $bp-sizes |
| 351 |
@if $size != "normal" |
| 352 |
.button.is-responsive.is-#{$size} |
| 353 |
font-size: $value |
| 354 |
@else |
| 355 |
.button.is-responsive, |
| 356 |
.button.is-responsive.is-normal |
| 357 |
font-size: $value |