details.css

Same filename in this branch
  1. 11.x core/profiles/demo_umami/themes/umami/css/classy/components/details.css
  2. 11.x core/misc/dialog/off-canvas/css/details.css
  3. 11.x core/themes/olivero/css/components/details.css
  4. 11.x core/themes/starterkit_theme/css/components/details.css
Same filename in other branches
  1. 9 core/profiles/demo_umami/themes/umami/css/classy/components/details.css
  2. 9 core/themes/olivero/css/components/details.css
  3. 9 core/themes/seven/css/components/details.css
  4. 9 core/themes/claro/css/components/details.css
  5. 9 core/themes/bartik/css/classy/components/details.css
  6. 9 core/themes/starterkit_theme/css/components/details.css
  7. 9 core/themes/classy/css/components/details.css
  8. 8.9.x core/profiles/demo_umami/themes/umami/css/classy/components/details.css
  9. 8.9.x core/themes/seven/css/components/details.css
  10. 8.9.x core/themes/claro/css/components/details.css
  11. 8.9.x core/themes/bartik/css/classy/components/details.css
  12. 8.9.x core/themes/classy/css/components/details.css
  13. 10 core/profiles/demo_umami/themes/umami/css/classy/components/details.css
  14. 10 core/misc/dialog/off-canvas/css/details.css
  15. 10 core/themes/olivero/css/components/details.css
  16. 10 core/themes/claro/css/components/details.css
  17. 10 core/themes/starterkit_theme/css/components/details.css

Collapsible details.

See also

collapse.js

File

core/themes/claro/css/components/details.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. * Collapsible details.
  10. *
  11. * @see collapse.js
  12. */
  13. /**
  14. * Available modifiers are:
  15. * - .claro-details--accordion
  16. * - .claro-details--accordion-item
  17. *
  18. * Despite the fact that 'accordion' isn't used anywhere right now, we
  19. * implemented it (since the design defines that).
  20. * This variant can be used by setting the '#accordion' to TRUE for a
  21. * Details render element:
  22. * @code
  23. * $build['detail_accordion'] = [
  24. * '#type' => 'details',
  25. * '#accordion' => TRUE,
  26. * ];
  27. *
  28. * 'Accordion item' is used for the details of the node edit sidebar. For
  29. * creating accordion item list from a set of details, set the surrounding
  30. * Container render element's '#accordion' key to TRUE.
  31. *
  32. * 'Vertical tabs item' is used for the children of the VerticalTabs render
  33. * element.
  34. */
  35. :root {
  36. --size-summary-border-radius: calc(var(--details-border-size-radius) - var(--details-border-size));
  37. --summary-accordion-padding-vertical: calc(var(--space-l) + ((var(--space-m) - var(--space-l)) / 2));
  38. --summary-accordion-line-height: var(--space-l);
  39. }
  40. .claro-details {
  41. display: block;
  42. margin-block: var(--space-m);
  43. color: var(--color-text);
  44. border: var(--details-border-size) solid var(--details-border-color);
  45. border-radius: var(--details-border-size-radius);
  46. background-color: var(--color-white);
  47. box-shadow: var(--details-box-shadow);
  48. /*
  49. * The following width and min-width values ensure that the
    element
  50. * does not shift widths when opening, in the event that a parent table
  51. * element constrains the width. This can happen when toggling the
  52. * "lazy-load" option within an image field.
  53. */
  54. }
  55. td .claro-details {
  56. width: min-content;
  57. min-width: 100%;
  58. }
  59. .claro-details--accordion-item,
  60. .claro-details--vertical-tabs-item {
  61. margin-block: 0;
  62. border-radius: 0;
  63. box-shadow: none;
  64. }
  65. .claro-details--accordion-item:first-of-type {
  66. border-top-left-radius: var(--details-border-size-radius);
  67. border-top-right-radius: var(--details-border-size-radius);
  68. }
  69. .claro-details--accordion-item:last-of-type {
  70. border-bottom-right-radius: var(--details-border-size-radius);
  71. border-bottom-left-radius: var(--details-border-size-radius);
  72. }
  73. /**
  74. * Details summary styles.
  75. */
  76. .claro-details__summary {
  77. position: relative;
  78. box-sizing: border-box;
  79. padding-block: var(--space-m);
  80. padding-inline: var(--details-desktop-wrapper-padding-start) var(--space-m);
  81. list-style: none;
  82. cursor: pointer;
  83. transition: background-color var(--details-bg-color-transition-duration) ease-in-out;
  84. color: var(--color-gray-800);
  85. border-radius: var(--size-summary-border-radius);
  86. background-color: transparent;
  87. line-height: var(--space-m);
  88. }
  89. /* Modifiers */
  90. .claro-details__summary--accordion,
  91. .claro-details__summary--accordion-item,
  92. .claro-details__summary--vertical-tabs-item {
  93. padding-block: var(--summary-accordion-padding-vertical);
  94. padding-inline: var(--details-desktop-wrapper-padding-start) var(--space-l);
  95. background: var(--color-white);
  96. line-height: var(--summary-accordion-line-height);
  97. }
  98. /**
  99. * Accordion list items must not have border radius except they are the first
  100. * or the last ones.
  101. */
  102. .claro-details__summary--accordion-item {
  103. border-radius: 0;
  104. }
  105. .claro-details--accordion-item:first-child .claro-details__summary--accordion-item {
  106. border-top-left-radius: var(--details-border-size-radius);
  107. border-top-right-radius: var(--details-border-size-radius);
  108. }
  109. .claro-details--accordion-item:last-child .claro-details__summary--accordion-item {
  110. border-bottom-right-radius: var(--details-border-size-radius);
  111. border-bottom-left-radius: var(--details-border-size-radius);
  112. }
  113. /**
  114. * Details marker styles.
  115. */
  116. /* Remove the marker on Chrome */
  117. .claro-details__summary::-webkit-details-marker {
  118. display: none;
  119. }
  120. .claro-details__summary::before {
  121. position: absolute;
  122. inset-block-start: 50%;
  123. inset-inline-start: var(--space-s);
  124. display: inline-block;
  125. width: var(--space-m);
  126. height: var(--space-m);
  127. margin-block-start: calc(var(--space-m) / -2);
  128. content: "";
  129. transition: transform var(--details-transform-transition-duration) ease-in 0s;
  130. transform: rotate(90deg);
  131. text-align: center;
  132. background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3e%3cpath d='M5.21 1.314L3.79 2.723l5.302 5.353-5.303 5.354 1.422 1.408 6.697-6.762z' fill='%23545560'/%3e%3c/svg%3e");
  133. background-size: contain;
  134. }
  135. [dir="rtl"] .claro-details__summary::before {
  136. transform: rotate(-270deg);
  137. }
  138. @media (prefers-reduced-motion: reduce) {
  139. .claro-details__summary::before {
  140. transition: none;
  141. }
  142. }
  143. @media (forced-colors: active) {
  144. .claro-details__summary::before {
  145. width: 0.5625rem;
  146. height: 0.5625rem;
  147. transition:
  148. transform var(--details-transform-transition-duration) ease-in 0s,
  149. margin var(--details-transform-transition-duration) ease-in 0s;
  150. transform: rotate(135deg); /* LTR */
  151. border-block-start: 0.125rem solid;
  152. border-inline-end: 0.125rem solid;
  153. background: none;
  154. }
  155. [dir="rtl"] .claro-details__summary::before {
  156. transform: rotate(-225deg);
  157. }
  158. }
  159. /**
  160. * Safari (at least version 12.1) cannot handle our details marker
  161. * transition properly.
  162. *
  163. * Every additional pointer triggered toggle event freezes the transition,
  164. * and the transition is continued and finished after the pointer leaves
  165. * the Detail elements' summary.
  166. *
  167. * Even that it is possible to provide a JavaScript workaround for it (by
  168. * adding/removing a helper class with JavaScript if the Details is
  169. * toggled), that hack will make RTL details worse than without the hack.
  170. *
  171. * This weird query was found in
  172. * https://stackoverflow.com/questions/16348489#25975282 (based on the
  173. * answer it works for Safari 10.1+)
  174. */
  175. /* stylelint-disable-next-line unit-allowed-list */
  176. @media not all and (min-resolution: 0.001dpcm) {
  177. @supports (-webkit-appearance: none) {
  178. .claro-details__summary::before {
  179. transition: none;
  180. }
  181. }
  182. }
  183. /**
  184. * Details summary focus.
  185. */
  186. .claro-details__summary::after {
  187. position: absolute;
  188. inset: -1px;
  189. content: "";
  190. transition: opacity var(--details-box-shadow-transition-duration) ease-in-out;
  191. pointer-events: none;
  192. opacity: 0;
  193. border-radius: var(--details-border-size-radius);
  194. box-shadow: inset 0 0 0 var(--details-summary-focus-border-size) var(--details-summary-shadow-color);
  195. }
  196. .claro-details > .claro-details__summary--accordion-item::after,
  197. .vertical-tabs__item > .claro-details__summary--vertical-tabs-item::after {
  198. border-radius: 0;
  199. }
  200. .claro-details:first-child > .claro-details__summary--accordion-item::after,
  201. .vertical-tabs__item--first > .claro-details__summary--vertical-tabs-item::after {
  202. border-top-left-radius: var(--details-border-size-radius);
  203. border-top-right-radius: var(--details-border-size-radius);
  204. }
  205. .claro-details:last-child > .claro-details__summary--accordion-item::after,
  206. .vertical-tabs__item--last > .claro-details__summary--vertical-tabs-item::after {
  207. border-bottom-right-radius: var(--details-border-size-radius);
  208. border-bottom-left-radius: var(--details-border-size-radius);
  209. }
  210. /**
  211. * Focus box of accordions and accordion items must not have bottom border
  212. * radius if their accordion is expanded.
  213. */
  214. .claro-details[open] > .claro-details__summary--accordion::after,
  215. .claro-details[open] > .claro-details__summary--accordion-item::after,
  216. .vertical-tabs__item--last[open] > .claro-details__summary--vertical-tabs-item::after {
  217. border-bottom-right-radius: 0;
  218. border-bottom-left-radius: 0;
  219. }
  220. /**
  221. * Details summary states.
  222. */
  223. .claro-details__summary:focus {
  224. box-shadow: none;
  225. }
  226. [open] .claro-details__summary--accordion,
  227. [open] .claro-details__summary--accordion-item,
  228. [open] .claro-details__summary--vertical-tabs-item {
  229. color: var(--color-absolutezero);
  230. }
  231. .claro-details__summary:hover::before,
  232. .claro-details__summary:hover:focus::before,
  233. .claro-details[open] > .claro-details__summary:focus::before,
  234. .claro-details[open] > .claro-details__summary--accordion::before,
  235. .claro-details[open] > .claro-details__summary--accordion-item::before,
  236. .claro-details[open] > .claro-details__summary--vertical-tabs-item::before {
  237. background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3e%3cpath d='M5.21 1.314L3.79 2.723l5.302 5.353-5.303 5.354 1.422 1.408 6.697-6.762z' fill='%230036B1'/%3e%3c/svg%3e");
  238. }
  239. .claro-details[open] > .claro-details__summary {
  240. border-radius: var(--size-summary-border-radius) var(--size-summary-border-radius) 0 0;
  241. }
  242. .claro-details[open] > .claro-details__summary::before {
  243. transform: rotate(-90deg); /* for LTR and RTL */
  244. }
  245. @media (forced-colors: active) {
  246. .claro-details__summary:hover::before,
  247. .claro-details__summary:hover:focus::before,
  248. .claro-details[open] > .claro-details__summary:focus::before {
  249. background: none;
  250. }
  251. .claro-details[open] > .claro-details__summary::before,
  252. [dir="rtl"] .claro-details[open] > .claro-details__summary::before {
  253. margin-block-start: -0.125rem;
  254. margin-inline-end: 0.125rem;
  255. transform: rotate(-45deg); /* for LTR and RTL */
  256. background: none;
  257. }
  258. }
  259. .claro-details[open] > .claro-details__summary--accordion,
  260. .claro-details[open] > .claro-details__summary--accordion-item,
  261. .claro-details[open] > .claro-details__summary--vertical-tabs-item {
  262. box-shadow: var(--details-box-shadow);
  263. }
  264. .claro-details__summary:hover {
  265. color: var(--color-absolutezero);
  266. background-color: var(--color-bgblue-hover);
  267. }
  268. /**
  269. * Focus styles.
  270. */
  271. /**
  272. * Active has to be here for Firefox.
  273. */
  274. [open] > .claro-details__summary--accordion:not(:focus, :active)::after,
  275. [open] > .claro-details__summary--accordion-item:not(:focus, :active)::after,
  276. [open] > .claro-details__summary--vertical-tabs-item:not(:focus, :active)::after {
  277. opacity: 1;
  278. border: var(--details-summary-focus-border-size) solid var(--color-absolutezero);
  279. border-width: 0 0 0 var(--details-summary-focus-border-size); /* LTR */
  280. box-shadow: none;
  281. }
  282. [dir="rtl"] :is([open] > .claro-details__summary--accordion:not(:focus, :active)::after),
  283. [dir="rtl"] :is([open] > .claro-details__summary--accordion-item:not(:focus, :active)::after),
  284. [dir="rtl"] :is([open] > .claro-details__summary--vertical-tabs-item:not(:focus, :active)::after) {
  285. border-width: 0 var(--details-summary-focus-border-size) 0 0;
  286. }
  287. .claro-details__summary:focus::after,
  288. .claro-details__summary:active::after {
  289. opacity: 1;
  290. }
  291. /**
  292. * Safari workaround.
  293. */
  294. /* stylelint-disable-next-line unit-allowed-list */
  295. @media not all and (min-resolution: 0.001dpcm) {
  296. @supports (-webkit-appearance: none) {
  297. .claro-details__summary::after {
  298. transition: none;
  299. }
  300. }
  301. }
  302. .claro-details[open] > .claro-details__summary:focus {
  303. color: var(--color-absolutezero);
  304. }
  305. /**
  306. * Details wrapper and content.
  307. *
  308. * Accordion and accordion-item variants should have an extra background.
  309. * In that case, we render an additional wrapper 'claro-details__content' that
  310. * creates the visual margins around the content, and use the original
  311. * wrapper for setting the background color.
  312. *
  313. * If there is no border or padding defined, margins of parent-child elements
  314. * collapse to the highest value. We want to take benefit of this behavior,
  315. * because the elements inside the details content won't cause too big
  316. * vertical spacing.
  317. */
  318. .claro-details__wrapper,
  319. .claro-details__content {
  320. margin: var(--space-m);
  321. }
  322. .claro-details__wrapper--accordion,
  323. .claro-details__wrapper--accordion-item,
  324. .claro-details__wrapper--vertical-tabs-item {
  325. margin: 0;
  326. }
  327. .claro-details__wrapper--accordion::before,
  328. .claro-details__wrapper--accordion::after,
  329. .claro-details__wrapper--accordion-item::before,
  330. .claro-details__wrapper--accordion-item::after,
  331. .claro-details__wrapper--vertical-tabs-item::before,
  332. .claro-details__wrapper--vertical-tabs-item::after {
  333. display: table;
  334. clear: both;
  335. content: "";
  336. }
  337. .claro-details__wrapper--accordion,
  338. .claro-details__wrapper--accordion-item,
  339. .claro-details__wrapper--vertical-tabs-item {
  340. border-top: var(--details-border-size) solid var(--details-border-color);
  341. background-color: var(--color-gray-050-o-40);
  342. }
  343. /* @see Drupal.behaviors.verticalTabs */
  344. @media screen and (min-width: 40.0625rem) {
  345. .claro-details__wrapper {
  346. margin: var(--space-l) var(--details-desktop-wrapper-padding-start);
  347. }
  348. .claro-details__wrapper--accordion,
  349. .claro-details__wrapper--accordion-item,
  350. .claro-details__wrapper--vertical-tabs-item {
  351. margin: 0;
  352. }
  353. .js .claro-details__wrapper--vertical-tabs-item {
  354. margin: 0;
  355. border-top: 0;
  356. background-color: transparent;
  357. }
  358. }
  359. .claro-details__content--accordion,
  360. .claro-details__content--accordion-item,
  361. .claro-details__content--vertical-tabs-item {
  362. margin: var(--space-m) var(--space-m) var(--space-l);
  363. }
  364. @media screen and (min-width: 85em) {
  365. .vertical-tabs .claro-details__content--vertical-tabs-item {
  366. margin: var(--space-l);
  367. }
  368. }
  369. /* Description. */
  370. .claro-details__description {
  371. margin-block-end: var(--space-m);
  372. color: var(--input-fg-color--description);
  373. font-size: var(--font-size-xs); /* ~13px */
  374. line-height: calc(17rem / 16); /* 17px */
  375. }
  376. .claro-details__description.is-disabled {
  377. color: var(--input--disabled-fg-color);
  378. }
  379. .claro-details__summary-summary {
  380. display: block;
  381. color: var(--color-gray-800);
  382. font-size: var(--font-size-s);
  383. font-weight: normal;
  384. }
  385. .required-mark::after {
  386. display: inline-block;
  387. width: 0.4375rem;
  388. height: 0.4375rem;
  389. margin-inline: 0.3em;
  390. content: "";
  391. vertical-align: super;
  392. background-image: url("data:image/svg+xml,%3csvg height='16' width='16' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='m0 7.562 1.114-3.438c2.565.906 4.43 1.688 5.59 2.35-.306-2.921-.467-4.93-.484-6.027h3.511c-.05 1.597-.234 3.6-.558 6.003 1.664-.838 3.566-1.613 5.714-2.325l1.113 3.437c-2.05.678-4.06 1.131-6.028 1.356.984.856 2.372 2.381 4.166 4.575l-2.906 2.059c-.935-1.274-2.041-3.009-3.316-5.206-1.194 2.275-2.244 4.013-3.147 5.206l-2.856-2.059c1.872-2.307 3.211-3.832 4.017-4.575-2.081-.402-4.058-.856-5.93-1.356' fill='%23e00'/%3e%3c/svg%3e");
  393. background-repeat: no-repeat;
  394. background-size: 0.4375rem 0.4375rem;
  395. }

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