tabledrag.pcss.css

Same filename in other branches
  1. 9 core/themes/olivero/css/components/tabledrag.pcss.css
  2. 9 core/themes/claro/css/components/tabledrag.pcss.css
  3. 10 core/misc/dialog/off-canvas/css/tabledrag.pcss.css
  4. 10 core/themes/olivero/css/components/tabledrag.pcss.css
  5. 10 core/themes/claro/css/components/tabledrag.pcss.css
  6. 11.x core/misc/dialog/off-canvas/css/tabledrag.pcss.css
  7. 11.x core/themes/olivero/css/components/tabledrag.pcss.css
  8. 11.x core/themes/claro/css/components/tabledrag.pcss.css

Replacement styles for table drag.

Replaces both of tabledrag.module.css (from core/stable) and tabledrag.css (from Classy theme).

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 both of tabledrag.module.css (from core/stable) and tabledrag.css
  6. * (from Classy theme).
  7. *
  8. * @see tabledrag.js
  9. */
  10. @import "../base/variables.pcss.css";
  11. :root {
  12. --table-row--dragging-bg-color: #fe7;
  13. --table-row--last-dragged-bg-color: #ffb;
  14. }
  15. body.drag {
  16. cursor: move;
  17. }
  18. /* The block region's title row in table. */
  19. .region-title {
  20. font-weight: bold;
  21. }
  22. /* Empty region message row in table. */
  23. .region-message {
  24. color: var(--color-oldsilver);
  25. }
  26. /* If the region is populated, we shouldn't display the empty message. */
  27. .region-message.region-populated {
  28. display: none;
  29. }
  30. /**
  31. * Remove border-bottom from abbr element. Class is duplicated in the selector
  32. * to increase weight to be able to win normalize.css selectors.
  33. */
  34. .tabledrag-changed.tabledrag-changed {
  35. border-bottom: none;
  36. }
  37. /* Don't display the abbreviation of 'add-new' table rows. */
  38. .add-new .tabledrag-changed {
  39. display: none;
  40. }
  41. .draggable .tabledrag-changed {
  42. position: relative;
  43. left: calc(var(--space-xs) * -1); /* LTR */
  44. }
  45. [dir="rtl"] .draggable .tabledrag-changed {
  46. right: calc(var(--space-xs) * -1); /* LTR */
  47. left: auto;
  48. }
  49. .tabledrag-cell--only-drag .tabledrag-changed {
  50. width: var(--space-l);
  51. min-width: var(--space-l);
  52. }
  53. /**
  54. * Draggable row state colors.
  55. */
  56. .draggable.drag,
  57. .draggable.drag:focus {
  58. background-color: var(--table-row--dragging-bg-color);
  59. }
  60. .draggable.drag-previous {
  61. background-color: var(--table-row--last-dragged-bg-color);
  62. }
  63. /**
  64. * Reduce the spacing of draggable table cells.
  65. */
  66. .draggable-table td:first-child ~ td,
  67. .draggable-table th:first-child ~ th {
  68. padding-left: 0 /* LTR */;
  69. }
  70. [dir="rtl"] .draggable-table td:first-child ~ td,
  71. [dir="rtl"] .draggable-table th:first-child ~ th {
  72. padding-right: 0;
  73. padding-left: var(--space-m);
  74. }
  75. /* Auto width for weight selects and number inputs. */
  76. .draggable td .form-element--type-select[name$="][_weight]"], /* Multiple field */
  77. .draggable td .term-weight, /* Taxonomy term list */
  78. .draggable td .field-weight /* Field UI table */ {
  79. width: auto;
  80. }
  81. /**
  82. * Handle styles.
  83. */
  84. .tabledrag-handle {
  85. position: relative;
  86. z-index: 1;
  87. overflow: visible;
  88. cursor: move;
  89. text-align: center;
  90. vertical-align: text-top;
  91. }
  92. .tabledrag-handle::after {
  93. display: inline-block;
  94. width: var(--tabledrag-handle-icon-size);
  95. height: var(--tabledrag-handle-icon-size);
  96. margin-left: calc(var(--space-m) * -1); /* LTR */
  97. padding: var(--space-xs) var(--space-m);
  98. content: "";
  99. transition: transform 0.1s ease-in-out 0s;
  100. background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='m 14.102955,5.47562 c -0.1819,-0.20654 -0.4917,-0.23016 -0.7014,-0.05265 -0.2098,0.17684 -0.2462,0.4914 -0.0814,0.71278 l 1.0998,1.34591 H 8.5124153 V 1.62014 l 1.31954,1.11304 c 0.1033,0.0945 0.2395997,0.14242 0.3771997,0.13162 0.1383,-0.01013 0.2667,-0.07762 0.3548,-0.18629 0.088,-0.10935 0.129,-0.24974 0.1131,-0.39014 -0.0159,-0.14039 -0.0873,-0.26796 -0.1979,-0.35369 L 8.3278353,0.118965 c -0.1879501,-0.1586199 -0.4592601,-0.1586199 -0.6472101,0 l -2.15136,1.815715 c -0.11052,0.08572 -0.1819799,0.2133 -0.19787,0.35369 -0.0159,0.1404 0.02514,0.2808 0.1131601,0.39014 0.08801,0.10867 0.2163899,0.17616 0.35471,0.18629 0.1376499,0.0108 0.2739799,-0.03712 0.3772199,-0.13162 l 1.31956,-1.11304 v 5.86152 h -5.90757 L 2.6797353,6.13575 c 0.13963,-0.22004 0.09661,-0.51163 -0.10059,-0.6797 -0.19722,-0.16875 -0.4864,-0.15997 -0.67369,0.01957 L 0.11663625,7.66993 c -0.155515,0.1917 -0.155515,0.46843 0,0.66013 L 1.9054553,10.5244 c 0.18199,0.2065 0.49169,0.2301 0.70147,0.0526 0.20978,-0.1768 0.24617,-0.4914 0.0814,-0.71276 l -1.09986,-1.34591 h 5.9075699 v 5.86147 l -1.3195699,-1.113 c -0.2170501,-0.1681 -0.52545,-0.1316 -0.6988201,0.0824 -0.1740399,0.2146 -0.15089,0.5298 0.05162,0.7161 l 2.15136,1.8164 v -7e-4 c 0.18794,0.1587 0.4592601,0.1587 0.6472001,0 l 2.1513297,-1.8157 c 0.2025,-0.1863 0.2257,-0.5015 0.0517,-0.7161 -0.1734,-0.214 -0.4818,-0.2504 -0.6988997,-0.0824 l -1.31954,1.1131 V 8.51835 h 5.9075397 l -1.0912,1.3459 c -0.1059,0.10193 -0.1641,0.24505 -0.1602,0.39285 0.004,0.1485 0.0702,0.2875 0.182,0.3827 0.1119,0.0952 0.2581,0.137 0.4017,0.1154 0.1436,-0.0223 0.2713,-0.106 0.3507,-0.2308 l 1.7809,-2.19434 c 0.1549,-0.19169 0.1549,-0.46842 0,-0.66012 z'/%3E%3C/svg%3E") no-repeat center;
  101. }
  102. [dir="rtl"] .tabledrag-handle::after {
  103. margin-right: calc(var(--space-m) * -1);
  104. margin-left: 0;
  105. }
  106. @media screen and (-ms-high-contrast: active) {
  107. .tabledrag-handle::after {
  108. content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' viewBox='0 0 16 16'%3E%3Cpath fill='currentColor' d='m 14.102955,5.47562 c -0.1819,-0.20654 -0.4917,-0.23016 -0.7014,-0.05265 -0.2098,0.17684 -0.2462,0.4914 -0.0814,0.71278 l 1.0998,1.34591 H 8.5124153 V 1.62014 l 1.31954,1.11304 c 0.1033,0.0945 0.2395997,0.14242 0.3771997,0.13162 0.1383,-0.01013 0.2667,-0.07762 0.3548,-0.18629 0.088,-0.10935 0.129,-0.24974 0.1131,-0.39014 -0.0159,-0.14039 -0.0873,-0.26796 -0.1979,-0.35369 L 8.3278353,0.118965 c -0.1879501,-0.1586199 -0.4592601,-0.1586199 -0.6472101,0 l -2.15136,1.815715 c -0.11052,0.08572 -0.1819799,0.2133 -0.19787,0.35369 -0.0159,0.1404 0.02514,0.2808 0.1131601,0.39014 0.08801,0.10867 0.2163899,0.17616 0.35471,0.18629 0.1376499,0.0108 0.2739799,-0.03712 0.3772199,-0.13162 l 1.31956,-1.11304 v 5.86152 h -5.90757 L 2.6797353,6.13575 c 0.13963,-0.22004 0.09661,-0.51163 -0.10059,-0.6797 -0.19722,-0.16875 -0.4864,-0.15997 -0.67369,0.01957 L 0.11663625,7.66993 c -0.155515,0.1917 -0.155515,0.46843 0,0.66013 L 1.9054553,10.5244 c 0.18199,0.2065 0.49169,0.2301 0.70147,0.0526 0.20978,-0.1768 0.24617,-0.4914 0.0814,-0.71276 l -1.09986,-1.34591 h 5.9075699 v 5.86147 l -1.3195699,-1.113 c -0.2170501,-0.1681 -0.52545,-0.1316 -0.6988201,0.0824 -0.1740399,0.2146 -0.15089,0.5298 0.05162,0.7161 l 2.15136,1.8164 v -7e-4 c 0.18794,0.1587 0.4592601,0.1587 0.6472001,0 l 2.1513297,-1.8157 c 0.2025,-0.1863 0.2257,-0.5015 0.0517,-0.7161 -0.1734,-0.214 -0.4818,-0.2504 -0.6988997,-0.0824 l -1.31954,1.1131 V 8.51835 h 5.9075397 l -1.0912,1.3459 c -0.1059,0.10193 -0.1641,0.24505 -0.1602,0.39285 0.004,0.1485 0.0702,0.2875 0.182,0.3827 0.1119,0.0952 0.2581,0.137 0.4017,0.1154 0.1436,-0.0223 0.2713,-0.106 0.3507,-0.2308 l 1.7809,-2.19434 c 0.1549,-0.19169 0.1549,-0.46842 0,-0.66012 z'/%3E%3C/svg%3E");
  109. background: none;
  110. }
  111. }
  112. .tabledrag-handle::after,
  113. .tabledrag-disabled .tabledrag-handle.tabledrag-handle.tabledrag-handle::after {
  114. transform: scale(1);
  115. }
  116. .tabledrag-handle:hover::after,
  117. .tabledrag-handle:focus::after,
  118. .draggable.drag .tabledrag-handle::after {
  119. transform: scale(1.25);
  120. }
  121. .tabledrag-handle:focus {
  122. outline: none !important;
  123. box-shadow: none !important;
  124. }
  125. .tabledrag-handle:focus::before {
  126. display: block;
  127. width: calc(var(--space-m) + (var(--space-xs) * 2)); /* Same as height. */
  128. height: calc(var(--space-m) + (var(--space-xs) * 2)); /* Hande svg height + its vertical padding */
  129. margin: 0 calc(var(--space-xs) * -1) calc((var(--space-m) + (var(--space-xs) * 2)) * -1); /* Bottom: handle height as negative value. */
  130. content: "";
  131. border-radius: var(--base-border-radius);
  132. outline: var(--outline-size) dotted transparent;
  133. box-shadow: 0 0 0 var(--focus-border-size) var(--color-focus);
  134. }
  135. /* Disabled tabledrag handle. */
  136. .tabledrag-disabled .tabledrag-handle {
  137. cursor: default;
  138. opacity: 0.4;
  139. }
  140. .tabledrag-disabled .tabledrag-handle.tabledrag-handle::before {
  141. content: normal;
  142. }
  143. /**
  144. * Enhancements for touch-capable screens.
  145. */
  146. /**
  147. * Increase handle size.
  148. */
  149. .touchevents .tabledrag-handle::after {
  150. padding-top: var(--space-s);
  151. padding-bottom: var(--space-s);
  152. }
  153. .touchevents .draggable .menu-item__link {
  154. padding-top: var(--space-xs);
  155. padding-bottom: var(--space-xs);
  156. }
  157. /**
  158. * Wrapper of the toggle weight button (styled as a link).
  159. */
  160. .tabledrag-toggle-weight-wrapper {
  161. text-align: right; /* LTR */
  162. }
  163. [dir="rtl"] .tabledrag-toggle-weight-wrapper {
  164. text-align: left;
  165. }
  166. /**
  167. * Keep crowded tabledrag cells vertically centered.
  168. */
  169. .tabledrag-cell {
  170. padding-top: 0;
  171. padding-bottom: 0;
  172. }
  173. /**
  174. * If the first table cell is empty (like in a multiple field widget table),
  175. * we can save some space for the following cells.
  176. * If it isn't empty (Field UI table, taxonomy term overview page), this CSS
  177. * class won't be added.
  178. */
  179. .tabledrag-cell--only-drag {
  180. width: 1px; /* This forces this cell to use the smallest possible width. */
  181. padding-right: 0; /* LTR */
  182. }
  183. [dir="rtl"] .tabledrag-cell--only-drag {
  184. padding-right: var(--space-m);
  185. padding-left: 0;
  186. }
  187. .tabledrag-cell-content {
  188. display: table;
  189. height: 100%;
  190. }
  191. .tabledrag-cell-content > * {
  192. display: table-cell;
  193. vertical-align: middle;
  194. }
  195. .tabledrag-cell-content__item {
  196. padding-right: var(--space-xs); /* LTR */
  197. }
  198. [dir="rtl"] .tabledrag-cell-content__item {
  199. padding-right: 0;
  200. padding-left: var(--space-xs);
  201. }
  202. .tabledrag-cell-content__item:empty {
  203. display: none;
  204. }
  205. .tabledrag-cell-content .indentation,
  206. [dir="rtl"] .tabledrag-cell-content .indentation {
  207. float: none;
  208. overflow: hidden;
  209. height: 100%;
  210. }
  211. .tabledrag-cell-content .tree {
  212. min-height: 100%; /* Using simply 'height: 100%' would make IE11 rendering ugly. */
  213. }
  214. /**
  215. * Safari (at least version 13.0) thinks that if we define a width or height for
  216. * and SVG, then we refer to the elements total size inside the SVG.
  217. * We only want to inherit the height of the parent element.
  218. */
  219. /* stylelint-disable-next-line unit-whitelist */
  220. @media not all and (min-resolution: 0.001dpcm) {
  221. @media {
  222. .tabledrag-cell-content .tree {
  223. overflow: visible;
  224. min-height: 0;
  225. }
  226. }
  227. }
  228. .tabledrag-cell-content .tabledrag-handle::after {
  229. vertical-align: middle;
  230. }
  231. /**
  232. * Indentation.
  233. */
  234. .indentation {
  235. position: relative;
  236. left: calc(var(--space-xs) * -0.5); /* LTR */
  237. float: left; /* LTR */
  238. width: calc(25rem / 16); /* 25px */
  239. height: calc(25rem / 16); /* 25px */
  240. background: none !important;
  241. line-height: 0;
  242. }
  243. [dir="rtl"] .indentation {
  244. right: calc(var(--space-xs) * -0.5);
  245. left: auto;
  246. float: right;
  247. }
  248. /**
  249. * Tree is the visual representation for the simultaneously moved draggable
  250. * rows.
  251. *
  252. * These rules are styleing the inline SVG that is placed inside the .indetation
  253. * element.
  254. */
  255. .tree {
  256. width: calc(25rem / 16); /* 25px */
  257. height: calc(25rem / 16); /* 25px */
  258. }
  259. .tree__item {
  260. display: none;
  261. }
  262. /* LTR tree child. */
  263. .tree-child path:not(.tree__item-child-ltr) {
  264. display: none;
  265. }
  266. .tree-child path.tree__item-child-ltr {
  267. display: block;
  268. }
  269. /* RTL tree child. */
  270. [dir="rtl"] .tree-child path:not(.tree__item-child-rtl) {
  271. display: none;
  272. }
  273. [dir="rtl"] .tree-child path.tree__item-child-rtl {
  274. display: block;
  275. }
  276. /* Last LTR tree child. */
  277. .tree-child-last path:not(.tree__item-child-last-ltr) {
  278. display: none;
  279. }
  280. .tree-child-last path.tree__item-child-last-ltr {
  281. display: block;
  282. }
  283. /* Last RTL tree child. */
  284. [dir="rtl"] .tree-child-last path:not(.tree__item-child-last-rtl) {
  285. display: none;
  286. }
  287. [dir="rtl"] .tree-child-last path.tree__item-child-last-rtl {
  288. display: block;
  289. }
  290. /* Horizontal line. */
  291. .tree-child-horizontal path:not(.tree__item-horizontal) {
  292. display: none;
  293. }
  294. .tree-child-horizontal path.tree__item-horizontal {
  295. display: block;
  296. }

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.