_dropdown.legacy.scss 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. .dropdown {
  2. @include clearfix();
  3. position: relative;
  4. input[type='submit'],
  5. input[type='reset'],
  6. input[type='button'],
  7. button,
  8. .button {
  9. padding: 0 5em 0 1em;
  10. display: block;
  11. width: 100%;
  12. height: 3em;
  13. line-height: 3em;
  14. text-align: start;
  15. float: inline-start;
  16. }
  17. .action-secondary {
  18. opacity: 0.8;
  19. }
  20. input[type='submit'],
  21. input[type='reset'],
  22. input[type='button'],
  23. button {
  24. line-height: inherit;
  25. }
  26. ul {
  27. @include unlist();
  28. background-color: theme('colors.surface-button-default');
  29. position: absolute;
  30. overflow: hidden;
  31. top: 100%;
  32. z-index: 500;
  33. opacity: 0;
  34. pointer-events: none;
  35. li {
  36. float: none;
  37. border-color: theme('colors.white-15');
  38. border-style: solid;
  39. border-width: 1px 0 0;
  40. overflow: hidden;
  41. a:focus,
  42. button:focus {
  43. border: 3px solid theme('colors.focus');
  44. }
  45. }
  46. // Media for Windows High Contrast
  47. @media (forced-colors: active) {
  48. li {
  49. border-width: 1px;
  50. }
  51. li:hover {
  52. border-color: Highlight;
  53. }
  54. li a,
  55. li button {
  56. border-color: theme('colors.text-button');
  57. color: theme('colors.text-button');
  58. }
  59. li a:focus,
  60. li button:focus {
  61. border: 4px solid currentColor;
  62. color: theme('colors.text-button');
  63. }
  64. }
  65. a {
  66. white-space: nowrap;
  67. position: relative;
  68. text-decoration: none;
  69. display: block;
  70. color: theme('colors.text-button');
  71. padding: 1em;
  72. font-weight: normal;
  73. &:hover {
  74. background-color: theme('colors.surface-button-hover');
  75. }
  76. &.icon {
  77. padding-inline-end: 5em;
  78. }
  79. &.shortcut {
  80. padding-inline-end: 7em;
  81. }
  82. }
  83. a,
  84. input[type='submit'],
  85. input[type='reset'],
  86. input[type='button'],
  87. .button,
  88. button {
  89. border-radius: 0;
  90. -webkit-font-smoothing: auto;
  91. }
  92. label {
  93. padding: 1.3em;
  94. }
  95. .kbd {
  96. position: absolute;
  97. inset-inline-end: 1em;
  98. font-weight: 600;
  99. font-size: 0.8em;
  100. color: theme('colors.black-20');
  101. }
  102. }
  103. &.open ul {
  104. box-shadow: 0 3px 3px 0 theme('colors.black-20');
  105. opacity: 1;
  106. pointer-events: initial;
  107. display: block;
  108. }
  109. &.match-width ul {
  110. width: 100%;
  111. min-width: 110px;
  112. li {
  113. white-space: nowrap;
  114. }
  115. }
  116. &.dropup ul {
  117. box-shadow: 0 -3px 3px 0 theme('colors.black-20');
  118. top: auto;
  119. bottom: 100%;
  120. li {
  121. border-width: 0 0 1px;
  122. }
  123. }
  124. .dropdown-toggle {
  125. color: theme('colors.text-button');
  126. background-color: theme('colors.surface-button-default');
  127. line-height: 2.8em;
  128. cursor: pointer;
  129. height: 100%;
  130. border-inline-start: 1px solid theme('colors.white-15');
  131. position: absolute;
  132. inset-inline-end: 0;
  133. padding: 0 0.5em;
  134. text-align: center;
  135. &:hover {
  136. background-color: theme('colors.surface-button-hover');
  137. }
  138. .icon {
  139. @include svg-icon(1.3em);
  140. }
  141. }
  142. .bicolor + .dropdown-toggle {
  143. background-color: theme('colors.surface-button-hover');
  144. }
  145. &.open .dropdown-toggle {
  146. background-color: theme('colors.surface-button-hover');
  147. }
  148. .bicolor:hover {
  149. background-color: theme('colors.surface-button-hover');
  150. }
  151. // Styles for dropdowns which are also buttons e.g page editor
  152. &.dropdown-button {
  153. // Media for Windows High Contrast
  154. @media (forced-colors: active) {
  155. button {
  156. border-color: ActiveText;
  157. }
  158. button:hover {
  159. border-color: Highlight;
  160. }
  161. a.button.bicolor.button:hover {
  162. border-color: Highlight;
  163. }
  164. }
  165. .dropdown-toggle {
  166. border-radius: 0 3px 3px 0;
  167. // Media for Windows High Contrast
  168. @media (forced-colors: active) {
  169. background: transparent;
  170. border: 1px solid ActiveText;
  171. }
  172. }
  173. .dropdown-toggle:hover {
  174. // Media for Windows High Contrast
  175. @media (forced-colors: active) {
  176. background-color: transparent;
  177. border: 1px solid Highlight;
  178. }
  179. }
  180. &.open {
  181. > input[type='button'],
  182. > input[type='submit'],
  183. > button,
  184. > .button {
  185. border-radius: 3px 3px 0 0;
  186. }
  187. .dropdown-toggle {
  188. border-radius: 0 3px 0 0;
  189. }
  190. }
  191. }
  192. &.dropup.dropdown-button {
  193. &.open {
  194. > input[type='button'],
  195. > input[type='submit'],
  196. > button,
  197. > .button {
  198. border-radius: 0 0 3px 3px;
  199. }
  200. .dropdown-toggle {
  201. border-radius: 0 0 3px;
  202. }
  203. }
  204. }
  205. }
  206. .dropdown.white {
  207. ul {
  208. background-color: theme('colors.surface-page');
  209. li {
  210. border-top: 1px solid theme('colors.black-10');
  211. }
  212. a {
  213. color: theme('colors.text-meta');
  214. &:hover {
  215. background-color: theme('colors.text-context');
  216. }
  217. }
  218. }
  219. }
  220. .dropdown.warning {
  221. ul {
  222. background-color: theme('colors.warning.100');
  223. }
  224. .dropdown-toggle {
  225. background-color: theme('colors.warning.100');
  226. }
  227. }
  228. // Transitions
  229. // stylelint-disable-next-line no-duplicate-selectors
  230. .dropdown ul {
  231. @include transition(opacity 0.2s linear);
  232. }
  233. .dropdown-button {
  234. .button .icon {
  235. @include svg-icon();
  236. }
  237. }