_forms.scss 4.2 KB

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