tabledrag.pcss.css

Same filename in this branch
  1. 10 core/misc/dialog/off-canvas/css/tabledrag.pcss.css
  2. 10 core/themes/olivero/css/components/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. 8.9.x core/themes/claro/css/components/tabledrag.pcss.css
  4. 11.x core/misc/dialog/off-canvas/css/tabledrag.pcss.css
  5. 11.x core/themes/olivero/css/components/tabledrag.pcss.css
  6. 11.x core/themes/claro/css/components/tabledrag.pcss.css

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

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