details.pcss.css

Same filename in this branch
  1. 9 core/themes/claro/css/components/details.pcss.css
Same filename in other branches
  1. 8.9.x core/themes/claro/css/components/details.pcss.css
  2. 10 core/misc/dialog/off-canvas/css/details.pcss.css
  3. 10 core/themes/olivero/css/components/details.pcss.css
  4. 10 core/themes/claro/css/components/details.pcss.css
  5. 11.x core/misc/dialog/off-canvas/css/details.pcss.css
  6. 11.x core/themes/olivero/css/components/details.pcss.css
  7. 11.x core/themes/claro/css/components/details.pcss.css

Collapsible details.

File

core/themes/olivero/css/components/details.pcss.css

View source
  1. /**
  2. * @file
  3. * Collapsible details.
  4. */
  5. @import "../base/variables.pcss.css";
  6. :root {
  7. --details-border-width: 1px;
  8. --details-summary-transition: background-color 0.12s ease-in-out;
  9. }
  10. .olivero-details {
  11. display: block;
  12. margin-block: var(--sp1);
  13. color: inherit;
  14. border: var(--details-border-width) solid var(--color--gray-80);
  15. border-radius: var(--border-radius);
  16. box-shadow: 0 1px 4px var(--color--gray-70);
  17. }
  18. /* Details summary styles */
  19. .olivero-details__summary {
  20. position: relative;
  21. padding-block: var(--sp1);
  22. padding-inline-start: var(--sp2);
  23. padding-inline-end: var(--sp1);
  24. list-style: none;
  25. cursor: pointer;
  26. transition: var(--details-summary-transition);
  27. word-wrap: break-word;
  28. hyphens: auto;
  29. color: inherit;
  30. background-color: var(--color--gray-95);
  31. font-size: var(--line-height-s);
  32. font-weight: 700;
  33. line-height: var(--sp1);
  34. }
  35. /* Arrow icon */
  36. .olivero-details__summary:before,
  37. .collapse-processed > .olivero-details__summary .details-title:before {
  38. position: absolute;
  39. inset-block-start: 50%;
  40. inset-inline-start: var(--sp0-75);
  41. display: block;
  42. width: 10px;
  43. height: 10px;
  44. content: "";
  45. transform: translateY(-50%) rotate(45deg); /* LTR */
  46. border-top: solid 2px currentColor;
  47. border-right: solid 2px currentColor;
  48. }
  49. [dir="rtl"] {
  50. & .olivero-details__summary:before,
  51. & .collapse-processed > .olivero-details__summary .details-title:before {
  52. transform: translateY(-50%) rotate(-135deg);
  53. }
  54. }
  55. /* Pseudo-selector to manage focus styles */
  56. .olivero-details__summary:after,
  57. .collapse-processed > .olivero-details__summary .details-title:after {
  58. position: absolute;
  59. inset: calc(var(--details-border-width) * -1);
  60. content: "";
  61. pointer-events: none;
  62. opacity: 0;
  63. border-radius: var(--border-radius);
  64. box-shadow: inset 0 0 0 2px var(--color--blue-70);
  65. }
  66. /* Hide the marker */
  67. .olivero-details__summary::-webkit-details-marker {
  68. display: none;
  69. }
  70. /* Disable default outline for summary, since we have own implementation */
  71. .olivero-details__summary:focus {
  72. outline: solid 2px transparent;
  73. outline-offset: -4px;
  74. }
  75. /* Details summary, hover state */
  76. .olivero-details__summary:hover {
  77. background-color: var(--color--gray-80);
  78. }
  79. /* Details summary, focus and active states */
  80. .olivero-details__summary:focus:after,
  81. .olivero-details__summary:active:after,
  82. .collapse-processed > .olivero-details__summary .details-title:focus:after,
  83. .collapse-processed > .olivero-details__summary .details-title:active:after {
  84. opacity: 1;
  85. }
  86. /* Rotate arrow icon of the details summary, when details expanded */
  87. .olivero-details[open] > .olivero-details__summary::before,
  88. .collapse-processed[open] > .olivero-details__summary .details-title::before {
  89. margin-block-start: -2px;
  90. transform: translateY(-50%) rotate(135deg);
  91. }
  92. /* Collapse processed for non-supporting browsers like IE or Edge */
  93. .collapse-processed > .olivero-details__summary {
  94. padding-block: 0;
  95. padding-inline-start: 0;
  96. padding-inline-end: 0;
  97. &:before {
  98. content: none;
  99. }
  100. &:after {
  101. content: none;
  102. }
  103. }
  104. .collapse-processed > .olivero-details__summary .details-title {
  105. position: relative;
  106. display: block;
  107. padding-block: var(--sp1);
  108. padding-inline-start: var(--sp2);
  109. padding-inline-end: var(--sp1);
  110. transition: var(--details-summary-transition);
  111. text-decoration: none;
  112. color: inherit;
  113. background-color: var(--color--gray-95);
  114. }
  115. .collapse-processed > .olivero-details__summary .details-title:focus {
  116. outline: solid 2px transparent;
  117. }
  118. .collapse-processed > .olivero-details__summary .details-title:hover {
  119. background-color: var(--color--gray-80);
  120. }
  121. @media screen and (-ms-high-contrast: active) {
  122. .collapse-processed > .olivero-details__summary .details-title::after {
  123. inset: -5px;
  124. border: 2px dotted;
  125. }
  126. }
  127. /* Details content wrapper */
  128. .olivero-details__wrapper {
  129. margin: var(--sp1);
  130. @media (--lg) {
  131. margin-block-start: var(--sp1-5);
  132. margin-block-end: var(--sp1-5);
  133. margin-inline-start: var(--sp2);
  134. margin-inline-end: var(--sp2);
  135. }
  136. }
  137. /* Description */
  138. .olivero-details__description {
  139. margin-block-end: var(--sp1);
  140. color: var(--color--gray-10);
  141. font-size: var(--font-size-xs);
  142. line-height: var(--line-height-s);
  143. }

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.