tabledrag.css

Replacement styles for table drag.

Replaces core's tabledrag.module.css.

See also

tabledrag.js

File

core/themes/claro/css/components/tabledrag.css

View source
  1. /*
  2. * DO NOT EDIT THIS FILE.
  3. * See the following change record for more information,
  4. * https://www.drupal.org/node/3084859
  5. * @preserve
  6. */
  7. /**
  8. * @file
  9. * Replacement styles for table drag.
  10. *
  11. * Replaces core's tabledrag.module.css.
  12. *
  13. * @see tabledrag.js
  14. */
  15. body.drag {
  16. cursor: move;
  17. }
  18. body.drag-y {
  19. cursor: row-resize;
  20. }
  21. .draggable-table {
  22. --table-row--dragging-bg-color: #fe7;
  23. --table-row--last-dragged-bg-color: #ffb;
  24. --tabledrag-handle-icon-size: 1.0625rem;
  25. /**
  26. * Reduce the spacing of draggable table cells.
  27. */
  28. & td:first-child ~ td,
  29. & th:first-child ~ th {
  30. padding-inline-start: 0;
  31. }
  32. }
  33. /* The block region's title row in table. */
  34. .region-title {
  35. font-weight: bold;
  36. }
  37. /* Empty region message row in table. */
  38. .region-message {
  39. color: var(--color-gray-600);
  40. &.region-populated {
  41. /* If the region is populated, we shouldn't display the empty message. */
  42. display: none;
  43. }
  44. }
  45. /**
  46. * Remove border-bottom from abbr element. Class is duplicated in the selector
  47. * to increase weight to be able to win normalize.css selectors.
  48. */
  49. .tabledrag-changed.tabledrag-changed {
  50. border-bottom: none;
  51. }
  52. .tabledrag-changed {
  53. /* Don't display the abbreviation of 'add-new' table rows. */
  54. .add-new
  55. .draggable
  56. .tabledrag-cell--only-drag
  57. }
  58. /**
  59. * Draggable row state colors.
  60. */
  61. .draggable.drag,
  62. .draggable.drag:focus {
  63. background-color: var(--table-row--dragging-bg-color);
  64. }
  65. .draggable.drag-previous {
  66. background-color: var(--table-row--last-dragged-bg-color);
  67. }
  68. /* Auto width for weight selects and number inputs. */
  69. .draggable td .form-element--type-select[name$="][_weight]"], /* Multiple field */
  70. .draggable td .term-weight, /* Taxonomy term list */
  71. .draggable td .field-weight /* Field UI table */ {
  72. width: auto;
  73. }
  74. /**
  75. * Handle styles.
  76. */
  77. .tabledrag-handle {
  78. position: relative;
  79. z-index: 1;
  80. overflow: visible;
  81. cursor: move;
  82. text-align: center;
  83. vertical-align: text-top;
  84. &::after {
  85. display: inline-block;
  86. width: var(--tabledrag-handle-icon-size);
  87. height: var(--tabledrag-handle-icon-size);
  88. margin-inline-start: calc(var(--space-m) * -1);
  89. padding: var(--space-xs) var(--space-m);
  90. content: "";
  91. transition: transform 0.1s ease-in-out 0s;
  92. 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='%23000f33' d='M14.103 5.476a.5.5 0 00-.701-.053.526.526 0 00-.082.713l1.1 1.346H8.512V1.62l1.32 1.113a.501.501 0 00.732-.054.528.528 0 00-.085-.744L8.328.119a.5.5 0 00-.647 0L5.529 1.935a.527.527 0 00-.085.744.504.504 0 00.732.054l1.32-1.113v5.862H1.588L2.68 6.136a.526.526 0 00-.1-.68.5.5 0 00-.675.02L.117 7.67a.525.525 0 000 .66l1.788 2.194a.5.5 0 00.702.053.526.526 0 00.081-.713l-1.1-1.346h5.908v5.862l-1.32-1.113a.501.501 0 00-.698.082.526.526 0 00.051.716l2.152 1.817v-.001a.5.5 0 00.647 0l2.151-1.816a.526.526 0 00.052-.716.501.501 0 00-.699-.082l-1.32 1.113V8.518h5.908l-1.091 1.346a.527.527 0 00.022.776.504.504 0 00.752-.116l1.78-2.194a.527.527 0 000-.66z'/%3e%3c/svg%3e") no-repeat center;
  93. @media (forced-colors: active) {
  94. background: linktext;
  95. mask-image: 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='%23000f33' d='M14.103 5.476a.5.5 0 00-.701-.053.526.526 0 00-.082.713l1.1 1.346H8.512V1.62l1.32 1.113a.501.501 0 00.732-.054.528.528 0 00-.085-.744L8.328.119a.5.5 0 00-.647 0L5.529 1.935a.527.527 0 00-.085.744.504.504 0 00.732.054l1.32-1.113v5.862H1.588L2.68 6.136a.526.526 0 00-.1-.68.5.5 0 00-.675.02L.117 7.67a.525.525 0 000 .66l1.788 2.194a.5.5 0 00.702.053.526.526 0 00.081-.713l-1.1-1.346h5.908v5.862l-1.32-1.113a.501.501 0 00-.698.082.526.526 0 00.051.716l2.152 1.817v-.001a.5.5 0 00.647 0l2.151-1.816a.526.526 0 00.052-.716.501.501 0 00-.699-.082l-1.32 1.113V8.518h5.908l-1.091 1.346a.527.527 0 00.022.776.504.504 0 00.752-.116l1.78-2.194a.527.527 0 000-.66z'/%3e%3c/svg%3e");
  96. mask-repeat: no-repeat;
  97. mask-position: center;
  98. }
  99. }
  100. }
  101. /* Change icon and cursor if only vertical drag is allowed. */
  102. .tabledrag-handle.tabledrag-handle-y {
  103. cursor: row-resize;
  104. }
  105. .tabledrag-handle.tabledrag-handle-y::after {
  106. background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M2 8h12'/%3e%3cpath d='M8 2l2 2 -4 0 2 -2'/%3e%3cpath d='M8 14l2 -2 -4 0 2 2'/%3e%3c/svg%3e");
  107. background-size: 1rem 1rem;
  108. }
  109. .tabledrag-handle::after,
  110. .tabledrag-disabled .tabledrag-handle.tabledrag-handle.tabledrag-handle::after {
  111. transform: scale(1);
  112. }
  113. .tabledrag-handle:is(:hover, :focus)::after,
  114. .draggable.drag .tabledrag-handle::after {
  115. transform: scale(1.25);
  116. }
  117. .tabledrag-handle:focus {
  118. outline: none !important;
  119. box-shadow: none !important;
  120. &::before {
  121. display: block;
  122. width: calc(var(--space-m) + (var(--space-xs) * 2)); /* Same as height. */
  123. height: calc(var(--space-m) + (var(--space-xs) * 2)); /* Hande svg height + its vertical padding */
  124. margin: 0 calc(var(--space-xs) * -1) calc((var(--space-m) + (var(--space-xs) * 2)) * -1); /* Bottom: handle height as negative value. */
  125. content: "";
  126. border-radius: var(--base-border-radius);
  127. outline: var(--outline-size) dotted transparent;
  128. box-shadow: 0 0 0 var(--focus-border-size) var(--color-focus);
  129. }
  130. }
  131. /* Disabled tabledrag handle. */
  132. .tabledrag-disabled {
  133. & .tabledrag-handle {
  134. cursor: default;
  135. opacity: 0.4;
  136. &.tabledrag-handle::before {
  137. content: none;
  138. }
  139. }
  140. }
  141. /**
  142. * Enhancements for touch-capable screens.
  143. */
  144. /**
  145. * Increase handle size.
  146. */
  147. .touchevents {
  148. & .tabledrag-handle::after {
  149. padding-block: var(--space-s);
  150. }
  151. & .draggable .menu-item__link {
  152. padding-block: var(--space-xs);
  153. }
  154. }
  155. /**
  156. * Wrapper of the toggle weight button (styled as a link).
  157. */
  158. .tabledrag-toggle-weight-wrapper {
  159. text-align: end;
  160. /* Hide nested weight toggles as they are redundant. */
  161. .draggable-table
  162. }
  163. /**
  164. * Keep crowded tabledrag cells vertically centered.
  165. */
  166. .tabledrag-cell {
  167. padding-block: 0;
  168. }
  169. /**
  170. * If the first table cell is empty (like in a multiple field widget table),
  171. * we can save some space for the following cells.
  172. * If it isn't empty (Field UI table, taxonomy term overview page), this CSS
  173. * class won't be added.
  174. */
  175. .tabledrag-cell--only-drag {
  176. width: 1px; /* This forces this cell to use the smallest possible width. */
  177. padding-inline-end: 0;
  178. }
  179. .tabledrag-cell-content {
  180. display: flex;
  181. align-items: center;
  182. height: 100%;
  183. & > * {
  184. display: table-cell;
  185. vertical-align: middle;
  186. }
  187. & .tree {
  188. flex-grow: 1;
  189. }
  190. & .tabledrag-handle::after {
  191. vertical-align: middle;
  192. }
  193. }
  194. .tabledrag-cell-content__item {
  195. padding-inline-end: var(--space-xs);
  196. &:empty {
  197. display: none;
  198. }
  199. }
  200. /**
  201. * Indentation.
  202. */
  203. .indentation {
  204. position: relative;
  205. inset-inline-start: calc(var(--space-xs) * -0.5);
  206. float: left; /* LTR */
  207. width: 1.5625rem;
  208. height: 1.5625rem;
  209. background: none !important;
  210. line-height: 0;
  211. .tabledrag-cell-content
  212. [dir="rtl"]
  213. }
  214. /**
  215. * Tree is the visual representation for the simultaneously moved draggable
  216. * rows.
  217. *
  218. * These rules are styling the inline SVG that is placed inside the .indentation
  219. * element.
  220. */
  221. .tree {
  222. width: 1.5625rem;
  223. height: 1.5625rem;
  224. }
  225. .tree__item {
  226. display: none;
  227. }
  228. /* LTR tree child. */
  229. .tree-child path {
  230. &:not(.tree__item-child-ltr) {
  231. display: none;
  232. }
  233. &.tree__item-child-ltr {
  234. display: block;
  235. }
  236. }
  237. /* RTL tree child. */
  238. [dir="rtl"] {
  239. & .tree-child path {
  240. &:not(.tree__item-child-rtl) {
  241. display: none;
  242. }
  243. &.tree__item-child-rtl {
  244. display: block;
  245. }
  246. }
  247. /* Last RTL tree child. */
  248. & .tree-child-last path {
  249. &:not(.tree__item-child-last-rtl) {
  250. display: none;
  251. }
  252. &.tree__item-child-last-rtl {
  253. display: block;
  254. }
  255. }
  256. }
  257. /* Last LTR tree child. */
  258. .tree-child-last path {
  259. &:not(.tree__item-child-last-ltr) {
  260. display: none;
  261. }
  262. &.tree__item-child-last-ltr {
  263. display: block;
  264. }
  265. }
  266. /* Horizontal line. */
  267. .tree-child-horizontal path {
  268. &:not(.tree__item-horizontal) {
  269. display: none;
  270. }
  271. &.tree__item-horizontal {
  272. display: block;
  273. }
  274. }

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