@inchurch/matcha-theme 20.0.11 → 20.277.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.
Files changed (116) hide show
  1. package/abstracts/_colors.scss +404 -404
  2. package/abstracts/_elevation.scss +102 -102
  3. package/abstracts/_functions.scss +1186 -1212
  4. package/abstracts/_media-breakpoint.scss +23 -23
  5. package/abstracts/_theme-api.scss +230 -0
  6. package/abstracts/_typography.scss +127 -127
  7. package/base/_reset.scss +438 -438
  8. package/components/app-page-header.scss +259 -0
  9. package/components/matcha-accordion.scss +293 -157
  10. package/components/matcha-audio-player.scss +1 -2
  11. package/components/matcha-autocomplete.scss +10 -11
  12. package/components/matcha-avatar.scss +173 -33
  13. package/components/matcha-badge.scss +15 -15
  14. package/components/matcha-breadcrumb.scss +231 -126
  15. package/components/matcha-button-toggle.scss +46 -2
  16. package/components/matcha-buttons.scss +908 -784
  17. package/components/matcha-calendar.scss +99 -35
  18. package/components/matcha-cards.scss +58 -33
  19. package/components/matcha-chart-card.scss +5 -12
  20. package/components/matcha-checkbox.scss +191 -490
  21. package/components/matcha-chip.scss +297 -212
  22. package/components/matcha-color-pick.scss +1 -2
  23. package/components/matcha-command-palette.scss +290 -63
  24. package/components/matcha-crop.scss +406 -172
  25. package/components/matcha-date.scss +81 -81
  26. package/components/matcha-divider.scss +86 -31
  27. package/components/matcha-draggable.scss +4 -5
  28. package/components/matcha-drawer.scss +207 -66
  29. package/components/matcha-drop-image.scss +14 -0
  30. package/components/matcha-drop-list.scss +87 -47
  31. package/components/matcha-emoji.scss +2 -2
  32. package/components/matcha-empty-state.scss +195 -83
  33. package/components/matcha-file-uploader.scss +462 -0
  34. package/components/matcha-flag.scss +93 -52
  35. package/components/matcha-footer.scss +67 -164
  36. package/components/matcha-form-field.scss +55 -3
  37. package/components/matcha-form-section.scss +100 -101
  38. package/components/matcha-header.scss +134 -325
  39. package/components/matcha-highlight.scss +65 -197
  40. package/components/matcha-hint-text.scss +25 -4
  41. package/components/matcha-horizontal-tree.scss +316 -317
  42. package/components/matcha-icon.scss +37 -45
  43. package/components/matcha-image.scss +2 -3
  44. package/components/matcha-list.scss +14 -15
  45. package/components/matcha-menu.scss +15 -2
  46. package/components/matcha-modal.scss +59 -86
  47. package/components/matcha-nav.scss +362 -231
  48. package/components/matcha-notification.scss +412 -197
  49. package/components/matcha-option.scss +98 -23
  50. package/components/matcha-page-builder.scss +16 -16
  51. package/components/matcha-paginator.scss +688 -235
  52. package/components/matcha-panel.scss +42 -27
  53. package/components/matcha-profile-card.scss +50 -50
  54. package/components/matcha-progress-bar.scss +257 -153
  55. package/components/matcha-radio.scss +244 -452
  56. package/components/matcha-scrollbar.scss +1 -2
  57. package/components/matcha-scrollbox-shadow.scss +120 -122
  58. package/components/matcha-section.scss +5 -9
  59. package/components/matcha-select-multiple.scss +56 -0
  60. package/components/matcha-select.scss +10 -10
  61. package/components/matcha-skeleton.scss +24 -7
  62. package/components/matcha-slide-toggle.scss +80 -301
  63. package/components/matcha-slider.scss +174 -77
  64. package/components/matcha-snack-bar.scss +123 -131
  65. package/components/matcha-spin.scss +12 -103
  66. package/components/matcha-spinner.scss +76 -57
  67. package/components/matcha-status-pill.scss +82 -0
  68. package/components/matcha-stepper.scss +376 -177
  69. package/components/matcha-table.scss +568 -785
  70. package/components/matcha-tabs.scss +622 -469
  71. package/components/matcha-text-editor.scss +78 -78
  72. package/components/matcha-time.scss +2 -2
  73. package/components/matcha-toolbar.scss +359 -206
  74. package/components/matcha-tooltip.scss +158 -62
  75. package/components/matcha-tree-view.scss +189 -0
  76. package/fonts/manrope/manrope-latin-ext.woff2 +0 -0
  77. package/fonts/manrope/manrope-latin.woff2 +0 -0
  78. package/layout/matcha-page-layout.scss +4 -4
  79. package/main.scss +237 -265
  80. package/package.json +1 -1
  81. package/tokens/_animations-tokens.scss +37 -37
  82. package/tokens/_breakpoints-tokens.scss +35 -26
  83. package/tokens/_color-tokens.scss +1149 -1152
  84. package/tokens/_css-custom-properties.scss +704 -568
  85. package/tokens/_primitives.scss +82 -0
  86. package/tokens/_semantic-aliases.scss +120 -0
  87. package/tokens/_spacing-tokens.scss +94 -94
  88. package/vendors/angular-editor.scss +56 -56
  89. package/vendors/angular-material-fixes.scss +297 -297
  90. package/vendors/charts.scss +92 -92
  91. package/vendors/ng5-slider.scss +56 -56
  92. package/vendors/ngx-material-timepicker.scss +50 -50
  93. package/components/matcha-uploader.scss +0 -215
  94. package/fonts/CircularStd-Black.eot +0 -0
  95. package/fonts/CircularStd-Black.svg +0 -3426
  96. package/fonts/CircularStd-Black.ttf +0 -0
  97. package/fonts/CircularStd-Black.woff +0 -0
  98. package/fonts/CircularStd-Black.woff2 +0 -0
  99. package/fonts/CircularStd-Bold.eot +0 -0
  100. package/fonts/CircularStd-Bold.otf +0 -0
  101. package/fonts/CircularStd-Bold.svg +0 -13532
  102. package/fonts/CircularStd-Bold.ttf +0 -0
  103. package/fonts/CircularStd-Bold.woff +0 -0
  104. package/fonts/CircularStd-Bold.woff2 +0 -0
  105. package/fonts/CircularStd-Medium.eot +0 -0
  106. package/fonts/CircularStd-Medium.otf +0 -0
  107. package/fonts/CircularStd-Medium.svg +0 -13511
  108. package/fonts/CircularStd-Medium.ttf +0 -0
  109. package/fonts/CircularStd-Medium.woff +0 -0
  110. package/fonts/CircularStd-Medium.woff2 +0 -0
  111. package/fonts/CircularStd-Regular.eot +0 -0
  112. package/fonts/CircularStd-Regular.otf +0 -0
  113. package/fonts/CircularStd-Regular.svg +0 -2378
  114. package/fonts/CircularStd-Regular.ttf +0 -0
  115. package/fonts/CircularStd-Regular.woff +0 -0
  116. package/fonts/CircularStd-Regular.woff2 +0 -0
@@ -1,23 +1,23 @@
1
- // -------------------------------------------------------------------------------------------------------------------
2
- // @ Theme mixins
3
- // --------------------------------------------------------------------------------------------------------------------
4
- /*
5
- Esse mixin foi criado para não precisar escrever o valor em pixels de cada breakpoint toda vez que for necessário
6
- criar um media query. Se em algum momento for necessário alterar o valor de um breakpoint, basta alterar o valor nos
7
- tokens e o mixin irá se encarregar de atualizar todos os media queries que utilizam aquele breakpoint.
8
-
9
- Exemplo de uso:
10
-
11
-
12
-
13
- */
14
- @mixin media-breakpoint($breakpointName) {
15
- $mediaQuery: map-get($breakpoints, $breakpointName);
16
- @if ($mediaQuery == null) {
17
- @content;
18
- } @else {
19
- @media #{$mediaQuery} {
20
- @content;
21
- }
22
- }
23
- }
1
+ // -------------------------------------------------------------------------------------------------------------------
2
+ // @ Theme mixins
3
+ // --------------------------------------------------------------------------------------------------------------------
4
+ /*
5
+ Esse mixin foi criado para não precisar escrever o valor em pixels de cada breakpoint toda vez que for necessário
6
+ criar um media query. Se em algum momento for necessário alterar o valor de um breakpoint, basta alterar o valor nos
7
+ tokens e o mixin irá se encarregar de atualizar todos os media queries que utilizam aquele breakpoint.
8
+
9
+ Exemplo de uso:
10
+
11
+
12
+
13
+ */
14
+ @mixin media-breakpoint($breakpointName) {
15
+ $mediaQuery: map-get($breakpoints, $breakpointName);
16
+ @if ($mediaQuery == null) {
17
+ @content;
18
+ } @else {
19
+ @media #{$mediaQuery} {
20
+ @content;
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,230 @@
1
+ // =============================================================================
2
+ // MATCHA THEME API — criação de temas por override de CSS custom properties
3
+ // =============================================================================
4
+ //
5
+ // Um tema Matcha adicional é uma SKIN: uma classe que sobrescreve as CSS vars
6
+ // de cor (--matcha-color-*) emitidas pelos temas default. Os component mixins
7
+ // consomem cor exclusivamente via var(--matcha-*), então a skin re-tematiza a
8
+ // lib inteira sem recompilar matcha-components() (~20k linhas de CSS por tema).
9
+ //
10
+ // CONTRATO DE RUNTIME (duas classes no <body>):
11
+ // <body class="theme-default-dark theme-nerd">
12
+ // 1. `theme-default-light` OU `theme-default-dark` — a BASE, escolhida pelo
13
+ // `base` do config. Fornece tudo que ainda é decidido em compile-time
14
+ // pelos component mixins (blocos `@if $is-dark` estruturais, shadows
15
+ // default, classes utilitárias) — ver backlog `matcha-theme-003`.
16
+ // 2. `theme-<nome>` — a skin gerada por `matcha-define-theme()`. Deve ser
17
+ // emitida DEPOIS dos temas default no CSS (ordem de fonte vence, mesma
18
+ // especificidade).
19
+ //
20
+ // USO:
21
+ // @use "@inchurch/matcha-theme/main.scss" as matcha;
22
+ // @include matcha.matcha-define-theme(meu-tema, (
23
+ // base: dark,
24
+ // colors: (
25
+ // // 9 seeds obrigatórios:
26
+ // surface-bg: #000, surface: #0a120a, text-primary: #33ff33,
27
+ // accent: #33ff33, primary: #00cc66, success: #33ff33,
28
+ // danger: #ff3333, warn: #ffcc00, info: #00ccff,
29
+ // // + qualquer token de $matcha-color-tokens como override fino:
30
+ // text-muted: #1faa1f,
31
+ // ),
32
+ // // opcionais:
33
+ // shadows: (1: 0 0 4px rgba(51, 255, 51, .4)), // --matcha-shadow-<n>
34
+ // font-family: ("Fira Code", monospace), // --matcha-font-family
35
+ // radius: (md: 0, lg: 0, pill: 0), // --matcha-radius-<k>
36
+ // ));
37
+ //
38
+ // O QUE A SKIN NÃO COBRE (limitações conhecidas — docs/theme-stress-test.md):
39
+ // - blocos `@if $is-dark` estruturais (calendar, section, drawer, chart-card,
40
+ // skeleton, reset) seguem a base light/dark escolhida;
41
+ // - cores hardcoded em componentes (ex.: matcha-page-builder — backlog
42
+ // `matcha-page-builder-001`);
43
+ // - cores passadas por @Input/JS (charts) não leem CSS var automaticamente.
44
+ //
45
+ // =============================================================================
46
+ @use "sass:color";
47
+ @use "sass:list";
48
+ @use "sass:map";
49
+ @use "sass:math";
50
+ @use "sass:meta";
51
+
52
+ $-matcha-theme-bases: (light, dark);
53
+ $-matcha-required-seeds: (surface-bg, surface, text-primary, accent, primary, success, danger, warn, info);
54
+
55
+ // ── Helpers de contraste ────────────────────────────────────────────────────
56
+ // Luminância perceptual aproximada (YIQ, 0–255).
57
+ @function matcha-yiq($color) {
58
+ $r: color.channel($color, "red", $space: rgb);
59
+ $g: color.channel($color, "green", $space: rgb);
60
+ $b: color.channel($color, "blue", $space: rgb);
61
+ @return math.div(($r * 299) + ($g * 587) + ($b * 114), 1000);
62
+ }
63
+
64
+ // Foreground de texto opaco sobre $color (padrão dos tokens *-text-on).
65
+ @function matcha-text-on($color) {
66
+ @return if(matcha-yiq($color) >= 150, #1a1d21, #ffffff);
67
+ }
68
+
69
+ // Foreground de contraste no padrão dos tokens *-contrast (preto .87 / branco).
70
+ @function matcha-contrast-on($color) {
71
+ @return if(matcha-yiq($color) >= 150, rgba(0, 0, 0, .87), #ffffff);
72
+ }
73
+
74
+ @function matcha-contrast-alpha-on($color) {
75
+ @return if(matcha-yiq($color) >= 150, rgba(0, 0, 0, .1), rgba(255, 255, 255, .1));
76
+ }
77
+
78
+ // ── Derivação de família de papel (primary/accent/feedback) ────────────────
79
+ // Gera <role>, <role>-hover/-pressed/-alpha/-contrast/-contrast-alpha/
80
+ // -surface-hover/-surface-pressed a partir do seed. Direção do hover segue a
81
+ // base: temas light escurecem no hover, temas dark clareiam (padrão DSV3).
82
+ @function matcha-role-tokens($role, $seed, $surface-bg, $is-dark) {
83
+ @return (
84
+ #{$role}: $seed,
85
+ #{$role}-hover: color.scale($seed, $lightness: if($is-dark, 18%, -12%)),
86
+ #{$role}-pressed: color.scale($seed, $lightness: if($is-dark, 32%, -20%)),
87
+ #{$role}-alpha: rgba($seed, .1),
88
+ #{$role}-contrast: matcha-contrast-on($seed),
89
+ #{$role}-contrast-alpha: matcha-contrast-alpha-on($seed),
90
+ #{$role}-surface-hover: color.mix($seed, $surface-bg, 10%),
91
+ #{$role}-surface-pressed: color.mix($seed, $surface-bg, 22%),
92
+ );
93
+ }
94
+
95
+ // ── Construção do mapa completo de cores do tema ────────────────────────────
96
+ // Parte dos defaults da base (light/dark), aplica as famílias derivadas dos
97
+ // seeds e, por último, os overrides explícitos de `colors` — ou seja, QUALQUER
98
+ // chave de $matcha-color-tokens pode ser cravada no config e vence a derivação.
99
+ @function matcha-build-color-map($config) {
100
+ $base: map.get($config, base);
101
+ @if not list.index($-matcha-theme-bases, $base) {
102
+ @error "matcha-build-color-map: `base` deve ser `light` ou `dark` (recebido: #{meta.inspect($base)}).";
103
+ }
104
+
105
+ $seeds: map.get($config, colors);
106
+ @each $required in $-matcha-required-seeds {
107
+ @if not map.has-key($seeds or (), $required) {
108
+ @error "matcha-build-color-map: seed obrigatório ausente em `colors`: #{$required}. Obrigatórios: #{meta.inspect($-matcha-required-seeds)}.";
109
+ }
110
+ }
111
+
112
+ $is-dark: $base == dark;
113
+ $defaults: if($is-dark, $matcha-colors-dark, $matcha-colors-light);
114
+
115
+ $surface-bg: map.get($seeds, surface-bg);
116
+ $surface: map.get($seeds, surface);
117
+ $text: map.get($seeds, text-primary);
118
+ $accent: map.get($seeds, accent);
119
+
120
+ // Superfícies e estrutura
121
+ $derived: (
122
+ surface-bg: $surface-bg,
123
+ surface-bg-alpha: rgba($surface-bg, .5),
124
+ surface: $surface,
125
+ surface-card: $surface,
126
+ surface-card-strong: color.scale($surface, $lightness: if($is-dark, 8%, 50%)),
127
+ surface-inner: if($is-dark, color.scale($surface, $lightness: 8%), $surface-bg),
128
+ surface-card-alpha: rgba($surface, if($is-dark, .5, .85)),
129
+ surface-sidebar: color.scale($surface-bg, $lightness: if($is-dark, -25%, -4%)),
130
+ surface-sidebar-hover: color.scale($surface-bg, $lightness: if($is-dark, -12%, -9%)),
131
+ surface-table-row-hover: color.mix($text, $surface, 4%),
132
+ surface-border: color.mix($text, $surface-bg, 10%),
133
+ surface-border-strong: color.mix($text, $surface-bg, 22%),
134
+ surface-hover: rgba(color.scale($surface-bg, $lightness: if($is-dark, -25%, -4%)), .5),
135
+ bg: $surface-bg,
136
+
137
+ // Texto e ícones
138
+ fg: $text,
139
+ fg-alpha: rgba($text, .5),
140
+ text-primary: $text,
141
+ text-secondary: color.mix($text, $surface-bg, 78%),
142
+ text-muted: color.mix($text, $surface-bg, 62%),
143
+ text-label: color.mix($text, $surface-bg, 55%),
144
+ text-placeholder: color.mix($text, $surface-bg, 55%),
145
+ text-hint: color.mix($text, $surface-bg, 55%),
146
+ icon-default: color.mix($text, $surface-bg, 65%),
147
+ icon-active: color.mix($text, $surface-bg, 88%),
148
+
149
+ // Neutral + interaction
150
+ neutral: color.mix($text, $surface-bg, if($is-dark, 12%, 8%)),
151
+ neutral-contrast: matcha-text-on(color.mix($text, $surface-bg, if($is-dark, 12%, 8%))),
152
+ neutral-alpha: rgba($text, .08),
153
+ neutral-hover: color.mix($text, $surface-bg, if($is-dark, 18%, 14%)),
154
+ interaction-disabled-bg: color.mix($text, $surface-bg, 14%),
155
+ interaction-disabled-bg-alpha: rgba(color.mix($text, $surface-bg, 14%), .5),
156
+ interaction-disabled-fg: color.mix($text, $surface-bg, 45%),
157
+ interaction-disabled-border: color.mix($text, $surface-bg, 18%),
158
+ disabled: color.mix($text, $surface-bg, 14%),
159
+ disabled-bg: color.mix($text, $surface-bg, 14%),
160
+ disabled-fg: color.mix($text, $surface-bg, 45%),
161
+ disabled-border: color.mix($text, $surface-bg, 18%),
162
+ focus-ring: $accent,
163
+
164
+ // Elevação (cores; shadows são tokens --matcha-shadow-* à parte)
165
+ elevation-surface-1: $surface,
166
+ elevation-surface-2: color.scale($surface, $lightness: if($is-dark, 8%, 50%)),
167
+ elevation-surface-3: color.scale($surface, $lightness: if($is-dark, 14%, 50%)),
168
+ state-layer-fg: if($is-dark, #ffffff, #000000),
169
+ );
170
+
171
+ // Papéis semânticos derivados dos seeds
172
+ @each $role in (accent, primary, success, danger, warn, info) {
173
+ $derived: map.merge($derived, matcha-role-tokens($role, map.get($seeds, $role), $surface-bg, $is-dark));
174
+ }
175
+
176
+ // Extras por papel (tokens que só algumas famílias têm)
177
+ $primary: map.get($seeds, primary);
178
+ $derived: map.merge($derived, (
179
+ accent-text-on: matcha-text-on($accent),
180
+ accent-light: color.scale($accent, $lightness: 45%),
181
+ accent-dark: color.scale($accent, $lightness: -30%),
182
+ primary-light: color.scale($primary, $lightness: 45%),
183
+ primary-dark: color.scale($primary, $lightness: -35%),
184
+ success-fill: map.get($seeds, success),
185
+ danger-fill: map.get($seeds, danger),
186
+ warn-fill: map.get($seeds, warn),
187
+ ));
188
+
189
+ // accent-2 só deriva se o seed opcional vier (senão herda da base)
190
+ @if map.has-key($seeds, accent-2) {
191
+ $accent-2: map.get($seeds, accent-2);
192
+ $derived: map.merge($derived, (
193
+ accent-2: $accent-2,
194
+ accent-2-contrast: matcha-text-on($accent-2),
195
+ accent-2-alpha: rgba($accent-2, .1),
196
+ accent-2-surface: color.mix($accent-2, $surface-bg, 14%),
197
+ ));
198
+ }
199
+
200
+ // defaults da base < derivados < overrides explícitos do config
201
+ @return map.merge(map.merge($defaults, $derived), $seeds);
202
+ }
203
+
204
+ // ── API pública ─────────────────────────────────────────────────────────────
205
+ // Emite a classe `.theme-<nome>` com o override completo das CSS vars de cor
206
+ // (+ shadows/font-family/radius opcionais). Ver contrato de runtime no topo.
207
+ @mixin matcha-define-theme($name, $config) {
208
+ .theme-#{$name} {
209
+ @include matcha-emit-color-properties(matcha-build-color-map($config));
210
+
211
+ $shadows: map.get($config, shadows);
212
+ @if $shadows {
213
+ @each $level, $value in $shadows {
214
+ --matcha-shadow-#{$level}: #{$value};
215
+ }
216
+ }
217
+
218
+ $font-family: map.get($config, font-family);
219
+ @if $font-family {
220
+ --matcha-font-family: #{$font-family};
221
+ }
222
+
223
+ $radius: map.get($config, radius);
224
+ @if $radius {
225
+ @each $key, $value in $radius {
226
+ --matcha-radius-#{$key}: #{$value};
227
+ }
228
+ }
229
+ }
230
+ }
@@ -1,127 +1,127 @@
1
- // -------------------------------------------------------------------------------------------------------------------
2
- // @ Typography mixins
3
- // -------------------------------------------------------------------------------------------------------------------
4
- // Outputs the shorthand `font` CSS property, based on a set of typography values. Falls back to
5
- // the individual properties if a value that isn't allowed in the shorthand is passed in.
6
- @mixin matcha-typography-font-shorthand($font-size, $font-weight, $line-height, $font-family) {
7
- // If any of the values are set to `inherit`, we can't use the shorthand
8
- // so we fall back to passing in the individual properties.
9
- @if (
10
- $font-size
11
- ==inherit or
12
- $font-weight
13
- ==inherit or
14
- $line-height
15
- ==inherit or
16
- $font-family
17
- ==inherit or
18
- $font-size
19
- ==null or
20
- $font-weight
21
- ==null or
22
- $line-height
23
- ==null or
24
- $font-family
25
- ==null
26
- ) {
27
- font-size: $font-size;
28
- font-weight: $font-weight;
29
- line-height: $line-height;
30
- font-family: $font-family;
31
- } @else {
32
- // Otherwise use the shorthand `font`, because it's the least amount of bytes. Note
33
- // that we need to use interpolation for `font-size/line-height` in order to prevent
34
- // Sass from dividing the two values.
35
- font: $font-weight #{$font-size}/#{$line-height} $font-family;
36
- }
37
- }
38
-
39
- // Converts a typography level into CSS styles.
40
- @mixin matcha-typography-level-to-styles($config, $level) {
41
- $font-size: matcha-font-size($config, $level);
42
- $font-weight: matcha-font-weight($config, $level);
43
- $line-height: matcha-line-height($config, $level);
44
- $font-family: matcha-font-family($config, $level);
45
-
46
- @include matcha-typography-font-shorthand($font-size, $font-weight, $line-height, $font-family);
47
- letter-spacing: matcha-letter-spacing($config, $level);
48
- }
49
-
50
- // Represents a collection of typography levels.
51
- // Defaults come from https://material.io/guidelines/style/typography.html
52
- // Note: The spec doesn't mention letter spacing. The values here come from
53
- // eyeballing it until it looked exactly like the spec examples.
54
-
55
- // h1 40px headline - bold
56
- // h2 32px title - medium
57
- // h3 24px subheading - bold
58
- // h4 20px subheading - bold
59
-
60
- // h5-5 18px '' - bold
61
- // h6 18px '' - bold
62
- // h7 18px '' - bold
63
- // h8 12px '' - bold
64
-
65
- // m 16px body - regular
66
- // p 14px body - regular
67
- // small 12px caption - regular
68
- @mixin matcha-reset-typography($config) {
69
- // Headings — aligned with Figma matcha/text/* styles
70
- .h1,
71
- h1 {
72
- @include matcha-typography-level-to-styles($config, display);
73
- }
74
-
75
- .h2,
76
- h2 {
77
- @include matcha-typography-level-to-styles($config, headline);
78
- }
79
-
80
- .h3,
81
- h3 {
82
- @include matcha-typography-level-to-styles($config, title-lg);
83
- }
84
-
85
- .h4,
86
- h4 {
87
- @include matcha-typography-level-to-styles($config, title-md);
88
- }
89
-
90
- .h5,
91
- h5 {
92
- @include matcha-typography-level-to-styles($config, title-sm);
93
- }
94
-
95
- .h6,
96
- h6 {
97
- @include matcha-typography-level-to-styles($config, label-sm);
98
- }
99
-
100
- .text-bold,
101
- strong,
102
- b {
103
- font-weight: matcha-font-weight($config, title-lg);
104
- }
105
-
106
- & {
107
- font-family: matcha-font-family($config, body-md);
108
- }
109
-
110
- button {
111
- font-family: matcha-font-family($config, button-md);
112
- font-weight: matcha-font-weight($config, button-md);
113
- }
114
-
115
- input[type="text"],
116
- input[type="email"],
117
- input[type="tel"],
118
- input[type="url"],
119
- input[type="password"],
120
- input[type="number"],
121
- input[type="search"],
122
- textarea {
123
- font-family: matcha-font-family($config, body-md);
124
- font-weight: matcha-font-weight($config, body-md);
125
- font-size: px-to-rem(16px);
126
- }
127
- }
1
+ // -------------------------------------------------------------------------------------------------------------------
2
+ // @ Typography mixins
3
+ // -------------------------------------------------------------------------------------------------------------------
4
+ // Outputs the shorthand `font` CSS property, based on a set of typography values. Falls back to
5
+ // the individual properties if a value that isn't allowed in the shorthand is passed in.
6
+ @mixin matcha-typography-font-shorthand($font-size, $font-weight, $line-height, $font-family) {
7
+ // If any of the values are set to `inherit`, we can't use the shorthand
8
+ // so we fall back to passing in the individual properties.
9
+ @if (
10
+ $font-size
11
+ ==inherit or
12
+ $font-weight
13
+ ==inherit or
14
+ $line-height
15
+ ==inherit or
16
+ $font-family
17
+ ==inherit or
18
+ $font-size
19
+ ==null or
20
+ $font-weight
21
+ ==null or
22
+ $line-height
23
+ ==null or
24
+ $font-family
25
+ ==null
26
+ ) {
27
+ font-size: $font-size;
28
+ font-weight: $font-weight;
29
+ line-height: $line-height;
30
+ font-family: $font-family;
31
+ } @else {
32
+ // Otherwise use the shorthand `font`, because it's the least amount of bytes. Note
33
+ // that we need to use interpolation for `font-size/line-height` in order to prevent
34
+ // Sass from dividing the two values.
35
+ font: $font-weight #{$font-size}/#{$line-height} $font-family;
36
+ }
37
+ }
38
+
39
+ // Converts a typography level into CSS styles.
40
+ @mixin matcha-typography-level-to-styles($config, $level) {
41
+ $font-size: matcha-font-size($config, $level);
42
+ $font-weight: matcha-font-weight($config, $level);
43
+ $line-height: matcha-line-height($config, $level);
44
+ $font-family: matcha-font-family($config, $level);
45
+
46
+ @include matcha-typography-font-shorthand($font-size, $font-weight, $line-height, $font-family);
47
+ letter-spacing: matcha-letter-spacing($config, $level);
48
+ }
49
+
50
+ // Represents a collection of typography levels.
51
+ // Defaults come from https://material.io/guidelines/style/typography.html
52
+ // Note: The spec doesn't mention letter spacing. The values here come from
53
+ // eyeballing it until it looked exactly like the spec examples.
54
+
55
+ // h1 40px headline - bold
56
+ // h2 32px title - medium
57
+ // h3 24px subheading - bold
58
+ // h4 20px subheading - bold
59
+
60
+ // h5-5 18px '' - bold
61
+ // h6 18px '' - bold
62
+ // h7 18px '' - bold
63
+ // h8 12px '' - bold
64
+
65
+ // m 16px body - regular
66
+ // p 14px body - regular
67
+ // small 12px caption - regular
68
+ @mixin matcha-reset-typography($config) {
69
+ // Headings — aligned with Figma matcha/text/* styles
70
+ .h1,
71
+ h1 {
72
+ @include matcha-typography-level-to-styles($config, display);
73
+ }
74
+
75
+ .h2,
76
+ h2 {
77
+ @include matcha-typography-level-to-styles($config, headline);
78
+ }
79
+
80
+ .h3,
81
+ h3 {
82
+ @include matcha-typography-level-to-styles($config, title-lg);
83
+ }
84
+
85
+ .h4,
86
+ h4 {
87
+ @include matcha-typography-level-to-styles($config, title-md);
88
+ }
89
+
90
+ .h5,
91
+ h5 {
92
+ @include matcha-typography-level-to-styles($config, title-sm);
93
+ }
94
+
95
+ .h6,
96
+ h6 {
97
+ @include matcha-typography-level-to-styles($config, label-sm);
98
+ }
99
+
100
+ .text-bold,
101
+ strong,
102
+ b {
103
+ font-weight: matcha-font-weight($config, title-lg);
104
+ }
105
+
106
+ & {
107
+ font-family: matcha-font-family($config, body-md);
108
+ }
109
+
110
+ button {
111
+ font-family: matcha-font-family($config, button-md);
112
+ font-weight: matcha-font-weight($config, button-md);
113
+ }
114
+
115
+ input[type="text"],
116
+ input[type="email"],
117
+ input[type="tel"],
118
+ input[type="url"],
119
+ input[type="password"],
120
+ input[type="number"],
121
+ input[type="search"],
122
+ textarea {
123
+ font-family: matcha-font-family($config, body-md);
124
+ font-weight: matcha-font-weight($config, body-md);
125
+ font-size: px-to-rem(16px);
126
+ }
127
+ }