_form.scss 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. /**
  2. * Forms
  3. * --------------------------------------------------
  4. */
  5. // Make all forms have space below them
  6. form {
  7. margin: 0 0 $line-height-base;
  8. }
  9. // Groups of fields with labels on top (legends)
  10. legend {
  11. display: block;
  12. margin-bottom: $line-height-base;
  13. padding: 0;
  14. width: 100%;
  15. border: $input-border-width solid $input-border;
  16. color: $dark;
  17. font-size: $font-size-base * 1.5;
  18. line-height: $line-height-base * 2;
  19. small {
  20. color: $stable;
  21. font-size: $line-height-base * .75;
  22. }
  23. }
  24. // Set font for forms
  25. label,
  26. input,
  27. button,
  28. select,
  29. textarea {
  30. @include font-shorthand($font-size-base, normal, $line-height-base); // Set size, weight, line-height here
  31. }
  32. input,
  33. button,
  34. select,
  35. textarea {
  36. font-family: $font-family-base; // And only set font-family here for those that need it (note the missing label element)
  37. }
  38. // Input List
  39. // -------------------------------
  40. .item-input {
  41. @include display-flex();
  42. @include align-items(center);
  43. position: relative;
  44. overflow: hidden;
  45. padding: 6px 0 5px 16px;
  46. input {
  47. @include border-radius(0);
  48. @include flex(1, 220px);
  49. @include appearance(none);
  50. margin: 0;
  51. padding-right: 24px;
  52. background-color: transparent;
  53. }
  54. .button .icon {
  55. @include flex(0, 0, 24px);
  56. position: static;
  57. display: inline-block;
  58. height: auto;
  59. text-align: center;
  60. font-size: 16px;
  61. }
  62. .button-bar {
  63. @include border-radius(0);
  64. @include flex(1, 0, 220px);
  65. @include appearance(none);
  66. }
  67. .icon {
  68. min-width: 14px;
  69. }
  70. }
  71. // prevent flex-shrink on WP
  72. .platform-windowsphone .item-input input{
  73. flex-shrink: 1;
  74. }
  75. .item-input-inset {
  76. @include display-flex();
  77. @include align-items(center);
  78. position: relative;
  79. overflow: hidden;
  80. padding: ($item-padding / 3) * 2;
  81. }
  82. .item-input-wrapper {
  83. @include display-flex();
  84. @include flex(1, 0);
  85. @include align-items(center);
  86. @include border-radius(4px);
  87. padding-right: 8px;
  88. padding-left: 8px;
  89. background: #eee;
  90. }
  91. .item-input-inset .item-input-wrapper input {
  92. padding-left: 4px;
  93. height: 29px;
  94. background: transparent;
  95. line-height: 18px;
  96. }
  97. .item-input-wrapper ~ .button {
  98. margin-left: ($item-padding / 3) * 2;
  99. }
  100. .input-label {
  101. display: table;
  102. padding: 7px 10px 7px 0px;
  103. max-width: 200px;
  104. width: 35%;
  105. color: $input-label-color;
  106. font-size: 16px;
  107. }
  108. .placeholder-icon {
  109. color: #aaa;
  110. &:first-child {
  111. padding-right: 6px;
  112. }
  113. &:last-child {
  114. padding-left: 6px;
  115. }
  116. }
  117. .item-stacked-label {
  118. display: block;
  119. background-color: transparent;
  120. box-shadow: none;
  121. .input-label, .icon {
  122. display: inline-block;
  123. padding: 4px 0 0 0px;
  124. vertical-align: middle;
  125. }
  126. }
  127. .item-stacked-label input,
  128. .item-stacked-label textarea {
  129. @include border-radius(2px);
  130. padding: 4px 8px 3px 0;
  131. border: none;
  132. background-color: $input-bg;
  133. }
  134. .item-stacked-label input {
  135. overflow: hidden;
  136. height: $line-height-computed + $font-size-base + 12px;
  137. }
  138. .item-select.item-stacked-label select {
  139. position: relative;
  140. padding: 0px;
  141. max-width: 90%;
  142. direction:ltr;
  143. white-space: pre-wrap;
  144. margin: -3px;
  145. }
  146. .item-floating-label {
  147. display: block;
  148. background-color: transparent;
  149. box-shadow: none;
  150. .input-label {
  151. position: relative;
  152. padding: 5px 0 0 0;
  153. opacity: 0;
  154. top: 10px;
  155. @include transition(opacity .15s ease-in, top .2s linear);
  156. &.has-input {
  157. opacity: 1;
  158. top: 0;
  159. @include transition(opacity .15s ease-in, top .2s linear);
  160. }
  161. }
  162. }
  163. // Form Controls
  164. // -------------------------------
  165. // Shared size and type resets
  166. textarea,
  167. input[type="text"],
  168. input[type="password"],
  169. input[type="datetime"],
  170. input[type="datetime-local"],
  171. input[type="date"],
  172. input[type="month"],
  173. input[type="time"],
  174. input[type="week"],
  175. input[type="number"],
  176. input[type="email"],
  177. input[type="url"],
  178. input[type="search"],
  179. input[type="tel"],
  180. input[type="color"] {
  181. display: block;
  182. padding-top: 2px;
  183. padding-left: 0;
  184. height: $line-height-computed + $font-size-base;
  185. color: $input-color;
  186. vertical-align: middle;
  187. font-size: $font-size-base;
  188. line-height: $font-size-base + 2;
  189. }
  190. .platform-ios,
  191. .platform-android {
  192. input[type="datetime-local"],
  193. input[type="date"],
  194. input[type="month"],
  195. input[type="time"],
  196. input[type="week"] {
  197. padding-top: 8px;
  198. }
  199. }
  200. .item-input {
  201. input,
  202. textarea {
  203. width: 100%;
  204. }
  205. }
  206. textarea {
  207. padding-left: 0;
  208. @include placeholder($input-color-placeholder, -3px);
  209. }
  210. // Reset height since textareas have rows
  211. textarea {
  212. height: auto;
  213. }
  214. // Everything else
  215. textarea,
  216. input[type="text"],
  217. input[type="password"],
  218. input[type="datetime"],
  219. input[type="datetime-local"],
  220. input[type="date"],
  221. input[type="month"],
  222. input[type="time"],
  223. input[type="week"],
  224. input[type="number"],
  225. input[type="email"],
  226. input[type="url"],
  227. input[type="search"],
  228. input[type="tel"],
  229. input[type="color"] {
  230. border: 0;
  231. }
  232. // Position radios and checkboxes better
  233. input[type="radio"],
  234. input[type="checkbox"] {
  235. margin: 0;
  236. line-height: normal;
  237. }
  238. // Reset width of input images, buttons, radios, checkboxes
  239. .item-input {
  240. input[type="file"],
  241. input[type="image"],
  242. input[type="submit"],
  243. input[type="reset"],
  244. input[type="button"],
  245. input[type="radio"],
  246. input[type="checkbox"] {
  247. width: auto; // Override of generic input selector
  248. }
  249. }
  250. // Set the height of file to match text inputs
  251. input[type="file"] {
  252. line-height: $input-height-base;
  253. }
  254. // Text input classes to hide text caret during scroll
  255. .previous-input-focus,
  256. .cloned-text-input + input,
  257. .cloned-text-input + textarea {
  258. position: absolute !important;
  259. left: -9999px;
  260. width: 200px;
  261. }
  262. // Placeholder
  263. // -------------------------------
  264. input,
  265. textarea {
  266. @include placeholder();
  267. }
  268. // DISABLED STATE
  269. // -------------------------------
  270. // Disabled and read-only inputs
  271. input[disabled],
  272. select[disabled],
  273. textarea[disabled],
  274. input[readonly]:not(.cloned-text-input),
  275. textarea[readonly]:not(.cloned-text-input),
  276. select[readonly] {
  277. background-color: $input-bg-disabled;
  278. cursor: not-allowed;
  279. }
  280. // Explicitly reset the colors here
  281. input[type="radio"][disabled],
  282. input[type="checkbox"][disabled],
  283. input[type="radio"][readonly],
  284. input[type="checkbox"][readonly] {
  285. background-color: transparent;
  286. }