@inchurch/matcha-core 21.3.2 → 21.4.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/core.scss CHANGED
@@ -514,6 +514,12 @@ $font-weight-token-map: (
514
514
  }
515
515
  @include generate-gap-classes($helper-breakpoints);
516
516
 
517
+ // Gap de 2px — o gerador acima salta de 4 em 4 (0/4/8…); 2px = --matcha-space-025 (token DSV3).
518
+ .gap-2 {
519
+ column-gap: var(--matcha-space-025, 2px);
520
+ row-gap: var(--matcha-space-025, 2px);
521
+ }
522
+
517
523
  // -----------------------------------------------------------------------------------------------------
518
524
  // @ Z-index classes
519
525
  // -----------------------------------------------------------------------------------------------------
@@ -600,7 +606,7 @@ $font-weight-token-map: (
600
606
  @include media-breakpoint($materialBreakpoint) {
601
607
  $infix: if($materialBreakpoint == null, "", "-#{$breakpoint}");
602
608
 
603
- @each $pos in (relative, absolute, static, fixed) {
609
+ @each $pos in (relative, absolute, static, fixed, sticky) {
604
610
  .position#{$infix}-#{$pos} {
605
611
  position: #{$pos};
606
612
  }
@@ -848,6 +854,64 @@ $font-weight-token-map: (
848
854
  }
849
855
  @include generate-line-height-classes($helper-breakpoints);
850
856
 
857
+ // -----------------------------------------------------------------------------------------------------
858
+ // @ Text Styles (composite — Figma matcha/text/*) → size + weight + line-height (+ letter-spacing/transform)
859
+ // Uma classe aplica o text style INTEIRO, token-backed. Nomes seguem --matcha-text-* (canônico DS).
860
+ // Não colide com os utilitários text-* single-prop (center/uppercase/truncate/...): sufixos distintos.
861
+ // Pareamento size/weight/leading/tracking espelha matcha-theme/tokens/_emit-tokens.scss:103-148
862
+ // (weight por estilo não é tokenizado → mapeia pro --matcha-weight-* correspondente).
863
+ // -----------------------------------------------------------------------------------------------------
864
+ @mixin generate-text-style-classes($helper-breakpoints) {
865
+ // name: (size, weight, line-height, letter-spacing-or-null, text-transform-or-null)
866
+ $text-styles: (
867
+ display-hero: (var(--matcha-text-display-hero, 36px), var(--matcha-weight-extrabold, 800), var(--matcha-leading-display-hero, 40px), var(--matcha-tracking-display-hero, -1.2px), null),
868
+ display: (var(--matcha-text-display, 32px), var(--matcha-weight-bold, 700), var(--matcha-leading-display, 40px), var(--matcha-tracking-display, -0.3px), null),
869
+ headline: (var(--matcha-text-headline, 24px), var(--matcha-weight-bold, 700), var(--matcha-leading-headline, 32px), var(--matcha-tracking-headline, -0.3px), null),
870
+ title-lg: (var(--matcha-text-title-lg, 20px), var(--matcha-weight-semibold, 600), var(--matcha-leading-title-lg, 28px), null, null),
871
+ title-md: (var(--matcha-text-title-md, 18px), var(--matcha-weight-semibold, 600), var(--matcha-leading-title-md, 24px), null, null),
872
+ title-sm: (var(--matcha-text-title-sm, 16px), var(--matcha-weight-semibold, 600), var(--matcha-leading-title-sm, 22px), null, null),
873
+ title-xs: (var(--matcha-text-title-xs, 14px), var(--matcha-weight-extrabold, 800), var(--matcha-leading-title-xs, 20px), null, null),
874
+ body-lg: (var(--matcha-text-body-lg, 16px), var(--matcha-weight-regular, 400), var(--matcha-leading-body-lg, 24px), null, null),
875
+ body-md: (var(--matcha-text-body-md, 14px), var(--matcha-weight-regular, 400), var(--matcha-leading-body-md, 20px), null, null),
876
+ body-sm: (var(--matcha-text-body-sm, 12px), var(--matcha-weight-regular, 400), var(--matcha-leading-body-sm, 16px), null, null),
877
+ p-tiny: (var(--matcha-text-p-tiny, 11px), var(--matcha-weight-regular, 400), var(--matcha-leading-p-tiny, 14px), var(--matcha-tracking-p-tiny, 0.3px), null),
878
+ label-lg: (var(--matcha-text-label-lg, 16px), var(--matcha-weight-medium, 500), var(--matcha-leading-label-lg, 22px), null, null),
879
+ label-md: (var(--matcha-text-label-md, 14px), var(--matcha-weight-medium, 500), var(--matcha-leading-label-md, 20px), null, null),
880
+ label-sm: (var(--matcha-text-label-sm, 12px), var(--matcha-weight-medium, 500), var(--matcha-leading-label-sm, 16px), null, null),
881
+ overline: (var(--matcha-text-overline, 10px), var(--matcha-weight-semibold, 600), var(--matcha-leading-overline, 14px), var(--matcha-tracking-overline, 1px), uppercase),
882
+ );
883
+
884
+ @each $breakpoint, $materialBreakpoint in $helper-breakpoints {
885
+ @include media-breakpoint($materialBreakpoint) {
886
+ $infix: if($materialBreakpoint == null, "", "-#{$breakpoint}");
887
+
888
+ @each $name, $props in $text-styles {
889
+ $size: list.nth($props, 1);
890
+ $weight: list.nth($props, 2);
891
+ $leading: list.nth($props, 3);
892
+ $tracking: list.nth($props, 4);
893
+ $transform: list.nth($props, 5);
894
+
895
+ .text#{$infix}-#{$name} {
896
+ font-size: $size;
897
+ font-weight: $weight;
898
+ line-height: $leading;
899
+ @if $tracking != null { letter-spacing: $tracking; }
900
+ @if $transform != null { text-transform: $transform; }
901
+ }
902
+ .text#{$infix}-#{$name}--force {
903
+ font-size: $size !important;
904
+ font-weight: $weight !important;
905
+ line-height: $leading !important;
906
+ @if $tracking != null { letter-spacing: $tracking !important; }
907
+ @if $transform != null { text-transform: $transform !important; }
908
+ }
909
+ }
910
+ }
911
+ }
912
+ }
913
+ @include generate-text-style-classes($helper-breakpoints);
914
+
851
915
  // -----------------------------------------------------------------------------------------------------
852
916
  // @ Aspect Ratio classes
853
917
  // -----------------------------------------------------------------------------------------------------
@@ -1263,6 +1327,27 @@ $font-weight-token-map: (
1263
1327
  .border#{$infix}-none--force {
1264
1328
  border: none !important;
1265
1329
  }
1330
+
1331
+ // Borda hairline (1px) — o loop acima só emite pares (0/2/4/6/8).
1332
+ // 1px é o valor que faltava da família e é token DSV3: --matcha-border-hairline.
1333
+ .border#{$infix}-1,
1334
+ .b#{$infix}-1 {
1335
+ border: var(--matcha-border-hairline, 1px) solid;
1336
+ }
1337
+ .border#{$infix}-1--force,
1338
+ .b#{$infix}-1--force {
1339
+ border: var(--matcha-border-hairline, 1px) solid !important;
1340
+ }
1341
+ @each $direction, $abbrev in $border-directions {
1342
+ .border-#{$direction}#{$infix}-1,
1343
+ .#{$abbrev}#{$infix}-1 {
1344
+ border-#{$direction}: var(--matcha-border-hairline, 1px) solid;
1345
+ }
1346
+ .border-#{$direction}#{$infix}-1--force,
1347
+ .#{$abbrev}#{$infix}-1--force {
1348
+ border-#{$direction}: var(--matcha-border-hairline, 1px) solid !important;
1349
+ }
1350
+ }
1266
1351
  }
1267
1352
  }
1268
1353
 
@@ -1270,6 +1355,50 @@ $font-weight-token-map: (
1270
1355
  }
1271
1356
  @include generate-border-size-classes($helper-breakpoints);
1272
1357
 
1358
+ // -----------------------------------------------------------------------------------------------------
1359
+ // @ Border Named Widths (token-backed — Figma matcha/border/{hairline,thin,medium,thick})
1360
+ // Espelha o gerador numérico acima, mas nomeado e ligado ao token. Cor herda currentColor
1361
+ // (cor de borda continua sendo token do tema — matcha-core não gera border-color).
1362
+ // -----------------------------------------------------------------------------------------------------
1363
+ @mixin generate-border-named-classes($helper-breakpoints){
1364
+ $border-named: (
1365
+ hairline: var(--matcha-border-hairline, 1px),
1366
+ thin: var(--matcha-border-thin, 2px),
1367
+ medium: var(--matcha-border-medium, 4px),
1368
+ thick: var(--matcha-border-thick, 8px),
1369
+ );
1370
+ $border-directions: (bottom: bb, top: bt, left: bl, right: br);
1371
+
1372
+ @each $breakpoint, $materialBreakpoint in $helper-breakpoints {
1373
+ @include media-breakpoint($materialBreakpoint) {
1374
+ $infix: if($materialBreakpoint == null, "", "-#{$breakpoint}");
1375
+
1376
+ @each $name, $width in $border-named {
1377
+ .border#{$infix}-#{$name},
1378
+ .b#{$infix}-#{$name} {
1379
+ border: $width solid;
1380
+ }
1381
+ .border#{$infix}-#{$name}--force,
1382
+ .b#{$infix}-#{$name}--force {
1383
+ border: $width solid !important;
1384
+ }
1385
+
1386
+ @each $direction, $abbrev in $border-directions {
1387
+ .border-#{$direction}#{$infix}-#{$name},
1388
+ .#{$abbrev}#{$infix}-#{$name} {
1389
+ border-#{$direction}: $width solid;
1390
+ }
1391
+ .border-#{$direction}#{$infix}-#{$name}--force,
1392
+ .#{$abbrev}#{$infix}-#{$name}--force {
1393
+ border-#{$direction}: $width solid !important;
1394
+ }
1395
+ }
1396
+ }
1397
+ }
1398
+ }
1399
+ }
1400
+ @include generate-border-named-classes($helper-breakpoints);
1401
+
1273
1402
  // -----------------------------------------------------------------------------------------------------
1274
1403
  // @ Border Style
1275
1404
  // -----------------------------------------------------------------------------------------------------
@@ -1389,6 +1518,39 @@ $font-weight-token-map: (
1389
1518
  }
1390
1519
  @include generate-radius-classes($helper-breakpoints);
1391
1520
 
1521
+ // -----------------------------------------------------------------------------------------------------
1522
+ // @ Shadow / Elevation (token-backed — Figma matcha/elevation/level-{1-4} → --matcha-shadow-*)
1523
+ // Classe utilitária CANÔNICA de sombra. NÃO confundir com o legado .elevation-z-* (Material,
1524
+ // deprecado, gerado no matcha-theme). Alternância light/dark vem do próprio token.
1525
+ // Fallbacks (light) via unquote() — a sombra é multi-camada (vírgulas) e não pode entrar
1526
+ // crua num mapa Sass. Mantidos fiéis a matcha-theme/tokens/_elevation-tokens.scss.
1527
+ // -----------------------------------------------------------------------------------------------------
1528
+ @mixin generate-shadow-classes() {
1529
+ $shadow-map: (
1530
+ 1: unquote("var(--matcha-shadow-1, 0 8px 24px -8px rgba(45, 122, 47, 0.04), 0 2px 8px -1px rgba(26, 44, 30, 0.08), 0 1px 2px rgba(26, 44, 30, 0.04))"),
1531
+ 2: unquote("var(--matcha-shadow-2, 0 12px 32px -10px rgba(45, 122, 47, 0.05), 0 4px 16px -2px rgba(26, 44, 30, 0.10), 0 2px 4px -1px rgba(26, 44, 30, 0.05))"),
1532
+ 3: unquote("var(--matcha-shadow-3, 0 16px 40px -12px rgba(45, 122, 47, 0.06), 0 12px 32px -4px rgba(26, 44, 30, 0.14), 0 4px 8px -2px rgba(26, 44, 30, 0.08))"),
1533
+ 4: unquote("var(--matcha-shadow-4, 0 24px 48px -16px rgba(45, 122, 47, 0.08), 0 24px 48px -8px rgba(26, 44, 30, 0.18), 0 8px 16px -4px rgba(26, 44, 30, 0.10))"),
1534
+ );
1535
+
1536
+ @each $level, $value in $shadow-map {
1537
+ .shadow-#{$level} {
1538
+ box-shadow: $value;
1539
+ }
1540
+ .shadow-#{$level}--force {
1541
+ box-shadow: $value !important;
1542
+ }
1543
+ }
1544
+
1545
+ .shadow-none {
1546
+ box-shadow: none;
1547
+ }
1548
+ .shadow-none--force {
1549
+ box-shadow: none !important;
1550
+ }
1551
+ }
1552
+ @include generate-shadow-classes();
1553
+
1392
1554
  // -----------------------------------------------------------------------------------------------------
1393
1555
  // @ Hover - Show/Hide
1394
1556
  // -----------------------------------------------------------------------------------------------------
@@ -1419,6 +1581,56 @@ $font-weight-token-map: (
1419
1581
  }
1420
1582
  @include generate-transition-classes();
1421
1583
 
1584
+ // -----------------------------------------------------------------------------------------------------
1585
+ // @ Motion — token-backed (Figma matcha/duration/*, matcha/easing/*)
1586
+ // Complementa o legado .ts-* (100/300ms hardcoded, mantido). Estas ligam nos tokens do DS.
1587
+ // .duration-* → transition-duration · .ease-* → transition-timing-function
1588
+ // .transition-* → atalho composto (all + duração + easing standard)
1589
+ // -----------------------------------------------------------------------------------------------------
1590
+ @mixin generate-motion-classes() {
1591
+ $duration-map: (
1592
+ instant: var(--matcha-duration-instant, 80ms),
1593
+ fast: var(--matcha-duration-fast, 200ms),
1594
+ normal: var(--matcha-duration-normal, 400ms),
1595
+ slow: var(--matcha-duration-slow, 600ms),
1596
+ );
1597
+ $easing-map: (
1598
+ standard: unquote("var(--matcha-easing-standard, cubic-bezier(0.4, 0, 0.2, 1))"),
1599
+ emphasized: unquote("var(--matcha-easing-emphasized, cubic-bezier(0.2, 0, 0, 1))"),
1600
+ decelerated: unquote("var(--matcha-easing-decelerated, cubic-bezier(0, 0, 0.2, 1))"),
1601
+ accelerated: unquote("var(--matcha-easing-accelerated, cubic-bezier(0.4, 0, 1, 1))"),
1602
+ );
1603
+ $standard-ease: unquote("var(--matcha-easing-standard, cubic-bezier(0.4, 0, 0.2, 1))");
1604
+
1605
+ @each $name, $value in $duration-map {
1606
+ .duration-#{$name} {
1607
+ transition-duration: $value;
1608
+ }
1609
+ .duration-#{$name}--force {
1610
+ transition-duration: $value !important;
1611
+ }
1612
+ }
1613
+
1614
+ @each $name, $value in $easing-map {
1615
+ .ease-#{$name} {
1616
+ transition-timing-function: $value;
1617
+ }
1618
+ .ease-#{$name}--force {
1619
+ transition-timing-function: $value !important;
1620
+ }
1621
+ }
1622
+
1623
+ @each $name, $value in $duration-map {
1624
+ .transition-#{$name} {
1625
+ transition: all $value $standard-ease;
1626
+ }
1627
+ .transition-#{$name}--force {
1628
+ transition: all $value $standard-ease !important;
1629
+ }
1630
+ }
1631
+ }
1632
+ @include generate-motion-classes();
1633
+
1422
1634
  // -----------------------------------------------------------------------------------------------------
1423
1635
  // @ Rotate Animation
1424
1636
  // -----------------------------------------------------------------------------------------------------
@@ -1510,3 +1722,4 @@ $font-weight-token-map: (
1510
1722
  @include generate-masonry-classes($helper-breakpoints);
1511
1723
 
1512
1724
 
1725
+