form.sass 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. $input-color: $grey-darker !default
  2. $input-background-color: $white !default
  3. $input-border-color: $grey-lighter !default
  4. $input-shadow: inset 0 1px 2px rgba($black, 0.1) !default
  5. $input-hover-color: $grey-darker !default
  6. $input-hover-border-color: $grey-light !default
  7. $input-focus-color: $grey-darker !default
  8. $input-focus-border-color: $link !default
  9. $input-focus-box-shadow-size: 0 0 0 0.125em !default
  10. $input-focus-box-shadow-color: rgba($link, 0.25) !default
  11. $input-disabled-color: $text-light !default
  12. $input-disabled-background-color: $background !default
  13. $input-disabled-border-color: $background !default
  14. $input-arrow: $link !default
  15. $input-icon-color: $grey-lighter !default
  16. $input-icon-active-color: $grey !default
  17. $input-radius: $radius !default
  18. $file-border-color: $border !default
  19. $file-radius: $radius !default
  20. $file-cta-background-color: $white-ter !default
  21. $file-cta-color: $grey-dark !default
  22. $file-cta-hover-color: $grey-darker !default
  23. $file-cta-active-color: $grey-darker !default
  24. $file-name-border-color: $border !default
  25. $file-name-border-style: solid !default
  26. $file-name-border-width: 1px 1px 1px 0 !default
  27. $file-name-max-width: 16em !default
  28. $label-color: $grey-darker !default
  29. $label-weight: $weight-bold !default
  30. $help-size: $size-small !default
  31. =input
  32. +control
  33. background-color: $input-background-color
  34. border-color: $input-border-color
  35. color: $input-color
  36. +placeholder
  37. color: rgba($input-color, 0.3)
  38. &:hover,
  39. &.is-hovered
  40. border-color: $input-hover-border-color
  41. &:focus,
  42. &.is-focused,
  43. &:active,
  44. &.is-active
  45. border-color: $input-focus-border-color
  46. box-shadow: $input-focus-box-shadow-size $input-focus-box-shadow-color
  47. &[disabled]
  48. background-color: $input-disabled-background-color
  49. border-color: $input-disabled-border-color
  50. box-shadow: none
  51. color: $input-disabled-color
  52. +placeholder
  53. color: rgba($input-disabled-color, 0.3)
  54. .input,
  55. .textarea
  56. +input
  57. box-shadow: $input-shadow
  58. max-width: 100%
  59. width: 100%
  60. &[type="search"]
  61. border-radius: 290486px
  62. &[readonly]
  63. box-shadow: none
  64. // Colors
  65. @each $name, $pair in $colors
  66. $color: nth($pair, 1)
  67. &.is-#{$name}
  68. border-color: $color
  69. &:focus,
  70. &.is-focused,
  71. &:active,
  72. &.is-active
  73. box-shadow: $input-focus-box-shadow-size rgba($color, 0.25)
  74. // Sizes
  75. &.is-small
  76. +control-small
  77. &.is-medium
  78. +control-medium
  79. &.is-large
  80. +control-large
  81. // Modifiers
  82. &.is-fullwidth
  83. display: block
  84. width: 100%
  85. &.is-inline
  86. display: inline
  87. width: auto
  88. .input
  89. &.is-static
  90. background-color: transparent
  91. border-color: transparent
  92. box-shadow: none
  93. padding-left: 0
  94. padding-right: 0
  95. .textarea
  96. display: block
  97. max-width: 100%
  98. min-width: 100%
  99. padding: 0.625em
  100. resize: vertical
  101. &:not([rows])
  102. max-height: 600px
  103. min-height: 120px
  104. &[rows]
  105. height: unset
  106. // Modifiers
  107. &.has-fixed-size
  108. resize: none
  109. .checkbox,
  110. .radio
  111. cursor: pointer
  112. display: inline-block
  113. line-height: 1.25
  114. position: relative
  115. input
  116. cursor: pointer
  117. &:hover
  118. color: $input-hover-color
  119. &[disabled]
  120. color: $input-disabled-color
  121. cursor: not-allowed
  122. .radio
  123. & + .radio
  124. margin-left: 0.5em
  125. .select
  126. display: inline-block
  127. max-width: 100%
  128. position: relative
  129. vertical-align: top
  130. &:not(.is-multiple)
  131. height: 2.25em
  132. &::after
  133. +arrow($input-arrow)
  134. margin-top: -0.375em
  135. right: 1.125em
  136. top: 50%
  137. z-index: 4
  138. select
  139. +input
  140. cursor: pointer
  141. display: block
  142. font-size: 1em
  143. max-width: 100%
  144. outline: none
  145. &::-ms-expand
  146. display: none
  147. &[disabled]:hover
  148. border-color: $input-disabled-border-color
  149. &:not([multiple])
  150. padding-right: 2.5em
  151. &[multiple]
  152. height: unset
  153. padding: 0
  154. option
  155. padding: 0.5em 1em
  156. // States
  157. &:hover
  158. &::after
  159. border-color: $input-hover-color
  160. // Colors
  161. @each $name, $pair in $colors
  162. $color: nth($pair, 1)
  163. &.is-#{$name} select
  164. border-color: $color
  165. &:focus,
  166. &.is-focused,
  167. &:active,
  168. &.is-active
  169. box-shadow: $input-focus-box-shadow-size rgba($color, 0.25)
  170. // Sizes
  171. &.is-small
  172. +control-small
  173. &.is-medium
  174. +control-medium
  175. &.is-large
  176. +control-large
  177. // Modifiers
  178. &.is-disabled
  179. &::after
  180. border-color: $input-disabled-color
  181. &.is-fullwidth
  182. width: 100%
  183. select
  184. width: 100%
  185. &.is-loading
  186. &::after
  187. +loader
  188. margin-top: 0
  189. position: absolute
  190. right: 0.625em
  191. top: 0.625em
  192. transform: none
  193. &.is-small:after
  194. font-size: $size-small
  195. &.is-medium:after
  196. font-size: $size-medium
  197. &.is-large:after
  198. font-size: $size-large
  199. .file
  200. +unselectable
  201. align-items: stretch
  202. display: flex
  203. justify-content: flex-start
  204. position: relative
  205. // Colors
  206. @each $name, $pair in $colors
  207. $color: nth($pair, 1)
  208. $color-invert: nth($pair, 2)
  209. &.is-#{$name}
  210. .file-cta
  211. background-color: $color
  212. border-color: transparent
  213. color: $color-invert
  214. &:hover,
  215. &.is-hovered
  216. .file-cta
  217. background-color: darken($color, 2.5%)
  218. border-color: transparent
  219. color: $color-invert
  220. &:focus,
  221. &.is-focused
  222. .file-cta
  223. border-color: transparent
  224. box-shadow: 0 0 0.5em rgba($color, 0.25)
  225. color: $color-invert
  226. &:active,
  227. &.is-active
  228. .file-cta
  229. background-color: darken($color, 5%)
  230. border-color: transparent
  231. color: $color-invert
  232. // Sizes
  233. &.is-small
  234. font-size: $size-small
  235. &.is-medium
  236. font-size: $size-medium
  237. .file-icon
  238. .fa
  239. font-size: 21px
  240. &.is-large
  241. font-size: $size-large
  242. .file-icon
  243. .fa
  244. font-size: 28px
  245. // Modifiers
  246. &.has-name
  247. .file-cta
  248. border-bottom-right-radius: 0
  249. border-top-right-radius: 0
  250. .file-name
  251. border-bottom-left-radius: 0
  252. border-top-left-radius: 0
  253. &.is-empty
  254. .file-cta
  255. border-radius: $file-radius
  256. .file-name
  257. display: none
  258. &.is-centered
  259. justify-content: center
  260. &.is-right
  261. justify-content: flex-end
  262. &.is-boxed
  263. .file-label
  264. flex-direction: column
  265. .file-cta
  266. flex-direction: column
  267. height: auto
  268. padding: 1em 3em
  269. .file-name
  270. border-width: 0 1px 1px
  271. .file-icon
  272. height: 1.5em
  273. width: 1.5em
  274. .fa
  275. font-size: 21px
  276. &.is-small
  277. .file-icon .fa
  278. font-size: 14px
  279. &.is-medium
  280. .file-icon .fa
  281. font-size: 28px
  282. &.is-large
  283. .file-icon .fa
  284. font-size: 35px
  285. &.has-name
  286. .file-cta
  287. border-radius: $file-radius $file-radius 0 0
  288. .file-name
  289. border-radius: 0 0 $file-radius $file-radius
  290. border-width: 0 1px 1px
  291. &.is-right
  292. .file-cta
  293. border-radius: 0 $file-radius $file-radius 0
  294. .file-name
  295. border-radius: $file-radius 0 0 $file-radius
  296. border-width: 1px 0 1px 1px
  297. order: -1
  298. &.is-fullwidth
  299. .file-label
  300. width: 100%
  301. .file-name
  302. flex-grow: 1
  303. max-width: none
  304. .file-label
  305. align-items: stretch
  306. display: flex
  307. cursor: pointer
  308. justify-content: flex-start
  309. overflow: hidden
  310. position: relative
  311. &:hover
  312. .file-cta
  313. background-color: darken($file-cta-background-color, 2.5%)
  314. color: $file-cta-hover-color
  315. .file-name
  316. border-color: darken($file-name-border-color, 2.5%)
  317. &:active
  318. .file-cta
  319. background-color: darken($file-cta-background-color, 5%)
  320. color: $file-cta-active-color
  321. .file-name
  322. border-color: darken($file-name-border-color, 5%)
  323. .file-input
  324. height: 0.01em
  325. left: 0
  326. outline: none
  327. position: absolute
  328. top: 0
  329. width: 0.01em
  330. .file-cta,
  331. .file-name
  332. +control
  333. border-color: $file-border-color
  334. border-radius: $file-radius
  335. font-size: 1em
  336. padding-left: 1em
  337. padding-right: 1em
  338. white-space: nowrap
  339. .file-cta
  340. background-color: $file-cta-background-color
  341. color: $file-cta-color
  342. .file-name
  343. border-color: $file-name-border-color
  344. border-style: $file-name-border-style
  345. border-width: $file-name-border-width
  346. display: block
  347. max-width: $file-name-max-width
  348. overflow: hidden
  349. text-align: left
  350. text-overflow: ellipsis
  351. .file-icon
  352. align-items: center
  353. display: flex
  354. height: 1em
  355. justify-content: center
  356. margin-right: 0.5em
  357. width: 1em
  358. .fa
  359. font-size: 14px
  360. .label
  361. color: $label-color
  362. display: block
  363. font-size: $size-normal
  364. font-weight: $label-weight
  365. &:not(:last-child)
  366. margin-bottom: 0.5em
  367. // Sizes
  368. &.is-small
  369. font-size: $size-small
  370. &.is-medium
  371. font-size: $size-medium
  372. &.is-large
  373. font-size: $size-large
  374. .help
  375. display: block
  376. font-size: $help-size
  377. margin-top: 0.25rem
  378. @each $name, $pair in $colors
  379. $color: nth($pair, 1)
  380. &.is-#{$name}
  381. color: $color
  382. // Containers
  383. .field
  384. &:not(:last-child)
  385. margin-bottom: 0.75rem
  386. // Modifiers
  387. &.has-addons
  388. display: flex
  389. justify-content: flex-start
  390. .control
  391. &:not(:last-child)
  392. margin-right: -1px
  393. &:first-child
  394. .button,
  395. .input,
  396. .select select
  397. border-bottom-left-radius: $input-radius
  398. border-top-left-radius: $input-radius
  399. &:last-child
  400. .button,
  401. .input,
  402. .select select
  403. border-bottom-right-radius: $input-radius
  404. border-top-right-radius: $input-radius
  405. .button,
  406. .input,
  407. .select select
  408. border-radius: 0
  409. &:hover,
  410. &.is-hovered
  411. z-index: 2
  412. &:focus,
  413. &.is-focused,
  414. &:active,
  415. &.is-active
  416. z-index: 3
  417. &:hover
  418. z-index: 4
  419. &.is-expanded
  420. flex-grow: 1
  421. &.has-addons-centered
  422. justify-content: center
  423. &.has-addons-right
  424. justify-content: flex-end
  425. &.has-addons-fullwidth
  426. .control
  427. flex-grow: 1
  428. flex-shrink: 0
  429. &.is-grouped
  430. display: flex
  431. justify-content: flex-start
  432. & > .control
  433. flex-shrink: 0
  434. &:not(:last-child)
  435. margin-bottom: 0
  436. margin-right: 0.75rem
  437. &.is-expanded
  438. flex-grow: 1
  439. flex-shrink: 1
  440. &.is-grouped-centered
  441. justify-content: center
  442. &.is-grouped-right
  443. justify-content: flex-end
  444. &.is-grouped-multiline
  445. flex-wrap: wrap
  446. & > .control
  447. &:last-child,
  448. &:not(:last-child)
  449. margin-bottom: 0.75rem
  450. &:last-child
  451. margin-bottom: -0.75rem
  452. &:not(:last-child)
  453. margin-bottom: 0
  454. &.is-horizontal
  455. +tablet
  456. display: flex
  457. .field-label
  458. .label
  459. font-size: inherit
  460. +mobile
  461. margin-bottom: 0.5rem
  462. +tablet
  463. flex-basis: 0
  464. flex-grow: 1
  465. flex-shrink: 0
  466. margin-right: 1.5rem
  467. text-align: right
  468. &.is-small
  469. font-size: $size-small
  470. padding-top: 0.375em
  471. &.is-normal
  472. padding-top: 0.375em
  473. &.is-medium
  474. font-size: $size-medium
  475. padding-top: 0.375em
  476. &.is-large
  477. font-size: $size-large
  478. padding-top: 0.375em
  479. .field-body
  480. .field .field
  481. margin-bottom: 0
  482. +tablet
  483. display: flex
  484. flex-basis: 0
  485. flex-grow: 5
  486. flex-shrink: 1
  487. .field
  488. margin-bottom: 0
  489. & > .field
  490. flex-shrink: 1
  491. &:not(.is-narrow)
  492. flex-grow: 1
  493. &:not(:last-child)
  494. margin-right: 0.75rem
  495. .control
  496. font-size: $size-normal
  497. position: relative
  498. text-align: left
  499. // Modifiers
  500. // DEPRECATED
  501. &.has-icon
  502. .icon
  503. color: $input-icon-color
  504. height: 2.25em
  505. pointer-events: none
  506. position: absolute
  507. top: 0
  508. width: 2.25em
  509. z-index: 4
  510. .input
  511. &:focus
  512. & + .icon
  513. color: $input-icon-active-color
  514. &.is-small
  515. & + .icon
  516. font-size: $size-small
  517. &.is-medium
  518. & + .icon
  519. font-size: $size-medium
  520. &.is-large
  521. & + .icon
  522. font-size: $size-large
  523. &:not(.has-icon-right)
  524. .icon
  525. left: 0
  526. .input
  527. padding-left: 2.25em
  528. &.has-icon-right
  529. .icon
  530. right: 0
  531. .input
  532. padding-right: 2.25em
  533. &.has-icons-left,
  534. &.has-icons-right
  535. .input,
  536. .select
  537. &:focus
  538. & ~ .icon
  539. color: $input-icon-active-color
  540. &.is-small ~ .icon
  541. font-size: $size-small
  542. &.is-medium ~ .icon
  543. font-size: $size-medium
  544. &.is-large ~ .icon
  545. font-size: $size-large
  546. .icon
  547. color: $input-icon-color
  548. height: 2.25em
  549. pointer-events: none
  550. position: absolute
  551. top: 0
  552. width: 2.25em
  553. z-index: 4
  554. &.has-icons-left
  555. .input,
  556. .select select
  557. padding-left: 2.25em
  558. .icon.is-left
  559. left: 0
  560. &.has-icons-right
  561. .input,
  562. .select select
  563. padding-right: 2.25em
  564. .icon.is-right
  565. right: 0
  566. &.is-loading
  567. &::after
  568. +loader
  569. position: absolute !important
  570. right: 0.625em
  571. top: 0.625em
  572. &.is-small:after
  573. font-size: $size-small
  574. &.is-medium:after
  575. font-size: $size-medium
  576. &.is-large:after
  577. font-size: $size-large