@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.
- package/abstracts/_colors.scss +236 -229
- package/abstracts/_elevation.scss +108 -108
- package/abstracts/_functions.scss +321 -321
- package/abstracts/_media-breakpoint.scss +26 -26
- package/abstracts/_theme-api.scss +219 -219
- package/abstracts/_typography.scss +128 -128
- package/base/_reset.scss +445 -432
- package/components/app-page-header.scss +260 -260
- package/components/matcha-accordion.scss +293 -293
- package/components/matcha-audio-player.scss +31 -31
- package/components/matcha-autocomplete.scss +145 -145
- package/components/matcha-avatar.scss +440 -301
- package/components/matcha-badge.scss +120 -120
- package/components/matcha-breadcrumb.scss +231 -231
- package/components/matcha-button-toggle.scss +384 -384
- package/components/matcha-buttons.scss +913 -913
- package/components/matcha-calendar.scss +218 -218
- package/components/matcha-cards.scss +230 -230
- package/components/matcha-chart-card.scss +53 -53
- package/components/matcha-checkbox.scss +255 -255
- package/components/matcha-chip.scss +292 -292
- package/components/matcha-color-pick.scss +34 -34
- package/components/matcha-command-palette.scss +316 -316
- package/components/matcha-crop.scss +406 -406
- package/components/matcha-date.scss +81 -81
- package/components/matcha-divider.scss +100 -100
- package/components/matcha-draggable.scss +23 -23
- package/components/matcha-drawer.scss +376 -376
- package/components/matcha-drop-image.scss +14 -14
- package/components/matcha-drop-list.scss +430 -430
- package/components/matcha-emoji.scss +69 -69
- package/components/matcha-empty-state.scss +230 -230
- package/components/matcha-file-uploader.scss +471 -471
- package/components/matcha-flag.scss +103 -103
- package/components/matcha-footer.scss +91 -91
- package/components/matcha-form-field.scss +606 -606
- package/components/matcha-form-section.scss +100 -100
- package/components/matcha-header.scss +135 -135
- package/components/matcha-highlight.scss +164 -164
- package/components/matcha-hint-text.scss +90 -90
- package/components/matcha-horizontal-tree.scss +316 -316
- package/components/matcha-icon.scss +98 -98
- package/components/matcha-image.scss +61 -61
- package/components/matcha-list.scss +211 -211
- package/components/matcha-menu.scss +99 -99
- package/components/matcha-modal.scss +210 -210
- package/components/matcha-nav.scss +581 -581
- package/components/matcha-notification.scss +413 -413
- package/components/matcha-option.scss +170 -170
- package/components/matcha-page-builder.scss +4196 -4196
- package/components/matcha-paginator.scss +689 -689
- package/components/matcha-panel.scss +194 -194
- package/components/matcha-profile-card.scss +50 -50
- package/components/matcha-progress-bar.scss +313 -313
- package/components/matcha-radio.scss +320 -320
- package/components/matcha-ripple.scss +7 -7
- package/components/matcha-scrollbar.scss +33 -33
- package/components/matcha-scrollbox-shadow.scss +120 -120
- package/components/matcha-section.scss +102 -102
- package/components/matcha-select-multiple.scss +56 -56
- package/components/matcha-select.scss +667 -667
- package/components/matcha-skeleton.scss +155 -155
- package/components/matcha-slide-toggle.scss +369 -369
- package/components/matcha-slider.scss +285 -285
- package/components/matcha-snack-bar.scss +259 -259
- package/components/matcha-spin.scss +164 -164
- package/components/matcha-spinner.scss +97 -97
- package/components/matcha-status-pill.scss +38 -18
- package/components/matcha-stepper.scss +376 -376
- package/components/matcha-table-cell.scss +74 -41
- package/components/matcha-table.scss +579 -578
- package/components/matcha-tabs.scss +600 -600
- package/components/matcha-text-editor.scss +105 -105
- package/components/matcha-time.scss +33 -33
- package/components/matcha-timepicker.scss +13 -13
- package/components/matcha-toolbar.scss +359 -359
- package/components/matcha-tooltip.scss +224 -224
- package/components/matcha-tree-view.scss +257 -212
- package/layout/matcha-page-layout.scss +778 -778
- package/main.scss +329 -329
- package/package.json +1 -1
- package/tokens/_animations-tokens.scss +37 -37
- package/tokens/_breakpoints-tokens.scss +35 -35
- package/tokens/_color-tokens.scss +274 -261
- package/tokens/_elevation-tokens.scss +33 -33
- package/tokens/_emit-tokens.scss +324 -324
- package/tokens/_material-palette.scss +1149 -1149
- package/tokens/_primitives.scss +98 -98
- package/tokens/_semantic-aliases.scss +120 -120
- package/tokens/_spacing-tokens.scss +94 -94
- package/tokens/_static-tokens.scss +137 -137
- package/tokens/_typography-tokens.scss +65 -65
- package/vendors/charts.scss +90 -90
|
@@ -1,369 +1,369 @@
|
|
|
1
|
-
// =============================================================================
|
|
2
|
-
// matcha-slide-toggle.scss — Migração Fase 3.1
|
|
3
|
-
//
|
|
4
|
-
// Template B: replaced element com child container
|
|
5
|
-
// - input[type="checkbox"] é replaced element (::before/::after são pseudo-elementos
|
|
6
|
-
// internos do browser para track/thumb, não suportam state layer externo)
|
|
7
|
-
// - label é o container hit area → recebe o state layer (::before)
|
|
8
|
-
// - Pattern: color: getXxx($theme) no label → currentColor funciona no ::before
|
|
9
|
-
//
|
|
10
|
-
// Mudanças:
|
|
11
|
-
// [3.1-A] State layer em label (container do replaced element)
|
|
12
|
-
// [3.1-B] cursor: not-allowed + opacity no .matcha-slide-toggle-disabled removidos
|
|
13
|
-
// [3.1-C] Disabled: tokens semânticos no mixin
|
|
14
|
-
// [3.1-D] :focus-within no mixin (foco está no input dentro do label)
|
|
15
|
-
// [3.1-E] transition: all → transições específicas
|
|
16
|
-
// [3.1-F] @media (prefers-reduced-motion: reduce) adicionado
|
|
17
|
-
// [3.1-G] :not([disabled]) guards via seletor de contexto do pai
|
|
18
|
-
// =============================================================================
|
|
19
|
-
|
|
20
|
-
@mixin matcha-slide-toggle-theme($theme) {
|
|
21
|
-
matcha-slide-toggle {
|
|
22
|
-
// Figma matcha/switch (14510:226): track off sem fill + stroke text-label, thumb off text-primary
|
|
23
|
-
input[type="checkbox"] {
|
|
24
|
-
&::before {
|
|
25
|
-
background-color: transparent;
|
|
26
|
-
border-color: var(--matcha-color-text-label);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&::after {
|
|
30
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
31
|
-
background-color: var(--matcha-color-text-primary);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// ── Sem cor / accent ───────────────────────────────────────────────
|
|
36
|
-
&:not([color]),
|
|
37
|
-
&[color="accent"] {
|
|
38
|
-
// [3.1-A] color no label → currentColor para o state layer
|
|
39
|
-
label {
|
|
40
|
-
color: var(--matcha-color-accent);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
input[type="checkbox"] {
|
|
44
|
-
&:checked {
|
|
45
|
-
&::before {
|
|
46
|
-
background-color: var(--matcha-color-accent);
|
|
47
|
-
border-color: var(--matcha-color-accent);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&::after {
|
|
51
|
-
background-color: var(--matcha-color-accent-contrast);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// ── Semântica: primary ─────────────────────────────────────────────
|
|
58
|
-
&[color="primary"] {
|
|
59
|
-
label { color: var(--matcha-color-primary); } // [3.1-A]
|
|
60
|
-
|
|
61
|
-
input[type="checkbox"]:checked::before {
|
|
62
|
-
background-color: var(--matcha-color-primary);
|
|
63
|
-
border-color: var(--matcha-color-primary);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
input[type="checkbox"]:checked::after {
|
|
67
|
-
background-color: var(--matcha-color-primary-contrast);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// ── Semântica: success ─────────────────────────────────────────────
|
|
72
|
-
&[color="success"] {
|
|
73
|
-
label { color: var(--matcha-color-success); } // [3.1-A]
|
|
74
|
-
|
|
75
|
-
input[type="checkbox"]:checked::before {
|
|
76
|
-
background-color: var(--matcha-color-success);
|
|
77
|
-
border-color: var(--matcha-color-success);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
input[type="checkbox"]:checked::after {
|
|
81
|
-
background-color: var(--matcha-color-success-contrast);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// ── Semântica: warn ────────────────────────────────────────────────
|
|
86
|
-
&[color="warn"] {
|
|
87
|
-
label { color: var(--matcha-color-warn); } // [3.1-A]
|
|
88
|
-
|
|
89
|
-
input[type="checkbox"]:checked::before {
|
|
90
|
-
background-color: var(--matcha-color-warn);
|
|
91
|
-
border-color: var(--matcha-color-warn);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
input[type="checkbox"]:checked::after {
|
|
95
|
-
background-color: var(--matcha-color-warn-contrast);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// ── Semântica: danger ──────────────────────────────────────────────
|
|
100
|
-
&[color="danger"] {
|
|
101
|
-
label { color: var(--matcha-color-danger); } // [3.1-A]
|
|
102
|
-
|
|
103
|
-
input[type="checkbox"]:checked::before {
|
|
104
|
-
background-color: var(--matcha-color-danger);
|
|
105
|
-
border-color: var(--matcha-color-danger);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
input[type="checkbox"]:checked::after {
|
|
109
|
-
background-color: var(--matcha-color-danger-contrast);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// ── Semântica: info ────────────────────────────────────────────────
|
|
114
|
-
&[color="info"] {
|
|
115
|
-
label { color: var(--matcha-color-info); } // [3.1-A]
|
|
116
|
-
|
|
117
|
-
input[type="checkbox"]:checked::before {
|
|
118
|
-
background-color: var(--matcha-color-info);
|
|
119
|
-
border-color: var(--matcha-color-info);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
input[type="checkbox"]:checked::after {
|
|
123
|
-
background-color: var(--matcha-color-info-contrast);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// ── Error state (aligned with Figma State=Error) ──────────────────
|
|
128
|
-
&.matcha-slide-toggle-error,
|
|
129
|
-
&[error] {
|
|
130
|
-
input[type="checkbox"] {
|
|
131
|
-
&::before {
|
|
132
|
-
border-color: var(--matcha-color-danger);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
&:checked::before {
|
|
136
|
-
background-color: var(--matcha-color-danger);
|
|
137
|
-
border-color: var(--matcha-color-danger);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// ── Loading state (aligned with Figma State=Loading) ────────────────
|
|
143
|
-
&.matcha-slide-toggle-loading,
|
|
144
|
-
&[loading] {
|
|
145
|
-
pointer-events: none;
|
|
146
|
-
|
|
147
|
-
input[type="checkbox"]::after {
|
|
148
|
-
animation: matcha-toggle-loading 800ms linear infinite;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// ── [3.1-C] Disabled — tokens semânticos (sem opacity no host) ─────
|
|
153
|
-
&[disabled] {
|
|
154
|
-
label {
|
|
155
|
-
color: var(--matcha-color-disabled-fg);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
input[type="checkbox"] {
|
|
159
|
-
&::before {
|
|
160
|
-
background-color: var(--matcha-color-disabled-bg);
|
|
161
|
-
border-color: var(--matcha-color-disabled-bg);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
&::after {
|
|
165
|
-
background-color: var(--matcha-color-disabled-fg);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Focus ring: só em navegação por teclado (não mostra em clique com mouse).
|
|
171
|
-
// :has(input:focus-visible) — apenas mostra outline quando o input interno
|
|
172
|
-
// tem focus-visible (keyboard nav), não em :focus geral (mouse click).
|
|
173
|
-
label:has(input:focus-visible) {
|
|
174
|
-
outline: var(--matcha-state-focus-ring-width, 2px) solid
|
|
175
|
-
var(--matcha-color-primary);
|
|
176
|
-
outline-offset: var(--matcha-state-focus-ring-offset, 2px);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Label padrão — Figma: text-primary. Slot pra consumer override.
|
|
180
|
-
.matcha-slide-toggle-label {
|
|
181
|
-
color: var(--matcha-slide-toggle-label-color, var(--matcha-color-text-primary));
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
// =============================================================================
|
|
188
|
-
// Bloco estrutural — fora do mixin de tema
|
|
189
|
-
// =============================================================================
|
|
190
|
-
|
|
191
|
-
// [3.1-A] label recebe o state layer
|
|
192
|
-
// input[type="checkbox"] é replaced element — state layer externo vai no container (label)
|
|
193
|
-
matcha-slide-toggle label {
|
|
194
|
-
position: relative;
|
|
195
|
-
overflow: hidden;
|
|
196
|
-
|
|
197
|
-
// State layer — segue INTERACTION-SYSTEM.md template B
|
|
198
|
-
&::before {
|
|
199
|
-
content: '';
|
|
200
|
-
position: absolute;
|
|
201
|
-
inset: 0;
|
|
202
|
-
background: currentColor; // herda o color (var(--matcha-color-*)) definido por variante
|
|
203
|
-
opacity: 0;
|
|
204
|
-
pointer-events: none;
|
|
205
|
-
transition: opacity var(--matcha-duration-instant, 80ms) linear;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// [3.1-G] Hover/active: [disabled] está em matcha-slide-toggle (pai), não no label
|
|
210
|
-
// Seletor de contexto do pai evita ativar o state layer quando desabilitado
|
|
211
|
-
matcha-slide-toggle:not([disabled]) label:hover::before { opacity: var(--matcha-state-hover, 0.08); }
|
|
212
|
-
matcha-slide-toggle:not([disabled]) label:active::before { opacity: var(--matcha-state-active, 0.12); }
|
|
213
|
-
|
|
214
|
-
matcha-slide-toggle {
|
|
215
|
-
label {
|
|
216
|
-
display: inline-flex;
|
|
217
|
-
align-items: center;
|
|
218
|
-
gap: var(--matcha-space-100, 8px); // Figma: gap 8 entre switch e content
|
|
219
|
-
cursor: pointer;
|
|
220
|
-
-webkit-tap-highlight-color: transparent;
|
|
221
|
-
vertical-align: middle;
|
|
222
|
-
|
|
223
|
-
.matcha-slide-toggle-label {
|
|
224
|
-
font-family: var(--matcha-font-family, 'Manrope', sans-serif);
|
|
225
|
-
font-size: var(--matcha-text-body-md, 14px);
|
|
226
|
-
line-height: 20px;
|
|
227
|
-
font-weight: 400;
|
|
228
|
-
user-select: none;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// [3.1-B] Disabled — sem cursor: not-allowed, sem opacity no host
|
|
233
|
-
// pointer-events: none bloqueia interação; cores via tokens no mixin
|
|
234
|
-
&[disabled] {
|
|
235
|
-
pointer-events: none;
|
|
236
|
-
|
|
237
|
-
label {
|
|
238
|
-
cursor: default;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
input[type="checkbox"] {
|
|
243
|
-
appearance: none;
|
|
244
|
-
-webkit-appearance: none;
|
|
245
|
-
position: relative;
|
|
246
|
-
display: inline-block;
|
|
247
|
-
width: 36px;
|
|
248
|
-
height: 20px;
|
|
249
|
-
margin: 0;
|
|
250
|
-
outline: none;
|
|
251
|
-
cursor: pointer;
|
|
252
|
-
vertical-align: middle;
|
|
253
|
-
min-width: 36px; // garante que não fique < 36px
|
|
254
|
-
flex-shrink: 0; // se estiver dentro de um container flex
|
|
255
|
-
|
|
256
|
-
&::before {
|
|
257
|
-
content: "";
|
|
258
|
-
position: absolute;
|
|
259
|
-
top: 50%;
|
|
260
|
-
left: 0;
|
|
261
|
-
transform: translateY(-50%);
|
|
262
|
-
width: 100%;
|
|
263
|
-
height: 20px;
|
|
264
|
-
border-width: 2px;
|
|
265
|
-
border-style: solid;
|
|
266
|
-
border-radius: var(--matcha-radius-xl, 16px);
|
|
267
|
-
box-sizing: border-box;
|
|
268
|
-
|
|
269
|
-
// [3.1-E] transition específico (não 'all')
|
|
270
|
-
transition: background-color 0.15s linear;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// Figma matcha/switch: thumb 12×12 off → 16×16 on (14510:226)
|
|
274
|
-
&::after {
|
|
275
|
-
content: "";
|
|
276
|
-
position: absolute;
|
|
277
|
-
top: 4px;
|
|
278
|
-
left: 4px;
|
|
279
|
-
width: 12px;
|
|
280
|
-
height: 12px;
|
|
281
|
-
border-radius: 50%;
|
|
282
|
-
|
|
283
|
-
transition:
|
|
284
|
-
transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
|
|
285
|
-
width 0.15s cubic-bezier(0.4, 0, 0.2, 1),
|
|
286
|
-
height 0.15s cubic-bezier(0.4, 0, 0.2, 1),
|
|
287
|
-
top 0.15s cubic-bezier(0.4, 0, 0.2, 1),
|
|
288
|
-
left 0.15s cubic-bezier(0.4, 0, 0.2, 1),
|
|
289
|
-
background-color 0.15s linear,
|
|
290
|
-
outline 0.1s ease-out;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
&:checked {
|
|
294
|
-
&::after {
|
|
295
|
-
top: 2px;
|
|
296
|
-
left: 2px;
|
|
297
|
-
width: 16px;
|
|
298
|
-
height: 16px;
|
|
299
|
-
transform: translateX(16px); // desliza 16px (36 - 16 - 2×2 = 16)
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
&:focus-visible::after {
|
|
304
|
-
outline-offset: 2px;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// ── Loading animation ──
|
|
309
|
-
@keyframes matcha-toggle-loading {
|
|
310
|
-
0% { opacity: 1; }
|
|
311
|
-
50% { opacity: 0.4; }
|
|
312
|
-
100% { opacity: 1; }
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
// [3.1-F] Movimento reduzido — obrigatório (WCAG 2.3.3)
|
|
316
|
-
@media (prefers-reduced-motion: reduce) {
|
|
317
|
-
input[type="checkbox"] {
|
|
318
|
-
&::before { transition: none; }
|
|
319
|
-
&::after { transition: none; animation: none; }
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
label::before { transition: none; }
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
// ── Forced colors ──
|
|
327
|
-
@media (forced-colors: active) {
|
|
328
|
-
matcha-slide-toggle,
|
|
329
|
-
.matcha-slide-toggle {
|
|
330
|
-
input[type="checkbox"] {
|
|
331
|
-
// Track
|
|
332
|
-
&::before {
|
|
333
|
-
background: Canvas !important;
|
|
334
|
-
border: 1px solid CanvasText !important;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
// Thumb
|
|
338
|
-
&::after {
|
|
339
|
-
background: ButtonFace !important;
|
|
340
|
-
border: 1px solid CanvasText !important;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
&:checked::before {
|
|
344
|
-
background: Highlight !important;
|
|
345
|
-
border-color: Highlight !important;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
&:focus-visible::before {
|
|
349
|
-
outline: 2px solid CanvasText !important;
|
|
350
|
-
outline-offset: 2px;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
&:disabled::before,
|
|
354
|
-
&:disabled::after {
|
|
355
|
-
border-color: GrayText !important;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
// ── Print ──
|
|
362
|
-
@media print {
|
|
363
|
-
matcha-slide-toggle,
|
|
364
|
-
.matcha-slide-toggle {
|
|
365
|
-
input[type="checkbox"] {
|
|
366
|
-
&::before { border: 1px solid currentColor !important; }
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// matcha-slide-toggle.scss — Migração Fase 3.1
|
|
3
|
+
//
|
|
4
|
+
// Template B: replaced element com child container
|
|
5
|
+
// - input[type="checkbox"] é replaced element (::before/::after são pseudo-elementos
|
|
6
|
+
// internos do browser para track/thumb, não suportam state layer externo)
|
|
7
|
+
// - label é o container hit area → recebe o state layer (::before)
|
|
8
|
+
// - Pattern: color: getXxx($theme) no label → currentColor funciona no ::before
|
|
9
|
+
//
|
|
10
|
+
// Mudanças:
|
|
11
|
+
// [3.1-A] State layer em label (container do replaced element)
|
|
12
|
+
// [3.1-B] cursor: not-allowed + opacity no .matcha-slide-toggle-disabled removidos
|
|
13
|
+
// [3.1-C] Disabled: tokens semânticos no mixin
|
|
14
|
+
// [3.1-D] :focus-within no mixin (foco está no input dentro do label)
|
|
15
|
+
// [3.1-E] transition: all → transições específicas
|
|
16
|
+
// [3.1-F] @media (prefers-reduced-motion: reduce) adicionado
|
|
17
|
+
// [3.1-G] :not([disabled]) guards via seletor de contexto do pai
|
|
18
|
+
// =============================================================================
|
|
19
|
+
|
|
20
|
+
@mixin matcha-slide-toggle-theme($theme) {
|
|
21
|
+
matcha-slide-toggle {
|
|
22
|
+
// Figma matcha/switch (14510:226): track off sem fill + stroke text-label, thumb off text-primary
|
|
23
|
+
input[type="checkbox"] {
|
|
24
|
+
&::before {
|
|
25
|
+
background-color: transparent;
|
|
26
|
+
border-color: var(--matcha-color-text-label);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&::after {
|
|
30
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
31
|
+
background-color: var(--matcha-color-text-primary);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ── Sem cor / accent ───────────────────────────────────────────────
|
|
36
|
+
&:not([color]),
|
|
37
|
+
&[color="accent"] {
|
|
38
|
+
// [3.1-A] color no label → currentColor para o state layer
|
|
39
|
+
label {
|
|
40
|
+
color: var(--matcha-color-accent);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
input[type="checkbox"] {
|
|
44
|
+
&:checked {
|
|
45
|
+
&::before {
|
|
46
|
+
background-color: var(--matcha-color-accent);
|
|
47
|
+
border-color: var(--matcha-color-accent);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&::after {
|
|
51
|
+
background-color: var(--matcha-color-accent-contrast);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ── Semântica: primary ─────────────────────────────────────────────
|
|
58
|
+
&[color="primary"] {
|
|
59
|
+
label { color: var(--matcha-color-primary); } // [3.1-A]
|
|
60
|
+
|
|
61
|
+
input[type="checkbox"]:checked::before {
|
|
62
|
+
background-color: var(--matcha-color-primary);
|
|
63
|
+
border-color: var(--matcha-color-primary);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
input[type="checkbox"]:checked::after {
|
|
67
|
+
background-color: var(--matcha-color-primary-contrast);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ── Semântica: success ─────────────────────────────────────────────
|
|
72
|
+
&[color="success"] {
|
|
73
|
+
label { color: var(--matcha-color-success); } // [3.1-A]
|
|
74
|
+
|
|
75
|
+
input[type="checkbox"]:checked::before {
|
|
76
|
+
background-color: var(--matcha-color-success);
|
|
77
|
+
border-color: var(--matcha-color-success);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
input[type="checkbox"]:checked::after {
|
|
81
|
+
background-color: var(--matcha-color-success-contrast);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ── Semântica: warn ────────────────────────────────────────────────
|
|
86
|
+
&[color="warn"] {
|
|
87
|
+
label { color: var(--matcha-color-warn); } // [3.1-A]
|
|
88
|
+
|
|
89
|
+
input[type="checkbox"]:checked::before {
|
|
90
|
+
background-color: var(--matcha-color-warn);
|
|
91
|
+
border-color: var(--matcha-color-warn);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
input[type="checkbox"]:checked::after {
|
|
95
|
+
background-color: var(--matcha-color-warn-contrast);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// ── Semântica: danger ──────────────────────────────────────────────
|
|
100
|
+
&[color="danger"] {
|
|
101
|
+
label { color: var(--matcha-color-danger); } // [3.1-A]
|
|
102
|
+
|
|
103
|
+
input[type="checkbox"]:checked::before {
|
|
104
|
+
background-color: var(--matcha-color-danger);
|
|
105
|
+
border-color: var(--matcha-color-danger);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
input[type="checkbox"]:checked::after {
|
|
109
|
+
background-color: var(--matcha-color-danger-contrast);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ── Semântica: info ────────────────────────────────────────────────
|
|
114
|
+
&[color="info"] {
|
|
115
|
+
label { color: var(--matcha-color-info); } // [3.1-A]
|
|
116
|
+
|
|
117
|
+
input[type="checkbox"]:checked::before {
|
|
118
|
+
background-color: var(--matcha-color-info);
|
|
119
|
+
border-color: var(--matcha-color-info);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
input[type="checkbox"]:checked::after {
|
|
123
|
+
background-color: var(--matcha-color-info-contrast);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// ── Error state (aligned with Figma State=Error) ──────────────────
|
|
128
|
+
&.matcha-slide-toggle-error,
|
|
129
|
+
&[error] {
|
|
130
|
+
input[type="checkbox"] {
|
|
131
|
+
&::before {
|
|
132
|
+
border-color: var(--matcha-color-danger);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&:checked::before {
|
|
136
|
+
background-color: var(--matcha-color-danger);
|
|
137
|
+
border-color: var(--matcha-color-danger);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// ── Loading state (aligned with Figma State=Loading) ────────────────
|
|
143
|
+
&.matcha-slide-toggle-loading,
|
|
144
|
+
&[loading] {
|
|
145
|
+
pointer-events: none;
|
|
146
|
+
|
|
147
|
+
input[type="checkbox"]::after {
|
|
148
|
+
animation: matcha-toggle-loading 800ms linear infinite;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// ── [3.1-C] Disabled — tokens semânticos (sem opacity no host) ─────
|
|
153
|
+
&[disabled] {
|
|
154
|
+
label {
|
|
155
|
+
color: var(--matcha-color-disabled-fg);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
input[type="checkbox"] {
|
|
159
|
+
&::before {
|
|
160
|
+
background-color: var(--matcha-color-disabled-bg);
|
|
161
|
+
border-color: var(--matcha-color-disabled-bg);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&::after {
|
|
165
|
+
background-color: var(--matcha-color-disabled-fg);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Focus ring: só em navegação por teclado (não mostra em clique com mouse).
|
|
171
|
+
// :has(input:focus-visible) — apenas mostra outline quando o input interno
|
|
172
|
+
// tem focus-visible (keyboard nav), não em :focus geral (mouse click).
|
|
173
|
+
label:has(input:focus-visible) {
|
|
174
|
+
outline: var(--matcha-state-focus-ring-width, 2px) solid
|
|
175
|
+
var(--matcha-color-primary);
|
|
176
|
+
outline-offset: var(--matcha-state-focus-ring-offset, 2px);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Label padrão — Figma: text-primary. Slot pra consumer override.
|
|
180
|
+
.matcha-slide-toggle-label {
|
|
181
|
+
color: var(--matcha-slide-toggle-label-color, var(--matcha-color-text-primary));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
// =============================================================================
|
|
188
|
+
// Bloco estrutural — fora do mixin de tema
|
|
189
|
+
// =============================================================================
|
|
190
|
+
|
|
191
|
+
// [3.1-A] label recebe o state layer
|
|
192
|
+
// input[type="checkbox"] é replaced element — state layer externo vai no container (label)
|
|
193
|
+
matcha-slide-toggle label {
|
|
194
|
+
position: relative;
|
|
195
|
+
overflow: hidden;
|
|
196
|
+
|
|
197
|
+
// State layer — segue INTERACTION-SYSTEM.md template B
|
|
198
|
+
&::before {
|
|
199
|
+
content: '';
|
|
200
|
+
position: absolute;
|
|
201
|
+
inset: 0;
|
|
202
|
+
background: currentColor; // herda o color (var(--matcha-color-*)) definido por variante
|
|
203
|
+
opacity: 0;
|
|
204
|
+
pointer-events: none;
|
|
205
|
+
transition: opacity var(--matcha-duration-instant, 80ms) linear;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// [3.1-G] Hover/active: [disabled] está em matcha-slide-toggle (pai), não no label
|
|
210
|
+
// Seletor de contexto do pai evita ativar o state layer quando desabilitado
|
|
211
|
+
matcha-slide-toggle:not([disabled]) label:hover::before { opacity: var(--matcha-state-hover, 0.08); }
|
|
212
|
+
matcha-slide-toggle:not([disabled]) label:active::before { opacity: var(--matcha-state-active, 0.12); }
|
|
213
|
+
|
|
214
|
+
matcha-slide-toggle {
|
|
215
|
+
label {
|
|
216
|
+
display: inline-flex;
|
|
217
|
+
align-items: center;
|
|
218
|
+
gap: var(--matcha-space-100, 8px); // Figma: gap 8 entre switch e content
|
|
219
|
+
cursor: pointer;
|
|
220
|
+
-webkit-tap-highlight-color: transparent;
|
|
221
|
+
vertical-align: middle;
|
|
222
|
+
|
|
223
|
+
.matcha-slide-toggle-label {
|
|
224
|
+
font-family: var(--matcha-font-family, 'Manrope', sans-serif);
|
|
225
|
+
font-size: var(--matcha-text-body-md, 14px);
|
|
226
|
+
line-height: 20px;
|
|
227
|
+
font-weight: 400;
|
|
228
|
+
user-select: none;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// [3.1-B] Disabled — sem cursor: not-allowed, sem opacity no host
|
|
233
|
+
// pointer-events: none bloqueia interação; cores via tokens no mixin
|
|
234
|
+
&[disabled] {
|
|
235
|
+
pointer-events: none;
|
|
236
|
+
|
|
237
|
+
label {
|
|
238
|
+
cursor: default;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
input[type="checkbox"] {
|
|
243
|
+
appearance: none;
|
|
244
|
+
-webkit-appearance: none;
|
|
245
|
+
position: relative;
|
|
246
|
+
display: inline-block;
|
|
247
|
+
width: 36px;
|
|
248
|
+
height: 20px;
|
|
249
|
+
margin: 0;
|
|
250
|
+
outline: none;
|
|
251
|
+
cursor: pointer;
|
|
252
|
+
vertical-align: middle;
|
|
253
|
+
min-width: 36px; // garante que não fique < 36px
|
|
254
|
+
flex-shrink: 0; // se estiver dentro de um container flex
|
|
255
|
+
|
|
256
|
+
&::before {
|
|
257
|
+
content: "";
|
|
258
|
+
position: absolute;
|
|
259
|
+
top: 50%;
|
|
260
|
+
left: 0;
|
|
261
|
+
transform: translateY(-50%);
|
|
262
|
+
width: 100%;
|
|
263
|
+
height: 20px;
|
|
264
|
+
border-width: 2px;
|
|
265
|
+
border-style: solid;
|
|
266
|
+
border-radius: var(--matcha-radius-xl, 16px);
|
|
267
|
+
box-sizing: border-box;
|
|
268
|
+
|
|
269
|
+
// [3.1-E] transition específico (não 'all')
|
|
270
|
+
transition: background-color 0.15s linear;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Figma matcha/switch: thumb 12×12 off → 16×16 on (14510:226)
|
|
274
|
+
&::after {
|
|
275
|
+
content: "";
|
|
276
|
+
position: absolute;
|
|
277
|
+
top: 4px;
|
|
278
|
+
left: 4px;
|
|
279
|
+
width: 12px;
|
|
280
|
+
height: 12px;
|
|
281
|
+
border-radius: 50%;
|
|
282
|
+
|
|
283
|
+
transition:
|
|
284
|
+
transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
|
|
285
|
+
width 0.15s cubic-bezier(0.4, 0, 0.2, 1),
|
|
286
|
+
height 0.15s cubic-bezier(0.4, 0, 0.2, 1),
|
|
287
|
+
top 0.15s cubic-bezier(0.4, 0, 0.2, 1),
|
|
288
|
+
left 0.15s cubic-bezier(0.4, 0, 0.2, 1),
|
|
289
|
+
background-color 0.15s linear,
|
|
290
|
+
outline 0.1s ease-out;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
&:checked {
|
|
294
|
+
&::after {
|
|
295
|
+
top: 2px;
|
|
296
|
+
left: 2px;
|
|
297
|
+
width: 16px;
|
|
298
|
+
height: 16px;
|
|
299
|
+
transform: translateX(16px); // desliza 16px (36 - 16 - 2×2 = 16)
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
&:focus-visible::after {
|
|
304
|
+
outline-offset: 2px;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// ── Loading animation ──
|
|
309
|
+
@keyframes matcha-toggle-loading {
|
|
310
|
+
0% { opacity: 1; }
|
|
311
|
+
50% { opacity: 0.4; }
|
|
312
|
+
100% { opacity: 1; }
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// [3.1-F] Movimento reduzido — obrigatório (WCAG 2.3.3)
|
|
316
|
+
@media (prefers-reduced-motion: reduce) {
|
|
317
|
+
input[type="checkbox"] {
|
|
318
|
+
&::before { transition: none; }
|
|
319
|
+
&::after { transition: none; animation: none; }
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
label::before { transition: none; }
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// ── Forced colors ──
|
|
327
|
+
@media (forced-colors: active) {
|
|
328
|
+
matcha-slide-toggle,
|
|
329
|
+
.matcha-slide-toggle {
|
|
330
|
+
input[type="checkbox"] {
|
|
331
|
+
// Track
|
|
332
|
+
&::before {
|
|
333
|
+
background: Canvas !important;
|
|
334
|
+
border: 1px solid CanvasText !important;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Thumb
|
|
338
|
+
&::after {
|
|
339
|
+
background: ButtonFace !important;
|
|
340
|
+
border: 1px solid CanvasText !important;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
&:checked::before {
|
|
344
|
+
background: Highlight !important;
|
|
345
|
+
border-color: Highlight !important;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
&:focus-visible::before {
|
|
349
|
+
outline: 2px solid CanvasText !important;
|
|
350
|
+
outline-offset: 2px;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
&:disabled::before,
|
|
354
|
+
&:disabled::after {
|
|
355
|
+
border-color: GrayText !important;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// ── Print ──
|
|
362
|
+
@media print {
|
|
363
|
+
matcha-slide-toggle,
|
|
364
|
+
.matcha-slide-toggle {
|
|
365
|
+
input[type="checkbox"] {
|
|
366
|
+
&::before { border: 1px solid currentColor !important; }
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|