2
0

_forms.scss 4.6 KB

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