grid.css 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. @reference "./globals.css";
  2. .sb-grid {
  3. @apply flex h-full flex-col;
  4. }
  5. .sb-grid-fill-container:after {
  6. content: '';
  7. display: inline-block;
  8. width: 100%;
  9. }
  10. .rdg-cell {
  11. @apply flex;
  12. @apply text-grid;
  13. @apply border-secondary border-r border-b;
  14. @apply text-foreground;
  15. padding-inline: 0.5rem;
  16. white-space: nowrap;
  17. overflow: hidden;
  18. text-overflow: ellipsis;
  19. line-height: inherit;
  20. }
  21. /* Apply parent bg colour while editing */
  22. .rdg-cell.rdg-editor-container > * {
  23. background-color: inherit;
  24. }
  25. .rdg-cell > div[draggable='true'] {
  26. @apply h-full;
  27. }
  28. .rdg-row .rdg-cell-frozen:nth-last-child(1 of .rdg-cell-frozen) {
  29. @apply border-secondary border-r;
  30. }
  31. .rdg-cell[aria-selected='true'] {
  32. box-shadow: inset 0 0 0 1px #24b47e;
  33. }
  34. .rdg:not(:focus-within):not(.rdg-context-menu-open) .rdg-cell[aria-selected='true'] {
  35. box-shadow: none;
  36. outline: none;
  37. }
  38. /* Cell with unsaved changes - warning (amber) background/text color */
  39. .rdg-cell.rdg-cell--dirty {
  40. background-color: hsl(var(--warning-300) / 0.75);
  41. color: hsl(var(--warning-default));
  42. }
  43. /* Row pending addition - green background, green text */
  44. .rdg-row.rdg-row--added {
  45. background-color: hsl(var(--brand-200) / 0.3);
  46. &:hover {
  47. background-color: hsl(var(--brand-200) / 0.5);
  48. }
  49. .rdg-cell {
  50. border-left-color: hsl(var(--brand-default));
  51. color: hsl(var(--brand-link));
  52. }
  53. /* First cell gets a stronger left border to indicate new row */
  54. .rdg-cell:first-child {
  55. box-shadow: inset 2px 0 0 0 hsl(var(--brand-default));
  56. }
  57. }
  58. /* Row pending deletion - red background with strikethrough effect, red text */
  59. .rdg-row.rdg-row--deleted {
  60. background-color: hsl(var(--destructive-300) / 0.3);
  61. &:hover {
  62. background-color: hsl(var(--destructive-300) / 0.5);
  63. }
  64. .rdg-cell {
  65. text-decoration: line-through;
  66. text-decoration-color: hsl(var(--destructive-default));
  67. border-left-color: hsl(var(--destructive-default));
  68. color: hsl(var(--destructive-default));
  69. }
  70. /* First cell gets a stronger left border to indicate deleted row */
  71. .rdg-cell:first-child {
  72. box-shadow: inset 2px 0 0 0 hsl(var(--destructive-default));
  73. }
  74. }
  75. .rdg {
  76. @apply box-border select-none overflow-x-auto overflow-y-scroll bg-dash-canvas;
  77. @apply border-t border-r-0 border-l-0;
  78. contain: strict;
  79. font-size: 14px;
  80. }
  81. .rdg *,
  82. .rdg ::after,
  83. .rdg ::before {
  84. box-sizing: inherit;
  85. }
  86. @supports not (contain: strict) {
  87. .rdg {
  88. position: relative;
  89. z-index: 0;
  90. }
  91. }
  92. .rdg-focus-sink {
  93. position: sticky;
  94. top: 0;
  95. left: 0;
  96. height: 0;
  97. width: 0;
  98. outline: 0;
  99. }
  100. /*
  101. Row header
  102. */
  103. .rdg-header-row {
  104. @apply bg-surface-200 select-none border-none;
  105. }
  106. .rdg-header-row {
  107. height: var(--header-row-height);
  108. line-height: var(--header-row-height);
  109. top: 0;
  110. }
  111. .rdg-header-row .rdg-cell {
  112. @apply bg-surface-200 border-default border-b;
  113. }
  114. .rdg-header-row .rdg-cell-frozen:nth-last-child(1 of .rdg-cell-frozen) {
  115. @apply border-default border-r border-b;
  116. }
  117. [data-theme='dark'] .rdg-row .rdg-cell-frozen:nth-last-child(1 of .rdg-cell-frozen),
  118. [data-theme='dark'] .rdg-header-row .rdg-cell-frozen:nth-last-child(1 of .rdg-cell-frozen) {
  119. @apply border-r-strong;
  120. }
  121. .rdg-header-row .rdg-cell p {
  122. @apply text-typography-body-light [[data-theme*=dark]_&]:text-typography-body-dark;
  123. }
  124. .rdg-header-row .rdg-checkbox {
  125. @apply bg-surface-200 border-default rounded-xs border;
  126. }
  127. .rdg-header-row .rdg-checkbox-input:checked + .rdg-checkbox {
  128. @apply border-default border-4 bg-brand-900;
  129. }
  130. .rdg-header-row .rdg-checkbox-input:focus + .rdg-checkbox {
  131. box-shadow: none;
  132. }
  133. .rdg-cell .Select {
  134. max-height: 30px;
  135. font-size: 12px;
  136. font-weight: 400;
  137. }
  138. /*
  139. Row
  140. */
  141. .rdg-row {
  142. @apply bg-dash-sidebar transition-colors;
  143. @apply hover:bg-surface-200;
  144. }
  145. /* edit button */
  146. .rdg-row__select-column__edit-action {
  147. @apply opacity-0;
  148. }
  149. .rdg-row:hover .rdg-row__select-column__edit-action {
  150. @apply opacity-100;
  151. }
  152. .rdg-row__select-column__edit-action:hover {
  153. opacity: 1 !important;
  154. }
  155. /* select row */
  156. .rdg-row[aria-selected='true'] {
  157. @apply bg-surface-200;
  158. }
  159. .tab-cursor {
  160. cursor: pointer !important;
  161. }
  162. /*
  163. Checkbox
  164. */
  165. .sb-grid {
  166. /* reset styles */
  167. [type='checkbox'] {
  168. webkit-appearance: none;
  169. -moz-appearance: none;
  170. appearance: none;
  171. padding: 0;
  172. -webkit-print-color-adjust: exact;
  173. print-color-adjust: exact;
  174. display: inline-block;
  175. vertical-align: middle;
  176. background-origin: border-box;
  177. -webkit-user-select: none;
  178. -moz-user-select: none;
  179. -ms-user-select: none;
  180. user-select: none;
  181. flex-shrink: 0;
  182. height: 1rem;
  183. width: 1rem;
  184. color: #2563eb;
  185. background-color: #fff;
  186. border-color: #6b7280;
  187. border-width: 1px;
  188. }
  189. [type='checkbox']:checked {
  190. @apply bg-foreground;
  191. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='hsl(0, 0%, 100%)'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E") !important;
  192. }
  193. [type='checkbox']:indeterminate {
  194. @apply bg-foreground;
  195. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='hsl(0, 0%, 100%)'%3E%3Crect x='3' y='7' width='10' height='2'/%3E%3C/svg%3E") !important;
  196. [data-theme='dark'] & {
  197. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='hsl(0, 0%, 0%)'%3E%3Crect x='3' y='7' width='10' height='2'/%3E%3C/svg%3E") !important;
  198. }
  199. }
  200. [type='checkbox'] {
  201. @apply cursor-pointer rounded-sm border border-solid;
  202. @apply text-foreground border-strong transition-all;
  203. @apply hover:border-foreground focus:ring-0 focus:outline-hidden;
  204. @apply bg-control;
  205. margin-top: 2px;
  206. }
  207. }
  208. /* Dark mode */
  209. [data-theme='dark'] .sb-grid [type='checkbox']:checked {
  210. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='hsl(0, 0%, 0%)'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E") !important;
  211. }
  212. .rdg__segmented-control {
  213. @apply border-default relative mx-2 h-8 rounded-md border;
  214. }
  215. .rdg__segmented-control__button {
  216. @apply absolute top-0 inline-flex h-full items-center justify-center;
  217. @apply text-xs font-medium;
  218. @apply text-border-muted;
  219. @apply active:bg-alternative hover:text-white focus:z-10 focus:outline-hidden;
  220. @apply transition duration-150 ease-in-out;
  221. @apply cursor-pointer;
  222. z-index: 1;
  223. }
  224. .rdg__segmented-control__button--option {
  225. @apply text-background;
  226. }
  227. .rdg__segmented-control__button--right {
  228. @apply right-0;
  229. }
  230. .rdg__segmented-control__button--left {
  231. @apply left-0;
  232. }
  233. .rdg__segmented-control__label {
  234. @apply bg-overlay-hover border-control z-0 inline-block h-full transform rounded-sm border shadow-sm transition duration-200 ease-in-out;
  235. }
  236. .rdg__segmented-control__label--left {
  237. @apply translate-x-0;
  238. }
  239. .rdg__segmented-control__label--right {
  240. @apply translate-x-12;
  241. }
  242. .rdg__segmented-control__options-label {
  243. @apply uppercase;
  244. color: inherit;
  245. }
  246. /*
  247. DropdownControl
  248. */
  249. .dropdown-control {
  250. @apply overflow-auto;
  251. }
  252. .dropdown-control .sbui-typography {
  253. @apply block px-2 py-4;
  254. }
  255. /*
  256. NullValue
  257. */
  258. .null-value {
  259. @apply block;
  260. }
  261. /*
  262. CheckboxEditor
  263. */
  264. .sb-grid-checkbox-editor {
  265. @apply flex h-full w-full;
  266. }
  267. .sb-grid-checkbox-editor__input {
  268. @apply h-4 w-4;
  269. outline: 4px auto -webkit-focus-ring-color;
  270. }
  271. /*
  272. JsonEditor
  273. */
  274. .sb-grid-json-editor__trigger {
  275. @apply text-grid overflow-hidden text-ellipsis px-2;
  276. }
  277. /*
  278. NumberEditor
  279. */
  280. .sb-grid-number-editor {
  281. @apply h-full w-full px-2;
  282. }
  283. /*
  284. SelectEditor
  285. */
  286. .sb-grid-select-editor {
  287. button {
  288. @apply border-none rounded-none shadow-none;
  289. box-shadow: none !important;
  290. }
  291. }
  292. /*
  293. TextEditor
  294. */
  295. .sb-grid-text-editor__trigger {
  296. @apply text-grid overflow-hidden text-ellipsis px-2;
  297. }
  298. /*
  299. TimeEditor
  300. */
  301. .sb-grid-time-editor {
  302. @apply h-full w-full px-2;
  303. }
  304. /*
  305. Footer
  306. */
  307. .sb-grid-footer {
  308. @apply bg-surface-100 flex h-10 items-center justify-between px-2;
  309. }
  310. .sb-grid-footer__inner {
  311. @apply flex items-center;
  312. }
  313. /*
  314. ForeignKeyFormatter
  315. */
  316. .sb-grid-foreign-key-formatter {
  317. @apply flex w-full items-center justify-between;
  318. }
  319. .sb-grid-foreign-key-formatter__text {
  320. @apply m-0 grow overflow-hidden text-ellipsis;
  321. }
  322. /*
  323. ColumnHeader
  324. */
  325. .sb-grid-column-header {
  326. @apply flex h-full w-full items-center justify-between;
  327. }
  328. .sb-grid-column-header--cursor {
  329. @apply cursor-default;
  330. }
  331. .sb-grid-column-header__inner {
  332. @apply flex items-center gap-2 overflow-hidden text-ellipsis;
  333. }
  334. .sb-grid-column-header__inner__name {
  335. @apply text-foreground overflow-hidden text-ellipsis text-xs select-text;
  336. }
  337. .sb-grid-column-header__inner__format {
  338. @apply text-xs;
  339. @apply overflow-hidden text-ellipsis font-normal;
  340. @apply text-foreground-light;
  341. }
  342. .sb-grid-column-header__inner__primary-key {
  343. @apply flex rotate-45 transform items-center;
  344. }
  345. .sb-grid-column-header__inner svg {
  346. @apply border-brand text-brand;
  347. }
  348. /*
  349. Grid
  350. */
  351. .sb-grid-grid--loading {
  352. @apply flex justify-center bg-transparent;
  353. }
  354. .sb-grid-grid--loading__inner {
  355. @apply flex items-center;
  356. }
  357. .sb-grid-grid--loading__inner__text {
  358. @apply m-8;
  359. }
  360. /*
  361. SelectColumn
  362. */
  363. .sb-grid-select-cell__formatter {
  364. @apply flex h-full w-full items-center justify-between;
  365. }
  366. .sb-grid-select-cell__header {
  367. @apply flex h-full w-full items-center justify-between;
  368. }
  369. .sb-grid-select-cell__header__input {
  370. /* @apply focus:ring-brand-300; */
  371. @apply border-background-surface-100;
  372. }
  373. /*
  374. Header
  375. */
  376. .sb-grid-header {
  377. @apply bg-surface-100 flex h-10 justify-between px-2;
  378. }
  379. .sb-grid-header__inner {
  380. @apply flex items-center space-x-2;
  381. }
  382. .sb-grid-header__inner__divider {
  383. @apply py-2;
  384. }
  385. .row_header__selected-rows {
  386. @apply ml-2 mr-2;
  387. }
  388. /*
  389. StatusLabel
  390. */
  391. .sb-grid-status-label {
  392. @apply text-grid text-white;
  393. }
  394. .sb-grid-status-label__no-msg {
  395. @apply flex h-5 w-5;
  396. }
  397. .sb-grid-status-label__no-msg > div {
  398. @apply m-auto h-2 w-2 rounded-full bg-brand-900;
  399. }
  400. /*
  401. Empty value
  402. */
  403. .sb-grid-empty-value {
  404. @apply block;
  405. }
  406. /*
  407. header/sort/SortDropdown
  408. */
  409. .sb-grid-sort-popover {
  410. @apply w-96;
  411. }
  412. .sb-grid-dropdown__empty {
  413. @apply py-2;
  414. }
  415. .sb-grid-dropdown__empty__text {
  416. @apply block;
  417. }
  418. .sb-grid-dropdown__item-trigger {
  419. @apply my-1;
  420. }
  421. /*
  422. header/sort/SortRow
  423. */
  424. .sb-grid-sort-row {
  425. @apply flex justify-between space-x-3;
  426. }
  427. .sb-grid-sort-row__item {
  428. @apply flex items-center space-x-3;
  429. }
  430. .sb-grid-sort-row__item__remove {
  431. @apply bg-transparent p-0 hover:bg-transparent;
  432. }
  433. .sb-grid-sort-row__item__label {
  434. @apply flex items-center space-x-2;
  435. }
  436. .sb-grid-sort-row__item_toogle {
  437. @apply flex w-28 items-center gap-0 space-x-3;
  438. }
  439. .sb-grid-sort-row__item__move {
  440. @apply flex cursor-move;
  441. }