@moontra/moonui 2.0.8 → 2.0.9
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/package.json +9 -2
- package/src/__tests__/use-intersection-observer.test.tsx +216 -0
- package/src/__tests__/use-local-storage.test.tsx +174 -0
- package/src/__tests__/use-pro-access.test.tsx +183 -0
- package/src/components/ui/__tests__/accordion.test.tsx +571 -0
- package/src/components/ui/__tests__/alert.test.tsx +484 -0
- package/src/components/ui/__tests__/aspect-ratio.test.tsx +492 -0
- package/src/components/ui/__tests__/avatar.test.tsx +382 -0
- package/src/components/ui/__tests__/badge.test.tsx +364 -0
- package/src/components/ui/__tests__/breadcrumb.test.tsx +687 -0
- package/src/components/ui/__tests__/button.test.tsx +91 -0
- package/src/components/ui/__tests__/card.test.tsx +104 -0
- package/src/components/ui/__tests__/checkbox.test.tsx +591 -0
- package/src/components/ui/__tests__/collapsible.test.tsx +592 -0
- package/src/components/ui/__tests__/color-picker.test.tsx +365 -0
- package/src/components/ui/__tests__/command.test.tsx +677 -0
- package/src/components/ui/__tests__/data-table.test.tsx +256 -0
- package/src/components/ui/__tests__/date-picker.test.tsx +320 -0
- package/src/components/ui/__tests__/dialog.test.tsx +764 -0
- package/src/components/ui/__tests__/input.test.tsx +318 -0
- package/src/components/ui/__tests__/label.test.tsx +103 -0
- package/src/components/ui/__tests__/popover.test.tsx +637 -0
- package/src/components/ui/__tests__/progress.test.tsx +382 -0
- package/src/components/ui/__tests__/radio-group.test.tsx +555 -0
- package/src/components/ui/__tests__/select.test.tsx +705 -0
- package/src/components/ui/__tests__/skeleton.test.tsx +253 -0
- package/src/components/ui/__tests__/slider.test.tsx +493 -0
- package/src/components/ui/__tests__/switch.test.tsx +372 -0
- package/src/components/ui/__tests__/table.test.tsx +824 -0
- package/src/components/ui/__tests__/tabs.test.tsx +887 -0
- package/src/components/ui/__tests__/toast.test.tsx +458 -0
- package/src/components/ui/__tests__/tooltip.test.tsx +583 -0
- package/src/components/ui/accordion.tsx +63 -0
- package/src/components/ui/alert.tsx +130 -0
- package/src/components/ui/aspect-ratio.tsx +72 -0
- package/src/components/ui/avatar.tsx +135 -0
- package/src/components/ui/badge.tsx +225 -0
- package/src/components/ui/breadcrumb.tsx +207 -0
- package/src/components/ui/button.stories.tsx +162 -0
- package/src/components/ui/button.tsx +221 -0
- package/src/components/ui/calendar.tsx +262 -0
- package/src/components/ui/card.stories.tsx +208 -0
- package/src/components/ui/card.tsx +141 -0
- package/src/components/ui/checkbox.tsx +256 -0
- package/src/components/ui/collapsible.tsx +129 -0
- package/src/components/ui/color-picker.tsx +664 -0
- package/src/components/ui/command.tsx +218 -0
- package/src/components/ui/data-table.stories.tsx +509 -0
- package/src/components/ui/data-table.tsx +623 -0
- package/src/components/ui/date-picker.stories.tsx +321 -0
- package/src/components/ui/date-picker.tsx +603 -0
- package/src/components/ui/dialog.tsx +332 -0
- package/src/components/ui/dropdown-menu.tsx +200 -0
- package/src/components/ui/file-upload.tsx +400 -0
- package/src/components/ui/github-stars.tsx +201 -0
- package/src/components/ui/index.ts +12 -0
- package/src/components/ui/input.stories.tsx +255 -0
- package/src/components/ui/input.tsx +219 -0
- package/src/components/ui/label.tsx +26 -0
- package/src/components/ui/locked-component.tsx +215 -0
- package/src/components/ui/moon-logo.tsx +97 -0
- package/src/components/ui/pagination.tsx +116 -0
- package/src/components/ui/popover.tsx +183 -0
- package/src/components/ui/progress.tsx +182 -0
- package/src/components/ui/radio-group.tsx +243 -0
- package/src/components/ui/select.tsx +273 -0
- package/src/components/ui/separator.tsx +140 -0
- package/src/components/ui/simple-editor.tsx +652 -0
- package/src/components/ui/skeleton.tsx +351 -0
- package/src/components/ui/slider.tsx +351 -0
- package/src/components/ui/switch.tsx +83 -0
- package/src/components/ui/table.tsx +322 -0
- package/src/components/ui/tabs.tsx +195 -0
- package/src/components/ui/textarea.tsx +46 -0
- package/src/components/ui/toast.tsx +313 -0
- package/src/components/ui/toggle.tsx +47 -0
- package/src/components/ui/tooltip.tsx +152 -0
- package/src/docs/theme-system.md +1194 -0
- package/src/index.tsx +39 -0
- package/src/lib/micro-interactions.ts +255 -0
- package/src/lib/theme.tsx +398 -0
- package/src/lib/utils.ts +69 -0
- package/src/styles/design-system.css +365 -0
- package/src/styles/index.css +4 -0
- package/src/styles/tailwind.css +6 -0
- package/src/styles/tokens.css +453 -0
- package/src/use-intersection-observer.tsx +154 -0
- package/src/use-local-storage.tsx +71 -0
- package/src/use-paddle.ts +138 -0
- package/src/use-performance-optimizer.ts +379 -0
- package/src/use-pro-access.ts +141 -0
- package/src/use-scroll-animation.ts +221 -0
- package/src/use-subscription.ts +37 -0
- package/src/use-toast.ts +32 -0
|
@@ -0,0 +1,1194 @@
|
|
|
1
|
+
# MoonUI Tema Özelleştirme Sistemi
|
|
2
|
+
|
|
3
|
+
MoonUI'ın tema özelleştirme sistemi, bileşen kütüphanesinin görünümünü ve hissini tam olarak uygulamanıza uygun şekilde özelleştirmenize olanak tanır. Bu belge, tema sisteminin nasıl kurulacağını ve kullanılacağını açıklamaktadır.
|
|
4
|
+
|
|
5
|
+
## Kurulum
|
|
6
|
+
|
|
7
|
+
Öncelikle, MoonUI tema sağlayıcısını uygulamanızın kök bileşenine eklemeniz gerekir:
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { ThemeProvider } from '@moontra/moonui';
|
|
11
|
+
import App from './App';
|
|
12
|
+
|
|
13
|
+
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
14
|
+
root.render(
|
|
15
|
+
<ThemeProvider
|
|
16
|
+
defaultColorMode="light"
|
|
17
|
+
preset="default"
|
|
18
|
+
>
|
|
19
|
+
<App />
|
|
20
|
+
</ThemeProvider>
|
|
21
|
+
);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Temel Kullanım
|
|
25
|
+
|
|
26
|
+
ThemeProvider, varsayılan ayarlarla kullanılabilir veya özel temalar belirtilebilir:
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
<ThemeProvider
|
|
30
|
+
defaultColorMode="dark"
|
|
31
|
+
preset="modern" // Hazır tema şablonu
|
|
32
|
+
lightTheme={{
|
|
33
|
+
colors: {
|
|
34
|
+
primary: 'hsl(215, 70%, 45%)',
|
|
35
|
+
secondary: 'hsl(280, 60%, 45%)'
|
|
36
|
+
}
|
|
37
|
+
}}
|
|
38
|
+
darkTheme={{
|
|
39
|
+
colors: {
|
|
40
|
+
primary: 'hsl(215, 70%, 65%)',
|
|
41
|
+
secondary: 'hsl(280, 60%, 65%)'
|
|
42
|
+
}
|
|
43
|
+
}}
|
|
44
|
+
extensions={{ // Özel tema değişkenleri
|
|
45
|
+
custom: {
|
|
46
|
+
headerHeight: '60px',
|
|
47
|
+
sidebarWidth: '280px',
|
|
48
|
+
cardShadow: '0 4px 6px rgba(0,0,0,0.1)'
|
|
49
|
+
}
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
</ThemeProvider>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Tema Değişkenlerini Kullanma
|
|
57
|
+
|
|
58
|
+
Uygulama içinde mevcut temayı almak ve kullanmak için `useTheme` kancasını kullanabilirsiniz:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { useTheme } from '@moontra/moonui';
|
|
62
|
+
|
|
63
|
+
const MyComponent = () => {
|
|
64
|
+
const { theme, colorMode, setColorMode, updateTheme, setThemePreset } = useTheme();
|
|
65
|
+
|
|
66
|
+
// Tema renklerine erişim
|
|
67
|
+
const primaryColor = theme.colors.primary;
|
|
68
|
+
|
|
69
|
+
// Özel tema değişkenlerine erişim
|
|
70
|
+
const headerHeight = theme.extensions?.custom?.headerHeight;
|
|
71
|
+
|
|
72
|
+
// Renk modunu değiştirmek için
|
|
73
|
+
const toggleTheme = () => {
|
|
74
|
+
setColorMode(colorMode === 'light' ? 'dark' : 'light');
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// Dinamik olarak temayı güncellemek için
|
|
78
|
+
const customizeTheme = () => {
|
|
79
|
+
updateTheme({
|
|
80
|
+
colors: {
|
|
81
|
+
primary: 'hsl(180, 70%, 50%)'
|
|
82
|
+
},
|
|
83
|
+
extensions: {
|
|
84
|
+
custom: {
|
|
85
|
+
headerHeight: '80px' // Özel değişkeni güncelleme
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Hazır tema şablonunu değiştirmek için
|
|
92
|
+
const changeToModernTheme = () => {
|
|
93
|
+
setThemePreset('modern');
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<div>
|
|
98
|
+
<button onClick={toggleTheme}>
|
|
99
|
+
Tema Değiştir ({colorMode})
|
|
100
|
+
</button>
|
|
101
|
+
<button onClick={customizeTheme}>
|
|
102
|
+
Teal Teması Uygula
|
|
103
|
+
</button>
|
|
104
|
+
<button onClick={changeToModernTheme}>
|
|
105
|
+
Modern Tema Uygula
|
|
106
|
+
</button>
|
|
107
|
+
<div style={{ height: headerHeight }}>Header</div>
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Özelleştirilebilir Tema Değişkenleri
|
|
114
|
+
|
|
115
|
+
MoonUI'ın tema sistemi aşağıdaki değişkenleri destekler:
|
|
116
|
+
|
|
117
|
+
### Hazır Tema Şablonları (Presets)
|
|
118
|
+
|
|
119
|
+
MoonUI, hızlı tema uygulaması için önceden tanımlanmış şablonlar sunar:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
type ThemePreset = 'default' | 'modern' | 'rounded' | 'minimal';
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
- **default**: MoonUI'ın standart teması
|
|
126
|
+
- **modern**: Daha canlı renkler ve daha yuvarlak köşeler
|
|
127
|
+
- **rounded**: Tüm bileşenler için çok yuvarlak köşeler
|
|
128
|
+
- **minimal**: Minimal, düz ve profesyonel görünüm
|
|
129
|
+
|
|
130
|
+
### Özel Değişkenler (Extensions)
|
|
131
|
+
|
|
132
|
+
Kendi özel CSS değişkenlerinizi eklemek için `extensions` özelliğini kullanabilirsiniz:
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
extensions?: Record<string, Record<string, string> | string>;
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Örneğin:
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
<ThemeProvider
|
|
142
|
+
extensions={{
|
|
143
|
+
layout: {
|
|
144
|
+
headerHeight: '60px',
|
|
145
|
+
sidebarWidth: '280px',
|
|
146
|
+
contentMaxWidth: '1200px'
|
|
147
|
+
},
|
|
148
|
+
animation: {
|
|
149
|
+
duration: '300ms',
|
|
150
|
+
easing: 'cubic-bezier(0.4, 0, 0.2, 1)'
|
|
151
|
+
},
|
|
152
|
+
customColor: '#ff5500' // Doğrudan string değer de kullanılabilir
|
|
153
|
+
}}
|
|
154
|
+
>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Bu değişkenler CSS'te şu şekilde erişilebilir olacaktır:
|
|
158
|
+
|
|
159
|
+
```css
|
|
160
|
+
:root {
|
|
161
|
+
--layout-headerHeight: 60px;
|
|
162
|
+
--layout-sidebarWidth: 280px;
|
|
163
|
+
--layout-contentMaxWidth: 1200px;
|
|
164
|
+
--animation-duration: 300ms;
|
|
165
|
+
--animation-easing: cubic-bezier(0.4, 0, 0.2, 1);
|
|
166
|
+
--customColor: #ff5500;
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Renkler
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
colors: {
|
|
174
|
+
primary: string; // Ana vurgu rengi
|
|
175
|
+
secondary: string; // İkincil vurgu rengi
|
|
176
|
+
success: string; // Başarılı işlemler için renk
|
|
177
|
+
warning: string; // Uyarılar için renk
|
|
178
|
+
error: string; // Hata ve tehlikeli işlemler için renk
|
|
179
|
+
background: string; // Sayfa arkaplan rengi
|
|
180
|
+
foreground: string; // Ana metin rengi
|
|
181
|
+
card: string; // Kart arkaplan rengi
|
|
182
|
+
cardForeground: string; // Kart metin rengi
|
|
183
|
+
border: string; // Kenarlık rengi
|
|
184
|
+
muted: string; // Pasif elementlerin arkaplan rengi
|
|
185
|
+
mutedForeground: string; // Pasif metin rengi
|
|
186
|
+
accent: string; // Vurgu arkaplan rengi
|
|
187
|
+
accentForeground: string; // Vurgu metin rengi
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Köşe Yuvarlama
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
borderRadius: {
|
|
195
|
+
sm: string; // Küçük köşe yuvarlama (ör: '0.25rem')
|
|
196
|
+
md: string; // Orta köşe yuvarlama (ör: '0.375rem')
|
|
197
|
+
lg: string; // Büyük köşe yuvarlama (ör: '0.5rem')
|
|
198
|
+
full: string; // Tam yuvarlak (ör: '9999px')
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Yazı Boyutları
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
fontSizes: {
|
|
206
|
+
xs: string; // Çok küçük metin (ör: '0.75rem')
|
|
207
|
+
sm: string; // Küçük metin (ör: '0.875rem')
|
|
208
|
+
base: string; // Temel metin (ör: '1rem')
|
|
209
|
+
lg: string; // Büyük metin (ör: '1.125rem')
|
|
210
|
+
xl: string; // Çok büyük metin (ör: '1.25rem')
|
|
211
|
+
'2xl': string; // 2x büyük metin (ör: '1.5rem')
|
|
212
|
+
'3xl': string; // 3x büyük metin (ör: '1.875rem')
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Boşluklar
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
spacing: {
|
|
220
|
+
1: string; // Çok küçük boşluk (ör: '0.25rem')
|
|
221
|
+
2: string; // Küçük boşluk (ör: '0.5rem')
|
|
222
|
+
4: string; // Orta boşluk (ör: '1rem')
|
|
223
|
+
6: string; // Büyük boşluk (ör: '1.5rem')
|
|
224
|
+
8: string; // Çok büyük boşluk (ör: '2rem')
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Tailwind CSS ile Kullanım
|
|
229
|
+
|
|
230
|
+
MoonUI tema değişkenleri, Tailwind CSS ile birlikte kullanılabilir. Tailwind config dosyanızı şu şekilde güncelleyin:
|
|
231
|
+
|
|
232
|
+
```js
|
|
233
|
+
// tailwind.config.js
|
|
234
|
+
module.exports = {
|
|
235
|
+
theme: {
|
|
236
|
+
extend: {
|
|
237
|
+
colors: {
|
|
238
|
+
primary: 'var(--color-primary)',
|
|
239
|
+
secondary: 'var(--color-secondary)',
|
|
240
|
+
// Diğer renk değişkenleri...
|
|
241
|
+
},
|
|
242
|
+
borderRadius: {
|
|
243
|
+
sm: 'var(--radius-sm)',
|
|
244
|
+
md: 'var(--radius-md)',
|
|
245
|
+
lg: 'var(--radius-lg)',
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Tema İçeriğini JSON Olarak Dışa Aktarma
|
|
253
|
+
|
|
254
|
+
Tema konfigürasyonunuzu JSON olarak dışa aktarmak istiyorsanız:
|
|
255
|
+
|
|
256
|
+
```tsx
|
|
257
|
+
import { useTheme, createCssVariables } from '@moontra/moonui';
|
|
258
|
+
|
|
259
|
+
const ExportTheme = () => {
|
|
260
|
+
const { theme } = useTheme();
|
|
261
|
+
|
|
262
|
+
const exportThemeToJson = () => {
|
|
263
|
+
const jsonContent = JSON.stringify(theme, null, 2);
|
|
264
|
+
const blob = new Blob([jsonContent], { type: 'application/json' });
|
|
265
|
+
const url = URL.createObjectURL(blob);
|
|
266
|
+
|
|
267
|
+
// JSON dosyasını indirme
|
|
268
|
+
const link = document.createElement('a');
|
|
269
|
+
link.href = url;
|
|
270
|
+
link.download = 'moonui-theme.json';
|
|
271
|
+
document.body.appendChild(link);
|
|
272
|
+
link.click();
|
|
273
|
+
document.body.removeChild(link);
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
return (
|
|
277
|
+
<button onClick={exportThemeToJson}>
|
|
278
|
+
Temayı JSON Olarak İndir
|
|
279
|
+
</button>
|
|
280
|
+
);
|
|
281
|
+
};
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Örnek Kullanım Senaryoları
|
|
285
|
+
|
|
286
|
+
### 1. Marka Renk Şeması Uygulama
|
|
287
|
+
|
|
288
|
+
```tsx
|
|
289
|
+
<ThemeProvider
|
|
290
|
+
lightTheme={{
|
|
291
|
+
colors: {
|
|
292
|
+
primary: '#0052CC', // Mavi marka rengi
|
|
293
|
+
secondary: '#FF5630', // Turuncu vurgu rengi
|
|
294
|
+
success: '#36B37E', // Yeşil başarı rengi
|
|
295
|
+
warning: '#FFAB00', // Sarı uyarı rengi
|
|
296
|
+
error: '#FF5630', // Kırmızı hata rengi
|
|
297
|
+
}
|
|
298
|
+
}}
|
|
299
|
+
>
|
|
300
|
+
<App />
|
|
301
|
+
</ThemeProvider>
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### 2. Özel Yuvarlaklık Değerleri
|
|
305
|
+
|
|
306
|
+
```tsx
|
|
307
|
+
<ThemeProvider
|
|
308
|
+
lightTheme={{
|
|
309
|
+
borderRadius: {
|
|
310
|
+
sm: '2px', // Minimal yuvarlaklık
|
|
311
|
+
md: '4px', // Standart yuvarlaklık
|
|
312
|
+
lg: '8px', // Büyük yuvarlaklık
|
|
313
|
+
full: '9999px', // Tam yuvarlak
|
|
314
|
+
}
|
|
315
|
+
}}
|
|
316
|
+
>
|
|
317
|
+
<App />
|
|
318
|
+
</ThemeProvider>
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### 3. Tamamen Düz Tasarım
|
|
322
|
+
|
|
323
|
+
```tsx
|
|
324
|
+
<ThemeProvider
|
|
325
|
+
lightTheme={{
|
|
326
|
+
borderRadius: {
|
|
327
|
+
sm: '0',
|
|
328
|
+
md: '0',
|
|
329
|
+
lg: '0',
|
|
330
|
+
full: '0',
|
|
331
|
+
},
|
|
332
|
+
colors: {
|
|
333
|
+
// Diğer renk ayarları...
|
|
334
|
+
border: 'transparent', // Kenarlıkları kaldır
|
|
335
|
+
}
|
|
336
|
+
}}
|
|
337
|
+
>
|
|
338
|
+
<App />
|
|
339
|
+
</ThemeProvider>
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## Bileşen Örnekleri
|
|
343
|
+
|
|
344
|
+
### Alert Bileşeni
|
|
345
|
+
|
|
346
|
+
```tsx
|
|
347
|
+
// Tema ile entegre Alert kullanımı
|
|
348
|
+
import { Alert, AlertTitle, AlertDescription } from "@moontra/moonui";
|
|
349
|
+
|
|
350
|
+
export default function AlertExample() {
|
|
351
|
+
return (
|
|
352
|
+
<div className="space-y-4">
|
|
353
|
+
<Alert variant="default">
|
|
354
|
+
<AlertTitle>Bilgilendirme</AlertTitle>
|
|
355
|
+
<AlertDescription>
|
|
356
|
+
Bu bir standart bilgilendirme mesajıdır.
|
|
357
|
+
</AlertDescription>
|
|
358
|
+
</Alert>
|
|
359
|
+
|
|
360
|
+
<Alert variant="primary">
|
|
361
|
+
<AlertTitle>Dikkat</AlertTitle>
|
|
362
|
+
<AlertDescription>
|
|
363
|
+
Önemli bir bildirim mesajı.
|
|
364
|
+
</AlertDescription>
|
|
365
|
+
</Alert>
|
|
366
|
+
|
|
367
|
+
<Alert variant="success">
|
|
368
|
+
<AlertTitle>Başarılı</AlertTitle>
|
|
369
|
+
<AlertDescription>
|
|
370
|
+
İşleminiz başarıyla tamamlandı.
|
|
371
|
+
</AlertDescription>
|
|
372
|
+
</Alert>
|
|
373
|
+
|
|
374
|
+
<Alert variant="warning">
|
|
375
|
+
<AlertTitle>Uyarı</AlertTitle>
|
|
376
|
+
<AlertDescription>
|
|
377
|
+
Dikkatli olmanızı gerektiren bir durum var.
|
|
378
|
+
</AlertDescription>
|
|
379
|
+
</Alert>
|
|
380
|
+
|
|
381
|
+
<Alert variant="error">
|
|
382
|
+
<AlertTitle>Hata</AlertTitle>
|
|
383
|
+
<AlertDescription>
|
|
384
|
+
İşlem sırasında bir hata oluştu.
|
|
385
|
+
</AlertDescription>
|
|
386
|
+
</Alert>
|
|
387
|
+
</div>
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Toast Bildirimleri
|
|
393
|
+
|
|
394
|
+
```tsx
|
|
395
|
+
// Tema ile entegre Toast kullanımı
|
|
396
|
+
import { useToast } from "@moontra/moonui";
|
|
397
|
+
|
|
398
|
+
export default function ToastExample() {
|
|
399
|
+
const { add } = useToast();
|
|
400
|
+
|
|
401
|
+
const showSuccess = () => {
|
|
402
|
+
add({
|
|
403
|
+
variant: "success",
|
|
404
|
+
title: "Başarılı",
|
|
405
|
+
description: "İşleminiz başarıyla tamamlandı."
|
|
406
|
+
});
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
const showError = () => {
|
|
410
|
+
add({
|
|
411
|
+
variant: "error",
|
|
412
|
+
title: "Hata",
|
|
413
|
+
description: "İşlem sırasında bir hata oluştu.",
|
|
414
|
+
showProgress: true,
|
|
415
|
+
duration: 5000
|
|
416
|
+
});
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
return (
|
|
420
|
+
<div className="space-x-2">
|
|
421
|
+
<button onClick={showSuccess}>Başarı Bildirimi</button>
|
|
422
|
+
<button onClick={showError}>Hata Bildirimi</button>
|
|
423
|
+
</div>
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### Tooltip Kullanımı
|
|
429
|
+
|
|
430
|
+
```tsx
|
|
431
|
+
// Tema ile entegre Tooltip kullanımı
|
|
432
|
+
import { Tooltip, Button } from "@moontra/moonui";
|
|
433
|
+
|
|
434
|
+
export default function TooltipExample() {
|
|
435
|
+
return (
|
|
436
|
+
<div className="flex space-x-4">
|
|
437
|
+
<Tooltip content="Bu bir ipucu metnidir">
|
|
438
|
+
<Button>Butonun Üzerine Gel</Button>
|
|
439
|
+
</Tooltip>
|
|
440
|
+
|
|
441
|
+
<Tooltip
|
|
442
|
+
content="Özel stillendirilmiş ipucu"
|
|
443
|
+
variant="primary"
|
|
444
|
+
size="lg"
|
|
445
|
+
radius="lg"
|
|
446
|
+
>
|
|
447
|
+
<Button variant="outline">Özel Tooltip</Button>
|
|
448
|
+
</Tooltip>
|
|
449
|
+
</div>
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### Checkbox ve Radio Butonları
|
|
455
|
+
|
|
456
|
+
```tsx
|
|
457
|
+
// Tema ile entegre Checkbox ve Radio kullanımı
|
|
458
|
+
import {
|
|
459
|
+
Checkbox,
|
|
460
|
+
CheckboxWithLabel,
|
|
461
|
+
RadioGroup,
|
|
462
|
+
RadioItemWithLabel
|
|
463
|
+
} from "@moontra/moonui";
|
|
464
|
+
|
|
465
|
+
export default function FormElementsExample() {
|
|
466
|
+
return (
|
|
467
|
+
<div className="space-y-6">
|
|
468
|
+
<div className="space-y-2">
|
|
469
|
+
<CheckboxWithLabel
|
|
470
|
+
label="Beni hatırla"
|
|
471
|
+
variant="default"
|
|
472
|
+
size="md"
|
|
473
|
+
/>
|
|
474
|
+
|
|
475
|
+
<CheckboxWithLabel
|
|
476
|
+
label="E-posta bildirimleri al"
|
|
477
|
+
variant="outline"
|
|
478
|
+
indeterminate
|
|
479
|
+
/>
|
|
480
|
+
</div>
|
|
481
|
+
|
|
482
|
+
<RadioGroup defaultValue="apple">
|
|
483
|
+
<RadioItemWithLabel
|
|
484
|
+
value="apple"
|
|
485
|
+
label="Apple"
|
|
486
|
+
variant="filled"
|
|
487
|
+
/>
|
|
488
|
+
<RadioItemWithLabel
|
|
489
|
+
value="banana"
|
|
490
|
+
label="Banana"
|
|
491
|
+
/>
|
|
492
|
+
<RadioItemWithLabel
|
|
493
|
+
value="orange"
|
|
494
|
+
label="Orange"
|
|
495
|
+
disabled
|
|
496
|
+
/>
|
|
497
|
+
</RadioGroup>
|
|
498
|
+
</div>
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
### Progress (İlerleme) Bileşeni
|
|
504
|
+
|
|
505
|
+
```tsx
|
|
506
|
+
// Tema ile entegre Progress kullanımı
|
|
507
|
+
import { Progress } from "@moontra/moonui";
|
|
508
|
+
|
|
509
|
+
export default function ProgressExample() {
|
|
510
|
+
return (
|
|
511
|
+
<div className="space-y-6">
|
|
512
|
+
<Progress value={30} variant="primary" showValueLabel />
|
|
513
|
+
|
|
514
|
+
<Progress
|
|
515
|
+
value={65}
|
|
516
|
+
variant="success"
|
|
517
|
+
size="lg"
|
|
518
|
+
radius="sm"
|
|
519
|
+
showValueLabel
|
|
520
|
+
valueLabel="65/100 tamamlandı"
|
|
521
|
+
/>
|
|
522
|
+
|
|
523
|
+
<Progress
|
|
524
|
+
value={45}
|
|
525
|
+
variant="warning"
|
|
526
|
+
animation="smooth"
|
|
527
|
+
showValueLabel
|
|
528
|
+
/>
|
|
529
|
+
|
|
530
|
+
<Progress
|
|
531
|
+
indeterminate
|
|
532
|
+
variant="primary"
|
|
533
|
+
size="md"
|
|
534
|
+
radius="full"
|
|
535
|
+
/>
|
|
536
|
+
</div>
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
### Skeleton (İskelet) Bileşenleri
|
|
542
|
+
|
|
543
|
+
```tsx
|
|
544
|
+
// Tema ile entegre Skeleton kullanımı
|
|
545
|
+
import {
|
|
546
|
+
Skeleton,
|
|
547
|
+
SkeletonText,
|
|
548
|
+
SkeletonAvatar,
|
|
549
|
+
SkeletonCard
|
|
550
|
+
} from "@moontra/moonui";
|
|
551
|
+
|
|
552
|
+
export default function SkeletonExample() {
|
|
553
|
+
const [isLoaded, setIsLoaded] = React.useState(false);
|
|
554
|
+
|
|
555
|
+
// 3 saniye sonra içeriğin yüklenmiş gibi simüle et
|
|
556
|
+
React.useEffect(() => {
|
|
557
|
+
const timer = setTimeout(() => setIsLoaded(true), 3000);
|
|
558
|
+
return () => clearTimeout(timer);
|
|
559
|
+
}, []);
|
|
560
|
+
|
|
561
|
+
return (
|
|
562
|
+
<div className="space-y-8">
|
|
563
|
+
{/* Basit bir iskelet */}
|
|
564
|
+
<div className="space-y-2">
|
|
565
|
+
<h3>Basit İskelet</h3>
|
|
566
|
+
<div className="flex items-center gap-4">
|
|
567
|
+
<SkeletonAvatar size="3rem" />
|
|
568
|
+
<div className="flex-1">
|
|
569
|
+
<Skeleton className="h-4 w-3/4 mb-2" />
|
|
570
|
+
<Skeleton className="h-3 w-1/2" />
|
|
571
|
+
</div>
|
|
572
|
+
</div>
|
|
573
|
+
</div>
|
|
574
|
+
|
|
575
|
+
{/* Metin iskeleti */}
|
|
576
|
+
<div className="space-y-2">
|
|
577
|
+
<h3>Metin İskeleti</h3>
|
|
578
|
+
<SkeletonText
|
|
579
|
+
lines={4}
|
|
580
|
+
variant="primary"
|
|
581
|
+
animation="pulse"
|
|
582
|
+
randomWidths
|
|
583
|
+
/>
|
|
584
|
+
</div>
|
|
585
|
+
|
|
586
|
+
{/* İçerik yükleme & değiştirme */}
|
|
587
|
+
<div className="space-y-2">
|
|
588
|
+
<h3>İçerik Yükleme</h3>
|
|
589
|
+
<Skeleton
|
|
590
|
+
isLoaded={isLoaded}
|
|
591
|
+
className="h-20 w-full"
|
|
592
|
+
>
|
|
593
|
+
<div className="h-20 w-full bg-gradient-to-r from-primary to-secondary flex items-center justify-center text-white">
|
|
594
|
+
İçerik Yüklendi!
|
|
595
|
+
</div>
|
|
596
|
+
</Skeleton>
|
|
597
|
+
</div>
|
|
598
|
+
|
|
599
|
+
{/* Kart iskeleti */}
|
|
600
|
+
<div className="space-y-2">
|
|
601
|
+
<h3>Kart İskeleti</h3>
|
|
602
|
+
<SkeletonCard
|
|
603
|
+
contentLines={3}
|
|
604
|
+
variant="accent"
|
|
605
|
+
animation="wave"
|
|
606
|
+
/>
|
|
607
|
+
</div>
|
|
608
|
+
</div>
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### Popover (Açılır Kutu) Bileşeni
|
|
614
|
+
|
|
615
|
+
```tsx
|
|
616
|
+
// Tema ile entegre Popover kullanımı
|
|
617
|
+
import {
|
|
618
|
+
Popover,
|
|
619
|
+
PopoverTrigger,
|
|
620
|
+
PopoverContent,
|
|
621
|
+
PopoverHeader,
|
|
622
|
+
PopoverFooter,
|
|
623
|
+
PopoverSeparator
|
|
624
|
+
} from "@moontra/moonui";
|
|
625
|
+
import { Button } from "@moontra/moonui";
|
|
626
|
+
|
|
627
|
+
export default function PopoverExample() {
|
|
628
|
+
return (
|
|
629
|
+
<div className="flex gap-8 flex-wrap">
|
|
630
|
+
{/* Basit Popover */}
|
|
631
|
+
<Popover>
|
|
632
|
+
<PopoverTrigger asChild>
|
|
633
|
+
<Button>Temel Popover</Button>
|
|
634
|
+
</PopoverTrigger>
|
|
635
|
+
<PopoverContent className="w-64">
|
|
636
|
+
<h3 className="font-medium mb-2">Popover Başlığı</h3>
|
|
637
|
+
<p className="text-sm text-[var(--color-muted-foreground)]">
|
|
638
|
+
Bu içerik temayla tam entegre bir popover içeriğidir.
|
|
639
|
+
</p>
|
|
640
|
+
</PopoverContent>
|
|
641
|
+
</Popover>
|
|
642
|
+
|
|
643
|
+
{/* Varyantlı Popover */}
|
|
644
|
+
<Popover>
|
|
645
|
+
<PopoverTrigger asChild>
|
|
646
|
+
<Button variant="outline">Varyantlar ve Başlık</Button>
|
|
647
|
+
</PopoverTrigger>
|
|
648
|
+
<PopoverContent variant="outline" size="lg" radius="lg" shadow="lg">
|
|
649
|
+
<PopoverHeader>
|
|
650
|
+
<h3 className="font-medium">Ayarlar</h3>
|
|
651
|
+
<p className="text-xs text-[var(--color-muted-foreground)]">
|
|
652
|
+
Tercihlerinizi ayarlayın
|
|
653
|
+
</p>
|
|
654
|
+
</PopoverHeader>
|
|
655
|
+
<div className="py-2">
|
|
656
|
+
<div className="flex items-center justify-between py-1">
|
|
657
|
+
<span className="text-sm">Bildirimler</span>
|
|
658
|
+
<Button size="sm" variant="ghost">Aç</Button>
|
|
659
|
+
</div>
|
|
660
|
+
<div className="flex items-center justify-between py-1">
|
|
661
|
+
<span className="text-sm">Otomatik kaydedici</span>
|
|
662
|
+
<Button size="sm" variant="ghost">Kapat</Button>
|
|
663
|
+
</div>
|
|
664
|
+
</div>
|
|
665
|
+
<PopoverSeparator />
|
|
666
|
+
<div className="py-2">
|
|
667
|
+
<p className="text-sm text-[var(--color-muted-foreground)]">
|
|
668
|
+
Önemli bilgiler burada görüntülenebilir.
|
|
669
|
+
</p>
|
|
670
|
+
</div>
|
|
671
|
+
<PopoverFooter className="flex justify-between">
|
|
672
|
+
<Button size="sm" variant="ghost">Sıfırla</Button>
|
|
673
|
+
<Button size="sm" variant="primary">Uygula</Button>
|
|
674
|
+
</PopoverFooter>
|
|
675
|
+
</PopoverContent>
|
|
676
|
+
</Popover>
|
|
677
|
+
|
|
678
|
+
{/* Varyantlı Popover */}
|
|
679
|
+
<Popover>
|
|
680
|
+
<PopoverTrigger asChild>
|
|
681
|
+
<Button variant="destructive">Uyarı Popover</Button>
|
|
682
|
+
</PopoverTrigger>
|
|
683
|
+
<PopoverContent variant="destructive" backdrop={true}>
|
|
684
|
+
<h3 className="font-medium mb-2">İşlemi Onaylıyor musunuz?</h3>
|
|
685
|
+
<p className="text-sm mb-4">
|
|
686
|
+
Bu işlem geri alınamaz ve tüm verileri silecektir.
|
|
687
|
+
</p>
|
|
688
|
+
<div className="flex justify-end gap-2">
|
|
689
|
+
<Button size="sm" variant="ghost">İptal</Button>
|
|
690
|
+
<Button size="sm" variant="destructive">Sil</Button>
|
|
691
|
+
</div>
|
|
692
|
+
</PopoverContent>
|
|
693
|
+
</Popover>
|
|
694
|
+
</div>
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
### Breadcrumb (Gezinti Yolu) Bileşeni
|
|
700
|
+
|
|
701
|
+
```tsx
|
|
702
|
+
// Tema ile entegre Breadcrumb kullanımı
|
|
703
|
+
import {
|
|
704
|
+
Breadcrumb,
|
|
705
|
+
BreadcrumbList,
|
|
706
|
+
BreadcrumbItem,
|
|
707
|
+
BreadcrumbSeparator,
|
|
708
|
+
BreadcrumbEllipsis
|
|
709
|
+
} from "@moontra/moonui";
|
|
710
|
+
|
|
711
|
+
export default function BreadcrumbExample() {
|
|
712
|
+
return (
|
|
713
|
+
<div className="space-y-6">
|
|
714
|
+
{/* Basit Breadcrumb */}
|
|
715
|
+
<Breadcrumb>
|
|
716
|
+
<BreadcrumbList>
|
|
717
|
+
<BreadcrumbItem href="/">
|
|
718
|
+
Ana Sayfa
|
|
719
|
+
</BreadcrumbItem>
|
|
720
|
+
<BreadcrumbSeparator />
|
|
721
|
+
<BreadcrumbItem href="/urunler">
|
|
722
|
+
Ürünler
|
|
723
|
+
</BreadcrumbItem>
|
|
724
|
+
<BreadcrumbSeparator />
|
|
725
|
+
<BreadcrumbItem href="/urunler/teknoloji">
|
|
726
|
+
Teknoloji
|
|
727
|
+
</BreadcrumbItem>
|
|
728
|
+
<BreadcrumbSeparator />
|
|
729
|
+
<BreadcrumbItem isCurrent>
|
|
730
|
+
Akıllı Telefonlar
|
|
731
|
+
</BreadcrumbItem>
|
|
732
|
+
</BreadcrumbList>
|
|
733
|
+
</Breadcrumb>
|
|
734
|
+
|
|
735
|
+
{/* Varyantlı Breadcrumb */}
|
|
736
|
+
<Breadcrumb variant="primary" size="md">
|
|
737
|
+
<BreadcrumbList>
|
|
738
|
+
<BreadcrumbItem href="/">
|
|
739
|
+
Dashboard
|
|
740
|
+
</BreadcrumbItem>
|
|
741
|
+
<BreadcrumbSeparator />
|
|
742
|
+
<BreadcrumbItem href="/projeler">
|
|
743
|
+
Projeler
|
|
744
|
+
</BreadcrumbItem>
|
|
745
|
+
<BreadcrumbSeparator />
|
|
746
|
+
<BreadcrumbItem isCurrent>
|
|
747
|
+
MoonUI Projesi
|
|
748
|
+
</BreadcrumbItem>
|
|
749
|
+
</BreadcrumbList>
|
|
750
|
+
</Breadcrumb>
|
|
751
|
+
|
|
752
|
+
{/* Daraltılmış Breadcrumb */}
|
|
753
|
+
<Breadcrumb variant="ghost">
|
|
754
|
+
<BreadcrumbList collapsed>
|
|
755
|
+
<BreadcrumbItem href="/">
|
|
756
|
+
Ana Sayfa
|
|
757
|
+
</BreadcrumbItem>
|
|
758
|
+
<BreadcrumbSeparator />
|
|
759
|
+
<BreadcrumbItem href="/kategoriler">
|
|
760
|
+
Kategoriler
|
|
761
|
+
</BreadcrumbItem>
|
|
762
|
+
<BreadcrumbSeparator />
|
|
763
|
+
<BreadcrumbItem href="/kategoriler/elektronik">
|
|
764
|
+
Elektronik
|
|
765
|
+
</BreadcrumbItem>
|
|
766
|
+
<BreadcrumbSeparator />
|
|
767
|
+
<BreadcrumbItem href="/kategoriler/elektronik/bilgisayar">
|
|
768
|
+
Bilgisayarlar
|
|
769
|
+
</BreadcrumbItem>
|
|
770
|
+
<BreadcrumbSeparator />
|
|
771
|
+
<BreadcrumbItem href="/kategoriler/elektronik/bilgisayar/dizustu">
|
|
772
|
+
Dizüstü Bilgisayarlar
|
|
773
|
+
</BreadcrumbItem>
|
|
774
|
+
<BreadcrumbSeparator />
|
|
775
|
+
<BreadcrumbItem isCurrent>
|
|
776
|
+
Gaming Laptop Modelleri
|
|
777
|
+
</BreadcrumbItem>
|
|
778
|
+
</BreadcrumbList>
|
|
779
|
+
</Breadcrumb>
|
|
780
|
+
</div>
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
### Accordion (Akordiyon) Bileşeni
|
|
786
|
+
|
|
787
|
+
```tsx
|
|
788
|
+
// Tema ile entegre Accordion kullanımı
|
|
789
|
+
import {
|
|
790
|
+
Accordion,
|
|
791
|
+
AccordionItem,
|
|
792
|
+
AccordionTrigger,
|
|
793
|
+
AccordionContent
|
|
794
|
+
} from "@moontra/moonui";
|
|
795
|
+
|
|
796
|
+
export default function AccordionExample() {
|
|
797
|
+
return (
|
|
798
|
+
<div className="space-y-8">
|
|
799
|
+
{/* Basit Accordion */}
|
|
800
|
+
<Accordion type="single" collapsible>
|
|
801
|
+
<AccordionItem value="item-1">
|
|
802
|
+
<AccordionTrigger>Sık Sorulan Soru #1</AccordionTrigger>
|
|
803
|
+
<AccordionContent>
|
|
804
|
+
MoonUI, tamamen özelleştirilebilir, modern ve erişilebilir bir React
|
|
805
|
+
bileşen kütüphanesidir. Tema sistemi ile kolaylıkla markanıza
|
|
806
|
+
uygun hale getirebilirsiniz.
|
|
807
|
+
</AccordionContent>
|
|
808
|
+
</AccordionItem>
|
|
809
|
+
<AccordionItem value="item-2">
|
|
810
|
+
<AccordionTrigger>Sık Sorulan Soru #2</AccordionTrigger>
|
|
811
|
+
<AccordionContent>
|
|
812
|
+
MoonUI'yi npm veya yarn kullanarak projenize ekleyebilirsiniz.
|
|
813
|
+
Kurulum sonrası ThemeProvider ile projenizi sarmalamanız yeterlidir.
|
|
814
|
+
</AccordionContent>
|
|
815
|
+
</AccordionItem>
|
|
816
|
+
<AccordionItem value="item-3">
|
|
817
|
+
<AccordionTrigger>Sık Sorulan Soru #3</AccordionTrigger>
|
|
818
|
+
<AccordionContent>
|
|
819
|
+
MoonUI, tüm bileşenleri için tam tema desteği sunar. Renkler, boyutlar,
|
|
820
|
+
gölgeler, yarıçaplar ve daha fazlasını özelleştirebilirsiniz.
|
|
821
|
+
</AccordionContent>
|
|
822
|
+
</AccordionItem>
|
|
823
|
+
</Accordion>
|
|
824
|
+
|
|
825
|
+
{/* Varyantlı ve Boyutlu Accordion */}
|
|
826
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
827
|
+
<Accordion type="multiple">
|
|
828
|
+
<AccordionItem variant="outline" value="item-1">
|
|
829
|
+
<AccordionTrigger variant="outline" size="md">
|
|
830
|
+
Özellikler
|
|
831
|
+
</AccordionTrigger>
|
|
832
|
+
<AccordionContent variant="outline">
|
|
833
|
+
<ul className="list-disc pl-5 space-y-1">
|
|
834
|
+
<li>Tam tema desteği</li>
|
|
835
|
+
<li>100+ bileşen</li>
|
|
836
|
+
<li>Türkçe dökümantasyon</li>
|
|
837
|
+
</ul>
|
|
838
|
+
</AccordionContent>
|
|
839
|
+
</AccordionItem>
|
|
840
|
+
<AccordionItem variant="outline" value="item-2">
|
|
841
|
+
<AccordionTrigger variant="outline" size="md">
|
|
842
|
+
Tarayıcı Desteği
|
|
843
|
+
</AccordionTrigger>
|
|
844
|
+
<AccordionContent variant="outline">
|
|
845
|
+
MoonUI, tüm modern tarayıcıları destekler: Chrome, Firefox,
|
|
846
|
+
Safari, Edge ve Opera.
|
|
847
|
+
</AccordionContent>
|
|
848
|
+
</AccordionItem>
|
|
849
|
+
</Accordion>
|
|
850
|
+
|
|
851
|
+
<Accordion type="single" collapsible>
|
|
852
|
+
<AccordionItem variant="card" value="item-1">
|
|
853
|
+
<AccordionTrigger variant="ghost" size="sm">
|
|
854
|
+
Özelleştirme
|
|
855
|
+
</AccordionTrigger>
|
|
856
|
+
<AccordionContent size="sm">
|
|
857
|
+
Tema değişkenlerini kullanarak tüm bileşenlerin görünümünü
|
|
858
|
+
markanıza uygun şekilde değiştirebilirsiniz.
|
|
859
|
+
</AccordionContent>
|
|
860
|
+
</AccordionItem>
|
|
861
|
+
<AccordionItem variant="card" value="item-2">
|
|
862
|
+
<AccordionTrigger variant="ghost" size="sm">
|
|
863
|
+
Erişilebilirlik
|
|
864
|
+
</AccordionTrigger>
|
|
865
|
+
<AccordionContent size="sm">
|
|
866
|
+
Tüm bileşenler WCAG standartlarına uygun olarak geliştirilmiştir
|
|
867
|
+
ve ekran okuyucularda sorunsuz çalışır.
|
|
868
|
+
</AccordionContent>
|
|
869
|
+
</AccordionItem>
|
|
870
|
+
<AccordionItem variant="card" value="item-3">
|
|
871
|
+
<AccordionTrigger variant="ghost" size="sm">
|
|
872
|
+
Performans
|
|
873
|
+
</AccordionTrigger>
|
|
874
|
+
<AccordionContent size="sm">
|
|
875
|
+
MoonUI, yüksek performans için optimize edilmiştir ve
|
|
876
|
+
bundle size minimuma indirgenmiştir.
|
|
877
|
+
</AccordionContent>
|
|
878
|
+
</AccordionItem>
|
|
879
|
+
</Accordion>
|
|
880
|
+
</div>
|
|
881
|
+
</div>
|
|
882
|
+
);
|
|
883
|
+
}
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
### Collapsible (Daraltılabilir) Bileşeni
|
|
887
|
+
|
|
888
|
+
```tsx
|
|
889
|
+
// Tema ile entegre Collapsible kullanımı
|
|
890
|
+
import {
|
|
891
|
+
Collapsible,
|
|
892
|
+
CollapsibleTrigger,
|
|
893
|
+
CollapsibleContent
|
|
894
|
+
} from "@moontra/moonui";
|
|
895
|
+
|
|
896
|
+
export default function CollapsibleExample() {
|
|
897
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
898
|
+
const [isOpen2, setIsOpen2] = React.useState(false);
|
|
899
|
+
const [isOpen3, setIsOpen3] = React.useState(false);
|
|
900
|
+
|
|
901
|
+
return (
|
|
902
|
+
<div className="space-y-8">
|
|
903
|
+
{/* Temel Collapsible */}
|
|
904
|
+
<Collapsible
|
|
905
|
+
open={isOpen}
|
|
906
|
+
onOpenChange={setIsOpen}
|
|
907
|
+
className="max-w-lg mx-auto"
|
|
908
|
+
>
|
|
909
|
+
<CollapsibleTrigger>
|
|
910
|
+
Detayları Göster/Gizle
|
|
911
|
+
</CollapsibleTrigger>
|
|
912
|
+
<CollapsibleContent>
|
|
913
|
+
<p>
|
|
914
|
+
MoonUI, modern web uygulamaları geliştirmek için gerekli tüm bileşenleri
|
|
915
|
+
içeren kapsamlı bir React kütüphanesidir. Tüm bileşenler tema sistemi ile
|
|
916
|
+
tamamen özelleştirilebilir.
|
|
917
|
+
</p>
|
|
918
|
+
</CollapsibleContent>
|
|
919
|
+
</Collapsible>
|
|
920
|
+
|
|
921
|
+
{/* Varyantlı ve Boyutlu Collapsible */}
|
|
922
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
923
|
+
<Collapsible open={isOpen2} onOpenChange={setIsOpen2}>
|
|
924
|
+
<CollapsibleTrigger variant="outline" size="md" className="w-full">
|
|
925
|
+
Teknik Özellikler
|
|
926
|
+
</CollapsibleTrigger>
|
|
927
|
+
<CollapsibleContent variant="outline">
|
|
928
|
+
<ul className="list-disc pl-5 space-y-2">
|
|
929
|
+
<li>React 18+ desteği</li>
|
|
930
|
+
<li>TypeScript ile tam tip güvenliği</li>
|
|
931
|
+
<li>Tailwind CSS entegrasyonu</li>
|
|
932
|
+
<li>Tema değişkenleri ile özelleştirme</li>
|
|
933
|
+
<li>100+ bileşen</li>
|
|
934
|
+
</ul>
|
|
935
|
+
</CollapsibleContent>
|
|
936
|
+
</Collapsible>
|
|
937
|
+
|
|
938
|
+
<Collapsible open={isOpen3} onOpenChange={setIsOpen3}>
|
|
939
|
+
<CollapsibleTrigger variant="ghost" size="sm" className="w-full">
|
|
940
|
+
Kurulum ve Kullanım
|
|
941
|
+
</CollapsibleTrigger>
|
|
942
|
+
<CollapsibleContent variant="ghost" size="sm">
|
|
943
|
+
<div className="bg-[var(--color-muted)]/10 p-3 rounded text-[var(--font-size-sm)] font-mono">
|
|
944
|
+
npm install @moontra/moonui
|
|
945
|
+
</div>
|
|
946
|
+
<p className="mt-2 mb-2">
|
|
947
|
+
Kurulumdan sonra ThemeProvider ile projenizi sarmalayın ve bileşenleri
|
|
948
|
+
kullanmaya başlayın.
|
|
949
|
+
</p>
|
|
950
|
+
<div className="bg-[var(--color-muted)]/10 p-3 rounded text-[var(--font-size-sm)] font-mono">
|
|
951
|
+
{`import { ThemeProvider } from '@moontra/moonui';`}
|
|
952
|
+
</div>
|
|
953
|
+
</CollapsibleContent>
|
|
954
|
+
</Collapsible>
|
|
955
|
+
</div>
|
|
956
|
+
</div>
|
|
957
|
+
);
|
|
958
|
+
}
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
### Aspect Ratio (En-Boy Oranı) Bileşeni
|
|
962
|
+
|
|
963
|
+
```tsx
|
|
964
|
+
// Tema ile entegre Aspect Ratio kullanımı
|
|
965
|
+
import { AspectRatio } from "@moontra/moonui";
|
|
966
|
+
import Image from "next/image";
|
|
967
|
+
|
|
968
|
+
export default function AspectRatioExample() {
|
|
969
|
+
return (
|
|
970
|
+
<div className="space-y-8">
|
|
971
|
+
{/* Temel En-Boy Oranı (16:9) */}
|
|
972
|
+
<div className="max-w-md mx-auto">
|
|
973
|
+
<h3 className="text-[var(--font-size-lg)] font-medium mb-2">Video Formatı (16:9)</h3>
|
|
974
|
+
<AspectRatio ratio={16 / 9} className="bg-[var(--color-muted)]/20">
|
|
975
|
+
<div className="flex items-center justify-center h-full">
|
|
976
|
+
<p className="text-[var(--color-muted-foreground)]">
|
|
977
|
+
16:9 en-boy oranı (video formatı)
|
|
978
|
+
</p>
|
|
979
|
+
</div>
|
|
980
|
+
</AspectRatio>
|
|
981
|
+
</div>
|
|
982
|
+
|
|
983
|
+
{/* Çeşitli En-Boy Oranları */}
|
|
984
|
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
|
985
|
+
{/* Kare Format (1:1) */}
|
|
986
|
+
<div>
|
|
987
|
+
<h4 className="text-[var(--font-size-sm)] font-medium mb-2">Kare Format (1:1)</h4>
|
|
988
|
+
<AspectRatio
|
|
989
|
+
ratio={1 / 1}
|
|
990
|
+
variant="outline"
|
|
991
|
+
radius="md"
|
|
992
|
+
>
|
|
993
|
+
<div className="flex items-center justify-center h-full">
|
|
994
|
+
<p className="text-[var(--color-muted-foreground)] text-center text-[var(--font-size-sm)]">
|
|
995
|
+
1:1 Oranı
|
|
996
|
+
</p>
|
|
997
|
+
</div>
|
|
998
|
+
</AspectRatio>
|
|
999
|
+
</div>
|
|
1000
|
+
|
|
1001
|
+
{/* Instagram Format (4:5) */}
|
|
1002
|
+
<div>
|
|
1003
|
+
<h4 className="text-[var(--font-size-sm)] font-medium mb-2">Instagram (4:5)</h4>
|
|
1004
|
+
<AspectRatio
|
|
1005
|
+
ratio={4 / 5}
|
|
1006
|
+
variant="card"
|
|
1007
|
+
radius="lg"
|
|
1008
|
+
>
|
|
1009
|
+
<div className="flex items-center justify-center h-full">
|
|
1010
|
+
<p className="text-[var(--color-muted-foreground)] text-center text-[var(--font-size-sm)]">
|
|
1011
|
+
4:5 Oranı
|
|
1012
|
+
</p>
|
|
1013
|
+
</div>
|
|
1014
|
+
</AspectRatio>
|
|
1015
|
+
</div>
|
|
1016
|
+
|
|
1017
|
+
{/* Klasik Format (4:3) */}
|
|
1018
|
+
<div>
|
|
1019
|
+
<h4 className="text-[var(--font-size-sm)] font-medium mb-2">Klasik (4:3)</h4>
|
|
1020
|
+
<AspectRatio
|
|
1021
|
+
ratio={4 / 3}
|
|
1022
|
+
variant="ghost"
|
|
1023
|
+
radius="sm"
|
|
1024
|
+
className="bg-[var(--color-primary)]/5"
|
|
1025
|
+
>
|
|
1026
|
+
<div className="flex items-center justify-center h-full">
|
|
1027
|
+
<p className="text-[var(--color-muted-foreground)] text-center text-[var(--font-size-sm)]">
|
|
1028
|
+
4:3 Oranı
|
|
1029
|
+
</p>
|
|
1030
|
+
</div>
|
|
1031
|
+
</AspectRatio>
|
|
1032
|
+
</div>
|
|
1033
|
+
</div>
|
|
1034
|
+
|
|
1035
|
+
{/* Resim Örneği */}
|
|
1036
|
+
<div className="max-w-sm mx-auto">
|
|
1037
|
+
<h4 className="text-[var(--font-size-md)] font-medium mb-2">Resim İçerik Örneği</h4>
|
|
1038
|
+
<AspectRatio ratio={3 / 2} className="bg-[var(--color-card)] rounded-[var(--radius-lg)] overflow-hidden">
|
|
1039
|
+
<div className="relative h-full w-full">
|
|
1040
|
+
{/* Next.js Image komponenti veya normal img kullanılabilir */}
|
|
1041
|
+
<img
|
|
1042
|
+
src="https://images.unsplash.com/photo-1588345921523-c2dcdb7f1dcd?w=800&dpr=2&q=80"
|
|
1043
|
+
alt="Örnek görsel"
|
|
1044
|
+
className="object-cover w-full h-full"
|
|
1045
|
+
/>
|
|
1046
|
+
<div className="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent flex items-end p-4">
|
|
1047
|
+
<p className="text-white font-medium">
|
|
1048
|
+
MoonUI ile responsive görsel oranı
|
|
1049
|
+
</p>
|
|
1050
|
+
</div>
|
|
1051
|
+
</div>
|
|
1052
|
+
</AspectRatio>
|
|
1053
|
+
</div>
|
|
1054
|
+
</div>
|
|
1055
|
+
);
|
|
1056
|
+
}
|
|
1057
|
+
```
|
|
1058
|
+
|
|
1059
|
+
### Command (Komut Paleti) Bileşeni
|
|
1060
|
+
|
|
1061
|
+
```tsx
|
|
1062
|
+
// Tema ile entegre Command kullanımı
|
|
1063
|
+
import {
|
|
1064
|
+
Command,
|
|
1065
|
+
CommandDialog,
|
|
1066
|
+
CommandInput,
|
|
1067
|
+
CommandList,
|
|
1068
|
+
CommandEmpty,
|
|
1069
|
+
CommandGroup,
|
|
1070
|
+
CommandItem,
|
|
1071
|
+
CommandShortcut
|
|
1072
|
+
} from "@moontra/moonui";
|
|
1073
|
+
import { useState } from "react";
|
|
1074
|
+
|
|
1075
|
+
export default function CommandExample() {
|
|
1076
|
+
const [open, setOpen] = useState(false);
|
|
1077
|
+
|
|
1078
|
+
return (
|
|
1079
|
+
<div className="space-y-6">
|
|
1080
|
+
{/* Temel Komut Paleti */}
|
|
1081
|
+
<div className="rounded-md border border-[var(--color-border)]">
|
|
1082
|
+
<Command>
|
|
1083
|
+
<CommandInput placeholder="Arama yapın..." />
|
|
1084
|
+
<CommandList>
|
|
1085
|
+
<CommandEmpty>Sonuç bulunamadı.</CommandEmpty>
|
|
1086
|
+
<CommandGroup heading="Öneriler">
|
|
1087
|
+
<CommandItem>
|
|
1088
|
+
<span>Ana Sayfa</span>
|
|
1089
|
+
<CommandShortcut>⌘H</CommandShortcut>
|
|
1090
|
+
</CommandItem>
|
|
1091
|
+
<CommandItem>
|
|
1092
|
+
<span>Ayarlar</span>
|
|
1093
|
+
<CommandShortcut>⌘S</CommandShortcut>
|
|
1094
|
+
</CommandItem>
|
|
1095
|
+
<CommandItem>
|
|
1096
|
+
<span>Profil</span>
|
|
1097
|
+
</CommandItem>
|
|
1098
|
+
</CommandGroup>
|
|
1099
|
+
<CommandGroup heading="Diğer">
|
|
1100
|
+
<CommandItem variant="destructive">
|
|
1101
|
+
<span>Çıkış Yap</span>
|
|
1102
|
+
</CommandItem>
|
|
1103
|
+
<CommandItem variant="subtle" disabled>
|
|
1104
|
+
<span>Yardım</span>
|
|
1105
|
+
</CommandItem>
|
|
1106
|
+
</CommandGroup>
|
|
1107
|
+
</CommandList>
|
|
1108
|
+
</Command>
|
|
1109
|
+
</div>
|
|
1110
|
+
|
|
1111
|
+
{/* Modal Dialog olarak Komut Paleti */}
|
|
1112
|
+
<div>
|
|
1113
|
+
<h3 className="text-[var(--font-size-lg)] font-medium mb-2">Dialog Olarak</h3>
|
|
1114
|
+
<p className="text-[var(--color-muted-foreground)] mb-4">
|
|
1115
|
+
Komut paletini herhangi bir yerde açabilir ve klavye kontrolü ekleyebilirsiniz.
|
|
1116
|
+
</p>
|
|
1117
|
+
|
|
1118
|
+
<button
|
|
1119
|
+
onClick={() => setOpen(true)}
|
|
1120
|
+
className="px-4 py-2 bg-[var(--color-primary)] text-white rounded-[var(--radius-md)]"
|
|
1121
|
+
>
|
|
1122
|
+
Komut Paletini Aç (⌘K)
|
|
1123
|
+
</button>
|
|
1124
|
+
|
|
1125
|
+
<CommandDialog open={open} onOpenChange={setOpen} commandClassName="bg-[var(--color-card)]">
|
|
1126
|
+
<CommandInput placeholder="Komut arayın..." />
|
|
1127
|
+
<CommandList>
|
|
1128
|
+
<CommandEmpty>Sonuç bulunamadı.</CommandEmpty>
|
|
1129
|
+
<CommandGroup heading="Sayfalar">
|
|
1130
|
+
<CommandItem onSelect={() => {alert('Ana sayfa seçildi!'); setOpen(false);}}>
|
|
1131
|
+
<span>Ana Sayfa</span>
|
|
1132
|
+
</CommandItem>
|
|
1133
|
+
<CommandItem>
|
|
1134
|
+
<span>Belgeler</span>
|
|
1135
|
+
</CommandItem>
|
|
1136
|
+
<CommandItem>
|
|
1137
|
+
<span>Bileşenler</span>
|
|
1138
|
+
</CommandItem>
|
|
1139
|
+
</CommandGroup>
|
|
1140
|
+
<CommandGroup heading="Tema">
|
|
1141
|
+
<CommandItem>
|
|
1142
|
+
<span>Açık Tema</span>
|
|
1143
|
+
</CommandItem>
|
|
1144
|
+
<CommandItem>
|
|
1145
|
+
<span>Koyu Tema</span>
|
|
1146
|
+
</CommandItem>
|
|
1147
|
+
<CommandItem>
|
|
1148
|
+
<span>Sistem</span>
|
|
1149
|
+
</CommandItem>
|
|
1150
|
+
</CommandGroup>
|
|
1151
|
+
</CommandList>
|
|
1152
|
+
</CommandDialog>
|
|
1153
|
+
</div>
|
|
1154
|
+
</div>
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
```
|
|
1158
|
+
|
|
1159
|
+
## İpuçları ve En İyi Uygulamalar
|
|
1160
|
+
|
|
1161
|
+
1. **Renk Sistematiği**: HSL renk formatını kullanarak (örn. 'hsl(210, 100%, 50%)') renkleri daha sistematik olarak düzenleyebilirsiniz.
|
|
1162
|
+
|
|
1163
|
+
2. **A11y Uyumluluğu**: Özelleştirilmiş renkler seçerken kontrast oranlarının WCAG 2.1 AA standardını (minimum 4.5:1) karşıladığından emin olun.
|
|
1164
|
+
|
|
1165
|
+
3. **Dark Mode Geçişi**: Dark mode ve light mode arasında geçiş yaparken ani değişiklikler yerine yumuşak geçişler için `transition` özelliğini kullanın:
|
|
1166
|
+
|
|
1167
|
+
```css
|
|
1168
|
+
body {
|
|
1169
|
+
transition: background-color 0.3s ease, color 0.3s ease;
|
|
1170
|
+
}
|
|
1171
|
+
```
|
|
1172
|
+
|
|
1173
|
+
4. **Hazır Tema Kullanımı**: Uygulamanızın genel görünümünü hızlıca değiştirmek için hazır tema şablonlarını kullanın:
|
|
1174
|
+
|
|
1175
|
+
```tsx
|
|
1176
|
+
// Başlangıçta bir şablon belirtin
|
|
1177
|
+
<ThemeProvider preset="modern">
|
|
1178
|
+
|
|
1179
|
+
// Veya çalışma zamanında değiştirin
|
|
1180
|
+
const { setThemePreset } = useTheme();
|
|
1181
|
+
setThemePreset('rounded');
|
|
1182
|
+
```
|
|
1183
|
+
|
|
1184
|
+
5. **Özel Değişkenleri Organize Etme**: Özel değişkenlerinizi mantıksal gruplar halinde organize edin:
|
|
1185
|
+
|
|
1186
|
+
```tsx
|
|
1187
|
+
extensions={{
|
|
1188
|
+
layout: { ... }, // Düzen ile ilgili değişkenler
|
|
1189
|
+
typography: { ... }, // Tipografi ile ilgili değişkenler
|
|
1190
|
+
animation: { ... }, // Animasyon ile ilgili değişkenler
|
|
1191
|
+
}}
|
|
1192
|
+
```
|
|
1193
|
+
|
|
1194
|
+
6. **Performans**: Tema değişikliklerinin performansını artırmak için, sık değişen değerler için CSS değişkenlerini kullanın ve yeniden-render'ı minimize edin.
|