bulma/sass/form/tools.sass

223 lines
5.4 KiB
Sass
Raw Normal View History

2020-08-23 16:46:09 +00:00
$label-font-size: var(--size-normal, #{$size-normal}) !default
$label-color: var(--text-strong, #{$text-strong}) !default
$label-weight: var(--weight-bold, #{$weight-bold}) !default
2019-05-18 14:52:00 +00:00
2020-08-23 16:46:09 +00:00
$help-size: var(--size-small, #{$size-small}) !default
$control-font-size: var(--size-normal, #{$size-normal}) !default
2019-05-18 14:52:00 +00:00
$label-colors: $form-colors !default
2019-05-18 14:52:00 +00:00
.label
2020-08-23 16:46:09 +00:00
--label-color: #{$label-color}
--label-font-size: #{$label-font-size}
--label-font-weight: #{$label-weight}
color: var(--label-color)
2019-05-18 14:52:00 +00:00
display: block
2020-08-23 16:46:09 +00:00
font-size: var(--label-font-size)
font-weight: var(--label-font-weight)
2019-05-18 14:52:00 +00:00
&:not(:last-child)
margin-bottom: 0.5em
// Sizes
&.is-small
2020-09-01 18:02:57 +00:00
font-size: var(--size-small, #{$size-small})
2019-05-18 14:52:00 +00:00
&.is-medium
2020-09-01 18:02:57 +00:00
font-size: var(--size-medium, #{$size-medium})
2019-05-18 14:52:00 +00:00
&.is-large
2020-09-01 18:02:57 +00:00
font-size: var(--size-large, #{$size-large})
2019-05-18 14:52:00 +00:00
.help
2020-08-23 16:46:09 +00:00
--help-font-size: #{$help-size}
2019-05-18 14:52:00 +00:00
display: block
2020-08-23 16:46:09 +00:00
font-size: var(--help-font-size)
2019-05-18 14:52:00 +00:00
margin-top: 0.25rem
@each $name, $pair in $label-colors
2019-05-18 14:52:00 +00:00
$color: nth($pair, 1)
&.is-#{$name}
color: var(--#{$name}, #{$color})
2019-05-18 14:52:00 +00:00
// Containers
.field
&:not(:last-child)
margin-bottom: 0.75rem
// Modifiers
&.has-addons
display: flex
justify-content: flex-start
.control
&:not(:last-child)
2020-01-22 09:14:04 +00:00
+ltr-property("margin", -1px)
2019-05-18 14:52:00 +00:00
&:not(:first-child):not(:last-child)
.button,
.input,
.select select
border-radius: 0
&:first-child:not(:only-child)
.button,
.input,
.select select
2020-01-20 19:39:09 +00:00
+ltr
border-bottom-right-radius: 0
border-top-right-radius: 0
+rtl
border-bottom-left-radius: 0
border-top-left-radius: 0
2019-05-18 14:52:00 +00:00
&:last-child:not(:only-child)
.button,
.input,
.select select
2020-01-20 19:39:09 +00:00
+ltr
border-bottom-left-radius: 0
border-top-left-radius: 0
+rtl
border-bottom-right-radius: 0
border-top-right-radius: 0
2019-05-18 14:52:00 +00:00
.button,
.input,
.select select
&:not([disabled])
&:hover,
&.is-hovered
z-index: 2
&:focus,
&.is-focused,
&:active,
&.is-active
z-index: 3
&:hover
z-index: 4
&.is-expanded
flex-grow: 1
flex-shrink: 1
&.has-addons-centered
justify-content: center
&.has-addons-right
justify-content: flex-end
&.has-addons-fullwidth
.control
flex-grow: 1
flex-shrink: 0
&.is-grouped
display: flex
justify-content: flex-start
& > .control
flex-shrink: 0
&:not(:last-child)
margin-bottom: 0
2020-01-22 09:14:04 +00:00
+ltr-property("margin", 0.75rem)
2019-05-18 14:52:00 +00:00
&.is-expanded
flex-grow: 1
flex-shrink: 1
&.is-grouped-centered
justify-content: center
&.is-grouped-right
justify-content: flex-end
&.is-grouped-multiline
flex-wrap: wrap
& > .control
&:last-child,
&:not(:last-child)
margin-bottom: 0.75rem
&:last-child
margin-bottom: -0.75rem
&:not(:last-child)
margin-bottom: 0
&.is-horizontal
+tablet
display: flex
.field-label
.label
font-size: inherit
+mobile
margin-bottom: 0.5rem
+tablet
flex-basis: 0
flex-grow: 1
flex-shrink: 0
2020-01-22 09:14:04 +00:00
+ltr-property("margin", 1.5rem)
2019-05-18 14:52:00 +00:00
text-align: right
&.is-small
2020-08-23 16:46:09 +00:00
font-size: var(--size-small, #{$size-small})
2019-05-18 14:52:00 +00:00
padding-top: 0.375em
&.is-normal
padding-top: 0.375em
&.is-medium
2020-08-23 16:46:09 +00:00
font-size: var(--size-medium, #{$size-medium})
2019-05-18 14:52:00 +00:00
padding-top: 0.375em
&.is-large
2020-08-23 16:46:09 +00:00
font-size: var(--size-large, #{$size-large})
2019-05-18 14:52:00 +00:00
padding-top: 0.375em
.field-body
.field .field
margin-bottom: 0
+tablet
display: flex
flex-basis: 0
flex-grow: 5
flex-shrink: 1
.field
margin-bottom: 0
& > .field
flex-shrink: 1
&:not(.is-narrow)
flex-grow: 1
&:not(:last-child)
2020-01-22 09:14:04 +00:00
+ltr-property("margin", 0.75rem)
2019-05-18 14:52:00 +00:00
.control
box-sizing: border-box
clear: both
font-size: var(--control-font-size, #{$control-font-size})
2019-05-18 14:52:00 +00:00
position: relative
2020-01-20 19:39:09 +00:00
text-align: inherit
2019-05-18 14:52:00 +00:00
// Modifiers
&.has-icons-left,
&.has-icons-right
.input,
.select
&:focus
& ~ .icon
color: var(--input-icon-active-color, #{$input-icon-active-color})
2019-05-18 14:52:00 +00:00
&.is-small ~ .icon
2020-08-23 16:46:09 +00:00
font-size: var(--size-small, #{$size-small})
2019-05-18 14:52:00 +00:00
&.is-medium ~ .icon
2020-08-23 16:46:09 +00:00
font-size: var(--size-medium, #{$size-medium})
2019-05-18 14:52:00 +00:00
&.is-large ~ .icon
2020-08-23 16:46:09 +00:00
font-size: var(--size-large, #{$size-large})
2019-05-18 14:52:00 +00:00
.icon
color: var(--input-icon-color, #{$input-icon-color})
height: var(--input-height, #{$input-height})
2019-05-18 14:52:00 +00:00
pointer-events: none
position: absolute
top: 0
width: var(--input-height, #{$input-height})
2019-05-18 14:52:00 +00:00
z-index: 4
&.has-icons-left
.input,
.select select
padding-left: var(--input-height, #{$input-height})
2019-05-18 14:52:00 +00:00
.icon.is-left
left: 0
&.has-icons-right
.input,
.select select
padding-right: var(--input-height, #{$input-height})
2019-05-18 14:52:00 +00:00
.icon.is-right
right: 0
&.is-loading
&::after
@extend %loader
position: absolute !important
2020-01-22 09:14:04 +00:00
+ltr-position(0.625em)
2019-05-18 14:52:00 +00:00
top: 0.625em
z-index: 4
&.is-small:after
2020-08-23 16:46:09 +00:00
font-size: var(--size-small, #{$size-small})
2019-05-18 14:52:00 +00:00
&.is-medium:after
2020-08-23 16:46:09 +00:00
font-size: var(--size-medium, #{$size-medium})
2019-05-18 14:52:00 +00:00
&.is-large:after
2020-08-23 16:46:09 +00:00
font-size: var(--size-large, #{$size-large})