@inchurch/matcha-theme 21.3.3 → 22.0.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 (93) hide show
  1. package/abstracts/_colors.scss +236 -229
  2. package/abstracts/_elevation.scss +108 -108
  3. package/abstracts/_functions.scss +321 -321
  4. package/abstracts/_media-breakpoint.scss +26 -26
  5. package/abstracts/_theme-api.scss +219 -219
  6. package/abstracts/_typography.scss +128 -128
  7. package/base/_reset.scss +445 -432
  8. package/components/app-page-header.scss +260 -260
  9. package/components/matcha-accordion.scss +293 -293
  10. package/components/matcha-audio-player.scss +31 -31
  11. package/components/matcha-autocomplete.scss +145 -145
  12. package/components/matcha-avatar.scss +440 -301
  13. package/components/matcha-badge.scss +120 -120
  14. package/components/matcha-breadcrumb.scss +231 -231
  15. package/components/matcha-button-toggle.scss +384 -384
  16. package/components/matcha-buttons.scss +913 -913
  17. package/components/matcha-calendar.scss +218 -218
  18. package/components/matcha-cards.scss +230 -230
  19. package/components/matcha-chart-card.scss +53 -53
  20. package/components/matcha-checkbox.scss +255 -255
  21. package/components/matcha-chip.scss +292 -292
  22. package/components/matcha-color-pick.scss +34 -34
  23. package/components/matcha-command-palette.scss +316 -316
  24. package/components/matcha-crop.scss +406 -406
  25. package/components/matcha-date.scss +81 -81
  26. package/components/matcha-divider.scss +100 -100
  27. package/components/matcha-draggable.scss +23 -23
  28. package/components/matcha-drawer.scss +376 -376
  29. package/components/matcha-drop-image.scss +14 -14
  30. package/components/matcha-drop-list.scss +430 -430
  31. package/components/matcha-emoji.scss +69 -69
  32. package/components/matcha-empty-state.scss +230 -230
  33. package/components/matcha-file-uploader.scss +471 -471
  34. package/components/matcha-flag.scss +103 -103
  35. package/components/matcha-footer.scss +91 -91
  36. package/components/matcha-form-field.scss +606 -606
  37. package/components/matcha-form-section.scss +100 -100
  38. package/components/matcha-header.scss +135 -135
  39. package/components/matcha-highlight.scss +164 -164
  40. package/components/matcha-hint-text.scss +90 -90
  41. package/components/matcha-horizontal-tree.scss +316 -316
  42. package/components/matcha-icon.scss +98 -98
  43. package/components/matcha-image.scss +61 -61
  44. package/components/matcha-list.scss +211 -211
  45. package/components/matcha-menu.scss +99 -99
  46. package/components/matcha-modal.scss +210 -210
  47. package/components/matcha-nav.scss +581 -581
  48. package/components/matcha-notification.scss +413 -413
  49. package/components/matcha-option.scss +170 -170
  50. package/components/matcha-page-builder.scss +4196 -4196
  51. package/components/matcha-paginator.scss +689 -689
  52. package/components/matcha-panel.scss +194 -194
  53. package/components/matcha-profile-card.scss +50 -50
  54. package/components/matcha-progress-bar.scss +313 -313
  55. package/components/matcha-radio.scss +320 -320
  56. package/components/matcha-ripple.scss +7 -7
  57. package/components/matcha-scrollbar.scss +33 -33
  58. package/components/matcha-scrollbox-shadow.scss +120 -120
  59. package/components/matcha-section.scss +102 -102
  60. package/components/matcha-select-multiple.scss +56 -56
  61. package/components/matcha-select.scss +667 -667
  62. package/components/matcha-skeleton.scss +155 -155
  63. package/components/matcha-slide-toggle.scss +369 -369
  64. package/components/matcha-slider.scss +285 -285
  65. package/components/matcha-snack-bar.scss +259 -259
  66. package/components/matcha-spin.scss +164 -164
  67. package/components/matcha-spinner.scss +97 -97
  68. package/components/matcha-status-pill.scss +38 -18
  69. package/components/matcha-stepper.scss +376 -376
  70. package/components/matcha-table-cell.scss +74 -41
  71. package/components/matcha-table.scss +579 -578
  72. package/components/matcha-tabs.scss +600 -600
  73. package/components/matcha-text-editor.scss +105 -105
  74. package/components/matcha-time.scss +33 -33
  75. package/components/matcha-timepicker.scss +13 -13
  76. package/components/matcha-toolbar.scss +359 -359
  77. package/components/matcha-tooltip.scss +224 -224
  78. package/components/matcha-tree-view.scss +257 -212
  79. package/layout/matcha-page-layout.scss +778 -778
  80. package/main.scss +329 -329
  81. package/package.json +1 -1
  82. package/tokens/_animations-tokens.scss +37 -37
  83. package/tokens/_breakpoints-tokens.scss +35 -35
  84. package/tokens/_color-tokens.scss +274 -261
  85. package/tokens/_elevation-tokens.scss +33 -33
  86. package/tokens/_emit-tokens.scss +324 -324
  87. package/tokens/_material-palette.scss +1149 -1149
  88. package/tokens/_primitives.scss +98 -98
  89. package/tokens/_semantic-aliases.scss +120 -120
  90. package/tokens/_spacing-tokens.scss +94 -94
  91. package/tokens/_static-tokens.scss +137 -137
  92. package/tokens/_typography-tokens.scss +65 -65
  93. package/vendors/charts.scss +90 -90
@@ -1,321 +1,321 @@
1
- @use "sass:map";
2
- @use "sass:math";
3
- @use "sass:color";
4
- @use "sass:meta";
5
- @use "sass:string";
6
-
7
- // -------------------------------------------------------------------------------------------------------------------
8
- // @ Theme functions — REMOVIDAS no major (API velha)
9
- // --------------------------------------------------------------------------------------------------------------------
10
- // palette() / map-color() / map-contrast() / light-theme() / dark-theme() /
11
- // light-custom-theme() / dark-custom-theme() foram removidas. Construíam o mapa $theme
12
- // (cores compile-time a partir das paletas Material) consumido por matcha-components().
13
- // A API nova é color-runtime: o tema é só o conjunto de --matcha-color-* (synced do Figma),
14
- // emitido por matcha-css-custom-properties($is-dark). Whitelabel = matcha-define-theme()
15
- // (override de --matcha-color-*). Ver src/app/app.theme.scss + main.scss (nota do shim).
16
- // Os mapas crus de paleta ($red/$blue/... em tokens/_material-palette) FICAM — alimentam
17
- // os tokens runtime --matcha-color-{nome} (ver tokens/_emit-tokens).
18
-
19
- // -------------------------------------------------------------------------------------------------------------------
20
- // @ Typography functions
21
- // --------------------------------------------------------------------------------------------------------------------
22
- // Represents a typography level from the Material design spec.
23
- @function matcha-typography-level($font-size,
24
- $line-height: $font-size,
25
- $font-weight: 400,
26
- $font-family: null,
27
- $letter-spacing: null) {
28
- @return (font-size: $font-size,
29
- line-height: $line-height,
30
- font-weight: $font-weight,
31
- font-family: $font-family,
32
- letter-spacing: $letter-spacing );
33
- }
34
-
35
- // Represents a collection of typography levels.
36
- // Defaults come from https://material.io/guidelines/style/typography.html
37
- // Note: The spec doesn't mention letter spacing. The values here come from
38
- // eyeballing it until it looked exactly like the spec examples.
39
- @function matcha-typography-config($font-family: $font-family-base,
40
- // ── Display ──
41
- $display-xl: matcha-typography-level(40px, 48px, 800, $letter-spacing: -0.5px),
42
- $display: matcha-typography-level(32px, 40px, 700, $letter-spacing: -0.5px),
43
- // ── Headline ──
44
- $headline: matcha-typography-level(24px, 32px, 700, $letter-spacing: -0.3px),
45
- // ── Title ──
46
- $title-xl: matcha-typography-level(20px, 28px, 800),
47
- $title-lg: matcha-typography-level(20px, 28px, 600),
48
- $title-md: matcha-typography-level(18px, 24px, 600),
49
- $title-sm: matcha-typography-level(16px, 22px, 600),
50
- $title-xs: matcha-typography-level(14px, 20px, 800),
51
- // ── Label ──
52
- $label-lg: matcha-typography-level(16px, 22px, 500),
53
- $label-md: matcha-typography-level(14px, 20px, 500),
54
- $label-sm: matcha-typography-level(12px, 16px, 500),
55
- // ── Body ──
56
- $body-lg: matcha-typography-level(16px, 24px, 400),
57
- $body-md: matcha-typography-level(14px, 20px, 400),
58
- $body-sm: matcha-typography-level(12px, 16px, 400),
59
- // ── Button ──
60
- $button-lg: matcha-typography-level(16px, 22px, 600, $letter-spacing: 0.2px),
61
- $button-md: matcha-typography-level(14px, 20px, 500, $letter-spacing: 0.2px),
62
- $button-sm: matcha-typography-level(13px, 19px, 500, $letter-spacing: 0.2px),
63
- // ── Other ──
64
- $caption: matcha-typography-level(11px, 14px, 400, $letter-spacing: 0.3px),
65
- $overline: matcha-typography-level(10px, 14px, 600, $letter-spacing: 1px),
66
- $input: matcha-typography-level(inherit, 1.125, 400),
67
- // ── Legacy aliases (kept for retrocompatibility) ──
68
- $display-4: matcha-typography-level(112px, 112px, 300, $letter-spacing: -0.05em),
69
- $display-3: matcha-typography-level(56px, 56px, 400, $letter-spacing: -0.02em),
70
- $display-2: matcha-typography-level(45px, 48px, 400, $letter-spacing: -0.005em),
71
- $display-1: matcha-typography-level(34px, 40px, 400),
72
- $title: matcha-typography-level(20px, 28px, 600),
73
- $subheading-2: matcha-typography-level(16px, 22px, 600),
74
- $subheading-1: matcha-typography-level(15px, 24px, 600),
75
- $body-2: matcha-typography-level(14px, 20px, 500),
76
- $body-1: matcha-typography-level(14px, 20px, 400),
77
- $button: matcha-typography-level(14px, 20px, 500, $letter-spacing: 0.2px)) {
78
- $config: (
79
- // New Figma-aligned styles
80
- display-xl: $display-xl,
81
- display: $display,
82
- headline: $headline,
83
- title-xl: $title-xl,
84
- title-lg: $title-lg,
85
- title-md: $title-md,
86
- title-sm: $title-sm,
87
- title-xs: $title-xs,
88
- label-lg: $label-lg,
89
- label-md: $label-md,
90
- label-sm: $label-sm,
91
- body-lg: $body-lg,
92
- body-md: $body-md,
93
- body-sm: $body-sm,
94
- button-lg: $button-lg,
95
- button-md: $button-md,
96
- button-sm: $button-sm,
97
- caption: $caption,
98
- overline: $overline,
99
- input: $input,
100
- // Legacy aliases
101
- display-4: $display-4,
102
- display-3: $display-3,
103
- display-2: $display-2,
104
- display-1: $display-1,
105
- title: $title,
106
- subheading-2: $subheading-2,
107
- subheading-1: $subheading-1,
108
- body-2: $body-2,
109
- body-1: $body-1,
110
- button: $button
111
- );
112
-
113
- // Loop through the levels and set the `font-family` of the ones that don't have one to the base.
114
- // Note that Sass can't modify maps in place, which means that we need to merge and re-assign.
115
- @each $key, $level in $config {
116
- @if map.get($level, font-family)==null {
117
- $new-level: map.merge($level,
118
- (font-family: $font-family ));
119
- $config: map.merge($config,
120
- ($key: $new-level ));
121
- }
122
- }
123
-
124
- // Add the base font family to the config.
125
- @return map.merge($config,
126
- (font-family: $font-family ));
127
- }
128
-
129
- // Utility for fetching a nested value from a typography config.
130
- @function _matcha-get-type-value($config, $level, $name) {
131
- @return map.get(map.get($config, $level), $name);
132
- }
133
-
134
- // Gets the font size for a level inside a typography config.
135
- @function matcha-font-size($config, $level) {
136
- @return _matcha-get-type-value($config, $level, font-size);
137
- }
138
-
139
- // Gets the line height for a level inside a typography config.
140
- @function matcha-line-height($config, $level) {
141
- @return _matcha-get-type-value($config, $level, line-height);
142
- }
143
-
144
- // Gets the font weight for a level inside a typography config.
145
- @function matcha-font-weight($config, $level) {
146
- @return _matcha-get-type-value($config, $level, font-weight);
147
- }
148
-
149
- // Gets the letter spacing for a level inside a typography config.
150
- @function matcha-letter-spacing($config, $level) {
151
- @return _matcha-get-type-value($config, $level, letter-spacing);
152
- }
153
-
154
- // Gets the font-family from a typography config and removes the quotes around it.
155
- @function matcha-font-family($config, $level: null) {
156
- $font-family: map.get($config, font-family);
157
-
158
- @if $level !=null {
159
- $font-family: _matcha-get-type-value($config, $level, font-family);
160
- }
161
-
162
- // Guard against unquoting non-string values, because it's deprecated.
163
- @return if(meta.type-of($font-family)==string, string.unquote($font-family), $font-family);
164
- }
165
-
166
- // -------------------------------------------------------------------------------------------------------------------
167
- // @ Elevation functions
168
- // --------------------------------------------------------------------------------------------------------------------
169
- // A collection of functions that can be used to apply elevation to a material
170
-
171
- @function get-umbra-map($color, $opacity) {
172
- $shadow-color: if(meta.type-of($color)==color, rgba($color, $opacity * 0.033), $color);
173
-
174
- @return (0: "0px 0px 0px 0px #{$shadow-color}",
175
- 1: "0px 2px 2px 0px #{$shadow-color}",
176
- 2: "0px 3px 2px -2px #{$shadow-color}",
177
- 3: "0px 3px 3px -2px #{$shadow-color}",
178
- 4: "0px 2px 4px -1px #{$shadow-color}",
179
- 5: "0px 3px 5px -1px #{$shadow-color}",
180
- 6: "0px 3px 5px -1px #{$shadow-color}",
181
- 7: "0px 4px 5px -2px #{$shadow-color}",
182
- 8: "0px 5px 5px -3px #{$shadow-color}",
183
- 9: "0px 5px 6px -3px #{$shadow-color}",
184
- 10: "0px 6px 6px -3px #{$shadow-color}",
185
- 11: "0px 6px 7px -4px #{$shadow-color}",
186
- 12: "0px 7px 8px -4px #{$shadow-color}",
187
- 13: "0px 7px 8px -4px #{$shadow-color}",
188
- 14: "0px 7px 9px -4px #{$shadow-color}",
189
- 15: "0px 8px 9px -5px #{$shadow-color}",
190
- 16: "0px 8px 10px -5px #{$shadow-color}",
191
- 17: "0px 8px 11px -5px #{$shadow-color}",
192
- 18: "0px 9px 11px -5px #{$shadow-color}",
193
- 19: "0px 9px 12px -6px #{$shadow-color}",
194
- 20: "0px 10px 13px -6px #{$shadow-color}",
195
- 21: "0px 10px 13px -6px #{$shadow-color}",
196
- 22: "0px 10px 14px -6px #{$shadow-color}",
197
- 23: "0px 11px 14px -7px #{$shadow-color}",
198
- 24: "0px 11px 15px -7px #{$shadow-color}"
199
- );
200
- }
201
-
202
- @function get-penumbra-map($color, $opacity) {
203
- $shadow-color: if(meta.type-of($color)==color, rgba($color, $opacity * 0.033), $color);
204
-
205
- @return (0: "0px 0px 0px 0px #{$shadow-color}",
206
- 1: "0px 2px 2px 0px #{$shadow-color}",
207
- 2: "0px 2px 3px 0px #{$shadow-color}",
208
- 3: "0px 3px 4px 0px #{$shadow-color}",
209
- 4: "0px 4px 5px 0px #{$shadow-color}",
210
- 5: "0px 5px 8px 0px #{$shadow-color}",
211
- 6: "0px 6px 10px 0px #{$shadow-color}",
212
- 7: "0px 7px 10px 1px #{$shadow-color}",
213
- 8: "0px 8px 10px 1px #{$shadow-color}",
214
- 9: "0px 9px 12px 1px #{$shadow-color}",
215
- 10: "0px 10px 14px 1px #{$shadow-color}",
216
- 11: "0px 11px 15px 1px #{$shadow-color}",
217
- 12: "0px 12px 17px 2px #{$shadow-color}",
218
- 13: "0px 13px 19px 2px #{$shadow-color}",
219
- 14: "0px 14px 21px 2px #{$shadow-color}",
220
- 15: "0px 15px 22px 2px #{$shadow-color}",
221
- 16: "0px 16px 24px 2px #{$shadow-color}",
222
- 17: "0px 17px 26px 2px #{$shadow-color}",
223
- 18: "0px 18px 28px 2px #{$shadow-color}",
224
- 19: "0px 19px 29px 2px #{$shadow-color}",
225
- 20: "0px 20px 31px 3px #{$shadow-color}",
226
- 21: "0px 21px 33px 3px #{$shadow-color}",
227
- 22: "0px 22px 35px 3px #{$shadow-color}",
228
- 23: "0px 23px 36px 3px #{$shadow-color}",
229
- 24: "0px 24px 38px 3px #{$shadow-color}"
230
- );
231
- }
232
-
233
- @function get-ambient-map($color, $opacity) {
234
- $shadow-color: if(meta.type-of($color)==color, rgba($color, $opacity * 0.033), $color);
235
-
236
- @return (0: "0px 0px 0px 0px #{$shadow-color}",
237
- 1: "0px 2px 2px 0px #{$shadow-color}",
238
- 2: "0px 1px 5px 0px #{$shadow-color}",
239
- 3: "0px 1px 8px 0px #{$shadow-color}",
240
- 4: "0px 1px 10px 0px #{$shadow-color}",
241
- 5: "0px 1px 14px 0px #{$shadow-color}",
242
- 6: "0px 1px 18px 0px #{$shadow-color}",
243
- 7: "0px 2px 16px 1px #{$shadow-color}",
244
- 8: "0px 3px 14px 2px #{$shadow-color}",
245
- 9: "0px 3px 16px 2px #{$shadow-color}",
246
- 10: "0px 4px 18px 3px #{$shadow-color}",
247
- 11: "0px 4px 20px 3px #{$shadow-color}",
248
- 12: "0px 5px 22px 4px #{$shadow-color}",
249
- 13: "0px 5px 24px 4px #{$shadow-color}",
250
- 14: "0px 5px 26px 4px #{$shadow-color}",
251
- 15: "0px 6px 28px 5px #{$shadow-color}",
252
- 16: "0px 6px 30px 5px #{$shadow-color}",
253
- 17: "0px 6px 32px 5px #{$shadow-color}",
254
- 18: "0px 7px 34px 6px #{$shadow-color}",
255
- 19: "0px 7px 36px 6px #{$shadow-color}",
256
- 20: "0px 8px 38px 7px #{$shadow-color}",
257
- 21: "0px 8px 40px 7px #{$shadow-color}",
258
- 22: "0px 8px 42px 7px #{$shadow-color}",
259
- 23: "0px 9px 44px 8px #{$shadow-color}",
260
- 24: "0px 9px 46px 8px #{$shadow-color}"
261
- );
262
- }
263
-
264
- // Returns a string that can be used as the value for a transition property for elevation.
265
- // Calling this function directly is useful in situations where a component needs to transition
266
- // more than one property.
267
- //
268
- // .foo {
269
- // transition: elevation-transition-property-value(), opacity 100ms ease;
270
- // }
271
- @function elevation-transition-property-value($duration: $elevation-transition-duration,
272
- $easing: $elevation-transition-timing-function) {
273
- @return box-shadow #{$duration} #{$easing};
274
- }
275
-
276
- // Define the variable for the base size (usually 16 pixels = 1 rem).
277
- $base-font-size: 16px;
278
-
279
- // Function to convert pixels to rem.
280
- @function px-to-rem($value-in-px) {
281
- @if $value-in-px !=0 {
282
- @return calc($value-in-px / $base-font-size) * 1rem;
283
- }
284
-
285
- @else {
286
- @return $value-in-px;
287
- }
288
- }
289
-
290
- // ── Color helpers (movidos de _theme-api p/ quebrar ciclo @use) ──────────────
291
- @function matcha-yiq($color) {
292
- $r: color.channel($color, "red", $space: rgb);
293
- $g: color.channel($color, "green", $space: rgb);
294
- $b: color.channel($color, "blue", $space: rgb);
295
- @return math.div(($r * 299) + ($g * 587) + ($b * 114), 1000);
296
- }
297
-
298
- @function matcha-text-on($color) {
299
- @return if(matcha-yiq($color) >= 150, #1a1d21, #ffffff);
300
- }
301
-
302
- @function matcha-contrast-on($color) {
303
- @return if(matcha-yiq($color) >= 150, rgba(0, 0, 0, .87), #ffffff);
304
- }
305
-
306
- @function matcha-contrast-alpha-on($color) {
307
- @return if(matcha-yiq($color) >= 150, rgba(0, 0, 0, .1), rgba(255, 255, 255, .1));
308
- }
309
-
310
- @function matcha-role-tokens($role, $seed, $surface-bg, $is-dark) {
311
- @return (
312
- #{$role}: $seed,
313
- #{$role}-hover: color.scale($seed, $lightness: if($is-dark, 18%, -12%)),
314
- #{$role}-pressed: color.scale($seed, $lightness: if($is-dark, 32%, -20%)),
315
- #{$role}-alpha: rgba($seed, .1),
316
- #{$role}-contrast: matcha-contrast-on($seed),
317
- #{$role}-contrast-alpha: matcha-contrast-alpha-on($seed),
318
- #{$role}-surface-hover: color.mix($seed, $surface-bg, 10%),
319
- #{$role}-surface-pressed: color.mix($seed, $surface-bg, 22%),
320
- );
321
- }
1
+ @use "sass:map";
2
+ @use "sass:math";
3
+ @use "sass:color";
4
+ @use "sass:meta";
5
+ @use "sass:string";
6
+
7
+ // -------------------------------------------------------------------------------------------------------------------
8
+ // @ Theme functions — REMOVIDAS no major (API velha)
9
+ // --------------------------------------------------------------------------------------------------------------------
10
+ // palette() / map-color() / map-contrast() / light-theme() / dark-theme() /
11
+ // light-custom-theme() / dark-custom-theme() foram removidas. Construíam o mapa $theme
12
+ // (cores compile-time a partir das paletas Material) consumido por matcha-components().
13
+ // A API nova é color-runtime: o tema é só o conjunto de --matcha-color-* (synced do Figma),
14
+ // emitido por matcha-css-custom-properties($is-dark). Whitelabel = matcha-define-theme()
15
+ // (override de --matcha-color-*). Ver src/app/app.theme.scss + main.scss (nota do shim).
16
+ // Os mapas crus de paleta ($red/$blue/... em tokens/_material-palette) FICAM — alimentam
17
+ // os tokens runtime --matcha-color-{nome} (ver tokens/_emit-tokens).
18
+
19
+ // -------------------------------------------------------------------------------------------------------------------
20
+ // @ Typography functions
21
+ // --------------------------------------------------------------------------------------------------------------------
22
+ // Represents a typography level from the Material design spec.
23
+ @function matcha-typography-level($font-size,
24
+ $line-height: $font-size,
25
+ $font-weight: 400,
26
+ $font-family: null,
27
+ $letter-spacing: null) {
28
+ @return (font-size: $font-size,
29
+ line-height: $line-height,
30
+ font-weight: $font-weight,
31
+ font-family: $font-family,
32
+ letter-spacing: $letter-spacing );
33
+ }
34
+
35
+ // Represents a collection of typography levels.
36
+ // Defaults come from https://material.io/guidelines/style/typography.html
37
+ // Note: The spec doesn't mention letter spacing. The values here come from
38
+ // eyeballing it until it looked exactly like the spec examples.
39
+ @function matcha-typography-config($font-family: $font-family-base,
40
+ // ── Display ──
41
+ $display-xl: matcha-typography-level(40px, 48px, 800, $letter-spacing: -0.5px),
42
+ $display: matcha-typography-level(32px, 40px, 700, $letter-spacing: -0.5px),
43
+ // ── Headline ──
44
+ $headline: matcha-typography-level(24px, 32px, 700, $letter-spacing: -0.3px),
45
+ // ── Title ──
46
+ $title-xl: matcha-typography-level(20px, 28px, 800),
47
+ $title-lg: matcha-typography-level(20px, 28px, 600),
48
+ $title-md: matcha-typography-level(18px, 24px, 600),
49
+ $title-sm: matcha-typography-level(16px, 22px, 600),
50
+ $title-xs: matcha-typography-level(14px, 20px, 800),
51
+ // ── Label ──
52
+ $label-lg: matcha-typography-level(16px, 22px, 500),
53
+ $label-md: matcha-typography-level(14px, 20px, 500),
54
+ $label-sm: matcha-typography-level(12px, 16px, 500),
55
+ // ── Body ──
56
+ $body-lg: matcha-typography-level(16px, 24px, 400),
57
+ $body-md: matcha-typography-level(14px, 20px, 400),
58
+ $body-sm: matcha-typography-level(12px, 16px, 400),
59
+ // ── Button ──
60
+ $button-lg: matcha-typography-level(16px, 22px, 600, $letter-spacing: 0.2px),
61
+ $button-md: matcha-typography-level(14px, 20px, 500, $letter-spacing: 0.2px),
62
+ $button-sm: matcha-typography-level(13px, 19px, 500, $letter-spacing: 0.2px),
63
+ // ── Other ──
64
+ $caption: matcha-typography-level(11px, 14px, 400, $letter-spacing: 0.3px),
65
+ $overline: matcha-typography-level(10px, 14px, 600, $letter-spacing: 1px),
66
+ $input: matcha-typography-level(inherit, 1.125, 400),
67
+ // ── Legacy aliases (kept for retrocompatibility) ──
68
+ $display-4: matcha-typography-level(112px, 112px, 300, $letter-spacing: -0.05em),
69
+ $display-3: matcha-typography-level(56px, 56px, 400, $letter-spacing: -0.02em),
70
+ $display-2: matcha-typography-level(45px, 48px, 400, $letter-spacing: -0.005em),
71
+ $display-1: matcha-typography-level(34px, 40px, 400),
72
+ $title: matcha-typography-level(20px, 28px, 600),
73
+ $subheading-2: matcha-typography-level(16px, 22px, 600),
74
+ $subheading-1: matcha-typography-level(15px, 24px, 600),
75
+ $body-2: matcha-typography-level(14px, 20px, 500),
76
+ $body-1: matcha-typography-level(14px, 20px, 400),
77
+ $button: matcha-typography-level(14px, 20px, 500, $letter-spacing: 0.2px)) {
78
+ $config: (
79
+ // New Figma-aligned styles
80
+ display-xl: $display-xl,
81
+ display: $display,
82
+ headline: $headline,
83
+ title-xl: $title-xl,
84
+ title-lg: $title-lg,
85
+ title-md: $title-md,
86
+ title-sm: $title-sm,
87
+ title-xs: $title-xs,
88
+ label-lg: $label-lg,
89
+ label-md: $label-md,
90
+ label-sm: $label-sm,
91
+ body-lg: $body-lg,
92
+ body-md: $body-md,
93
+ body-sm: $body-sm,
94
+ button-lg: $button-lg,
95
+ button-md: $button-md,
96
+ button-sm: $button-sm,
97
+ caption: $caption,
98
+ overline: $overline,
99
+ input: $input,
100
+ // Legacy aliases
101
+ display-4: $display-4,
102
+ display-3: $display-3,
103
+ display-2: $display-2,
104
+ display-1: $display-1,
105
+ title: $title,
106
+ subheading-2: $subheading-2,
107
+ subheading-1: $subheading-1,
108
+ body-2: $body-2,
109
+ body-1: $body-1,
110
+ button: $button
111
+ );
112
+
113
+ // Loop through the levels and set the `font-family` of the ones that don't have one to the base.
114
+ // Note that Sass can't modify maps in place, which means that we need to merge and re-assign.
115
+ @each $key, $level in $config {
116
+ @if map.get($level, font-family)==null {
117
+ $new-level: map.merge($level,
118
+ (font-family: $font-family ));
119
+ $config: map.merge($config,
120
+ ($key: $new-level ));
121
+ }
122
+ }
123
+
124
+ // Add the base font family to the config.
125
+ @return map.merge($config,
126
+ (font-family: $font-family ));
127
+ }
128
+
129
+ // Utility for fetching a nested value from a typography config.
130
+ @function _matcha-get-type-value($config, $level, $name) {
131
+ @return map.get(map.get($config, $level), $name);
132
+ }
133
+
134
+ // Gets the font size for a level inside a typography config.
135
+ @function matcha-font-size($config, $level) {
136
+ @return _matcha-get-type-value($config, $level, font-size);
137
+ }
138
+
139
+ // Gets the line height for a level inside a typography config.
140
+ @function matcha-line-height($config, $level) {
141
+ @return _matcha-get-type-value($config, $level, line-height);
142
+ }
143
+
144
+ // Gets the font weight for a level inside a typography config.
145
+ @function matcha-font-weight($config, $level) {
146
+ @return _matcha-get-type-value($config, $level, font-weight);
147
+ }
148
+
149
+ // Gets the letter spacing for a level inside a typography config.
150
+ @function matcha-letter-spacing($config, $level) {
151
+ @return _matcha-get-type-value($config, $level, letter-spacing);
152
+ }
153
+
154
+ // Gets the font-family from a typography config and removes the quotes around it.
155
+ @function matcha-font-family($config, $level: null) {
156
+ $font-family: map.get($config, font-family);
157
+
158
+ @if $level !=null {
159
+ $font-family: _matcha-get-type-value($config, $level, font-family);
160
+ }
161
+
162
+ // Guard against unquoting non-string values, because it's deprecated.
163
+ @return if(meta.type-of($font-family)==string, string.unquote($font-family), $font-family);
164
+ }
165
+
166
+ // -------------------------------------------------------------------------------------------------------------------
167
+ // @ Elevation functions
168
+ // --------------------------------------------------------------------------------------------------------------------
169
+ // A collection of functions that can be used to apply elevation to a material
170
+
171
+ @function get-umbra-map($color, $opacity) {
172
+ $shadow-color: if(meta.type-of($color)==color, rgba($color, $opacity * 0.033), $color);
173
+
174
+ @return (0: "0px 0px 0px 0px #{$shadow-color}",
175
+ 1: "0px 2px 2px 0px #{$shadow-color}",
176
+ 2: "0px 3px 2px -2px #{$shadow-color}",
177
+ 3: "0px 3px 3px -2px #{$shadow-color}",
178
+ 4: "0px 2px 4px -1px #{$shadow-color}",
179
+ 5: "0px 3px 5px -1px #{$shadow-color}",
180
+ 6: "0px 3px 5px -1px #{$shadow-color}",
181
+ 7: "0px 4px 5px -2px #{$shadow-color}",
182
+ 8: "0px 5px 5px -3px #{$shadow-color}",
183
+ 9: "0px 5px 6px -3px #{$shadow-color}",
184
+ 10: "0px 6px 6px -3px #{$shadow-color}",
185
+ 11: "0px 6px 7px -4px #{$shadow-color}",
186
+ 12: "0px 7px 8px -4px #{$shadow-color}",
187
+ 13: "0px 7px 8px -4px #{$shadow-color}",
188
+ 14: "0px 7px 9px -4px #{$shadow-color}",
189
+ 15: "0px 8px 9px -5px #{$shadow-color}",
190
+ 16: "0px 8px 10px -5px #{$shadow-color}",
191
+ 17: "0px 8px 11px -5px #{$shadow-color}",
192
+ 18: "0px 9px 11px -5px #{$shadow-color}",
193
+ 19: "0px 9px 12px -6px #{$shadow-color}",
194
+ 20: "0px 10px 13px -6px #{$shadow-color}",
195
+ 21: "0px 10px 13px -6px #{$shadow-color}",
196
+ 22: "0px 10px 14px -6px #{$shadow-color}",
197
+ 23: "0px 11px 14px -7px #{$shadow-color}",
198
+ 24: "0px 11px 15px -7px #{$shadow-color}"
199
+ );
200
+ }
201
+
202
+ @function get-penumbra-map($color, $opacity) {
203
+ $shadow-color: if(meta.type-of($color)==color, rgba($color, $opacity * 0.033), $color);
204
+
205
+ @return (0: "0px 0px 0px 0px #{$shadow-color}",
206
+ 1: "0px 2px 2px 0px #{$shadow-color}",
207
+ 2: "0px 2px 3px 0px #{$shadow-color}",
208
+ 3: "0px 3px 4px 0px #{$shadow-color}",
209
+ 4: "0px 4px 5px 0px #{$shadow-color}",
210
+ 5: "0px 5px 8px 0px #{$shadow-color}",
211
+ 6: "0px 6px 10px 0px #{$shadow-color}",
212
+ 7: "0px 7px 10px 1px #{$shadow-color}",
213
+ 8: "0px 8px 10px 1px #{$shadow-color}",
214
+ 9: "0px 9px 12px 1px #{$shadow-color}",
215
+ 10: "0px 10px 14px 1px #{$shadow-color}",
216
+ 11: "0px 11px 15px 1px #{$shadow-color}",
217
+ 12: "0px 12px 17px 2px #{$shadow-color}",
218
+ 13: "0px 13px 19px 2px #{$shadow-color}",
219
+ 14: "0px 14px 21px 2px #{$shadow-color}",
220
+ 15: "0px 15px 22px 2px #{$shadow-color}",
221
+ 16: "0px 16px 24px 2px #{$shadow-color}",
222
+ 17: "0px 17px 26px 2px #{$shadow-color}",
223
+ 18: "0px 18px 28px 2px #{$shadow-color}",
224
+ 19: "0px 19px 29px 2px #{$shadow-color}",
225
+ 20: "0px 20px 31px 3px #{$shadow-color}",
226
+ 21: "0px 21px 33px 3px #{$shadow-color}",
227
+ 22: "0px 22px 35px 3px #{$shadow-color}",
228
+ 23: "0px 23px 36px 3px #{$shadow-color}",
229
+ 24: "0px 24px 38px 3px #{$shadow-color}"
230
+ );
231
+ }
232
+
233
+ @function get-ambient-map($color, $opacity) {
234
+ $shadow-color: if(meta.type-of($color)==color, rgba($color, $opacity * 0.033), $color);
235
+
236
+ @return (0: "0px 0px 0px 0px #{$shadow-color}",
237
+ 1: "0px 2px 2px 0px #{$shadow-color}",
238
+ 2: "0px 1px 5px 0px #{$shadow-color}",
239
+ 3: "0px 1px 8px 0px #{$shadow-color}",
240
+ 4: "0px 1px 10px 0px #{$shadow-color}",
241
+ 5: "0px 1px 14px 0px #{$shadow-color}",
242
+ 6: "0px 1px 18px 0px #{$shadow-color}",
243
+ 7: "0px 2px 16px 1px #{$shadow-color}",
244
+ 8: "0px 3px 14px 2px #{$shadow-color}",
245
+ 9: "0px 3px 16px 2px #{$shadow-color}",
246
+ 10: "0px 4px 18px 3px #{$shadow-color}",
247
+ 11: "0px 4px 20px 3px #{$shadow-color}",
248
+ 12: "0px 5px 22px 4px #{$shadow-color}",
249
+ 13: "0px 5px 24px 4px #{$shadow-color}",
250
+ 14: "0px 5px 26px 4px #{$shadow-color}",
251
+ 15: "0px 6px 28px 5px #{$shadow-color}",
252
+ 16: "0px 6px 30px 5px #{$shadow-color}",
253
+ 17: "0px 6px 32px 5px #{$shadow-color}",
254
+ 18: "0px 7px 34px 6px #{$shadow-color}",
255
+ 19: "0px 7px 36px 6px #{$shadow-color}",
256
+ 20: "0px 8px 38px 7px #{$shadow-color}",
257
+ 21: "0px 8px 40px 7px #{$shadow-color}",
258
+ 22: "0px 8px 42px 7px #{$shadow-color}",
259
+ 23: "0px 9px 44px 8px #{$shadow-color}",
260
+ 24: "0px 9px 46px 8px #{$shadow-color}"
261
+ );
262
+ }
263
+
264
+ // Returns a string that can be used as the value for a transition property for elevation.
265
+ // Calling this function directly is useful in situations where a component needs to transition
266
+ // more than one property.
267
+ //
268
+ // .foo {
269
+ // transition: elevation-transition-property-value(), opacity 100ms ease;
270
+ // }
271
+ @function elevation-transition-property-value($duration: $elevation-transition-duration,
272
+ $easing: $elevation-transition-timing-function) {
273
+ @return box-shadow #{$duration} #{$easing};
274
+ }
275
+
276
+ // Define the variable for the base size (usually 16 pixels = 1 rem).
277
+ $base-font-size: 16px;
278
+
279
+ // Function to convert pixels to rem.
280
+ @function px-to-rem($value-in-px) {
281
+ @if $value-in-px !=0 {
282
+ @return calc($value-in-px / $base-font-size) * 1rem;
283
+ }
284
+
285
+ @else {
286
+ @return $value-in-px;
287
+ }
288
+ }
289
+
290
+ // ── Color helpers (movidos de _theme-api p/ quebrar ciclo @use) ──────────────
291
+ @function matcha-yiq($color) {
292
+ $r: color.channel($color, "red", $space: rgb);
293
+ $g: color.channel($color, "green", $space: rgb);
294
+ $b: color.channel($color, "blue", $space: rgb);
295
+ @return math.div(($r * 299) + ($g * 587) + ($b * 114), 1000);
296
+ }
297
+
298
+ @function matcha-text-on($color) {
299
+ @return if(matcha-yiq($color) >= 150, #1a1d21, #ffffff);
300
+ }
301
+
302
+ @function matcha-contrast-on($color) {
303
+ @return if(matcha-yiq($color) >= 150, rgba(0, 0, 0, .87), #ffffff);
304
+ }
305
+
306
+ @function matcha-contrast-alpha-on($color) {
307
+ @return if(matcha-yiq($color) >= 150, rgba(0, 0, 0, .1), rgba(255, 255, 255, .1));
308
+ }
309
+
310
+ @function matcha-role-tokens($role, $seed, $surface-bg, $is-dark) {
311
+ @return (
312
+ #{$role}: $seed,
313
+ #{$role}-hover: color.scale($seed, $lightness: if($is-dark, 18%, -12%)),
314
+ #{$role}-pressed: color.scale($seed, $lightness: if($is-dark, 32%, -20%)),
315
+ #{$role}-alpha: rgba($seed, .1),
316
+ #{$role}-contrast: matcha-contrast-on($seed),
317
+ #{$role}-contrast-alpha: matcha-contrast-alpha-on($seed),
318
+ #{$role}-surface-hover: color.mix($seed, $surface-bg, 10%),
319
+ #{$role}-surface-pressed: color.mix($seed, $surface-bg, 22%),
320
+ );
321
+ }