_listing.scss 14 KB

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