@inchurch/matcha-theme 22.38.9 → 22.40.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.
- package/components/matcha-tree-view.scss +96 -74
- package/package.json +1 -1
|
@@ -35,17 +35,22 @@ matcha-tree-branch,
|
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: column;
|
|
37
37
|
gap: 0;
|
|
38
|
-
min-height: 2px; // alvo de drop mínimo quando o branch está vazio
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
// ── Recuo (bloco de filhos) ────────────────────────────────────────────────
|
|
42
41
|
// O recuo é do BLOCO, não de cada linha: o item dentro do container não recua
|
|
43
42
|
// sozinho, e a guia vira UM traço por nível, contínuo por estrutura.
|
|
44
43
|
.matcha-tree-view__children {
|
|
45
|
-
position:
|
|
46
|
-
padding-inline-start: var(--matcha-tree-view-indent-step, 32px);
|
|
44
|
+
position: relative;
|
|
47
45
|
// Motion do Figma: filhos entram em 200ms, desacelerando.
|
|
48
46
|
animation: matcha-tree-view-children-in var(--matcha-duration-fast, 200ms) var(--matcha-easing-decelerated, ease-out) both;
|
|
47
|
+
|
|
48
|
+
// O padding mora no BRANCH, não no bloco: a faixa do recuo (onde passa a
|
|
49
|
+
// guia) é da lista de filhos no hit-test do arraste. No bloco, o cursor
|
|
50
|
+
// sobre a guia caía na lista de fora, e o destino mostrado era outro.
|
|
51
|
+
> matcha-tree-branch {
|
|
52
|
+
padding-inline-start: var(--matcha-tree-view-indent-step, 32px);
|
|
53
|
+
}
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
@keyframes matcha-tree-view-children-in {
|
|
@@ -125,7 +130,7 @@ matcha-tree-branch,
|
|
|
125
130
|
|
|
126
131
|
// Recuo travado ([maxIndentLevel]): o bloco não recua nem desenha guia; a linha
|
|
127
132
|
// fica no recuo do pai e o contexto entrega `clamped` pra ela sinalizar (L5+).
|
|
128
|
-
.matcha-tree-view .matcha-tree-view__children.is-clamped {
|
|
133
|
+
.matcha-tree-view .matcha-tree-view__children.is-clamped > matcha-tree-branch {
|
|
129
134
|
padding-inline-start: 0;
|
|
130
135
|
}
|
|
131
136
|
|
|
@@ -322,35 +327,26 @@ matcha-tree-view-item:focus-within .matcha-tree-view-item__actions,
|
|
|
322
327
|
opacity: 1;
|
|
323
328
|
}
|
|
324
329
|
|
|
325
|
-
//
|
|
326
|
-
//
|
|
327
|
-
//
|
|
328
|
-
//
|
|
330
|
+
// "Solte aqui para tornar filho" — o alvo de uma pasta ABERTA e VAZIA que aceita
|
|
331
|
+
// o item (Figma: filhos · vazio). Aparece durante todo o arraste pra dar onde
|
|
332
|
+
// mirar (IN-42506), mas só onde o drop é possível: nunca numa página, nunca na
|
|
333
|
+
// outra árvore. É sempre neutro: quando o cursor chega nele (`.is-target`), o
|
|
334
|
+
// destaque é o Recebendo na linha do PAI — um sinal só, como no Figma.
|
|
329
335
|
.matcha-tree-view .matcha-drop-list-empty-placeholder {
|
|
330
336
|
display: flex;
|
|
331
337
|
align-items: center;
|
|
332
338
|
justify-content: center;
|
|
333
|
-
min-height:
|
|
339
|
+
min-height: 48px;
|
|
334
340
|
margin: var(--matcha-space-050, 4px) 0;
|
|
335
|
-
padding: var(--matcha-space-150, 12px);
|
|
341
|
+
padding: var(--matcha-space-100, 8px) var(--matcha-space-150, 12px);
|
|
336
342
|
font-size: var(--matcha-text-body-sm, 12px);
|
|
343
|
+
line-height: 16px;
|
|
337
344
|
color: var(--matcha-color-text-muted);
|
|
338
|
-
border:
|
|
345
|
+
border: var(--matcha-border-hairline, 1px) dashed var(--matcha-color-surface-border);
|
|
339
346
|
border-radius: var(--matcha-radius-md, 4px);
|
|
340
347
|
background: transparent;
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
// Drag ativo mas o cursor ainda não chegou / chegou e o drop é válido.
|
|
345
|
-
&.can-accept {
|
|
346
|
-
border-color: var(--matcha-color-accent);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
// Cursor sobre o alvo e o drop é rejeitado (profundidade, ciclo, tipo).
|
|
350
|
-
&.cannot-accept {
|
|
351
|
-
border-color: var(--matcha-color-danger);
|
|
352
|
-
background: var(--matcha-color-danger-alpha, transparent);
|
|
353
|
-
}
|
|
348
|
+
box-sizing: border-box;
|
|
349
|
+
pointer-events: auto;
|
|
354
350
|
}
|
|
355
351
|
|
|
356
352
|
// Em ponteiro grosso (toque) não existe hover: grip e ações ficam visíveis.
|
|
@@ -538,18 +534,86 @@ matcha-tree-view-item:focus-within .matcha-tree-view-item__disclosure,
|
|
|
538
534
|
}
|
|
539
535
|
|
|
540
536
|
// ── Drag-and-drop (compõe com o motor do matcha-drop-list) ──────────────────
|
|
537
|
+
// Um alvo por vez: a árvore resolve o destino sob o cursor e pinta UMA coisa —
|
|
538
|
+
// Recebendo na pasta que vai receber, Recusado na linha que não aceita, ou a
|
|
539
|
+
// linha do Figma entre irmãos. As classes vêm do branch (estado da árvore).
|
|
540
|
+
|
|
541
|
+
// Dragging = o FANTASMA na origem, durante o arraste inteiro (Figma:
|
|
542
|
+
// opacity/disabled). Esmaece o bloco todo: a subárvore vai junto com o nó.
|
|
543
|
+
.matcha-tree-view .matcha-tree-view__node.is-dragging {
|
|
544
|
+
opacity: var(--matcha-opacity-disabled, 0.38);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// Durante o arraste o hover das linhas sai de cena: um fundo de hover sob o
|
|
548
|
+
// cursor parecia um segundo alvo ao lado do Recebendo, e o grip e o kebab
|
|
549
|
+
// revelados na linha de destino eram ruído (ela é destino, não alvo de clique).
|
|
550
|
+
.matcha-tree-view--dragging matcha-tree-view-item:not([disabled]):hover .matcha-tree-view-item__row {
|
|
551
|
+
background: transparent;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.matcha-tree-view--dragging matcha-tree-view-item:hover .matcha-tree-view-item__grip,
|
|
555
|
+
.matcha-tree-view--dragging matcha-tree-view-item:hover .matcha-tree-view-item__actions {
|
|
556
|
+
opacity: 0;
|
|
557
|
+
}
|
|
541
558
|
|
|
542
|
-
//
|
|
543
|
-
//
|
|
544
|
-
//
|
|
545
|
-
|
|
559
|
+
// Recebendo = a pasta que vai receber o item como filho: tinta accent + hairline
|
|
560
|
+
// accent. Mesma especificidade da regra acima e declarada depois: vence o hover
|
|
561
|
+
// suprimido e o selected.
|
|
562
|
+
.matcha-tree-view .matcha-tree-view__node.is-drop-into > matcha-tree-view-item .matcha-tree-view-item__row {
|
|
563
|
+
background: var(--matcha-color-accent-surface-hover, var(--matcha-color-accent-alpha));
|
|
564
|
+
box-shadow: inset 0 0 0 var(--matcha-border-hairline, 1px) var(--matcha-color-accent);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// Recusado = destino inválido (tipo ou profundidade), só na linha sob o cursor:
|
|
568
|
+
// tracejado danger de 2px (Figma: border/thin).
|
|
569
|
+
.matcha-tree-view .matcha-tree-view__node.is-drop-rejected > matcha-tree-view-item .matcha-tree-view-item__row {
|
|
570
|
+
outline: var(--matcha-border-thin, 2px) dashed var(--matcha-color-danger);
|
|
571
|
+
outline-offset: calc(-1 * var(--matcha-border-thin, 2px));
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
// Entre irmãos = a linha do Figma (matcha/tree-view/drop-indicator): 2px accent
|
|
575
|
+
// com uma bolinha no começo, na borda do nó e no recuo do nível dele.
|
|
576
|
+
.matcha-tree-view__drop-line {
|
|
577
|
+
position: absolute;
|
|
578
|
+
inset-inline: 0;
|
|
579
|
+
top: calc(-1 * var(--matcha-border-thin, 2px) / 2);
|
|
580
|
+
height: var(--matcha-border-thin, 2px);
|
|
581
|
+
border-radius: var(--matcha-radius-pill, 9999px);
|
|
582
|
+
background: var(--matcha-color-accent);
|
|
583
|
+
pointer-events: none;
|
|
584
|
+
z-index: 1;
|
|
585
|
+
|
|
586
|
+
&::before {
|
|
587
|
+
content: "";
|
|
588
|
+
position: absolute;
|
|
589
|
+
inset-inline-start: 0;
|
|
590
|
+
top: 50%;
|
|
591
|
+
width: var(--matcha-space-075, 6px);
|
|
592
|
+
height: var(--matcha-space-075, 6px);
|
|
593
|
+
border-radius: var(--matcha-radius-pill, 9999px);
|
|
594
|
+
background: var(--matcha-color-accent);
|
|
595
|
+
transform: translateY(-50%);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
&--after {
|
|
599
|
+
top: auto;
|
|
600
|
+
bottom: calc(-1 * var(--matcha-border-thin, 2px) / 2);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
546
603
|
|
|
547
604
|
// Levantado = a cópia que acompanha o cursor: SÓ a linha, com superfície e
|
|
548
|
-
// elevação level-2
|
|
549
|
-
//
|
|
550
|
-
.
|
|
551
|
-
|
|
605
|
+
// elevação level-2 — a sombra é da row, não da caixa do clone. Escopado no
|
|
606
|
+
// clone de nó da árvore: o ghost das listas planas segue com a opacidade e a
|
|
607
|
+
// sombra do drop-list.
|
|
608
|
+
.matcha-drag-ghost:has(> .matcha-tree-view__node) {
|
|
609
|
+
opacity: 1;
|
|
610
|
+
box-shadow: none;
|
|
611
|
+
border-radius: 0;
|
|
612
|
+
}
|
|
552
613
|
|
|
614
|
+
// O motor clona o wrapper inteiro (a subárvore junto); esconder os filhos no
|
|
615
|
+
// clone deixa a cópia do tamanho de uma linha.
|
|
616
|
+
.matcha-drag-ghost {
|
|
553
617
|
.matcha-tree-view__children-host { display: none; }
|
|
554
618
|
|
|
555
619
|
.matcha-tree-view-item__row {
|
|
@@ -574,48 +638,6 @@ matcha-tree-view-item:focus-within .matcha-tree-view-item__disclosure,
|
|
|
574
638
|
border: 0;
|
|
575
639
|
}
|
|
576
640
|
|
|
577
|
-
// Recebendo = o PAI que vai receber o drop dentro: tinta accent + hairline
|
|
578
|
-
// accent na linha dele. O motor marca o branch dos filhos; a linha do pai é a
|
|
579
|
-
// irmã anterior do bloco, daí o :has() com filhos diretos.
|
|
580
|
-
.matcha-tree-view .matcha-tree-view__node:has(
|
|
581
|
-
> .matcha-tree-view__children-host > .matcha-tree-view__children > matcha-tree-branch.matcha-drop-list-receiving
|
|
582
|
-
) > matcha-tree-view-item .matcha-tree-view-item__row {
|
|
583
|
-
background: var(--matcha-color-accent-surface-hover, var(--matcha-color-accent-alpha));
|
|
584
|
-
box-shadow: inset 0 0 0 var(--matcha-border-hairline, 1px) var(--matcha-color-accent);
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
// Recusado = destino inválido por TIPO: tracejado danger na linha do pai. A
|
|
588
|
-
// zona em si não ganha moldura, e a subárvore de quem está sendo arrastado
|
|
589
|
-
// (.matcha-drop-zone-self) não é pintada: rejeitar a si mesmo é óbvio.
|
|
590
|
-
.matcha-tree-view .matcha-tree-view__node:has(
|
|
591
|
-
> .matcha-tree-view__children-host > .matcha-drop-zone-cannot-accept:not(.matcha-drop-zone-self)
|
|
592
|
-
) > matcha-tree-view-item .matcha-tree-view-item__row {
|
|
593
|
-
outline: var(--matcha-border-hairline, 1px) dashed var(--matcha-color-danger);
|
|
594
|
-
outline-offset: calc(-1 * var(--matcha-border-hairline, 1px));
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
// A moldura listrada/tracejada que o drop-list dá à zona não vale na árvore.
|
|
598
|
-
.matcha-tree-view .matcha-tree-view__children.matcha-drop-zone-cannot-accept {
|
|
599
|
-
outline: none;
|
|
600
|
-
background: transparent;
|
|
601
|
-
border: 0;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
// O branch NÃO herda a moldura listrada do drop-list plano.
|
|
605
|
-
.matcha-tree-view matcha-tree-branch.matcha-drop-list-receiving,
|
|
606
|
-
.matcha-tree-view matcha-tree-branch.matcha-drop-list-can-accept,
|
|
607
|
-
.matcha-tree-view matcha-tree-branch.matcha-drop-list-cannot-accept {
|
|
608
|
-
background: transparent;
|
|
609
|
-
border: 0;
|
|
610
|
-
padding: 0;
|
|
611
|
-
|
|
612
|
-
&::before { content: none; }
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
// Entre irmãos NÃO há linha indicadora: o motor abre o espaço do item arrastado
|
|
616
|
-
// (translateY nos irmãos, 150ms) e deixa o fantasma na origem. É o "indicador"
|
|
617
|
-
// do código; o bloco drop-indicator do Figma é a representação estática disso.
|
|
618
|
-
|
|
619
641
|
// Respeita preferência de redução de movimento
|
|
620
642
|
@media (prefers-reduced-motion: reduce) {
|
|
621
643
|
matcha-tree-view-item,
|