_forms.scss 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. @use 'sass:map';
  2. @use 'sass:math';
  3. // Layouts for particular kinds of of fields
  4. // This is expected to go on the parent of the input/select/textarea
  5. // so in most cases .input
  6. .iconfield, // generic
  7. .date_field,
  8. .time_field,
  9. .date_time_field,
  10. .url_field {
  11. .input {
  12. position: relative;
  13. &:before,
  14. &:after {
  15. font-family: $font-wagtail-icons;
  16. display: flex;
  17. flex-flow: row nowrap;
  18. align-items: center;
  19. position: absolute;
  20. top: 0;
  21. height: 100%;
  22. line-height: 100%;
  23. font-size: 2em;
  24. color: theme('colors.grey.200');
  25. }
  26. &:before {
  27. inset-inline-start: 0.3em;
  28. }
  29. &:after {
  30. inset-inline-end: 0.5em;
  31. }
  32. }
  33. input {
  34. padding-inline-start: 2.5em;
  35. }
  36. // smaller fields required slight repositioning of icons
  37. &.field-small {
  38. .input {
  39. &:before,
  40. &:after {
  41. font-size: 1.3rem; // REMs are necessary here because IE doesn't treat generated content correctly
  42. }
  43. &:before {
  44. inset-inline-start: 0.5em;
  45. }
  46. &:after {
  47. inset-inline-end: 0.5em;
  48. }
  49. }
  50. }
  51. // special case for search spinners
  52. &.icon-spinner:after {
  53. color: $color-teal;
  54. opacity: 0.8;
  55. text-align: center;
  56. top: 0.3em;
  57. }
  58. }
  59. .date_field,
  60. .date_time_field {
  61. .input:before {
  62. content: map.get($icons, 'date'); // UI-Redesign: To be removed
  63. }
  64. }
  65. .time_field {
  66. .input:before {
  67. content: map.get($icons, 'time'); // UI-Redesign: To be removed
  68. }
  69. }
  70. .url_field {
  71. .input:before {
  72. content: map.get($icons, 'link'); // UI-Redesign: To be removed
  73. }
  74. }
  75. .fields > li,
  76. .field-col {
  77. @include clearfix();
  78. padding-top: 0.5em;
  79. padding-bottom: 1.2em;
  80. list-style: none;
  81. }
  82. .field-row {
  83. @include clearfix();
  84. // negative margin the bottom so it doesn't add too much space
  85. margin-bottom: -1.2em;
  86. }
  87. .input {
  88. clear: both;
  89. }
  90. // field sizing and alignment
  91. .field-small {
  92. input,
  93. textarea,
  94. select,
  95. .tagit {
  96. border-radius: 3px;
  97. padding: 0.4em 1em;
  98. }
  99. }
  100. .field {
  101. &.col1,
  102. &.col2,
  103. &.col3,
  104. &.col4,
  105. &.col5,
  106. &.col6,
  107. &.col7,
  108. &.col8,
  109. &.col9,
  110. &.col10,
  111. &.col11,
  112. &.col12 {
  113. clear: both;
  114. }
  115. }
  116. li.inline .field {
  117. &.col1,
  118. &.col2,
  119. &.col3,
  120. &.col4,
  121. &.col5,
  122. &.col6,
  123. &.col7,
  124. &.col8,
  125. &.col9,
  126. &.col10,
  127. &.col11,
  128. &.col12 {
  129. clear: none;
  130. }
  131. }
  132. // solve gutter issues of inline fields
  133. ul.inline li:first-child,
  134. li.inline:first-child {
  135. margin-inline-start: math.div(-$grid-gutter-width, 2);
  136. }
  137. @include media-breakpoint-up(sm) {
  138. .fields {
  139. max-width: 800px;
  140. }
  141. .field {
  142. @include row();
  143. }
  144. .field-content {
  145. @include column(10, 0);
  146. }
  147. .field-col {
  148. float: left;
  149. padding-inline-start: 0;
  150. // anything less than 4 columns or greater than 6 is impractical
  151. &.col4 {
  152. label {
  153. @include column(2, 0, 4);
  154. }
  155. .field-content {
  156. @include column(2, $padding, 4);
  157. padding-inline-start: 0;
  158. }
  159. }
  160. &.col6 {
  161. label {
  162. @include column(2, 0, 6);
  163. }
  164. .field-content {
  165. @include column(4, $padding, 6);
  166. padding-inline-start: 0;
  167. }
  168. }
  169. }
  170. .label-above {
  171. .field > label,
  172. .field > .field-content {
  173. display: block;
  174. padding: 0 0 0.8em;
  175. float: none;
  176. width: auto;
  177. }
  178. }
  179. }