You are here

dropbutton.css in Drupal 10

Dropbutton styles.

File

core/themes/olivero/css/components/dropbutton.css
View source
  1. /*
  2. * DO NOT EDIT THIS FILE.
  3. * See the following change record for more information,
  4. * https://www.drupal.org/node/3084859
  5. * @preserve
  6. */
  7. /**
  8. * @file
  9. * Dropbutton styles.
  10. */
  11. .dropbutton-wrapper {
  12. --dropbutton--height: var(--sp1-5);
  13. --dropbutton--secondary-bg-color: var(--color--white);
  14. --dropbutton--active-bg-color: var(--color--gray-90);
  15. --dropbutton--outline-color: var(--color--primary-40); /* Minimum 3:1 contrast ratio against --dropbutton--active-bg-color and --dropbutton--secondary-bg-color. */
  16. --dropbutton--border-radius: var(--border-radius);
  17. --dropbutton--font-size: var(--font-size-s);
  18. --dropbutton--text-color: var(--color-text-neutral-medium); /* Minimum 4.5:1 contrast ratio against --dropbutton--active-bg-color and --dropbutton--secondary-bg-color. */
  19. --dropbutton--text-hover-color: var(--color-text-primary-medium) /* Minimum 4.5:1 contrast ratio against --dropbutton--active-bg-color and --dropbutton--secondary-bg-color. */
  20. }
  21. .dropbutton-wrapper.open {
  22. position: relative;
  23. z-index: 100; /* Ensure this appears above all other dropbuttons. */
  24. filter: drop-shadow(0 2px 2px var(--dropbutton--active-bg-color));
  25. }
  26. [dir="ltr"] .dropbutton-widget {
  27. padding-right: var(--dropbutton--height);
  28. }
  29. [dir="rtl"] .dropbutton-widget {
  30. padding-left: var(--dropbutton--height);
  31. }
  32. .dropbutton-widget {
  33. position: relative;
  34. width: max-content;
  35. height: var(--dropbutton--height);
  36. border-radius: var(--dropbutton--border-radius)
  37. }
  38. [dir="ltr"] .dropbutton-single .dropbutton-widget {
  39. padding-right: 0;
  40. }
  41. [dir="rtl"] .dropbutton-single .dropbutton-widget {
  42. padding-left: 0;
  43. }
  44. .dropbutton-wrapper.open .dropbutton-widget {
  45. border-radius: var(--dropbutton--border-radius) var(--dropbutton--border-radius) 0 0
  46. }
  47. [dir="ltr"] .dropbutton {
  48. margin-left: 0;
  49. }
  50. [dir="rtl"] .dropbutton {
  51. margin-right: 0;
  52. }
  53. [dir="ltr"] .dropbutton {
  54. padding-left: 0;
  55. }
  56. [dir="rtl"] .dropbutton {
  57. padding-right: 0;
  58. }
  59. .dropbutton {
  60. height: var(--dropbutton--height);
  61. margin-top: 0;
  62. margin-bottom: 0;
  63. list-style: none;
  64. font-size: var(--dropbutton--font-size);
  65. }
  66. /* This is the button that expands/collapses the secondary options. */
  67. [dir="ltr"] .dropbutton-toggle button {
  68. right: 0;
  69. }
  70. [dir="rtl"] .dropbutton-toggle button {
  71. left: 0;
  72. }
  73. .dropbutton-toggle button {
  74. position: absolute;
  75. top: 0;
  76. display: flex;
  77. align-items: center;
  78. justify-content: center;
  79. width: var(--dropbutton--height);
  80. height: var(--dropbutton--height);
  81. padding: 0;
  82. cursor: pointer;
  83. border-color: transparent;
  84. border-radius: 0 var(--border-radius) var(--border-radius) 0; /* LTR */
  85. background: var(--dropbutton--active-bg-color)
  86. }
  87. .dropbutton-toggle button:focus {
  88. outline: solid 2px var(--dropbutton--outline-color);
  89. outline-offset: -2px;
  90. }
  91. .dropbutton-toggle button:before {
  92. display: block;
  93. width: var(--sp0-5);
  94. height: var(--sp0-5);
  95. content: "";
  96. transform: translateY(-25%) rotate(45deg);
  97. border-right: solid 2px var(--dropbutton--outline-color);
  98. border-bottom: solid 2px var(--dropbutton--outline-color)
  99. }
  100. .dropbutton-wrapper.open .dropbutton-toggle button:before {
  101. transform: translateY(25%) rotate(225deg)
  102. }
  103. [dir="rtl"] .dropbutton-toggle button {
  104. border-radius: var(--dropbutton--border-radius) 0 0 var(--dropbutton--border-radius);
  105. }
  106. /* This is the first
  107. element in the list of actions. */
  108. [dir="ltr"] .dropbutton-action:first-child {
  109. margin-right: 2px;
  110. }
  111. [dir="rtl"] .dropbutton-action:first-child {
  112. margin-left: 2px;
  113. }
  114. .dropbutton-action:first-child {
  115. border: solid 1px transparent;
  116. border-radius: var(--dropbutton--border-radius) 0 0 var(--dropbutton--border-radius); /* LTR */
  117. background: var(--dropbutton--active-bg-color)
  118. }
  119. [dir="rtl"] .dropbutton-action:first-child {
  120. border: solid 1px transparent;
  121. border-radius: 0 var(--dropbutton--border-radius) var(--dropbutton--border-radius) 0;
  122. }
  123. .dropbutton-action a {
  124. display: flex;
  125. align-items: center;
  126. margin-bottom: -2px; /* Account for borders. */
  127. padding: 0 0.5625rem;
  128. text-decoration: none;
  129. color: var(--dropbutton--text-color);
  130. font-weight: 600
  131. }
  132. .dropbutton-action a:hover {
  133. color: inherit;
  134. }
  135. .dropbutton-action a:focus {
  136. outline: solid 2px var(--dropbutton--outline-color);
  137. outline-offset: -1px; /* Overlap parent container by 1px. */
  138. }
  139. .dropbutton-action {
  140. /* Special rules if there is only one action. */
  141. }
  142. .dropbutton-single .dropbutton-action:first-child {
  143. border-right: solid 1px transparent; /* LTR */
  144. border-radius: var(--dropbutton--border-radius)
  145. }
  146. [dir="rtl"] .dropbutton-single .dropbutton-action:first-child {
  147. border: solid 1px transparent;
  148. }
  149. .dropbutton-single .dropbutton-action a {
  150. justify-content: center;
  151. }
  152. /* These are the
  153. elements other than the first. */
  154. .secondary-action {
  155. visibility: hidden;
  156. width: calc(100% + var(--dropbutton--height));
  157. border-right: 1px solid var(--dropbutton--active-bg-color);
  158. border-left: 1px solid var(--dropbutton--active-bg-color);
  159. background: var(--dropbutton--secondary-bg-color)
  160. }
  161. .secondary-action:last-child {
  162. border-bottom: 1px solid var(--dropbutton--active-bg-color);
  163. }
  164. .secondary-action a:hover {
  165. color: var(--dropbutton--text-hover-color);
  166. }
  167. .dropbutton-wrapper.open .secondary-action {
  168. visibility: visible
  169. }