_listing.scss 14 KB

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