_forms.scss 4.4 KB

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