_dropdown.legacy.scss 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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: left;
  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. inset-inline-start: -2000px;
  33. z-index: 500;
  34. opacity: 0;
  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. // stylelint-disable-next-line max-nesting-depth
  79. &:before,
  80. &:after {
  81. inset-inline-end: 1em;
  82. }
  83. }
  84. &.shortcut {
  85. padding-inline-end: 7em;
  86. }
  87. }
  88. a,
  89. input[type='submit'],
  90. input[type='reset'],
  91. input[type='button'],
  92. .button,
  93. button {
  94. border-radius: 0;
  95. -webkit-font-smoothing: auto;
  96. }
  97. label {
  98. padding: 1.3em;
  99. }
  100. .kbd {
  101. position: absolute;
  102. inset-inline-end: 1em;
  103. font-weight: 600;
  104. font-size: 0.8em;
  105. color: theme('colors.black-20');
  106. }
  107. }
  108. &.open ul {
  109. box-shadow: 0 3px 3px 0 theme('colors.black-20');
  110. opacity: 1;
  111. inset-inline-start: 0;
  112. display: block;
  113. }
  114. &.match-width ul {
  115. width: 100%;
  116. min-width: 110px;
  117. li {
  118. white-space: nowrap;
  119. }
  120. }
  121. &.dropup ul {
  122. box-shadow: 0 -3px 3px 0 theme('colors.black-20');
  123. top: auto;
  124. bottom: 100%;
  125. li {
  126. border-width: 0 0 1px;
  127. }
  128. }
  129. .dropdown-toggle {
  130. color: theme('colors.text-button');
  131. background-color: theme('colors.surface-button-default');
  132. line-height: 2.8em;
  133. cursor: pointer;
  134. height: 100%;
  135. border-inline-start: 1px solid theme('colors.white-15');
  136. position: absolute;
  137. inset-inline-end: 0;
  138. padding: 0 0.5em;
  139. text-align: center;
  140. &:before,
  141. &:after {
  142. margin: 0;
  143. }
  144. &:before {
  145. width: 1em;
  146. font-size: 1.2rem;
  147. }
  148. &:hover {
  149. background-color: theme('colors.surface-button-hover');
  150. }
  151. svg.icon {
  152. // TODO: remove svg qualifier once the icon font styles are gone
  153. @include svg-icon(1.3em);
  154. }
  155. }
  156. .bicolor + .dropdown-toggle {
  157. background-color: theme('colors.surface-button-hover');
  158. }
  159. &.open .dropdown-toggle {
  160. background-color: theme('colors.surface-button-hover');
  161. }
  162. .bicolor:hover {
  163. background-color: theme('colors.surface-button-hover');
  164. }
  165. // Styles for dropdowns which are also buttons e.g page editor
  166. &.dropdown-button {
  167. // Media for Windows High Contrast
  168. @media (forced-colors: active) {
  169. button {
  170. border-color: ActiveText;
  171. }
  172. button:hover {
  173. border-color: Highlight;
  174. }
  175. a.button.bicolor.button:hover {
  176. border-color: Highlight;
  177. }
  178. }
  179. .dropdown-toggle {
  180. border-radius: 0 3px 3px 0;
  181. // Media for Windows High Contrast
  182. @media (forced-colors: active) {
  183. background: transparent;
  184. border: 1px solid ActiveText;
  185. }
  186. }
  187. .dropdown-toggle:hover {
  188. // Media for Windows High Contrast
  189. @media (forced-colors: active) {
  190. background-color: transparent;
  191. border: 1px solid Highlight;
  192. }
  193. }
  194. &.open {
  195. > input[type='button'],
  196. > input[type='submit'],
  197. > button,
  198. > .button {
  199. border-radius: 3px 3px 0 0;
  200. }
  201. .dropdown-toggle {
  202. border-radius: 0 3px 0 0;
  203. }
  204. }
  205. }
  206. &.dropup.dropdown-button {
  207. &.open {
  208. > input[type='button'],
  209. > input[type='submit'],
  210. > button,
  211. > .button {
  212. border-radius: 0 0 3px 3px;
  213. }
  214. .dropdown-toggle {
  215. border-radius: 0 0 3px;
  216. }
  217. }
  218. }
  219. }
  220. .dropdown.white {
  221. ul {
  222. background-color: theme('colors.surface-page');
  223. li {
  224. border-top: 1px solid theme('colors.black-10');
  225. }
  226. a {
  227. color: theme('colors.text-meta');
  228. &:hover {
  229. background-color: theme('colors.text-context');
  230. }
  231. }
  232. }
  233. }
  234. .dropdown.warning {
  235. ul {
  236. background-color: theme('colors.warning.100');
  237. }
  238. .dropdown-toggle {
  239. background-color: theme('colors.warning.100');
  240. }
  241. }
  242. // Transitions
  243. // stylelint-disable-next-line no-duplicate-selectors
  244. .dropdown ul {
  245. @include transition(opacity 0.2s linear);
  246. }
  247. .dropdown-button {
  248. .button svg.icon {
  249. // TODO: leave only class when iconfont styles are removed
  250. @include svg-icon();
  251. }
  252. }