tabledrag.pcss.css

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

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