_forms.scss 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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. .file_field {
  110. .input {
  111. label {
  112. float: none;
  113. display: inline;
  114. padding: 0;
  115. }
  116. input[type='checkbox'] {
  117. margin-top: 5px;
  118. }
  119. a {
  120. &:after {
  121. content: ' ';
  122. display: block;
  123. }
  124. }
  125. }
  126. }
  127. // radio and check boxes
  128. input[type='radio'],
  129. input[type='checkbox'] {
  130. border-radius: 0;
  131. cursor: pointer;
  132. border: 0;
  133. padding: 0;
  134. }
  135. input[type='radio'] {
  136. height: 12px;
  137. width: auto;
  138. position: relative;
  139. margin-right: 27px;
  140. }
  141. input[type='radio']:before {
  142. border-radius: 100%;
  143. font-family: $font-wagtail-icons;
  144. font-style: normal;
  145. text-align: center;
  146. position: absolute;
  147. top: -5px;
  148. left: -2px;
  149. cursor: pointer;
  150. display: block;
  151. content: map.get($icons, 'radio-full');
  152. width: 1em;
  153. height: 1em;
  154. line-height: 1.1em;
  155. padding: 4px;
  156. background-color: $color-white;
  157. color: $color-grey-4;
  158. border: 1px solid $color-grey-4;
  159. }
  160. input[type='radio']:checked:before {
  161. content: map.get($icons, 'radio-full');
  162. color: $color-teal;
  163. }
  164. input[type='checkbox'] {
  165. height: 12px;
  166. width: 22px;
  167. position: relative;
  168. margin-right: 5px;
  169. }
  170. input[type='checkbox']:before {
  171. font-family: $font-wagtail-icons;
  172. font-style: normal;
  173. text-align: center;
  174. position: absolute;
  175. top: -5px;
  176. cursor: pointer;
  177. display: block;
  178. content: '';
  179. line-height: 20px;
  180. width: 20px;
  181. height: 20px;
  182. background-color: $color-white;
  183. border: 1px solid $color-grey-4;
  184. color: $color-teal;
  185. }
  186. input[type='checkbox']:checked:before {
  187. content: map.get($icons, 'tick');
  188. }
  189. input[type='checkbox'][disabled]:before {
  190. cursor: not-allowed;
  191. }
  192. // Special styles to counteract Firefox's completely unwarranted assumptions about button styles
  193. input[type='submit'],
  194. input[type='reset'],
  195. input[type='button'],
  196. button {
  197. padding: 0 1em;
  198. @include media-breakpoint-up(sm) {
  199. &.button-small {
  200. height: 2em;
  201. }
  202. }
  203. }
  204. // Transitions
  205. fieldset,
  206. input,
  207. textarea,
  208. select {
  209. @include transition(background-color 0.2s ease);
  210. }