details.css

Same filename in this branch
  1. 8.9.x core/profiles/demo_umami/themes/umami/css/classy/components/details.css
  2. 8.9.x core/themes/seven/css/components/details.css
  3. 8.9.x core/themes/bartik/css/classy/components/details.css
  4. 8.9.x core/themes/classy/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. 10 core/profiles/demo_umami/themes/umami/css/classy/components/details.css
  9. 10 core/misc/dialog/off-canvas/css/details.css
  10. 10 core/themes/olivero/css/components/details.css
  11. 10 core/themes/claro/css/components/details.css
  12. 10 core/themes/starterkit_theme/css/components/details.css
  13. 11.x core/profiles/demo_umami/themes/umami/css/classy/components/details.css
  14. 11.x core/misc/dialog/off-canvas/css/details.css
  15. 11.x core/themes/olivero/css/components/details.css
  16. 11.x core/themes/claro/css/components/details.css
  17. 11.x 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/2815083
  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. .claro-details {
  36. display: block;
  37. margin-top: 1rem;
  38. margin-bottom: 1rem;
  39. color: #222330;
  40. border: 1px solid rgba(216, 217, 224, 0.8);
  41. border-radius: 2px;
  42. background-color: #fff;
  43. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  44. }
  45. .claro-details--accordion-item,
  46. .claro-details--vertical-tabs-item {
  47. margin-top: 0;
  48. margin-bottom: 0;
  49. border-radius: 0;
  50. box-shadow: none;
  51. }
  52. .claro-details--accordion-item:first-of-type {
  53. border-top-left-radius: 2px;
  54. border-top-right-radius: 2px;
  55. }
  56. .claro-details--accordion-item:last-of-type {
  57. border-bottom-right-radius: 2px;
  58. border-bottom-left-radius: 2px;
  59. }
  60. /**
  61. * Details summary styles.
  62. */
  63. .claro-details__summary {
  64. position: relative;
  65. box-sizing: border-box;
  66. padding: 1rem 1rem 1rem 2.25rem; /* LTR */
  67. list-style: none;
  68. cursor: pointer;
  69. transition: background-color 0.12s ease-in-out;
  70. word-wrap: break-word;
  71. -webkit-hyphens: auto;
  72. -ms-hyphens: auto;
  73. hyphens: auto;
  74. color: #545560;
  75. border-radius: 1px;
  76. background-color: transparent;
  77. line-height: 1rem;
  78. }
  79. [dir="rtl"] .claro-details__summary {
  80. padding-right: 2.25rem;
  81. padding-left: 1rem;
  82. }
  83. /* Modifiers */
  84. .claro-details__summary--accordion,
  85. .claro-details__summary--accordion-item,
  86. .claro-details__summary--vertical-tabs-item {
  87. padding: 1.25rem 1.5rem 1.25rem 2.25rem; /* LTR */
  88. background: #fff;
  89. line-height: 1.5rem;
  90. }
  91. [dir="rtl"] .claro-details__summary--accordion,
  92. [dir="rtl"] .claro-details__summary--accordion-item,
  93. [dir="rtl"] .claro-details__summary--vertical-tabs-item {
  94. padding-right: 2.25rem;
  95. padding-left: 1.5rem;
  96. }
  97. /**
  98. * Accordion list items must not have border radius except they are the first
  99. * or the last ones.
  100. */
  101. .claro-details__summary--accordion-item {
  102. border-radius: 0;
  103. }
  104. .claro-details--accordion-item:first-child .claro-details__summary--accordion-item {
  105. border-top-left-radius: 2px;
  106. border-top-right-radius: 2px;
  107. }
  108. .claro-details--accordion-item:last-child .claro-details__summary--accordion-item {
  109. border-bottom-right-radius: 2px;
  110. border-bottom-left-radius: 2px;
  111. }
  112. /**
  113. * Details marker styles.
  114. */
  115. /* Remove the marker on Chrome */
  116. .claro-details__summary::-webkit-details-marker {
  117. display: none;
  118. }
  119. .claro-details__summary::before {
  120. position: absolute;
  121. top: 50%;
  122. left: 0.75rem; /* LTR */
  123. display: inline-block;
  124. width: 1rem;
  125. height: 1rem;
  126. margin-top: -0.5rem;
  127. content: "";
  128. transition: transform 0.12s ease-in 0s;
  129. transform: rotate(0); /* LTR */
  130. text-align: center;
  131. background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M5.2109375,1.3144531 3.7890625,2.7226562 9.0917969,8.0761719 3.7890625,13.429688 5.2109375,14.837891 11.908203,8.0761719Z' fill='%23545560'/%3E%3C/svg%3E") no-repeat 50% 50%;
  132. background-size: contain;
  133. }
  134. [dir="rtl"] .claro-details__summary::before {
  135. right: 0.75rem;
  136. left: auto;
  137. transform: rotate(180deg);
  138. }
  139. @media (prefers-reduced-motion: reduce) {
  140. .claro-details__summary::before {
  141. transition: none;
  142. }
  143. }
  144. @media screen and (-ms-high-contrast: active) {
  145. .claro-details__summary::before {
  146. width: 0.5625rem;
  147. height: 0.5625rem;
  148. margin-top: -0.28125rem;
  149. transition: transform 0.12s ease-in 0s, margin 0.12s ease-in 0s;
  150. transform: rotate(45deg); /* LTR */
  151. border: 0.125rem solid;
  152. border-width: 0.125rem 0.125rem 0 0;
  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-whitelist */
  176. @media not all and (min-resolution: 0.001dpcm) {
  177. @media {
  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. top: -1px;
  189. right: -1px;
  190. bottom: -1px;
  191. left: -1px;
  192. content: "";
  193. transition: opacity 0.2s ease-in-out;
  194. pointer-events: none;
  195. opacity: 0;
  196. border-radius: 2px;
  197. box-shadow: inset 0 0 0 3px #26a769;
  198. }
  199. .claro-details > .claro-details__summary--accordion-item::after,
  200. .vertical-tabs__item > .claro-details__summary--vertical-tabs-item::after {
  201. border-radius: 0;
  202. }
  203. .claro-details:first-child > .claro-details__summary--accordion-item::after,
  204. .vertical-tabs__item--first > .claro-details__summary--vertical-tabs-item::after {
  205. border-top-left-radius: 2px;
  206. border-top-right-radius: 2px;
  207. }
  208. .claro-details:last-child > .claro-details__summary--accordion-item::after,
  209. .vertical-tabs__item--last > .claro-details__summary--vertical-tabs-item::after {
  210. border-bottom-right-radius: 2px;
  211. border-bottom-left-radius: 2px;
  212. }
  213. /**
  214. * Focus box of accordions and accordion items must not have bottom border
  215. * radius if their accordion is expanded.
  216. */
  217. .claro-details[open] > .claro-details__summary--accordion::after,
  218. .claro-details[open] > .claro-details__summary--accordion-item::after,
  219. .vertical-tabs__item--last[open] > .claro-details__summary--vertical-tabs-item::after {
  220. border-bottom-right-radius: 0;
  221. border-bottom-left-radius: 0;
  222. }
  223. /**
  224. * Details summary states.
  225. */
  226. .claro-details__summary:focus {
  227. box-shadow: none;
  228. }
  229. [open] .claro-details__summary--accordion,
  230. [open] .claro-details__summary--accordion-item,
  231. [open] .claro-details__summary--vertical-tabs-item {
  232. color: #003cc5;
  233. }
  234. .claro-details__summary:hover::before,
  235. .claro-details__summary:hover:focus::before,
  236. .claro-details[open] > .claro-details__summary:focus::before,
  237. .claro-details[open] > .claro-details__summary--accordion::before,
  238. .claro-details[open] > .claro-details__summary--accordion-item::before,
  239. .claro-details[open] > .claro-details__summary--vertical-tabs-item::before {
  240. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M5.2109375,1.3144531 3.7890625,2.7226562 9.0917969,8.0761719 3.7890625,13.429688 5.2109375,14.837891 11.908203,8.0761719Z' fill='%230036B1'/%3E%3C/svg%3E");
  241. }
  242. .claro-details[open] > .claro-details__summary {
  243. border-radius: 1px 1px 0 0;
  244. }
  245. .claro-details[open] > .claro-details__summary::before {
  246. transform: rotate(90deg); /* for LTR and RTL */
  247. }
  248. @media screen and (-ms-high-contrast: active) {
  249. .claro-details__summary:hover::before,
  250. .claro-details__summary:hover:focus::before {
  251. background: none;
  252. }
  253. .claro-details[open] > .claro-details__summary::before,
  254. [dir="rtl"] .claro-details[open] > .claro-details__summary::before {
  255. margin-top: -0.40625rem;
  256. margin-right: 0.125rem;
  257. transform: rotate(135deg); /* for LTR and RTL */
  258. background: none;
  259. }
  260. }
  261. .claro-details[open] > .claro-details__summary--accordion,
  262. .claro-details[open] > .claro-details__summary--accordion-item,
  263. .claro-details[open] > .claro-details__summary--vertical-tabs-item {
  264. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  265. }
  266. .claro-details__summary:hover {
  267. color: #003cc5;
  268. background-color: #f0f5fd;
  269. }
  270. /**
  271. * Focus styles.
  272. */
  273. /**
  274. * Active has to be here for Firefox.
  275. * Merges standard collapse-processed selectors.
  276. */
  277. [open] > .claro-details__summary--accordion:not(:focus):not(:active)::after,
  278. [open] > .claro-details__summary--accordion-item:not(:focus):not(:active)::after,
  279. .collapse-processed[open] > .claro-details__summary--accordion .details-title:not(:focus)::after,
  280. .collapse-processed[open] > .claro-details__summary--accordion-item .details-title:not(:focus)::after,
  281. [open] > .claro-details__summary--vertical-tabs-item:not(:focus):not(:active)::after,
  282. .collapse-processed[open] > .claro-details__summary--vertical-tabs-item .details-title:not(:focus)::after {
  283. opacity: 1;
  284. border: 3px solid #003cc5;
  285. border-width: 0 0 0 3px; /* LTR */
  286. box-shadow: none;
  287. }
  288. [dir="rtl"] [open] > .claro-details__summary--accordion:not(:focus)::after,
  289. [dir="rtl"] [open] > .claro-details__summary--accordion-item:not(:focus)::after,
  290. [dir="rtl"] .collapse-processed[open] > .claro-details__summary--accordion .details-title:not(:focus)::after,
  291. [dir="rtl"] .collapse-processed[open] > .claro-details__summary--accordion-item .details-title:not(:focus)::after,
  292. [dir="rtl"] [open] > .claro-details__summary--vertical-tabs-item:not(:focus)::after,
  293. [dir="rtl"] .collapse-processed[open] > .claro-details__summary--vertical-tabs-item .details-title:not(:focus)::after {
  294. border-width: 0 3px 0 0;
  295. }
  296. .claro-details__summary:focus::after,
  297. .claro-details__summary:active::after,
  298. .collapse-processed > .claro-details__summary .details-title:focus::after {
  299. opacity: 1;
  300. }
  301. /**
  302. * Safari workaround.
  303. */
  304. /* stylelint-disable-next-line unit-whitelist */
  305. @media not all and (min-resolution: 0.001dpcm) {
  306. @media {
  307. .claro-details__summary::after {
  308. transition: none;
  309. }
  310. }
  311. }
  312. .claro-details[open] > .claro-details__summary:focus {
  313. color: #003cc5;
  314. }
  315. /**
  316. * Details wrapper and content.
  317. *
  318. * Accordion and accordion-item variants should have an extra background.
  319. * In that case, we render an additional wrapper 'claro-details__content' that
  320. * creates the visual margins around the content, and use the original
  321. * wrapper for setting the background color.
  322. *
  323. * If there is no border or padding defined, margins of parent-child elements
  324. * collapse to the highest value. We want to take benefit of this behavior,
  325. * because the elements inside the details content won't cause too big
  326. * vertical spacing.
  327. */
  328. .claro-details__wrapper,
  329. .claro-details__content {
  330. margin: 1rem;
  331. }
  332. .claro-details__wrapper--accordion,
  333. .claro-details__wrapper--accordion-item,
  334. .claro-details__wrapper--vertical-tabs-item {
  335. margin: 0;
  336. }
  337. .claro-details__wrapper--accordion::before,
  338. .claro-details__wrapper--accordion::after,
  339. .claro-details__wrapper--accordion-item::before,
  340. .claro-details__wrapper--accordion-item::after,
  341. .claro-details__wrapper--vertical-tabs-item::before,
  342. .claro-details__wrapper--vertical-tabs-item::after {
  343. display: table;
  344. clear: both;
  345. content: "";
  346. }
  347. .claro-details__wrapper--accordion,
  348. .claro-details__wrapper--accordion-item,
  349. .claro-details__wrapper--vertical-tabs-item {
  350. border-top: 1px solid rgba(216, 217, 224, 0.8);
  351. background-color: rgba(243, 244, 249, 0.4);
  352. }
  353. @media screen and (min-width: 48em) {
  354. .claro-details__wrapper {
  355. margin: 1.5rem 2.25rem;
  356. }
  357. .claro-details__wrapper--accordion,
  358. .claro-details__wrapper--accordion-item,
  359. .claro-details__wrapper--vertical-tabs-item {
  360. margin: 0;
  361. }
  362. }
  363. @media screen and (min-width: 85em) {
  364. .js .claro-details__wrapper--vertical-tabs-item {
  365. margin: 0;
  366. border-top: 0;
  367. background-color: transparent;
  368. }
  369. }
  370. .claro-details__content--accordion,
  371. .claro-details__content--accordion-item,
  372. .claro-details__content--vertical-tabs-item {
  373. margin: 1rem 1rem 1.5rem;
  374. }
  375. @media screen and (min-width: 85em) {
  376. .vertical-tabs .claro-details__content--vertical-tabs-item {
  377. margin: 1.5rem;
  378. }
  379. }
  380. /* Description. */
  381. .claro-details__description {
  382. margin-bottom: 1rem;
  383. color: #545560;
  384. font-size: 0.79rem; /* ~13px */
  385. line-height: 1.0625rem; /* 17px */
  386. }
  387. .claro-details__description.is-disabled {
  388. color: #82828c;
  389. }
  390. /**
  391. * Collapse processed for non-supporting browsers like IE or Edge.
  392. */
  393. .collapse-processed > .claro-details__summary {
  394. padding: 0;
  395. }
  396. .collapse-processed > .claro-details__summary::after {
  397. content: none;
  398. }
  399. .collapse-processed > .claro-details__summary .details-title {
  400. position: relative;
  401. display: block;
  402. padding: 1rem 1rem 1rem 2.25rem; /* LTR */
  403. text-decoration: none;
  404. color: inherit;
  405. border-radius: 1px;
  406. }
  407. [dir="rtl"] .collapse-processed > .claro-details__summary .details-title {
  408. padding-right: 2.25rem;
  409. padding-left: 1rem;
  410. }
  411. .collapse-processed > .claro-details__summary--accordion .details-title,
  412. .collapse-processed > .claro-details__summary--accordion-item .details-title,
  413. .collapse-processed > .claro-details__summary--vertical-tabs-item .details-title {
  414. padding: 1.25rem 1.5rem 1.25rem 2.25rem; /* LTR */
  415. }
  416. [dir="rtl"] .collapse-processed > .claro-details__summary--accordion .details-title,
  417. [dir="rtl"] .collapse-processed > .claro-details__summary--accordion-item .details-title,
  418. [dir="rtl"] .collapse-processed > .claro-details__summary--vertical-tabs-item .details-title {
  419. padding-right: 2.25rem;
  420. padding-left: 1.5rem;
  421. }
  422. /* Focus and hover states. */
  423. .collapse-processed > .claro-details__summary .details-title:focus,
  424. .collapse-processed > .claro-details__summary .details-title:hover {
  425. z-index: 1;
  426. text-decoration: none;
  427. outline: none;
  428. box-shadow: none;
  429. }
  430. .collapse-processed > .claro-details__summary .details-title::after {
  431. position: absolute;
  432. top: -1px;
  433. right: -1px;
  434. bottom: -1px;
  435. left: -1px;
  436. content: "";
  437. transition: opacity 0.2s ease-in-out;
  438. pointer-events: none;
  439. opacity: 0;
  440. border: 3px solid #26a769;
  441. border-radius: 2px;
  442. }
  443. .collapse-processed > .claro-details__summary .details-title:focus::after {
  444. opacity: 1;
  445. }
  446. /* Accordion item modifiers for the focus box. */
  447. .collapse-processed > .claro-details__summary--accordion-item .details-title::after,
  448. .vertical-tabs__item > .claro-details__summary--vertical-tabs-item .details-title::after {
  449. border-radius: 0;
  450. }
  451. .collapse-processed:first-child > .claro-details__summary--accordion-item .details-title::after,
  452. .vertical-tabs__item--first > .claro-details__summary--vertical-tabs-item .details-title::after {
  453. border-top-left-radius: 2px;
  454. border-top-right-radius: 2px;
  455. }
  456. .collapse-processed:last-child > .claro-details__summary--accordion-item .details-title::after,
  457. .vertical-tabs__item--last > .claro-details__summary--vertical-tabs-item .details-title::after {
  458. border-bottom-right-radius: 2px;
  459. border-bottom-left-radius: 2px;
  460. }
  461. .collapse-processed[open] > .claro-details__summary--accordion .details-title::after,
  462. .collapse-processed[open] > .claro-details__summary--accordion-item .details-title::after,
  463. .vertical-tabs__item[open] > .claro-details__summary--vertical-tabs-item .details-title::after {
  464. border-bottom-right-radius: 0;
  465. border-bottom-left-radius: 0;
  466. }
  467. /**
  468. * Hide JS summary from the details polyfill to make it consistent with native
  469. * details elements.
  470. *
  471. * @todo Consider removing this after https://www.drupal.org/node/2493957 has
  472. * been solved.
  473. */
  474. .claro-details__summary--accordion .summary,
  475. .claro-details__summary--accordion-item .summary,
  476. .claro-details__summary--vertical-tabs-item .summary {
  477. display: none;
  478. }
  479. @media screen and (-ms-high-contrast: active) {
  480. .collapse-processed[open] > .claro-details__summary--accordion .details-title:not(:focus)::after,
  481. .collapse-processed[open] > .claro-details__summary--accordion-item .details-title:not(:focus)::after,
  482. .collapse-processed[open] > .claro-details__summary--vertical-tabs-item .details-title:not(:focus)::after {
  483. top: -1px;
  484. right: -1px;
  485. bottom: -1px;
  486. left: -1px;
  487. }
  488. .collapse-processed > .claro-details__summary .details-title::after {
  489. top: -5px;
  490. right: -5px;
  491. bottom: -5px;
  492. left: -5px;
  493. border: 2px dotted;
  494. }
  495. }
  496. .required-mark::after {
  497. display: inline-block;
  498. width: 0.4375rem;
  499. height: 0.4375rem;
  500. margin-right: 0.3em;
  501. margin-left: 0.3em;
  502. content: "";
  503. vertical-align: super;
  504. background-image: url(../../images/core/ee0000/required.svg);
  505. background-repeat: no-repeat;
  506. background-size: 0.4375rem 0.4375rem;
  507. }

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