bulma/sass/elements/form.sass

301 lines
6.2 KiB
Sass
Raw Normal View History

2016-10-29 20:51:13 +00:00
$input: $grey-darker !default
$input-background: $white !default
$input-border: $grey-lighter !default
$input-hover: $grey-darker !default
$input-hover-border: $grey-light !default
$input-focus: $grey-darker !default
$input-focus-border: $link !default
$input-disabled: $text-light !default
$input-disabled-background: $background !default
$input-disabled-border: $background !default
$input-arrow: $link !default
$input-icon: $grey-lighter !default
2016-10-30 14:59:46 +00:00
$input-icon-active: $grey !default
2016-10-29 20:51:13 +00:00
$input-radius: $radius !default
=input
+control
2016-10-29 20:51:13 +00:00
background-color: $input-background
border: 1px solid $input-border
color: $input
&:hover,
&.is-hovered
border-color: $input-hover-border
&:focus,
&.is-focused,
&:active,
&.is-active
border-color: $input-focus-border
&[disabled],
&.is-disabled
background-color: $input-disabled-background
border-color: $input-disabled-border
box-shadow: none
color: $input-disabled
+placeholder
color: rgba($input, 0.3)
2016-09-22 21:03:22 +00:00
.input,
.textarea
2016-10-29 20:51:13 +00:00
+input
box-shadow: inset 0 1px 2px rgba($black, 0.1)
2016-01-24 00:03:43 +00:00
max-width: 100%
width: 100%
&[type="search"]
border-radius: 290486px
2016-10-29 20:51:13 +00:00
// Colors
@each $name, $pair in $colors
$color: nth($pair, 1)
&.is-#{$name}
border-color: $color
2016-04-10 15:00:32 +00:00
// Sizes
2016-01-24 00:03:43 +00:00
&.is-small
+control-small
&.is-medium
+control-medium
&.is-large
+control-large
2016-04-10 15:00:32 +00:00
// Modifiers
2016-01-24 00:03:43 +00:00
&.is-fullwidth
display: block
width: 100%
&.is-inline
display: inline
width: auto
.textarea
display: block
2016-10-29 20:51:13 +00:00
line-height: 1.25
2016-01-24 00:03:43 +00:00
max-height: 600px
max-width: 100%
min-height: 120px
min-width: 100%
padding: 10px
resize: vertical
2016-09-22 22:14:18 +00:00
.checkbox,
.radio
2016-10-29 20:51:13 +00:00
align-items: center
2016-01-24 00:03:43 +00:00
cursor: pointer
2016-10-29 20:51:13 +00:00
display: inline-flex
flex-wrap: wrap
justify-content: flex-start
2016-01-24 00:03:43 +00:00
position: relative
vertical-align: top
input
cursor: pointer
2016-10-29 20:51:13 +00:00
margin-right: 0.5em
2016-01-24 00:03:43 +00:00
&:hover
2016-10-29 20:51:13 +00:00
color: $input-hover
2016-01-24 00:03:43 +00:00
&.is-disabled
2016-10-29 20:51:13 +00:00
color: $input-disabled
2016-04-10 15:00:32 +00:00
pointer-events: none
input
pointer-events: none
2016-01-24 00:03:43 +00:00
.radio
& + .radio
2016-10-29 17:53:30 +00:00
margin-left: 0.5em
2016-01-24 00:03:43 +00:00
.select
display: inline-block
2016-10-29 17:53:30 +00:00
height: 2.5em
2016-01-24 00:03:43 +00:00
position: relative
vertical-align: top
2016-10-29 20:51:13 +00:00
&:after
+arrow($input-arrow)
margin-top: -0.375em
right: 1.125em
top: 50%
z-index: 4
2016-01-24 00:03:43 +00:00
select
2016-10-29 20:51:13 +00:00
+input
2016-01-24 00:03:43 +00:00
cursor: pointer
display: block
2016-10-29 20:51:13 +00:00
font-size: 1em
2016-01-24 00:03:43 +00:00
outline: none
2016-10-29 17:53:30 +00:00
padding-right: 2.5em
2016-01-24 00:03:43 +00:00
&:hover
2016-10-29 20:51:13 +00:00
border-color: $input-hover-border
2016-01-29 13:39:29 +00:00
&::ms-expand
display: none
2016-10-29 20:51:13 +00:00
// States
&:hover
&:after
border-color: $input-hover
// Sizes
&.is-small
+control-small
&.is-medium
+control-medium
&.is-large
+control-large
// Modifiers
&.is-fullwidth
width: 100%
select
width: 100%
2016-01-24 00:03:43 +00:00
.label
2016-10-29 20:51:13 +00:00
color: $input
display: block
2016-03-26 15:38:33 +00:00
font-weight: bold
&:not(:last-child)
2016-10-29 17:53:30 +00:00
margin-bottom: 0.5em
2016-03-26 15:38:33 +00:00
.help
display: block
2016-10-30 10:41:53 +00:00
font-size: $size-small
2016-03-26 15:38:33 +00:00
margin-top: 5px
@each $name, $pair in $colors
$color: nth($pair, 1)
&.is-#{$name}
color: $color
// Containers
2016-03-25 13:38:40 +00:00
.control-label
2016-03-26 15:38:33 +00:00
+mobile
2016-10-29 17:53:30 +00:00
margin-bottom: 0.5em
2016-03-26 15:38:33 +00:00
+tablet
flex-basis: 0
2016-07-31 10:45:56 +00:00
flex-grow: 1
flex-shrink: 0
2016-10-29 17:53:30 +00:00
margin-right: 1.5em
padding-top: 0.5em
2016-03-26 15:38:33 +00:00
text-align: right
2016-03-25 13:38:40 +00:00
2016-01-24 00:03:43 +00:00
.control
position: relative
text-align: left
2016-01-24 00:03:43 +00:00
&:not(:last-child)
2016-10-30 10:41:53 +00:00
margin-bottom: 0.75rem
2016-04-10 15:00:32 +00:00
// Modifiers
&.has-addons
2016-01-24 00:03:43 +00:00
display: flex
2016-04-10 15:00:32 +00:00
justify-content: flex-start
2016-01-24 00:03:43 +00:00
.button,
2016-04-10 15:00:32 +00:00
.input,
2016-01-24 00:03:43 +00:00
.select
border-radius: 0
margin-right: -1px
2016-05-30 18:36:17 +00:00
width: auto
2016-01-24 00:03:43 +00:00
&:hover
z-index: 2
2016-10-29 20:51:13 +00:00
&:focus,
&:active
2016-01-24 00:03:43 +00:00
z-index: 3
&:first-child
2016-10-29 20:51:13 +00:00
border-radius: $input-radius 0 0 $input-radius
2016-01-24 00:03:43 +00:00
select
2016-10-29 20:51:13 +00:00
border-radius: $input-radius 0 0 $input-radius
2016-01-24 00:03:43 +00:00
&:last-child
2016-10-29 20:51:13 +00:00
border-radius: 0 $input-radius $input-radius 0
2016-04-10 15:00:32 +00:00
select
2016-10-29 20:51:13 +00:00
border-radius: 0 $input-radius $input-radius 0
2016-05-30 18:36:17 +00:00
&.is-expanded
2016-07-31 10:45:56 +00:00
flex-grow: 1
flex-shrink: 0
2016-10-29 20:51:13 +00:00
.select select
&:hover
z-index: 2
&:focus,
&:active
z-index: 3
2016-04-10 15:00:32 +00:00
&.has-addons-centered
2016-01-24 00:03:43 +00:00
justify-content: center
2016-04-10 15:00:32 +00:00
&.has-addons-right
justify-content: flex-end
2016-05-30 18:36:17 +00:00
&.has-addons-fullwidth
.button,
.input,
.select
2016-07-31 10:45:56 +00:00
flex-grow: 1
flex-shrink: 0
2016-04-10 15:00:32 +00:00
&.has-icon
2016-10-30 14:59:46 +00:00
.icon
2016-10-29 20:51:13 +00:00
color: $input-icon
2016-04-10 15:00:32 +00:00
pointer-events: none
position: absolute
2016-10-30 14:59:46 +00:00
top: ($size-normal * 2.5) / 2
2016-04-10 15:00:32 +00:00
z-index: 4
.input
2016-10-30 14:59:46 +00:00
&:focus
& + .icon
color: $input-icon-active
&.is-small
& + .icon
top: ($size-small * 2.5) / 2
&.is-medium
& + .icon
top: ($size-medium * 2.5) / 2
&.is-large
& + .icon
top: ($size-large * 2.5) / 2
2016-04-10 15:00:32 +00:00
&:not(.has-icon-right)
2016-10-30 14:59:46 +00:00
.icon
left: ($size-normal * 2.5) / 2
transform: translateX(-50%) translateY(-50%)
2016-04-10 15:00:32 +00:00
.input
2016-10-30 14:59:46 +00:00
padding-left: 2.5em
2016-04-13 23:07:02 +00:00
&.is-small
2016-10-30 14:59:46 +00:00
& + .icon
left: ($size-small * 2.5) / 2
2016-04-13 23:07:02 +00:00
&.is-medium
2016-10-30 14:59:46 +00:00
& + .icon
left: ($size-medium * 2.5) / 2
2016-04-13 23:07:02 +00:00
&.is-large
2016-10-30 14:59:46 +00:00
& + .icon
left: ($size-large * 2.5) / 2
2016-04-10 15:00:32 +00:00
&.has-icon-right
2016-10-30 14:59:46 +00:00
.icon
right: ($size-normal * 2.5) / 2
transform: translateX(50%) translateY(-50%)
2016-04-10 15:00:32 +00:00
.input
2016-10-30 14:59:46 +00:00
padding-right: 2.5em
2016-04-13 23:07:02 +00:00
&.is-small
2016-10-30 14:59:46 +00:00
& + .icon
right: ($size-small * 2.5) / 2
2016-04-13 23:07:02 +00:00
&.is-medium
2016-10-30 14:59:46 +00:00
& + .icon
right: ($size-medium * 2.5) / 2
2016-04-13 23:07:02 +00:00
&.is-large
2016-10-30 14:59:46 +00:00
& + .icon
right: ($size-large * 2.5) / 2
&.is-grouped
2016-03-25 13:38:40 +00:00
display: flex
2016-04-10 15:00:32 +00:00
justify-content: flex-start
2016-05-30 18:21:10 +00:00
& > .control
2016-12-22 18:44:54 +00:00
flex-basis: 0
flex-shrink: 0
2016-03-25 13:38:40 +00:00
&:not(:last-child)
2016-05-30 18:21:10 +00:00
margin-bottom: 0
2016-10-30 10:41:53 +00:00
margin-right: 0.75rem
2016-05-30 18:21:10 +00:00
&.is-expanded
2016-07-31 10:45:56 +00:00
flex-grow: 1
2016-10-16 18:15:56 +00:00
flex-shrink: 1
2016-04-10 15:00:32 +00:00
&.is-grouped-centered
justify-content: center
&.is-grouped-right
justify-content: flex-end
&.is-horizontal
2016-03-26 15:38:33 +00:00
+tablet
display: flex
2016-03-26 15:38:33 +00:00
& > .control
display: flex
flex-basis: 0
2016-07-31 10:45:56 +00:00
flex-grow: 5
flex-shrink: 1
2016-04-10 15:00:32 +00:00
&.is-loading
&:after
2016-09-22 22:14:18 +00:00
+loader
2016-04-10 15:00:32 +00:00
position: absolute !important
2016-10-29 20:51:13 +00:00
right: 0.75em
top: 0.75em