_listing.scss 14 KB

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