tabledrag.css

Same filename in this branch
  1. main core/profiles/demo_umami/themes/umami/css/classy/components/tabledrag.css
  2. main core/misc/dialog/off-canvas/css/tabledrag.css
  3. main core/themes/olivero/css/components/tabledrag.css
  4. main core/themes/claro/css/components/tabledrag.css
  5. main core/themes/starterkit_theme/css/components/tabledrag.css
  6. main core/themes/admin/css/components/tabledrag.css
Same filename and directory in other branches
  1. 10 core/profiles/demo_umami/themes/umami/css/classy/components/tabledrag.css
  2. 10 core/misc/dialog/off-canvas/css/tabledrag.css
  3. 10 core/themes/olivero/css/components/tabledrag.css
  4. 10 core/themes/claro/css/components/tabledrag.css
  5. 10 core/themes/starterkit_theme/css/components/tabledrag.css
  6. 11.x core/profiles/demo_umami/themes/umami/css/classy/components/tabledrag.css
  7. 11.x core/misc/dialog/off-canvas/css/tabledrag.css
  8. 11.x core/themes/olivero/css/components/tabledrag.css
  9. 11.x core/themes/claro/css/components/tabledrag.css
  10. 11.x core/themes/starterkit_theme/css/components/tabledrag.css
  11. 9 core/profiles/demo_umami/themes/umami/css/classy/components/tabledrag.css
  12. 9 core/themes/olivero/css/components/tabledrag.css
  13. 9 core/themes/seven/css/classy/components/tabledrag.css
  14. 9 core/themes/claro/css/components/tabledrag.css
  15. 9 core/themes/bartik/css/classy/components/tabledrag.css
  16. 9 core/themes/starterkit_theme/css/components/tabledrag.css
  17. 9 core/themes/classy/css/components/tabledrag.css
  18. 8.9.x core/profiles/demo_umami/themes/umami/css/classy/components/tabledrag.css
  19. 8.9.x core/themes/seven/css/classy/components/tabledrag.css
  20. 8.9.x core/themes/claro/css/components/tabledrag.css
  21. 8.9.x core/themes/bartik/css/classy/components/tabledrag.css
  22. 8.9.x core/themes/classy/css/components/tabledrag.css
  23. 11.x core/themes/admin/css/components/tabledrag.css
  24. 11.x core/themes/default_admin/css/components/tabledrag.css

Replacement styles for table drag.

Replaces core's tabledrag.module.css.

See also

tabledrag.js

File

core/themes/default_admin/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. /*
  16. * When mouse is pressed, scrollbar disappears. This prevents the horizontal
  17. * layout shift from occurring
  18. */
  19. html {
  20. scrollbar-gutter: stable;
  21. }
  22. body {
  23. &.drag {
  24. cursor: move;
  25. }
  26. &.drag-y {
  27. cursor: row-resize;
  28. }
  29. }
  30. .draggable-table {
  31. --table-row--dragging-bg-color: #fe7;
  32. --table-row--last-dragged-bg-color: #ffb;
  33. --tabledrag-handle-icon-size: 1.0625rem;
  34. /*
  35. * We remove all padding and hard-code the height of the elements to
  36. * ensure that the "tree" icons span full height. You can replicate this in
  37. * the UI by clicking and holding down the drag icon. The tree icons will
  38. * become visible underneath.
  39. */
  40. :is(th, td) {
  41. height: 3.75rem;
  42. html[data-gin-layout-density="medium"]
  43. html[data-gin-layout-density="small"]
  44. .layer-wrapper {
  45. margin-block: var(--gin-spacing-density-s);
  46. }
  47. .draggable-table {
  48. margin-block: 0;
  49. }
  50. :is(th, td) {
  51. height: auto;
  52. }
  53. }
  54. /**
  55. * Reduce the spacing of draggable table cells.
  56. */
  57. & :is(th, td):first-child ~ :is(th, td) {
  58. padding-inline-start: 0;
  59. }
  60. }
  61. /* The block region's title row in table. */
  62. .region-title {
  63. font-weight: bold;
  64. }
  65. /* Empty region message row in table. */
  66. .region-message {
  67. color: var(--color-gray-600);
  68. &.region-populated {
  69. /* If the region is populated, we shouldn't display the empty message. */
  70. display: none;
  71. }
  72. }
  73. /**
  74. * Remove border-bottom from abbr element. Class is duplicated in the selector
  75. * to increase weight to be able to win normalize.css selectors.
  76. */
  77. .tabledrag-changed.tabledrag-changed {
  78. border-bottom: none;
  79. }
  80. .tabledrag-changed {
  81. /* Don't display the abbreviation of 'add-new' table rows. */
  82. .add-new
  83. .draggable
  84. .tabledrag-cell--only-drag
  85. }
  86. /**
  87. * Draggable row state colors.
  88. */
  89. .draggable {
  90. &.region-title,
  91. &.region-title:focus {
  92. background-color: var(--table-row--dragging-bg-color);
  93. }
  94. &.region-title-previous {
  95. background-color: var(--table-row--last-dragged-bg-color);
  96. }
  97. &.drag-previous {
  98. background-color: var(--gin-bg-layer2);
  99. box-shadow: inset 6px 0 0 0 var(--gin-color-warning);
  100. &:dir(rtl) {
  101. box-shadow: inset -6px 0 0 0 var(--gin-color-warning);
  102. }
  103. &::after {
  104. position: absolute;
  105. width: 0.375rem;
  106. height: 100%;
  107. content: "";
  108. }
  109. @media (forced-colors: active) {
  110. position: relative;
  111. &::after {
  112. border-inline-start: 0.375rem solid linktext;
  113. inset-inline-start: 0;
  114. }
  115. }
  116. }
  117. &.drag,
  118. &.drag:focus {
  119. background-color: var(--gin-bg-layer2);
  120. .gin--dark-mode
  121. }
  122. /* Auto width for weight selects and number inputs. */
  123. td .form-element--type-select[name$="][_weight]"], /* Multiple field */
  124. td .term-weight, /* Taxonomy term list */
  125. td .field-weight /* Field UI table */ {
  126. width: auto;
  127. }
  128. a.tabledrag-handle {
  129. float: none;
  130. vertical-align: middle;
  131. }
  132. }
  133. /**
  134. * Handle styles.
  135. */
  136. .tabledrag-handle {
  137. position: relative;
  138. z-index: 1;
  139. display: flex;
  140. overflow: visible;
  141. place-content: center;
  142. box-sizing: border-box;
  143. height: 2.75rem;
  144. cursor: move;
  145. text-align: center;
  146. vertical-align: text-top;
  147. margin-inline: calc(-1 * var(--space-s)) var(--space-s);
  148. padding-inline: var(--space-s);
  149. &::after {
  150. display: inline-block;
  151. box-sizing: border-box;
  152. width: var(--tabledrag-handle-icon-size);
  153. height: var(--tabledrag-handle-icon-size);
  154. padding: var(--space-xs);
  155. content: "";
  156. transition: transform 0.1s ease-in-out 0s;
  157. background-color: var(--gin-color-text-light);
  158. mask-image: var(--admin-icon-drag);
  159. mask-repeat: no-repeat;
  160. mask-position: center center;
  161. mask-size: 1rem 1rem;
  162. @media (forced-colors: active) {
  163. background: linktext;
  164. 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");
  165. mask-repeat: no-repeat;
  166. mask-position: center;
  167. @supports (mask-composite: source-over) {
  168. background-color: var(--gin-color-text-light);
  169. }
  170. }
  171. }
  172. &:focus {
  173. outline-offset: calc(-1 * var(--outline-size, 0px));
  174. }
  175. &:hover {
  176. &::after {
  177. transform: scale(1);
  178. @media (forced-colors: none) {
  179. background-color: var(--gin-color-primary);
  180. }
  181. }
  182. }
  183. }
  184. /* Change icon and cursor if only vertical drag is allowed. */
  185. .tabledrag-handle.tabledrag-handle-y {
  186. cursor: row-resize;
  187. &::after {
  188. mask-image: var(--admin-icon-drag-y);
  189. }
  190. }
  191. .tabledrag-handle::after,
  192. .tabledrag-disabled .tabledrag-handle.tabledrag-handle.tabledrag-handle::after {
  193. transform: scale(1);
  194. }
  195. .tabledrag-handle:is(:hover, :focus)::after,
  196. .draggable.drag .tabledrag-handle::after {
  197. transform: scale(1.25);
  198. }
  199. /* Disabled tabledrag handle. */
  200. .tabledrag-disabled {
  201. & .tabledrag-handle {
  202. cursor: default;
  203. opacity: 0.4;
  204. &.tabledrag-handle::before {
  205. content: none;
  206. }
  207. }
  208. }
  209. /**
  210. * Enhancements for touch-capable screens.
  211. */
  212. /**
  213. * Increase handle size.
  214. */
  215. .touchevents {
  216. & .tabledrag-handle::after {
  217. padding-block: var(--space-s);
  218. }
  219. & .draggable .menu-item__link {
  220. padding-block: var(--space-xs);
  221. }
  222. }
  223. /**
  224. * Wrapper of the toggle weight button (styled as a link).
  225. */
  226. .tabledrag-toggle-weight-wrapper {
  227. text-align: end;
  228. line-height: calc(28rem / 16);
  229. & + table,
  230. & + .tableresponsive-toggle-columns + table {
  231. margin-block-start: 0;
  232. }
  233. /* Hide nested weight toggles as they are redundant. */
  234. .draggable-table
  235. #field-display-overview,
  236. #field-display-overview-wrapper,
  237. .field--widget-entity-reference-paragraphs,
  238. .field--type-link,
  239. .field--type-smartdate {
  240. .gin-layer-wrapper >
  241. @media (min-width: 61em) {
  242. position: relative;
  243. z-index: 1;
  244. margin-block-end: calc(var(--gin-spacing-xxl) * -1);
  245. pointer-events: none;
  246. }
  247. }
  248. }
  249. .action-link {
  250. margin-block-end: var(--gin-spacing-xs);
  251. .action-link {
  252. margin-block-end: 0;
  253. }
  254. }
  255. }
  256. /**
  257. * If the first table cell is empty (like in a multiple field widget table),
  258. * we can save some space for the following cells.
  259. * If it isn't empty (Field UI table, taxonomy term overview page), this CSS
  260. * class won't be added.
  261. */
  262. .tabledrag-cell--only-drag {
  263. width: 1px; /* This forces this cell to use the smallest possible width. */
  264. padding-inline-end: 0;
  265. }
  266. .tabledrag-cell-content {
  267. display: flex;
  268. align-items: center;
  269. height: 100%;
  270. & > * {
  271. display: table-cell;
  272. vertical-align: middle;
  273. }
  274. & .tree {
  275. flex-grow: 1;
  276. }
  277. & .tabledrag-handle::after {
  278. vertical-align: middle;
  279. }
  280. .table-file-multiple-widget
  281. }
  282. .tabledrag-cell-content__item {
  283. display: flex;
  284. align-items: center;
  285. padding-inline-end: var(--space-xs);
  286. &:empty {
  287. display: none;
  288. }
  289. }
  290. /**
  291. * Indentation.
  292. */
  293. .indentation {
  294. position: relative;
  295. display: inline-flex;
  296. overflow: clip;
  297. flex-direction: column;
  298. height: calc(100% + var(--cell-padding-y) * 2);
  299. inset-inline-start: calc(var(--space-xs) * -0.5);
  300. margin-block: calc(-1 * var(--cell-padding-y));
  301. }
  302. /**
  303. * Tree is the visual representation for the simultaneously moved draggable
  304. * rows.
  305. *
  306. * These rules are styling the inline SVG that is placed inside the .indentation
  307. * element.
  308. */
  309. .tree {
  310. width: 1.5625rem;
  311. height: 1.5625rem;
  312. }
  313. .tree__item {
  314. display: none;
  315. }
  316. /* LTR tree child. */
  317. .tree-child path {
  318. &:not(.tree__item-child-ltr) {
  319. display: none;
  320. }
  321. &.tree__item-child-ltr {
  322. display: block;
  323. }
  324. }
  325. /* RTL tree child. */
  326. [dir="rtl"] {
  327. & .tree-child path {
  328. &:not(.tree__item-child-rtl) {
  329. display: none;
  330. }
  331. &.tree__item-child-rtl {
  332. display: block;
  333. }
  334. }
  335. /* Last RTL tree child. */
  336. & .tree-child-last path {
  337. &:not(.tree__item-child-last-rtl) {
  338. display: none;
  339. }
  340. &.tree__item-child-last-rtl {
  341. display: block;
  342. }
  343. }
  344. }
  345. /* Last LTR tree child. */
  346. .tree-child-last path {
  347. &:not(.tree__item-child-last-ltr) {
  348. display: none;
  349. }
  350. &.tree__item-child-last-ltr {
  351. display: block;
  352. }
  353. }
  354. /* Horizontal line. */
  355. .tree-child-horizontal path {
  356. &:not(.tree__item-horizontal) {
  357. display: none;
  358. }
  359. &.tree__item-horizontal {
  360. display: block;
  361. }
  362. }
  363. /* @todo do these styles belong here? They were migrated from Gin. */
  364. .field-plugin-settings-edit-wrapper,
  365. .field-plugin-settings-edit-wrapper + a {
  366. margin-block: var(--gin-spacing-m);
  367. }
  368. .field-plugin-settings-edit-wrapper + a {
  369. margin-block-start: var(--gin-spacing-s);
  370. }
  371. /* Correctly align bulk action checkboxes when used in combination with tabledrag */
  372. table:has(.tabledrag-cell-content__item .form-checkbox) th.select-all .form-checkbox {
  373. margin-inline-start: calc(var(--tabledrag-handle-icon-size, calc(17rem / 16)) + var(--gin-spacing-m));
  374. }

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