@wface/pixel-ui 0.5.3 → 0.5.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/README.md CHANGED
@@ -1,73 +1,200 @@
1
- # React + TypeScript + Vite
1
+ # Pixel UI @wface/pixel-ui
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ Pixel UI, WFace ekosistemi için hazırlanmış, React + TypeScript ile yazılmış bir bileşen kütüphanesidir. Bu paket, yeniden kullanılabilir UI bileşenleri, tema/context sağlayıcıları ve yardımcı stiller (utilities) içerir. Kütüphane hem uygulama içinde (dev mode) hem de bağımsız paket olarak (npm/yarn) kullanılmak üzere hazırlanmıştır.
4
4
 
5
- Currently, two official plugins are available:
5
+ Bu README, bileşenin nasıl kurulacağı, kullanılacağı, geliştirileceği ve paketleneceği hakkında pratik bilgiler içerir.
6
6
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
7
+ ---
9
8
 
10
- ## React Compiler
9
+ İçindekiler
10
+ - Ne işe yarar?
11
+ - Hızlı kurulum
12
+ - Örnek kullanım
13
+ - Temel kullanım
14
+ - `PiTable` örneği (alt tablo / expandable)
15
+ - Stiller ve tema
16
+ - Geliştirme & Build
17
+ - Yayınlama
18
+ - Yardımcı (utilities) sınıflar
19
+ - Katkıda bulunma
20
+ - Lisans
11
21
 
12
- The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
22
+ ---
13
23
 
14
- ## Expanding the ESLint configuration
24
+ Ne işe yarar?
15
25
 
16
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
26
+ - Tek bir paket içinde ortak UI bileşenlerini sağlar (buton, input, table, dropdown, modal vb.).
27
+ - Tasarım token'ları ve SCSS utilities ile tutarlı stilizasyon sunar.
28
+ - Tema ve Toast gibi provider'lar ile uygulama seviyesinde kullanım sağlar.
17
29
 
18
- ```js
19
- export default defineConfig([
20
- globalIgnores(['dist']),
21
- {
22
- files: ['**/*.{ts,tsx}'],
23
- extends: [
24
- // Other configs...
30
+ Hızlı kurulum
25
31
 
26
- // Remove tseslint.configs.recommended and replace with this
27
- tseslint.configs.recommendedTypeChecked,
28
- // Alternatively, use this for stricter rules
29
- tseslint.configs.strictTypeChecked,
30
- // Optionally, add this for stylistic rules
31
- tseslint.configs.stylisticTypeChecked,
32
+ Projeye bağımlılık olarak eklemek için:
32
33
 
33
- // Other configs...
34
- ],
35
- languageOptions: {
36
- parserOptions: {
37
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
- tsconfigRootDir: import.meta.dirname,
39
- },
40
- // other options...
41
- },
42
- },
43
- ])
34
+ ```bash
35
+ # npm
36
+ npm install @wface/pixel-ui
37
+
38
+ # veya yarn
39
+ yarn add @wface/pixel-ui
44
40
  ```
45
41
 
46
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
-
48
- ```js
49
- // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
52
-
53
- export default defineConfig([
54
- globalIgnores(['dist']),
55
- {
56
- files: ['**/*.{ts,tsx}'],
57
- extends: [
58
- // Other configs...
59
- // Enable lint rules for React
60
- reactX.configs['recommended-typescript'],
61
- // Enable lint rules for React DOM
62
- reactDom.configs.recommended,
63
- ],
64
- languageOptions: {
65
- parserOptions: {
66
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
- tsconfigRootDir: import.meta.dirname,
68
- },
69
- // other options...
70
- },
71
- },
72
- ])
42
+ Peer-dependencies
43
+ - react 18.2.0
44
+ - react-dom 18.2.0
45
+ - react-router-dom 6.x (pakette 6.2.2 hedeflenmiştir)
46
+
47
+ Kullanım (örnek)
48
+
49
+ Temel kullanımda kütüphaneyi import edip stilleri ekleyin:
50
+
51
+ ```tsx
52
+ import React from 'react'
53
+ import ReactDOM from 'react-dom/client'
54
+ import { Pixel, PiButton } from '@wface/pixel-ui'
55
+ import '@wface/pixel-ui/styles.css' // veya uygulamanızın global stil yükleme noktasına ekleyin
56
+
57
+ function App() {
58
+ return (
59
+ <Pixel>
60
+ <div style={{ padding: 24 }}>
61
+ <PiButton>Buton</PiButton>
62
+ </div>
63
+ </Pixel>
64
+ )
65
+ }
66
+
67
+ ReactDOM.createRoot(document.getElementById('root')!).render(<App />)
73
68
  ```
69
+
70
+ Not: `Pixel` provider'ı tema ve bazı global context'leri sağlar; bazı bileşenler (örn. `useTheme`) yalnızca provider içinde çalışır.
71
+
72
+ PiTable örneği — alt tablo (subtable) ve expandable row
73
+
74
+ Aşağıdaki örnek, `PiTable` kullanımını, alt tabloyu (subtable) ve bir `user.id` tıklamasıyla satırı genişletmeyi gösterir:
75
+
76
+ ```tsx
77
+ import React, { useState } from 'react'
78
+ import { PiTable } from '@wface/pixel-ui'
79
+
80
+ const data = [
81
+ { id: 'u1', name: 'Ali', email: 'ali@example.com' },
82
+ { id: 'u2', name: 'Ayşe', email: 'ayse@example.com' },
83
+ ]
84
+
85
+ function HomeTable() {
86
+ const [expanded, setExpanded] = useState<Record<string, boolean>>({})
87
+
88
+ const toggle = (id: string) => setExpanded(prev => ({ ...prev, [id]: !prev[id] }))
89
+
90
+ return (
91
+ <PiTable>
92
+ <PiTable.TableHeader>
93
+ <PiTable.TableRow>
94
+ <PiTable.TableCell width={120}>ID</PiTable.TableCell>
95
+ <PiTable.TableCell>İsim</PiTable.TableCell>
96
+ <PiTable.TableCell>Mail</PiTable.TableCell>
97
+ </PiTable.TableRow>
98
+ </PiTable.TableHeader>
99
+
100
+ <PiTable.TableBody>
101
+ {data.map((u) => (
102
+ <PiTable.TableRow
103
+ key={u.id}
104
+ id={`row-${u.id}`}
105
+ onClick={() => toggle(u.id)}
106
+ showSubTable={!!expanded[u.id]}
107
+ subTable={
108
+ <PiTable subTable variant="bordered">
109
+ <PiTable.TableHeader>
110
+ <PiTable.TableRow>
111
+ <PiTable.TableCell>Alt Bilgi</PiTable.TableCell>
112
+ </PiTable.TableRow>
113
+ </PiTable.TableHeader>
114
+ <PiTable.TableBody>
115
+ <PiTable.TableRow>
116
+ <PiTable.TableCell>{`Detay: ${u.email}`}</PiTable.TableCell>
117
+ </PiTable.TableRow>
118
+ </PiTable.TableBody>
119
+ </PiTable>
120
+ }
121
+ >
122
+ <PiTable.TableCell width={120}>{u.id}</PiTable.TableCell>
123
+ <PiTable.TableCell>{u.name}</PiTable.TableCell>
124
+ <PiTable.TableCell>{u.email}</PiTable.TableCell>
125
+ </PiTable.TableRow>
126
+ ))}
127
+ </PiTable.TableBody>
128
+ </PiTable>
129
+ )
130
+ }
131
+ ```
132
+
133
+ Açıklamalar:
134
+ - `PiTable.TableRow`, `PiTable.TableCell`, `PiTable.TableHeader`, `PiTable.TableBody` alt bileşenleri `PiTable`'ın üzerine eklenmiş şekilde kullanılabilir.
135
+ - `subTable` prop'u bir React düğüm (element) bekler; `showSubTable` ile görünürlüğü kontrol edebilirsiniz.
136
+ - Satır genişletme (expand) davranışı örnekte tıklama ile yapıldı; isterseniz daha kontrollü state yönetimi sağlayabilirsiniz.
137
+
138
+ Stiller & tema
139
+
140
+ - Paket `styles.css` (dist içinde) ile birlikte gelir. Uygulamanıza dahil etmek için `import '@wface/pixel-ui/styles.css'` kullanın.
141
+ - SCSS kaynakları `src/styles` içinde bulunur. Değiştirilebilir tokenlar ve temalar `tokens/` ve `theme.scss` içinde yer alır.
142
+ - Utility sınıflar `src/styles/_utilities.scss` içinde tanımlıdır. `.pi-m-4`, `.pi-p-8`, `.pi-flex` gibi sınıflarla hızlı düzenlemeler yapabilirsiniz.
143
+
144
+ Geliştirme & build
145
+
146
+ Proje kökünde (paket dizini) yaygın script'ler:
147
+
148
+ - `yarn dev` — kütüphaneyi uygulama modunda çalıştırır (Vite dev server).
149
+ - `yarn dev:lib` — yalnızca kütüphane için Vite server (farklı port).
150
+ - `yarn build` — kütüphaneyi üretim için derler (Vite build) ve TypeScript tiplerini (`.d.ts`) üretir.
151
+ - `yarn clean` — `dist` klasörünü temizler.
152
+ - `yarn prepublishOnly` — yayın öncesi temizleme ve build çalıştırır.
153
+
154
+ Örnek: lokal geliştirme
155
+
156
+ 1. repo kökünde bağımlılıkları yükleyin (örn. `yarn` veya `npm install`).
157
+ 2. Bu pakete gelin: `cd packages/lib` (eğer monorepo düzeni varsa).
158
+ 3. `yarn dev` ile story/dev uygulamayı başlatın.
159
+
160
+ Yayınlama
161
+
162
+ Paket `dist` klasörünü içerir ve `package.json` içindeki `files` alanı sayesinde sadece `dist` yayımlanır. Paket yayınlamadan önce:
163
+
164
+ ```bash
165
+ yarn clean && yarn build
166
+ # ardından npm publish (veya yarn publish)
167
+ ```
168
+
169
+ Paket `publishConfig.access` `public` olarak ayarlı, npm registry'ye public olarak yayınlar.
170
+
171
+ Yardımcı (utilities)
172
+
173
+ `_utilities.scss` içinde bir dizi yardımcı sınıf (spacing, typography, display, gap, border vb.) bulunur. Bu sınıflar hızlı layout ve spacing işleri için uygundur ve komponent modul SCSS'leri içinde `@extend` veya component className ile kullanılabilir.
174
+
175
+ Örnekler:
176
+ - `.pi-m-4` — tüm kenarlar için margin
177
+ - `.pi-px-8` — yatay padding
178
+ - `.pi-flex`, `.pi-items-center`, `.pi-justify-between` — flex helper'lar
179
+
180
+ Katkıda bulunma
181
+
182
+ - Yeni bileşen eklerken, `src/components` altında modüler şekilde oluşturun ve `src/index.ts` içinde export edin.
183
+ - Stil değişiklikleri SCSS token ve utilities üzerinden yapılmalı.
184
+ - Build ve test aşamalarını yerel olarak çalıştırıp kontrol edin.
185
+
186
+ Sorun giderme / sık karşılaşılan hatalar
187
+
188
+ - "useTheme must be used within ThemeProvider" hatası: `useTheme` hook'unu kullanmadan önce `ThemeProvider` veya `Pixel` provider'ı render ağacına eklediğinizden emin olun.
189
+ - Stiller görünmüyorsa: uygulamanızın entry noktasında `@wface/pixel-ui/styles.css` import edildiğinden emin olun.
190
+ - Peer dependency hataları: proje React versiyonunun paket peer dependency ile uyumlu olduğundan emin olun.
191
+
192
+ İletişim & daha fazla bilgi
193
+
194
+ Daha detaylı kullanım örnekleri ve demo uygulamalar `packages/lib/src/demo` ve `packages/docs` içinde bulunabilir (monorepo yapısına bağlı olarak). Hata bildirmek veya katkıda bulunmak için repository'de issue açabilirsiniz.
195
+
196
+ Lisans
197
+
198
+ Bu proje lisans bilgilerini repository kökünde bulundurur. (Burada proje lisansı belirtilmemişse, kök dizindeki `LICENSE` dosyasına bakın.)
199
+
200
+ ---