You are here

tabledrag.pcss.css in Drupal 9

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-oldsilver);
  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/222330/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. .tabledrag-handle::after,
  112. .tabledrag-disabled .tabledrag-handle.tabledrag-handle.tabledrag-handle::after {
  113. transform: scale(1);
  114. }
  115. .tabledrag-handle:hover::after,
  116. .tabledrag-handle:focus::after,
  117. .draggable.drag .tabledrag-handle::after {
  118. transform: scale(1.25);
  119. }
  120. .tabledrag-handle:focus {
  121. outline: none !important;
  122. box-shadow: none !important;
  123. }
  124. .tabledrag-handle:focus::before {
  125. display: block;
  126. width: calc(var(--space-m) + (var(--space-xs) * 2)); /* Same as height. */
  127. height: calc(var(--space-m) + (var(--space-xs) * 2)); /* Hande svg height + its vertical padding */
  128. margin: 0 calc(var(--space-xs) * -1) calc((var(--space-m) + (var(--space-xs) * 2)) * -1); /* Bottom: handle height as negative value. */
  129. content: "";
  130. border-radius: var(--base-border-radius);
  131. outline: var(--outline-size) dotted transparent;
  132. box-shadow: 0 0 0 var(--focus-border-size) var(--color-focus);
  133. }
  134. /* Disabled tabledrag handle. */
  135. .tabledrag-disabled .tabledrag-handle {
  136. cursor: default;
  137. opacity: 0.4;
  138. }
  139. .tabledrag-disabled .tabledrag-handle.tabledrag-handle::before {
  140. content: normal;
  141. }
  142. /**
  143. * Enhancements for touch-capable screens.
  144. */
  145. /**
  146. * Increase handle size.
  147. */
  148. .touchevents .tabledrag-handle::after {
  149. padding-top: var(--space-s);
  150. padding-bottom: var(--space-s);
  151. }
  152. .touchevents .draggable .menu-item__link {
  153. padding-top: var(--space-xs);
  154. padding-bottom: var(--space-xs);
  155. }
  156. /**
  157. * Wrapper of the toggle weight button (styled as a link).
  158. */
  159. .tabledrag-toggle-weight-wrapper {
  160. text-align: right; /* LTR */
  161. }
  162. [dir="rtl"] .tabledrag-toggle-weight-wrapper {
  163. text-align: left;
  164. }
  165. /* Hide nested weight toggles as they are redundant. */
  166. .draggable-table .tabledrag-toggle-weight-wrapper {
  167. display: none;
  168. }
  169. /**
  170. * Keep crowded tabledrag cells vertically centered.
  171. */
  172. .tabledrag-cell {
  173. padding-top: 0;
  174. padding-bottom: 0;
  175. }
  176. /**
  177. * If the first table cell is empty (like in a multiple field widget table),
  178. * we can save some space for the following cells.
  179. * If it isn't empty (Field UI table, taxonomy term overview page), this CSS
  180. * class won't be added.
  181. */
  182. .tabledrag-cell--only-drag {
  183. width: 1px; /* This forces this cell to use the smallest possible width. */
  184. padding-right: 0; /* LTR */
  185. }
  186. [dir="rtl"] .tabledrag-cell--only-drag {
  187. padding-right: var(--space-m);
  188. padding-left: 0;
  189. }
  190. .tabledrag-cell-content {
  191. display: table;
  192. height: 100%;
  193. }
  194. .tabledrag-cell-content > * {
  195. display: table-cell;
  196. vertical-align: middle;
  197. }
  198. .tabledrag-cell-content__item {
  199. padding-right: var(--space-xs); /* LTR */
  200. }
  201. [dir="rtl"] .tabledrag-cell-content__item {
  202. padding-right: 0;
  203. padding-left: var(--space-xs);
  204. }
  205. .tabledrag-cell-content__item:empty {
  206. display: none;
  207. }
  208. .tabledrag-cell-content .indentation,
  209. [dir="rtl"] .tabledrag-cell-content .indentation {
  210. float: none;
  211. overflow: hidden;
  212. height: 100%;
  213. }
  214. .tabledrag-cell-content .tree {
  215. min-height: 100%; /* Using simply 'height: 100%' would make IE11 rendering ugly. */
  216. }
  217. /**
  218. * Safari (at least version 13.0) thinks that if we define a width or height for
  219. * and SVG, then we refer to the elements total size inside the SVG.
  220. * We only want to inherit the height of the parent element.
  221. */
  222. /* stylelint-disable-next-line unit-allowed-list */
  223. @media not all and (min-resolution: 0.001dpcm) {
  224. @supports (-webkit-appearance: none) {
  225. .tabledrag-cell-content .tree {
  226. overflow: visible;
  227. min-height: 0;
  228. }
  229. }
  230. }
  231. .tabledrag-cell-content .tabledrag-handle::after {
  232. vertical-align: middle;
  233. }
  234. /**
  235. * Indentation.
  236. */
  237. .indentation {
  238. position: relative;
  239. left: calc(var(--space-xs) * -0.5); /* LTR */
  240. float: left; /* LTR */
  241. width: calc(25rem / 16); /* 25px */
  242. height: calc(25rem / 16); /* 25px */
  243. background: none !important;
  244. line-height: 0;
  245. }
  246. [dir="rtl"] .indentation {
  247. right: calc(var(--space-xs) * -0.5);
  248. left: auto;
  249. float: right;
  250. }
  251. /**
  252. * Tree is the visual representation for the simultaneously moved draggable
  253. * rows.
  254. *
  255. * These rules are styling the inline SVG that is placed inside the .indentation
  256. * element.
  257. */
  258. .tree {
  259. width: calc(25rem / 16); /* 25px */
  260. height: calc(25rem / 16); /* 25px */
  261. }
  262. .tree__item {
  263. display: none;
  264. }
  265. /* LTR tree child. */
  266. .tree-child path:not(.tree__item-child-ltr) {
  267. display: none;
  268. }
  269. .tree-child path.tree__item-child-ltr {
  270. display: block;
  271. }
  272. /* RTL tree child. */
  273. [dir="rtl"] .tree-child path:not(.tree__item-child-rtl) {
  274. display: none;
  275. }
  276. [dir="rtl"] .tree-child path.tree__item-child-rtl {
  277. display: block;
  278. }
  279. /* Last LTR tree child. */
  280. .tree-child-last path:not(.tree__item-child-last-ltr) {
  281. display: none;
  282. }
  283. .tree-child-last path.tree__item-child-last-ltr {
  284. display: block;
  285. }
  286. /* Last RTL tree child. */
  287. [dir="rtl"] .tree-child-last path:not(.tree__item-child-last-rtl) {
  288. display: none;
  289. }
  290. [dir="rtl"] .tree-child-last path.tree__item-child-last-rtl {
  291. display: block;
  292. }
  293. /* Horizontal line. */
  294. .tree-child-horizontal path:not(.tree__item-horizontal) {
  295. display: none;
  296. }
  297. .tree-child-horizontal path.tree__item-horizontal {
  298. display: block;
  299. }