You are here

tabledrag.pcss.css in Drupal 10

Replacement styles for table drag.

Replaces core's tabledrag.module.css.

See also

tabledrag.js

File

core/themes/claro/css/components/tabledrag.pcss.css
View source
  1. /**
  2. * @file
  3. * Replacement styles for table drag.
  4. *
  5. * Replaces core's tabledrag.module.css.
  6. *
  7. * @see tabledrag.js
  8. */
  9. :root {
  10. --table-row--dragging-bg-color: #fe7;
  11. --table-row--last-dragged-bg-color: #ffb;
  12. }
  13. body.drag {
  14. cursor: move;
  15. }
  16. /* The block region's title row in table. */
  17. .region-title {
  18. font-weight: bold;
  19. }
  20. /* Empty region message row in table. */
  21. .region-message {
  22. color: var(--color-gray-600);
  23. }
  24. /* If the region is populated, we shouldn't display the empty message. */
  25. .region-message.region-populated {
  26. display: none;
  27. }
  28. /**
  29. * Remove border-bottom from abbr element. Class is duplicated in the selector
  30. * to increase weight to be able to win normalize.css selectors.
  31. */
  32. .tabledrag-changed.tabledrag-changed {
  33. border-bottom: none;
  34. }
  35. /* Don't display the abbreviation of 'add-new' table rows. */
  36. .add-new .tabledrag-changed {
  37. display: none;
  38. }
  39. .draggable .tabledrag-changed {
  40. position: relative;
  41. left: calc(var(--space-xs) * -1); /* LTR */
  42. }
  43. [dir="rtl"] .draggable .tabledrag-changed {
  44. right: calc(var(--space-xs) * -1); /* LTR */
  45. left: auto;
  46. }
  47. .tabledrag-cell--only-drag .tabledrag-changed {
  48. width: var(--space-l);
  49. min-width: var(--space-l);
  50. }
  51. /**
  52. * Draggable row state colors.
  53. */
  54. .draggable.drag,
  55. .draggable.drag:focus {
  56. background-color: var(--table-row--dragging-bg-color);
  57. }
  58. .draggable.drag-previous {
  59. background-color: var(--table-row--last-dragged-bg-color);
  60. }
  61. /**
  62. * Reduce the spacing of draggable table cells.
  63. */
  64. .draggable-table td:first-child ~ td,
  65. .draggable-table th:first-child ~ th {
  66. padding-left: 0 /* LTR */;
  67. }
  68. [dir="rtl"] .draggable-table td:first-child ~ td,
  69. [dir="rtl"] .draggable-table th:first-child ~ th {
  70. padding-right: 0;
  71. padding-left: var(--space-m);
  72. }
  73. /* Auto width for weight selects and number inputs. */
  74. .draggable td .form-element--type-select[name$="][_weight]"], /* Multiple field */
  75. .draggable td .term-weight, /* Taxonomy term list */
  76. .draggable td .field-weight /* Field UI table */ {
  77. width: auto;
  78. }
  79. /**
  80. * Handle styles.
  81. */
  82. .tabledrag-handle {
  83. position: relative;
  84. z-index: 1;
  85. overflow: visible;
  86. cursor: move;
  87. text-align: center;
  88. vertical-align: text-top;
  89. }
  90. .tabledrag-handle::after {
  91. display: inline-block;
  92. width: var(--tabledrag-handle-icon-size);
  93. height: var(--tabledrag-handle-icon-size);
  94. margin-left: calc(var(--space-m) * -1); /* LTR */
  95. padding: var(--space-xs) var(--space-m);
  96. content: "";
  97. transition: transform 0.1s ease-in-out 0s;
  98. background: url(../../images/icons/000f33/tabledrag-handle.svg) no-repeat center;
  99. }
  100. [dir="rtl"] .tabledrag-handle::after {
  101. margin-right: calc(var(--space-m) * -1);
  102. margin-left: 0;
  103. }
  104. @media screen and (-ms-high-contrast: active) {
  105. .tabledrag-handle::after {
  106. content: url(../../images/icons/currentColor/tabledrag-handle.svg);
  107. background: none;
  108. }
  109. }
  110. @media (forced-colors: active) {
  111. .tabledrag-handle::after {
  112. content: "";
  113. background: linktext;
  114. mask-image: url(../../images/icons/000f33/tabledrag-handle.svg);
  115. mask-repeat: no-repeat;
  116. mask-position: center;
  117. }
  118. }
  119. .tabledrag-handle::after,
  120. .tabledrag-disabled .tabledrag-handle.tabledrag-handle.tabledrag-handle::after {
  121. transform: scale(1);
  122. }
  123. .tabledrag-handle:hover::after,
  124. .tabledrag-handle:focus::after,
  125. .draggable.drag .tabledrag-handle::after {
  126. transform: scale(1.25);
  127. }
  128. .tabledrag-handle:focus {
  129. outline: none !important;
  130. box-shadow: none !important;
  131. }
  132. .tabledrag-handle:focus::before {
  133. display: block;
  134. width: calc(var(--space-m) + (var(--space-xs) * 2)); /* Same as height. */
  135. height: calc(var(--space-m) + (var(--space-xs) * 2)); /* Hande svg height + its vertical padding */
  136. margin: 0 calc(var(--space-xs) * -1) calc((var(--space-m) + (var(--space-xs) * 2)) * -1); /* Bottom: handle height as negative value. */
  137. content: "";
  138. border-radius: var(--base-border-radius);
  139. outline: var(--outline-size) dotted transparent;
  140. box-shadow: 0 0 0 var(--focus-border-size) var(--color-focus);
  141. }
  142. /* Disabled tabledrag handle. */
  143. .tabledrag-disabled .tabledrag-handle {
  144. cursor: default;
  145. opacity: 0.4;
  146. }
  147. .tabledrag-disabled .tabledrag-handle.tabledrag-handle::before {
  148. content: normal;
  149. }
  150. /**
  151. * Enhancements for touch-capable screens.
  152. */
  153. /**
  154. * Increase handle size.
  155. */
  156. .touchevents .tabledrag-handle::after {
  157. padding-top: var(--space-s);
  158. padding-bottom: var(--space-s);
  159. }
  160. .touchevents .draggable .menu-item__link {
  161. padding-top: var(--space-xs);
  162. padding-bottom: var(--space-xs);
  163. }
  164. /**
  165. * Wrapper of the toggle weight button (styled as a link).
  166. */
  167. .tabledrag-toggle-weight-wrapper {
  168. text-align: right; /* LTR */
  169. }
  170. [dir="rtl"] .tabledrag-toggle-weight-wrapper {
  171. text-align: left;
  172. }
  173. /* Hide nested weight toggles as they are redundant. */
  174. .draggable-table .tabledrag-toggle-weight-wrapper {
  175. display: none;
  176. }
  177. /**
  178. * Keep crowded tabledrag cells vertically centered.
  179. */
  180. .tabledrag-cell {
  181. padding-top: 0;
  182. padding-bottom: 0;
  183. }
  184. /**
  185. * If the first table cell is empty (like in a multiple field widget table),
  186. * we can save some space for the following cells.
  187. * If it isn't empty (Field UI table, taxonomy term overview page), this CSS
  188. * class won't be added.
  189. */
  190. .tabledrag-cell--only-drag {
  191. width: 1px; /* This forces this cell to use the smallest possible width. */
  192. padding-right: 0; /* LTR */
  193. }
  194. [dir="rtl"] .tabledrag-cell--only-drag {
  195. padding-right: var(--space-m);
  196. padding-left: 0;
  197. }
  198. .tabledrag-cell-content {
  199. display: table;
  200. height: 100%;
  201. }
  202. .tabledrag-cell-content > * {
  203. display: table-cell;
  204. vertical-align: middle;
  205. }
  206. .tabledrag-cell-content__item {
  207. padding-right: var(--space-xs); /* LTR */
  208. }
  209. [dir="rtl"] .tabledrag-cell-content__item {
  210. padding-right: 0;
  211. padding-left: var(--space-xs);
  212. }
  213. .tabledrag-cell-content__item:empty {
  214. display: none;
  215. }
  216. .tabledrag-cell-content .indentation,
  217. [dir="rtl"] .tabledrag-cell-content .indentation {
  218. float: none;
  219. overflow: hidden;
  220. height: 100%;
  221. }
  222. .tabledrag-cell-content .tree {
  223. min-height: 100%; /* Using simply 'height: 100%' would make IE11 rendering ugly. */
  224. }
  225. /**
  226. * Safari (at least version 13.0) thinks that if we define a width or height for
  227. * and SVG, then we refer to the elements total size inside the SVG.
  228. * We only want to inherit the height of the parent element.
  229. */
  230. /* stylelint-disable-next-line unit-allowed-list */
  231. @media not all and (min-resolution: 0.001dpcm) {
  232. @supports (-webkit-appearance: none) {
  233. .tabledrag-cell-content .tree {
  234. overflow: visible;
  235. min-height: 0;
  236. }
  237. }
  238. }
  239. .tabledrag-cell-content .tabledrag-handle::after {
  240. vertical-align: middle;
  241. }
  242. /**
  243. * Indentation.
  244. */
  245. .indentation {
  246. position: relative;
  247. left: calc(var(--space-xs) * -0.5); /* LTR */
  248. float: left; /* LTR */
  249. width: calc(25rem / 16); /* 25px */
  250. height: calc(25rem / 16); /* 25px */
  251. background: none !important;
  252. line-height: 0;
  253. }
  254. [dir="rtl"] .indentation {
  255. right: calc(var(--space-xs) * -0.5);
  256. left: auto;
  257. float: right;
  258. }
  259. /**
  260. * Tree is the visual representation for the simultaneously moved draggable
  261. * rows.
  262. *
  263. * These rules are styling the inline SVG that is placed inside the .indentation
  264. * element.
  265. */
  266. .tree {
  267. width: calc(25rem / 16); /* 25px */
  268. height: calc(25rem / 16); /* 25px */
  269. }
  270. .tree__item {
  271. display: none;
  272. }
  273. /* LTR tree child. */
  274. .tree-child path:not(.tree__item-child-ltr) {
  275. display: none;
  276. }
  277. .tree-child path.tree__item-child-ltr {
  278. display: block;
  279. }
  280. /* RTL tree child. */
  281. [dir="rtl"] .tree-child path:not(.tree__item-child-rtl) {
  282. display: none;
  283. }
  284. [dir="rtl"] .tree-child path.tree__item-child-rtl {
  285. display: block;
  286. }
  287. /* Last LTR tree child. */
  288. .tree-child-last path:not(.tree__item-child-last-ltr) {
  289. display: none;
  290. }
  291. .tree-child-last path.tree__item-child-last-ltr {
  292. display: block;
  293. }
  294. /* Last RTL tree child. */
  295. [dir="rtl"] .tree-child-last path:not(.tree__item-child-last-rtl) {
  296. display: none;
  297. }
  298. [dir="rtl"] .tree-child-last path.tree__item-child-last-rtl {
  299. display: block;
  300. }
  301. /* Horizontal line. */
  302. .tree-child-horizontal path:not(.tree__item-horizontal) {
  303. display: none;
  304. }
  305. .tree-child-horizontal path.tree__item-horizontal {
  306. display: block;
  307. }