@inchurch/matcha-theme 22.2.0 → 22.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@
29
29
  // CSS vars do componente — única fonte de verdade. ZERO literal hardcoded
30
30
  // fora deste bloco. Consumer override qualquer um no escopo do <table>.
31
31
  // ═══════════════════════════════════════════════════════════════════════
32
- table.matcha-table {
32
+ .matcha-table {
33
33
  // ── Dimensions ────────────────────────────────────────────────────────
34
34
  // Calibrado pra density moderna (Stripe/Linear/Notion). Comfortable era 52
35
35
  // antes — apertado em telas wide. 58px equilibra densidade × respiro.
@@ -122,10 +122,16 @@
122
122
  }
123
123
 
124
124
  // ── Base — display table nativo + typography via vars ─────────────────
125
- table.matcha-table {
125
+ .matcha-table {
126
126
  display: table;
127
127
  width: 100%;
128
- border-collapse: collapse;
128
+ // separate (não collapse) + spacing 0 → visualmente idêntico (zero gap
129
+ // entre cells), mas `border-collapse: collapse` é conhecido por quebrar
130
+ // `position: sticky` em <th>/<td> em vários browsers — especialmente
131
+ // quando a cell precisa ficar sticky nos DOIS eixos ao mesmo tempo (linha
132
+ // + coluna, o canto stickyHeader × stickyStart/stickyEnd). Só existe
133
+ // border-bottom no arquivo (nenhum border-top) — sem risco de borda dupla.
134
+ border-collapse: separate;
129
135
  border-spacing: 0;
130
136
  font-family: var(--matcha-font-family);
131
137
  font-size: var(--matcha-table-font-size);
@@ -401,7 +407,16 @@
401
407
  border-radius: var(--matcha-table-bordered-radius);
402
408
  }
403
409
 
404
- // Sticky header (vertical scroll)
410
+ // Sticky header (vertical scroll). Forma legado: o host (a própria table) é
411
+ // o container de scroll. Default do componente é overflow-y:hidden (só
412
+ // horizontal é fallback passivo — dois scrolls na tela atrapalham mobile);
413
+ // stickyHeader é opt-in EXPLÍCITO, reabilita overflow-y:auto de propósito
414
+ // + altura máxima (sem isso não há o que rolar, o header não tem contra o
415
+ // que grudar). Altura configurável via var (default 70vh).
416
+ &.matcha-table-sticky-header {
417
+ max-height: var(--matcha-table-sticky-header-max-height, 70vh);
418
+ overflow-y: auto;
419
+ }
405
420
  &.matcha-table-sticky-header thead th {
406
421
  position: sticky;
407
422
  top: 0;
@@ -417,13 +432,27 @@
417
432
  // ── Sticky columns (start/end) — canon scroll horizontal ──────────────
418
433
  // Shadow scroll-edge via color-mix() pra tokenizar — funciona em light
419
434
  // E dark. Offsets/blur/cor todos via var.
435
+ //
436
+ // :not(.matcha-table-sticky-header) — combinar sticky column COM sticky
437
+ // header exige que a cell de CANTO (cabeçalho da coluna fixa) fique sticky
438
+ // nos dois eixos (top E left/right) ao mesmo tempo — inconsistente entre
439
+ // browsers em cells de <table> (documentado no JSDoc do componente). Em vez
440
+ // de deixar o canto quebrado (cabeçalho da coluna fixa não gruda, mostra
441
+ // dado errado por trás), desliga a coluna fixa inteira quando stickyHeader
442
+ // está ativo — só o header fixo (mais universalmente útil) permanece.
420
443
  @for $i from 1 through 4 {
421
- &[data-sticky-start="#{$i}"] {
444
+ &[data-sticky-start="#{$i}"]:not(.matcha-table-sticky-header) {
422
445
  thead th:nth-child(-n+#{$i}),
423
446
  tbody tr td:nth-child(-n+#{$i}) {
424
447
  position: sticky;
425
448
  z-index: 2;
426
- background: var(--matcha-table-cell-bg);
449
+ // --matcha-table-cell-bg em hover/rowHover="accent"/striped é um TINT
450
+ // translúcido (rgba ~12-18%) — correto pra cells normais (nada sólido
451
+ // atrás), mas cells sticky têm conteúdo real rolando por baixo. Duas
452
+ // camadas: background-color sempre opaco, background-image pinta o
453
+ // tint (mesma var, já cascade certo) por cima.
454
+ background-color: var(--matcha-color-surface-card);
455
+ background-image: linear-gradient(var(--matcha-table-cell-bg), var(--matcha-table-cell-bg));
427
456
  }
428
457
  // Última cell do grupo sticky-start projeta shadow scroll-edge.
429
458
  thead th:nth-child(#{$i}),
@@ -436,12 +465,13 @@
436
465
  }
437
466
  }
438
467
 
439
- &[data-sticky-end="#{$i}"] {
468
+ &[data-sticky-end="#{$i}"]:not(.matcha-table-sticky-header) {
440
469
  thead th:nth-last-child(-n+#{$i}),
441
470
  tbody tr td:nth-last-child(-n+#{$i}) {
442
471
  position: sticky;
443
472
  z-index: 2;
444
- background: var(--matcha-table-cell-bg);
473
+ background-color: var(--matcha-color-surface-card);
474
+ background-image: linear-gradient(var(--matcha-table-cell-bg), var(--matcha-table-cell-bg));
445
475
  }
446
476
  thead th:nth-last-child(#{$i}),
447
477
  tbody tr td:nth-last-child(#{$i}) {
@@ -454,10 +484,10 @@
454
484
  }
455
485
  }
456
486
 
457
- &[data-sticky-start] thead th:first-child,
458
- &[data-sticky-start] tbody tr td:first-child { left: 0; }
459
- &[data-sticky-end] thead th:last-child,
460
- &[data-sticky-end] tbody tr td:last-child { right: 0; }
487
+ &[data-sticky-start]:not(.matcha-table-sticky-header) thead th:first-child,
488
+ &[data-sticky-start]:not(.matcha-table-sticky-header) tbody tr td:first-child { left: 0; }
489
+ &[data-sticky-end]:not(.matcha-table-sticky-header) thead th:last-child,
490
+ &[data-sticky-end]:not(.matcha-table-sticky-header) tbody tr td:last-child { right: 0; }
461
491
 
462
492
  // ── Variant accent (semantic row coloring) ────────────────────────────
463
493
  // Defaults canon Figma DSV3: equal=info, plus=success, minus=danger.
@@ -563,6 +593,16 @@
563
593
  }
564
594
  }
565
595
 
596
+ // Sticky header — forma ELEMENTO (`<matcha-table>`, ver table.component.ts).
597
+ // Aqui quem rola de verdade é `.matcha-table__scroll` (o wrapper), não a
598
+ // `<table class="matcha-table">` interna — a altura máxima precisa ir no
599
+ // wrapper. `:has()` alcança o pai a partir da tabela filha (já usado no
600
+ // showcase — ver page-matcha-table.component.scss).
601
+ .matcha-table__scroll:has(> table.matcha-table-sticky-header) {
602
+ max-height: var(--matcha-table-sticky-header-max-height, 70vh);
603
+ overflow-y: auto;
604
+ }
605
+
566
606
  @keyframes matcha-table-loading-pulse {
567
607
  0%, 100% { opacity: 1; }
568
608
  50% { opacity: var(--matcha-table-loading-pulse-opacity-min); }
@@ -570,8 +610,8 @@
570
610
 
571
611
  // ── Reduced motion ────────────────────────────────────────────────────
572
612
  @media (prefers-reduced-motion: reduce) {
573
- table.matcha-table tbody td,
574
- table.matcha-table.matcha-table-loading tbody tr {
613
+ .matcha-table tbody td,
614
+ .matcha-table.matcha-table-loading tbody tr {
575
615
  transition: none;
576
616
  animation: none;
577
617
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inchurch/matcha-theme",
3
- "version": "22.2.0",
3
+ "version": "22.3.0",
4
4
  "description": "Themes for matcha-design-system",
5
5
  "main": "main.scss",
6
6
  "scripts": {