_listing.scss 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. /* stylelint-disable selector-max-combinators */
  2. // General listings, like for pages, images or snippets
  3. ul.listing {
  4. @include unlist();
  5. }
  6. .listing {
  7. margin-bottom: 2em;
  8. color: theme('colors.text-context');
  9. font-size: 0.95em;
  10. ul {
  11. list-style-type: none;
  12. margin: 0;
  13. padding-inline-start: 0;
  14. }
  15. > li {
  16. padding: 1em 0;
  17. border-bottom: 1px dashed theme('colors.border-field-default');
  18. }
  19. h3 {
  20. margin: 0;
  21. font-size: 1em;
  22. }
  23. td,
  24. th {
  25. padding: calc(1em * var(--w-density-factor)) 0.3em;
  26. @include media-breakpoint-up(sm) {
  27. padding: calc(1em * var(--w-density-factor)) 1em;
  28. }
  29. &.no-padding {
  30. padding: 0;
  31. }
  32. }
  33. &.small td,
  34. th {
  35. padding: 0.6em 0.3em;
  36. @include media-breakpoint-up(sm) {
  37. padding: 0.6em 1em;
  38. }
  39. }
  40. td {
  41. vertical-align: middle;
  42. }
  43. td.title {
  44. line-height: 2em;
  45. }
  46. thead {
  47. font-size: 1.1em;
  48. color: theme('colors.text-context');
  49. border-bottom: 1px solid theme('colors.border-furniture');
  50. th {
  51. font-size: 0.9em;
  52. text-align: start;
  53. font-weight: normal;
  54. white-space: nowrap;
  55. }
  56. th.title {
  57. white-space: normal;
  58. }
  59. th.children {
  60. border: 0;
  61. }
  62. th a.label:not(.teal) {
  63. text-decoration: none;
  64. color: inherit;
  65. position: relative;
  66. &.icon:after {
  67. inset-inline-end: 0;
  68. }
  69. }
  70. }
  71. &:has(
  72. td:first-child input[type='checkbox'],
  73. th:first-child input[type='checkbox']
  74. ) {
  75. td:first-child,
  76. th:first-child {
  77. // Bulk actions, use smaller width (48px) for smaller screens
  78. // (no need to match where the breadcrumbs are)
  79. width: theme('spacing.10');
  80. text-align: center;
  81. input[type='checkbox'] {
  82. margin-inline-end: 0;
  83. }
  84. }
  85. }
  86. &.full-width {
  87. margin-bottom: -3em; // this negates the padding added to the bottom of .content
  88. }
  89. .table-headers {
  90. border-bottom: 1px solid theme('colors.border-furniture');
  91. }
  92. tbody {
  93. border-bottom: 1px dashed theme('colors.border-field-default');
  94. tr {
  95. border-top: 1px dashed theme('colors.border-furniture');
  96. &:first-child {
  97. border-top: 1px dashed theme('colors.border-furniture');
  98. }
  99. }
  100. tr.selected {
  101. background-color: theme('colors.text-highlight');
  102. }
  103. }
  104. &.full-width tbody {
  105. border: 0;
  106. }
  107. &.chooser {
  108. tbody .parent-page {
  109. font-size: 1.15em;
  110. background-color: theme('colors.border-furniture');
  111. }
  112. tbody .parent-page .title {
  113. a {
  114. display: inline-block;
  115. }
  116. .w-status--label {
  117. border: 1px solid;
  118. }
  119. }
  120. tbody .title a {
  121. @include transition(none);
  122. display: block;
  123. }
  124. tbody tr:hover {
  125. background-color: theme('colors.surface-button-hover');
  126. color: theme('colors.text-button');
  127. .title a,
  128. .title a:hover,
  129. .title label {
  130. color: theme('colors.text-button');
  131. }
  132. .parent a {
  133. color: theme('colors.text-button');
  134. }
  135. .w-status {
  136. border-color: theme('colors.text-button');
  137. }
  138. }
  139. tbody tr.disabled td {
  140. opacity: 0.25;
  141. }
  142. tbody tr.disabled td.children {
  143. opacity: 1;
  144. }
  145. tbody tr.disabled:hover {
  146. background-color: inherit;
  147. color: inherit;
  148. .title {
  149. cursor: not-allowed;
  150. }
  151. .w-status {
  152. border-color: inherit;
  153. }
  154. }
  155. }
  156. &.small tbody tr {
  157. font-size: 1em;
  158. }
  159. &.full-width .divider td {
  160. padding-inline-start: 20px;
  161. }
  162. // specific columns
  163. .bulk {
  164. padding-inline-end: 0;
  165. label {
  166. font-size: 1em;
  167. display: block;
  168. width: 100%;
  169. position: relative;
  170. }
  171. label span {
  172. @apply w-sr-only;
  173. }
  174. input {
  175. margin-top: 3px;
  176. }
  177. }
  178. .title {
  179. word-break: break-word;
  180. .title-wrapper,
  181. h2 {
  182. @apply w-label-1;
  183. display: inline-flex;
  184. gap: theme('spacing.2');
  185. margin: 0;
  186. vertical-align: middle;
  187. a {
  188. color: inherit;
  189. text-decoration: none;
  190. // stylelint-disable max-nesting-depth
  191. &:hover {
  192. color: theme('colors.text-link-default');
  193. }
  194. }
  195. }
  196. .icon-folder {
  197. margin: 3px 0.3em 0 0;
  198. vertical-align: top;
  199. }
  200. }
  201. .actions {
  202. float: inline-end;
  203. font-size: 0.8rem;
  204. margin: 0;
  205. a {
  206. text-decoration: none;
  207. }
  208. > li {
  209. float: inline-start;
  210. padding: 0 0.5em 0 0;
  211. vertical-align: middle;
  212. }
  213. }
  214. &--inline-actions td.title {
  215. display: flex;
  216. align-items: center;
  217. justify-content: space-between;
  218. flex-wrap: wrap;
  219. gap: 0.5rem;
  220. .title-wrapper {
  221. margin-inline-end: 2.5em;
  222. }
  223. .w-status {
  224. margin: 0;
  225. }
  226. }
  227. &--inline-actions .actions {
  228. display: inline-block;
  229. margin-top: 0;
  230. vertical-align: inherit;
  231. li {
  232. margin-bottom: 0;
  233. }
  234. .button {
  235. vertical-align: inherit;
  236. }
  237. }
  238. .moderate-actions form {
  239. float: inline-start;
  240. margin: 0 1em 1em 0;
  241. }
  242. .children,
  243. .no-children {
  244. padding: 0;
  245. vertical-align: middle;
  246. a {
  247. display: block;
  248. padding: 0;
  249. }
  250. }
  251. .children a {
  252. color: theme('colors.text-button-outline-default');
  253. display: block;
  254. text-align: center;
  255. .icon {
  256. width: 3rem;
  257. height: 3rem;
  258. }
  259. }
  260. .no-children a {
  261. color: theme('colors.text-button-outline-default');
  262. display: block;
  263. text-align: center;
  264. line-height: 3rem;
  265. .icon {
  266. width: 1.5rem;
  267. height: 1.5rem;
  268. }
  269. &:hover,
  270. &:focus {
  271. color: theme('colors.text-button-outline-hover');
  272. }
  273. &:focus {
  274. opacity: 1; //opacity is already changed on hover on the parent tr
  275. }
  276. }
  277. &.small .children a .icon {
  278. width: 30px;
  279. height: 30px;
  280. }
  281. th.ord {
  282. text-align: center;
  283. .icon {
  284. width: 1rem;
  285. height: 1rem;
  286. vertical-align: middle;
  287. margin-inline-end: 2px;
  288. }
  289. &--active a,
  290. a:hover {
  291. color: theme('colors.text-button-outline-hover');
  292. }
  293. }
  294. .w-orderable__item--active {
  295. border: 1px dashed theme('colors.border-field-default');
  296. border-width: 1px 0;
  297. td {
  298. display: none;
  299. }
  300. .ord,
  301. .title {
  302. display: table-cell;
  303. }
  304. }
  305. .w-orderable__item__handle {
  306. cursor: move;
  307. }
  308. table .no-results-message {
  309. padding-inline-start: 20px;
  310. }
  311. .unpublished .title-wrapper {
  312. opacity: 0.7;
  313. }
  314. .w-status {
  315. margin: 0;
  316. margin-inline: 0;
  317. }
  318. &.images img {
  319. @include transition(border-color 0.2s ease);
  320. border: 3px solid theme('colors.surface-page');
  321. }
  322. }
  323. .image-choice {
  324. // Force the link to be displayed as a block, so its focus outline has the right shape.
  325. display: block;
  326. color: inherit;
  327. overflow-wrap: break-word;
  328. word-wrap: break-word;
  329. }
  330. // stylelint-disable-next-line no-duplicate-selectors
  331. ul.listing {
  332. border-top: 1px dashed theme('colors.border-field-default');
  333. margin-bottom: 2em;
  334. }
  335. table.listing {
  336. width: 100%;
  337. }
  338. // Use consistent spacing to the left and right of the header.
  339. .page-explorer .w-slim-header {
  340. @include media-breakpoint-up(md) {
  341. padding-inline-end: theme('spacing.6');
  342. }
  343. }
  344. .page-explorer .listing {
  345. position: relative;
  346. .table-headers,
  347. thead tr {
  348. height: 35px;
  349. }
  350. }
  351. .pagination {
  352. text-align: center;
  353. p {
  354. margin: 0;
  355. }
  356. ul {
  357. @include unlist();
  358. margin-top: -1.7em;
  359. }
  360. li {
  361. line-height: 1em;
  362. }
  363. .prev {
  364. float: inline-start;
  365. }
  366. .next {
  367. float: inline-end;
  368. }
  369. }
  370. .listing.full-width + .pagination {
  371. margin-top: 3em;
  372. border-top: 1px dashed theme('colors.border-furniture');
  373. padding: 2em 50px 0;
  374. }
  375. // listing filters
  376. .listing-filter {
  377. @include clearfix();
  378. background-color: theme('colors.surface-header');
  379. border-width: 1px 0;
  380. margin: 3em 0;
  381. }
  382. .filter-title {
  383. float: inline-start;
  384. font-size: 0.95em;
  385. padding: 1em;
  386. margin: 0 1em 0 0;
  387. background-color: theme('colors.border-furniture');
  388. }
  389. .filter-options {
  390. @include unlist();
  391. @include clearfix();
  392. overflow: hidden;
  393. li {
  394. padding: 0.8em;
  395. float: inline-start;
  396. }
  397. &__icon {
  398. width: 1em;
  399. height: 1em;
  400. margin-inline-end: 0.2em;
  401. vertical-align: middle;
  402. position: relative;
  403. top: -1px;
  404. }
  405. }
  406. @include media-breakpoint-up(sm) {
  407. .listing {
  408. &.horiz {
  409. display: grid;
  410. grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  411. align-items: flex-end;
  412. justify-items: initial;
  413. }
  414. &.images {
  415. border: 0;
  416. > li {
  417. padding: 1.5em;
  418. width: auto;
  419. height: auto;
  420. text-align: center;
  421. margin-top: -1px;
  422. border: 0;
  423. .bulk-action-checkbox {
  424. float: inline-start;
  425. margin: -0.5em 0.5em 0.5em -0.75em;
  426. }
  427. .bulk-action-checkbox + .image-choice {
  428. clear: both;
  429. margin-top: 1em;
  430. }
  431. .image {
  432. text-align: center;
  433. height: 180px;
  434. // Vertically center the image.
  435. &:before {
  436. content: '';
  437. display: inline-block;
  438. height: 100%;
  439. vertical-align: middle;
  440. margin-inline-end: -0.25em;
  441. }
  442. img {
  443. display: inline-block;
  444. vertical-align: middle;
  445. }
  446. }
  447. &:hover {
  448. img {
  449. border-color: theme('colors.border-button-outline-default');
  450. }
  451. }
  452. }
  453. }
  454. .bulk-action-checkbox {
  455. opacity: 0;
  456. &.show,
  457. &:checked {
  458. opacity: 1;
  459. }
  460. }
  461. .no-children {
  462. border-color: transparent;
  463. a {
  464. opacity: 0;
  465. }
  466. }
  467. tr:hover,
  468. tr:focus-within {
  469. .no-children a,
  470. .bulk-action-checkbox {
  471. opacity: 1;
  472. }
  473. }
  474. // used on the image listing
  475. li:hover,
  476. li:focus-within {
  477. .bulk-action-checkbox {
  478. opacity: 1;
  479. }
  480. }
  481. tr:hover .children {
  482. background-color: theme('colors.text-button-outline-default');
  483. .icon {
  484. color: theme('colors.surface-page');
  485. }
  486. }
  487. td.children:hover {
  488. background-color: theme('colors.text-button-outline-default');
  489. }
  490. table .no-results-message {
  491. padding-inline-start: 50px;
  492. }
  493. &:has(
  494. td:first-child input[type='checkbox'],
  495. th:first-child input[type='checkbox']
  496. ) {
  497. // Bulk actions, match the width of the header spacing up until
  498. // the page title (final breadcrumb item):
  499. // Breadcrumbs left padding: 20px
  500. // Breadcrumbs toggle: 50px
  501. // Breadcrumbs toggle margin right: 10px
  502. // Total: 80px
  503. th:first-child,
  504. td:first-child {
  505. width: theme('spacing.20');
  506. // Follow the left padding for the breadcrumbs (20px)
  507. // so the checkbox align with the breadcrumbs toggle.
  508. padding-inline-start: theme('spacing.5');
  509. }
  510. }
  511. // Remove left padding from the second column if either bulk action or
  512. // custom ordering is active, as the padding to match the breadcrumbs is
  513. // already handled by the first column.
  514. &:has(
  515. td:first-child input[type='checkbox'],
  516. th:first-child input[type='checkbox'],
  517. .ord
  518. ) {
  519. th:nth-child(2),
  520. td:nth-child(2) {
  521. padding-inline-start: 0;
  522. }
  523. }
  524. // If either:
  525. // - no nice padding is applied,
  526. // - we're not in a report listing,
  527. // - we're not in the editor view,
  528. // and:
  529. // - no bulk actions are present,
  530. // - we're not in the "custom ordering" mode,
  531. // then apply the same 80px padding via the first column's left padding.
  532. &:not(.nice-padding &, .report &, .editor-view &):not(
  533. :has(
  534. td:first-child input[type='checkbox'],
  535. th:first-child input[type='checkbox'],
  536. .ord
  537. )
  538. ) {
  539. th:first-child,
  540. td:first-child {
  541. padding-inline-start: theme('spacing.20');
  542. }
  543. }
  544. &.full-width .divider td {
  545. padding-inline-start: 50px;
  546. }
  547. }
  548. }
  549. // State
  550. .listing__item--active {
  551. > .actions {
  552. visibility: visible;
  553. }
  554. }
  555. // stylelint-disable no-duplicate-selectors
  556. // Transitions
  557. .listing {
  558. .children,
  559. .no-children {
  560. @include transition(background-color 0.2s ease);
  561. }
  562. .children a,
  563. .no-children a {
  564. @include transition(all 0.2s ease);
  565. }
  566. }
  567. // Ordering
  568. td.ord {
  569. // Align with the row's title text, and the column's label.
  570. vertical-align: top;
  571. }
  572. table.listing {
  573. th.ordered {
  574. color: theme('colors.text-link-default');
  575. }
  576. }
  577. .w-title-ellipsis {
  578. display: inline-block;
  579. vertical-align: bottom;
  580. max-width: 20ch;
  581. overflow-x: hidden;
  582. text-overflow: ellipsis;
  583. white-space: nowrap;
  584. @include media-breakpoint-up(sm) {
  585. max-width: 30ch;
  586. }
  587. @include media-breakpoint-up(md) {
  588. max-width: none;
  589. }
  590. }