2
0

_forms.scss 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. // These are the generic stylings for forms of any type.
  2. // If you're styling something specific to the page editing interface,
  3. // it probably ought to go in layouts/page-editor.scss
  4. form {
  5. ul,
  6. li {
  7. list-style-type: none;
  8. }
  9. ul {
  10. margin: 0;
  11. padding: 0;
  12. }
  13. }
  14. fieldset {
  15. border: 0;
  16. padding: 0 0 2em;
  17. margin: 0;
  18. }
  19. legend {
  20. @include visuallyhidden();
  21. }
  22. label,
  23. .label {
  24. text-transform: none;
  25. font-weight: bold;
  26. color: $color-grey-1;
  27. font-size: 1.1em;
  28. display: block;
  29. padding: 0 0 0.8em;
  30. margin: 0;
  31. line-height: 1.3em;
  32. .checkbox &,
  33. .radio & {
  34. display: inline;
  35. }
  36. &.no-float {
  37. float: none;
  38. }
  39. &.disabled {
  40. opacity: 0.7;
  41. cursor: not-allowed;
  42. }
  43. @include media-breakpoint-up(sm) {
  44. @include column(2);
  45. padding-top: 1.2em;
  46. padding-left: 0;
  47. .radio_select &,
  48. .multiple_choice_field &,
  49. .model_multiple_choice_field &,
  50. .checkbox_select_multiple &,
  51. .boolean_field &,
  52. .model_choice_field &,
  53. .image_field & {
  54. padding-top: 0;
  55. }
  56. // Horrid specificity war
  57. .model_choice_field.select & {
  58. padding-top: 1.2em;
  59. }
  60. }
  61. }
  62. // Provide a way to "unfloat" all form elements
  63. .no-float-elements {
  64. label,
  65. .label {
  66. display: block;
  67. float: none;
  68. padding: 1.2em 0 0.8em;
  69. width: auto;
  70. }
  71. li > label,
  72. li > .label {
  73. padding-top: 0;
  74. }
  75. .helptext {
  76. display: inline-block;
  77. margin-bottom: 0.8em;
  78. }
  79. }
  80. input:not([type=submit]),
  81. textarea,
  82. select,
  83. .halloeditor,
  84. .tagit {
  85. appearance: none;
  86. box-sizing: border-box;
  87. border-radius: 6px;
  88. width: 100%;
  89. font-family: Open Sans,Arial,sans-serif;
  90. border: 1px solid $color-input-border;
  91. padding: 0.9em 1.2em;
  92. background-color: $color-fieldset-hover;
  93. color: $color-text-input;
  94. font-size: 1.2em;
  95. font-weight: 300;
  96. &:hover {
  97. background-color: $color-white;
  98. }
  99. &:focus {
  100. background-color: $color-input-focus;
  101. border-color: $color-input-focus-border;
  102. }
  103. &:disabled,
  104. &[disabled],
  105. &:disabled:hover,
  106. &[disabled]:hover {
  107. background-color: $color-grey-4;
  108. cursor: not-allowed;
  109. color: $color-grey-2;
  110. }
  111. }
  112. @media (forced-colors: $media-forced-colours) {
  113. .tagit,
  114. .field-content .tagit .tagit-choice,
  115. .tagit .tagit-new .ui-widget-content {
  116. box-shadow: inset 1000px 0 0 0 $color-black;
  117. color: $color-white;
  118. forced-color-adjust: none;
  119. }
  120. .tagit span.tagit-label:before,
  121. .tagit span.tagit-label {
  122. color: $color-black;
  123. forced-color-adjust: none;
  124. }
  125. }
  126. // Reset the arrow on `<select>`s in IE10+.
  127. select::-ms-expand {
  128. display: none;
  129. }
  130. .file_field {
  131. .input {
  132. label {
  133. float: none;
  134. display: inline;
  135. padding: 0;
  136. }
  137. input[type=checkbox] {
  138. margin-top: 5px;
  139. }
  140. a {
  141. &:after {
  142. content: ' ';
  143. display: block;
  144. }
  145. }
  146. }
  147. }
  148. // radio and check boxes
  149. input[type=radio],
  150. input[type=checkbox] {
  151. border-radius: 0;
  152. cursor: pointer;
  153. border: 0;
  154. padding: 0;
  155. }
  156. input[type=radio] {
  157. height: 12px;
  158. width: auto;
  159. position: relative;
  160. margin-right: 27px;
  161. }
  162. input[type=radio]:before {
  163. border-radius: 100%;
  164. font-family: wagtail;
  165. font-style: normal;
  166. text-align: center;
  167. position: absolute;
  168. top: -5px;
  169. left: -2px;
  170. cursor: pointer;
  171. display: block;
  172. content: map-get($icons, 'radio-full');
  173. width: 1em;
  174. height: 1em;
  175. line-height: 1.1em;
  176. padding: 4px;
  177. background-color: $color-white;
  178. color: $color-grey-4;
  179. border: 1px solid $color-grey-4;
  180. }
  181. input[type=radio]:checked:before {
  182. content: map-get($icons, 'radio-full');
  183. color: $color-teal;
  184. }
  185. input[type=checkbox] {
  186. height: 12px;
  187. width: 22px;
  188. position: relative;
  189. margin-right: 5px;
  190. }
  191. input[type=checkbox]:before {
  192. font-family: wagtail;
  193. font-style: normal;
  194. text-align: center;
  195. position: absolute;
  196. top: -5px;
  197. cursor: pointer;
  198. display: block;
  199. content: '';
  200. line-height: 20px;
  201. width: 20px;
  202. height: 20px;
  203. background-color: $color-white;
  204. border: 1px solid $color-grey-4;
  205. color: $color-teal;
  206. }
  207. input[type=checkbox]:checked:before {
  208. content: map-get($icons, 'tick');
  209. }
  210. input[type=checkbox][disabled]:before {
  211. cursor: not-allowed;
  212. }
  213. // Special styles to counteract Firefox's completely unwarranted assumptions about button styles
  214. input[type=submit],
  215. input[type=reset],
  216. input[type=button],
  217. button {
  218. padding: 0 1em;
  219. @include media-breakpoint-up(sm) {
  220. &.button-small {
  221. height: 2em;
  222. }
  223. }
  224. }
  225. // Transitions
  226. fieldset,
  227. input,
  228. textarea,
  229. select {
  230. @include transition(background-color 0.2s ease);
  231. }