form.sass 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. =form-control
  2. +control
  3. @each $name, $pair in $colors
  4. $color: nth($pair, 1)
  5. &.is-#{$name}
  6. border-color: $color
  7. .input
  8. +form-control
  9. box-shadow: inset 0 1px 2px rgba($black, 0.1)
  10. max-width: 100%
  11. width: 100%
  12. &[type="search"]
  13. border-radius: 290486px
  14. // Sizes
  15. &.is-small
  16. +control-small
  17. &.is-medium
  18. +control-medium
  19. &.is-large
  20. +control-large
  21. // Modifiers
  22. &.is-fullwidth
  23. display: block
  24. width: 100%
  25. &.is-inline
  26. display: inline
  27. width: auto
  28. .textarea
  29. @extend .input
  30. display: block
  31. line-height: 1.2
  32. max-height: 600px
  33. max-width: 100%
  34. min-height: 120px
  35. min-width: 100%
  36. padding: 10px
  37. resize: vertical
  38. %control-with-element
  39. cursor: pointer
  40. display: inline-block
  41. line-height: 16px
  42. position: relative
  43. vertical-align: top
  44. input
  45. cursor: pointer
  46. &:hover
  47. color: $control-hover
  48. &.is-disabled
  49. color: $text-light
  50. pointer-events: none
  51. input
  52. pointer-events: none
  53. .checkbox
  54. @extend %control-with-element
  55. .radio
  56. @extend %control-with-element
  57. & + .radio
  58. margin-left: 10px
  59. .select
  60. display: inline-block
  61. height: 32px
  62. position: relative
  63. vertical-align: top
  64. select
  65. +form-control
  66. cursor: pointer
  67. display: block
  68. outline: none
  69. padding-right: 36px
  70. &:hover
  71. border-color: $control-hover-border
  72. &::ms-expand
  73. display: none
  74. &.is-fullwidth
  75. width: 100%
  76. select
  77. width: 100%
  78. &:after
  79. +arrow($link)
  80. margin-top: -6px
  81. right: 16px
  82. top: 50%
  83. &:hover
  84. &:after
  85. border-color: $link-hover
  86. &.is-small
  87. height: 24px
  88. select
  89. +control-small
  90. padding-right: 28px
  91. &.is-medium
  92. height: 40px
  93. select
  94. +control-medium
  95. padding-right: 44px
  96. &.is-large
  97. height: 48px
  98. select
  99. +control-large
  100. padding-right: 52px
  101. .label
  102. color: $text-strong
  103. display: block
  104. font-weight: bold
  105. &:not(:last-child)
  106. margin-bottom: 5px
  107. .help
  108. display: block
  109. font-size: $size-small
  110. margin-top: 5px
  111. @each $name, $pair in $colors
  112. $color: nth($pair, 1)
  113. &.is-#{$name}
  114. color: $color
  115. // Containers
  116. .control-label
  117. +mobile
  118. margin-bottom: 5px
  119. +tablet
  120. flex-grow: 1
  121. margin-right: 20px
  122. padding-top: 7px
  123. text-align: right
  124. .control
  125. position: relative
  126. text-align: left
  127. &:not(:last-child)
  128. margin-bottom: 10px
  129. // Modifiers
  130. &.has-addons
  131. display: flex
  132. justify-content: flex-start
  133. .button,
  134. .input,
  135. .select
  136. border-radius: 0
  137. margin-right: -1px
  138. width: auto
  139. &:hover
  140. z-index: 2
  141. &:active,
  142. &:focus
  143. z-index: 3
  144. &:first-child
  145. border-radius: $radius 0 0 $radius
  146. select
  147. border-radius: $radius 0 0 $radius
  148. &:last-child
  149. border-radius: 0 $radius $radius 0
  150. select
  151. border-radius: 0 $radius $radius 0
  152. &.is-expanded
  153. flex-grow: 1
  154. &.has-addons-centered
  155. justify-content: center
  156. &.has-addons-right
  157. justify-content: flex-end
  158. &.has-addons-fullwidth
  159. .button,
  160. .input,
  161. .select
  162. flex-grow: 1
  163. &.has-icon
  164. & > .fa
  165. +fa(14px, 24px)
  166. color: $text-light
  167. pointer-events: none
  168. position: absolute
  169. top: 4px
  170. z-index: 4
  171. .input
  172. &:focus + .fa
  173. color: $text-strong
  174. &.is-small + .fa
  175. font-size: 10.5px
  176. top: 0
  177. &.is-medium + .fa
  178. font-size: 21px
  179. top: 8px
  180. &.is-large + .fa
  181. font-size: 21px
  182. top: 12px
  183. &:not(.has-icon-right)
  184. & > .fa
  185. left: 4px
  186. .input
  187. padding-left: 32px
  188. &.is-small
  189. padding-left: 24px
  190. & + .fa
  191. left: 0
  192. &.is-medium
  193. padding-left: 40px
  194. & + .fa
  195. left: 8px
  196. &.is-large
  197. padding-left: 48px
  198. & + .fa
  199. left: 12px
  200. &.has-icon-right
  201. & > .fa
  202. right: 4px
  203. .input
  204. padding-right: 32px
  205. &.is-small
  206. padding-right: 24px
  207. & + .fa
  208. right: 0
  209. &.is-medium
  210. padding-right: 40px
  211. & + .fa
  212. right: 8px
  213. &.is-large
  214. padding-right: 48px
  215. & + .fa
  216. right: 12px
  217. &.is-grouped
  218. display: flex
  219. justify-content: flex-start
  220. & > .control
  221. &:not(:last-child)
  222. margin-bottom: 0
  223. margin-right: 10px
  224. &.is-expanded
  225. flex-grow: 1
  226. &.is-grouped-centered
  227. justify-content: center
  228. &.is-grouped-right
  229. justify-content: flex-end
  230. &.is-horizontal
  231. +tablet
  232. display: flex
  233. & > .control
  234. display: flex
  235. flex-grow: 5
  236. &.is-loading
  237. &:after
  238. @extend .loader
  239. position: absolute !important
  240. right: 8px
  241. top: 8px