tabledrag.pcss.css

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

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