_forms.scss 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. .tagit {
  67. appearance: none;
  68. box-sizing: border-box;
  69. border-radius: 6px;
  70. width: 100%;
  71. font-family: $font-sans;
  72. border: 1px solid $color-input-border;
  73. padding: 0.9em 1.2em;
  74. background-color: $color-fieldset-hover;
  75. color: $color-text-input;
  76. font-size: 1.2em;
  77. font-weight: 300;
  78. &:hover {
  79. background-color: $color-white;
  80. }
  81. &:focus {
  82. background-color: $color-input-focus;
  83. border-color: $color-input-focus-border;
  84. }
  85. &:disabled,
  86. &[disabled],
  87. &:disabled:hover,
  88. &[disabled]:hover {
  89. background-color: $color-grey-4;
  90. cursor: not-allowed;
  91. color: $color-grey-2;
  92. }
  93. }
  94. @media (forced-colors: $media-forced-colours) {
  95. .tagit,
  96. .field-content .tagit .tagit-choice,
  97. .tagit .tagit-new .ui-widget-content {
  98. box-shadow: inset 1000px 0 0 0 $color-black;
  99. color: $color-white;
  100. forced-color-adjust: none;
  101. }
  102. .tagit span.tagit-label:before,
  103. .tagit span.tagit-label {
  104. color: $color-black;
  105. forced-color-adjust: none;
  106. }
  107. }
  108. .file_field {
  109. .input {
  110. label {
  111. float: none;
  112. display: inline;
  113. padding: 0;
  114. }
  115. input[type='checkbox'] {
  116. margin-top: 5px;
  117. }
  118. a {
  119. &:after {
  120. content: ' ';
  121. display: block;
  122. }
  123. }
  124. }
  125. }
  126. // radio and check boxes
  127. input[type='radio'],
  128. input[type='checkbox'] {
  129. border-radius: 0;
  130. cursor: pointer;
  131. border: 0;
  132. padding: 0;
  133. }
  134. input[type='radio'] {
  135. height: 12px;
  136. width: auto;
  137. position: relative;
  138. margin-right: 27px;
  139. }
  140. input[type='radio']:before {
  141. border-radius: 100%;
  142. font-family: $font-wagtail-icons;
  143. font-style: normal;
  144. text-align: center;
  145. position: absolute;
  146. top: -5px;
  147. left: -2px;
  148. cursor: pointer;
  149. display: block;
  150. content: map.get($icons, 'radio-full');
  151. width: 1em;
  152. height: 1em;
  153. line-height: 1.1em;
  154. padding: 4px;
  155. background-color: $color-white;
  156. color: $color-grey-4;
  157. border: 1px solid $color-grey-4;
  158. }
  159. input[type='radio']:checked:before {
  160. content: map.get($icons, 'radio-full');
  161. color: $color-teal;
  162. }
  163. input[type='checkbox'] {
  164. height: 12px;
  165. width: 22px;
  166. position: relative;
  167. margin-right: 5px;
  168. }
  169. input[type='checkbox']:before {
  170. font-family: $font-wagtail-icons;
  171. font-style: normal;
  172. text-align: center;
  173. position: absolute;
  174. top: -5px;
  175. cursor: pointer;
  176. display: block;
  177. content: '';
  178. line-height: 20px;
  179. width: 20px;
  180. height: 20px;
  181. background-color: $color-white;
  182. border: 1px solid $color-grey-4;
  183. color: $color-teal;
  184. }
  185. input[type='checkbox']:checked:before {
  186. content: map.get($icons, 'tick');
  187. }
  188. input[type='checkbox'][disabled]:before {
  189. cursor: not-allowed;
  190. }
  191. // Special styles to counteract Firefox's completely unwarranted assumptions about button styles
  192. input[type='submit'],
  193. input[type='reset'],
  194. input[type='button'],
  195. button {
  196. padding: 0 1em;
  197. @include media-breakpoint-up(sm) {
  198. &.button-small {
  199. height: 2em;
  200. }
  201. }
  202. }
  203. // Transitions
  204. fieldset,
  205. input,
  206. textarea,
  207. select {
  208. @include transition(background-color 0.2s ease);
  209. }