@moontra/moonui 6.27.0 → 6.28.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/dist/cdn/moonui.css +2 -2
- package/dist/cdn/moonui.esm.js +3 -3
- package/dist/cdn/moonui.global.js +3 -3
- package/dist/index.js +21 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/ui/__tests__/alert.test.tsx +12 -12
- package/src/components/ui/__tests__/dark-token-contrast.test.ts +8 -2
- package/src/components/ui/__tests__/select.test.tsx +3 -3
- package/src/components/ui/alert.tsx +19 -6
- package/src/components/ui/select.tsx +2 -2
- package/src/styles/tokens.css +18 -5
package/package.json
CHANGED
|
@@ -43,23 +43,23 @@ describe('Alert Components', () => {
|
|
|
43
43
|
it('renders primary variant correctly', () => {
|
|
44
44
|
render(<Alert variant="primary" data-testid="alert">Test</Alert>)
|
|
45
45
|
const alert = screen.getByTestId('alert')
|
|
46
|
-
expect(alert).toHaveClass('bg-primary
|
|
47
|
-
expect(alert).toHaveClass('text-primary')
|
|
46
|
+
expect(alert).toHaveClass('bg-primary-subtle')
|
|
47
|
+
expect(alert).toHaveClass('text-primary-subtle-foreground')
|
|
48
48
|
expect(alert).toHaveClass('border-primary/30')
|
|
49
49
|
})
|
|
50
50
|
|
|
51
51
|
it('renders success variant correctly', () => {
|
|
52
52
|
render(<Alert variant="success" data-testid="alert">Test</Alert>)
|
|
53
53
|
const alert = screen.getByTestId('alert')
|
|
54
|
-
expect(alert).toHaveClass('bg-success
|
|
55
|
-
expect(alert).toHaveClass('text-success')
|
|
54
|
+
expect(alert).toHaveClass('bg-success-subtle')
|
|
55
|
+
expect(alert).toHaveClass('text-success-subtle-foreground')
|
|
56
56
|
expect(alert).toHaveClass('border-success/30')
|
|
57
57
|
})
|
|
58
58
|
|
|
59
59
|
it('renders warning variant correctly', () => {
|
|
60
60
|
render(<Alert variant="warning" data-testid="alert">Test</Alert>)
|
|
61
61
|
const alert = screen.getByTestId('alert')
|
|
62
|
-
expect(alert).toHaveClass('bg-warning
|
|
62
|
+
expect(alert).toHaveClass('bg-warning-subtle')
|
|
63
63
|
// #630: metin `text-warning` idi ve `bg-warning/10` zemininde 1.98:1 ölçüldü —
|
|
64
64
|
// AA'nın (4.5) çok altında. Yüzey rengi (`--warning`) DEĞİŞMEDİ; yalnız metin
|
|
65
65
|
// aynı ailenin yüzey-üstü tonuna taşındı: 8.65 (light) / 15.71 (dark).
|
|
@@ -70,16 +70,16 @@ describe('Alert Components', () => {
|
|
|
70
70
|
it('renders error variant correctly', () => {
|
|
71
71
|
render(<Alert variant="error" data-testid="alert">Test</Alert>)
|
|
72
72
|
const alert = screen.getByTestId('alert')
|
|
73
|
-
expect(alert).toHaveClass('bg-destructive
|
|
74
|
-
expect(alert).toHaveClass('text-destructive')
|
|
73
|
+
expect(alert).toHaveClass('bg-destructive-subtle')
|
|
74
|
+
expect(alert).toHaveClass('text-destructive-subtle-foreground')
|
|
75
75
|
expect(alert).toHaveClass('border-destructive/30')
|
|
76
76
|
})
|
|
77
77
|
|
|
78
78
|
it('renders info variant correctly', () => {
|
|
79
79
|
render(<Alert variant="info" data-testid="alert">Test</Alert>)
|
|
80
80
|
const alert = screen.getByTestId('alert')
|
|
81
|
-
expect(alert).toHaveClass('bg-info
|
|
82
|
-
expect(alert).toHaveClass('text-info')
|
|
81
|
+
expect(alert).toHaveClass('bg-info-subtle')
|
|
82
|
+
expect(alert).toHaveClass('text-info-subtle-foreground')
|
|
83
83
|
expect(alert).toHaveClass('border-info/30')
|
|
84
84
|
})
|
|
85
85
|
|
|
@@ -377,7 +377,7 @@ describe('Alert Components', () => {
|
|
|
377
377
|
const description = screen.getByTestId('alert-description')
|
|
378
378
|
expect(description).toHaveClass('text-sm')
|
|
379
379
|
expect(description).toHaveClass('leading-5')
|
|
380
|
-
expect(description).toHaveClass('text-
|
|
380
|
+
expect(description).toHaveClass('text-current')
|
|
381
381
|
})
|
|
382
382
|
|
|
383
383
|
it('forwards ref correctly', () => {
|
|
@@ -407,7 +407,7 @@ describe('Alert Components', () => {
|
|
|
407
407
|
)
|
|
408
408
|
|
|
409
409
|
const alert = screen.getByTestId('alert')
|
|
410
|
-
expect(alert).toHaveClass('bg-success
|
|
410
|
+
expect(alert).toHaveClass('bg-success-subtle')
|
|
411
411
|
expect(alert).toHaveClass('py-4')
|
|
412
412
|
|
|
413
413
|
expect(screen.getByText('Success!')).toBeInTheDocument()
|
|
@@ -432,7 +432,7 @@ describe('Alert Components', () => {
|
|
|
432
432
|
)
|
|
433
433
|
|
|
434
434
|
const alert = screen.getByTestId('alert')
|
|
435
|
-
expect(alert).toHaveClass('bg-destructive
|
|
435
|
+
expect(alert).toHaveClass('bg-destructive-subtle')
|
|
436
436
|
expect(alert).toHaveClass('py-2')
|
|
437
437
|
expect(alert).toHaveClass('rounded-lg')
|
|
438
438
|
expect(alert).toHaveClass('pr-10')
|
|
@@ -149,11 +149,17 @@ describe('#368 koyu tema token kontrastları', () => {
|
|
|
149
149
|
})
|
|
150
150
|
})
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
// Bu blok #368'in KAPSAM kriteriydi: koyu tema düzeltilirken açık tema
|
|
153
|
+
// değerlerine dokunulmadığını kanıtlıyordu. Kalıcı bir "asla değişmez" kuralı
|
|
154
|
+
// DEĞİL — açık temanın kendi kontrast denetimi bu değerleri bilinçli olarak
|
|
155
|
+
// değiştirebilir. `--muted-foreground` 45% → 42% böyle güncellendi: #284 onu
|
|
156
|
+
// yalnız --muted/--background yüzeylerine göre ayarlamıştı, --secondary
|
|
157
|
+
// (#ebeff5) üstünde gerçek render'da 4.42 ölçüldü (AA 4.5 ister).
|
|
158
|
+
describe('kabul kriteri: AÇIK tema değerleri', () => {
|
|
153
159
|
it.each([
|
|
154
160
|
['destructive', '0 84.2% 48%'],
|
|
155
161
|
['muted', '217.2 32.6% 96%'],
|
|
156
|
-
['muted-foreground', '215.4 16.3%
|
|
162
|
+
['muted-foreground', '215.4 16.3% 42%'],
|
|
157
163
|
['primary', '217.2 91.2% 51%'],
|
|
158
164
|
])('--%s açık temada sabit: %s', (name, expected) => {
|
|
159
165
|
expect(tokenOku(name, 'light')).toBe(expected)
|
|
@@ -387,11 +387,11 @@ describe('Select Components', () => {
|
|
|
387
387
|
|
|
388
388
|
rerender(<SelectItem value="item1" variant="destructive">Item</SelectItem>)
|
|
389
389
|
item = screen.getByTestId('select-item')
|
|
390
|
-
expect(item).toHaveClass('text-
|
|
390
|
+
expect(item).toHaveClass('text-destructive-subtle-foreground')
|
|
391
391
|
|
|
392
392
|
rerender(<SelectItem value="item1" variant="success">Item</SelectItem>)
|
|
393
393
|
item = screen.getByTestId('select-item')
|
|
394
|
-
expect(item).toHaveClass('text-success')
|
|
394
|
+
expect(item).toHaveClass('text-success-subtle-foreground')
|
|
395
395
|
|
|
396
396
|
// #623: `text-warning` (DEFAULT token) açık temada beyaz zeminde 2.14:1 ölçüldü —
|
|
397
397
|
// AA'nın (4.5) ve hatta büyük-metin eşiğinin (3.0) altında. `--warning` aynı zamanda
|
|
@@ -639,7 +639,7 @@ describe('Select Components', () => {
|
|
|
639
639
|
|
|
640
640
|
const item = screen.getByTestId('select-item')
|
|
641
641
|
expect(item).toHaveClass('py-2')
|
|
642
|
-
expect(item).toHaveClass('text-success')
|
|
642
|
+
expect(item).toHaveClass('text-success-subtle-foreground')
|
|
643
643
|
expect(item).toHaveClass('custom-item')
|
|
644
644
|
expect(screen.getByTestId('right-icon')).toBeInTheDocument()
|
|
645
645
|
expect(screen.getByTestId('custom-indicator')).toBeInTheDocument()
|
|
@@ -19,14 +19,22 @@ const alertVariants = cva(
|
|
|
19
19
|
variants: {
|
|
20
20
|
variant: {
|
|
21
21
|
default: "bg-background text-foreground border-border",
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
// KONTRAST (açık tema): metin rengi ham `text-X` DEĞİL,
|
|
23
|
+
// `text-X-subtle-foreground` olmalı. `bg-X/10 + text-X` deseni
|
|
24
|
+
// açık temada ölçülen 4.11–4.45 veriyor ve WCAG AA eşiğini
|
|
25
|
+
// (4.5) geçmiyor. `-subtle-foreground` token'ları aynı yüzey
|
|
26
|
+
// için 8.20–9.52 sağlıyor (tokens.css'te oranlar yazılı) ve
|
|
27
|
+
// `bg-X-subtle`, `bg-X/10` ile AYNI görünümü verir
|
|
28
|
+
// (tokens.css:217) → görsel kimlik değişmez, yalnız metin
|
|
29
|
+
// koyulaşır. `warning` bu düzeltmeyi zaten taşıyordu.
|
|
30
|
+
primary: "bg-primary-subtle text-primary-subtle-foreground border-primary/30",
|
|
31
|
+
success: "bg-success-subtle text-success-subtle-foreground border-success/30",
|
|
32
|
+
warning: "bg-warning-subtle text-warning-subtle-foreground border-warning/30",
|
|
33
|
+
error: "bg-destructive-subtle text-destructive-subtle-foreground border-destructive/30",
|
|
26
34
|
// `--info` token'ı (tokens.css) blue-500 ile birebir aynı değeri
|
|
27
35
|
// taşır → görsel değişiklik yok, ancak varyant artık temaya ve
|
|
28
36
|
// karanlık moda duyarlı. Kardeş varyantlarla simetrik.
|
|
29
|
-
info: "bg-info
|
|
37
|
+
info: "bg-info-subtle text-info-subtle-foreground border-info/30",
|
|
30
38
|
},
|
|
31
39
|
size: {
|
|
32
40
|
sm: "py-2 text-xs",
|
|
@@ -174,7 +182,12 @@ const AlertDescription = React.forwardRef<
|
|
|
174
182
|
ref={ref}
|
|
175
183
|
className={cn(
|
|
176
184
|
"moonui-theme",
|
|
177
|
-
|
|
185
|
+
// KONTRAST: sabit `text-muted-foreground` (#606f85) renkli varyant
|
|
186
|
+
// yüzeylerinde 4.31–4.48 veriyordu — başlık düzelse bile açıklama
|
|
187
|
+
// satırı eşiğin altında kalıyordu. `text-current` varyantın
|
|
188
|
+
// `-subtle-foreground` rengini miras alır; hiyerarşi renk yerine
|
|
189
|
+
// ağırlıkla (başlık `font-semibold`) ve hafif opaklıkla korunur.
|
|
190
|
+
"text-sm leading-5 text-current opacity-90",
|
|
178
191
|
className
|
|
179
192
|
)}
|
|
180
193
|
{...props}
|
|
@@ -295,8 +295,8 @@ const SelectItem = React.forwardRef<
|
|
|
295
295
|
/* Color variants */
|
|
296
296
|
variant === "default" && "focus:bg-accent focus:text-accent-foreground dark:focus:bg-gray-700 dark:focus:text-gray-100",
|
|
297
297
|
variant === "subtle" && "focus:bg-gray-100 dark:focus:bg-gray-800 focus:text-foreground dark:focus:text-gray-200",
|
|
298
|
-
variant === "destructive" && "text-
|
|
299
|
-
variant === "success" && "text-success focus:bg-success
|
|
298
|
+
variant === "destructive" && "text-destructive-subtle-foreground focus:bg-destructive-subtle focus:text-destructive-subtle-foreground",
|
|
299
|
+
variant === "success" && "text-success-subtle-foreground focus:bg-success-subtle focus:text-success-subtle-foreground",
|
|
300
300
|
variant === "warning" && "text-warning-700 dark:text-warning-500 focus:bg-warning/10 focus:text-warning-700 dark:focus:text-warning-500",
|
|
301
301
|
|
|
302
302
|
className
|
package/src/styles/tokens.css
CHANGED
|
@@ -136,14 +136,27 @@
|
|
|
136
136
|
oradaki koyu foreground DOĞRU ve değiştirilmedi.) */
|
|
137
137
|
--primary-foreground: 210 40% 98%;
|
|
138
138
|
--secondary: 217.2 32.6% 94%;
|
|
139
|
-
/* #284: --secondary rozetinde metin rolünde 4.26 (AA altı) idi -> 49
|
|
139
|
+
/* #284: --secondary rozetinde metin rolünde 4.26 (AA altı) idi -> 49%.
|
|
140
140
|
--primary 51%te KALIR: o token zemin rolünde ve beyaz metinle 4.70 taşıyor.
|
|
141
|
-
Aynı mavinin rolüne göre ayrışması --success (#280) ile aynı desendir.
|
|
142
|
-
|
|
141
|
+
Aynı mavinin rolüne göre ayrışması --success (#280) ile aynı desendir.
|
|
142
|
+
|
|
143
|
+
%49 YETMEDİ — 44%'e çekildi. #284'ün hesabı 4.54 diyordu, ama gerçek
|
|
144
|
+
tarayıcı render'ı axe-core ile 4.45 ölçüldü (eşik 4.5): teorik HSL→RGB
|
|
145
|
+
hesabı ile tarayıcının ürettiği renk sınırda ayrışıyor (hesap rgb(11,98,239),
|
|
146
|
+
render #0e64ef). DERS: 4.5–4.6 aralığındaki "geçti" sonuçlarına güvenme,
|
|
147
|
+
gerçek render'da ölç. 44% teorik 5.37 verir ve ölçümde de geçer. */
|
|
148
|
+
--secondary-foreground: 217.2 91.2% 44%;
|
|
143
149
|
--muted: 217.2 32.6% 96%;
|
|
144
150
|
/* #284: --muted zemininde 4.31 (AA altı) idi -> 45% ile 4.56.
|
|
145
|
-
--background üzerinde zaten 4.76 geçiyordu; kırılan yüzey bg-muted (kbd).
|
|
146
|
-
|
|
151
|
+
--background üzerinde zaten 4.76 geçiyordu; kırılan yüzey bg-muted (kbd).
|
|
152
|
+
|
|
153
|
+
%45 de YETMEDİ — 42%'ye çekildi. #284 yalnız --muted ve --background
|
|
154
|
+
yüzeylerine bakmış; --secondary (#ebeff5) HESABA KATILMAMIŞTI ve orada
|
|
155
|
+
gerçek render'da 4.42 ölçüldü (docs/components/card, "Secondary surface").
|
|
156
|
+
42% üç yüzeyde de geçer: secondary 4.90 · muted 5.13 · background 5.66.
|
|
157
|
+
Kademe seçiminde teorik hesabın gerçek render'dan ~0.1 yüksek çıktığı
|
|
158
|
+
gözlendi (bkz. --secondary-foreground notu), o yüzden sınıra yaslanılmadı. */
|
|
159
|
+
--muted-foreground: 215.4 16.3% 42%;
|
|
147
160
|
--accent: 217.2 32.6% 94%;
|
|
148
161
|
/* #647: --accent-foreground 51% idi -> 4.26 (AA 4.5 altı). Zemin (--accent, 94%)
|
|
149
162
|
--secondary ile BİREBİR aynı token değeri; #284'ün --secondary-foreground'da
|