@khraben/flowui 1.0.3 → 1.0.4
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/LICENSE +21 -0
- package/dist/README.md +758 -0
- package/{index.js → dist/index.js} +311 -2858
- package/dist/index.js.map +1 -0
- package/{index.mjs → dist/index.mjs} +311 -2858
- package/dist/index.mjs.map +1 -0
- package/dist/package.json +41 -0
- package/package.json +59 -23
- package/index.js.map +0 -1
- package/index.mjs.map +0 -1
- /package/{index.d.mts → dist/index.d.mts} +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
package/dist/README.md
ADDED
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
# FlowUI
|
|
2
|
+
|
|
3
|
+
Modern React component library with TypeScript and CSS-in-JS styling.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@khraben/flowui)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## 📦 Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @khraben/flowui
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Note:** FlowUI v1.0.0+ uses **CSS-in-JS** and no longer requires Tailwind CSS. All styling is done through inline styles with dynamic color calculations.
|
|
15
|
+
|
|
16
|
+
### Troubleshooting Installation
|
|
17
|
+
|
|
18
|
+
If you encounter issues with npm installing dependencies (specifically `closure-net` errors), try one of these solutions:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Option 1: Use pnpm (recommended)
|
|
22
|
+
pnpm add @khraben/flowui
|
|
23
|
+
|
|
24
|
+
# Option 2: Use yarn
|
|
25
|
+
yarn add @khraben/flowui
|
|
26
|
+
|
|
27
|
+
# Option 3: Use npm with legacy peer deps
|
|
28
|
+
npm install @khraben/flowui --legacy-peer-deps
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 🎨 Design Philosophy
|
|
32
|
+
|
|
33
|
+
FlowUI uses a **simplified color system** that dramatically reduces the number of props needed while maintaining full customization flexibility.
|
|
34
|
+
|
|
35
|
+
### Color System (v1.0+)
|
|
36
|
+
|
|
37
|
+
- **3 Base Colors** - `primary`, `secondary`, `accent` (required for most components)
|
|
38
|
+
- **3 Extended Colors** - `warning`, `success`, `danger` (for modals and alerts)
|
|
39
|
+
- **Auto-calculated States** - Hover, focus, disabled states computed automatically
|
|
40
|
+
- **Type-Safe** - Full TypeScript support with proper interfaces
|
|
41
|
+
- **Flexible** - Use defaults or customize with individual color overrides
|
|
42
|
+
|
|
43
|
+
### Color Format
|
|
44
|
+
|
|
45
|
+
All colors accept **standard CSS color formats**:
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
// ✅ Hexadecimal
|
|
49
|
+
const colors = {
|
|
50
|
+
primary: '#3B82F6',
|
|
51
|
+
secondary: '#8B5CF6',
|
|
52
|
+
accent: '#EC4899',
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// ✅ RGB/RGBA
|
|
56
|
+
const colors = {
|
|
57
|
+
primary: 'rgb(59, 130, 246)',
|
|
58
|
+
secondary: 'rgba(139, 92, 246, 0.9)',
|
|
59
|
+
accent: '#EC4899',
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// ✅ HSL/HSLA
|
|
63
|
+
const colors = {
|
|
64
|
+
primary: 'hsl(217, 91%, 60%)',
|
|
65
|
+
secondary: 'hsl(258, 90%, 66%)',
|
|
66
|
+
accent: '#EC4899',
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// ✅ CSS Variables
|
|
70
|
+
const colors = {
|
|
71
|
+
primary: 'var(--color-primary)',
|
|
72
|
+
secondary: 'var(--color-secondary)',
|
|
73
|
+
accent: 'var(--color-accent)',
|
|
74
|
+
};
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 🚀 Features
|
|
78
|
+
|
|
79
|
+
- ✅ **Simplified Color Props** - Define 3 colors instead of 10+
|
|
80
|
+
- ✅ **Auto-calculated States** - Hover, focus, disabled colors computed dynamically
|
|
81
|
+
- ✅ **Smart Contrast** - Text colors automatically adjusted for readability
|
|
82
|
+
- ✅ **Consistent Theming** - Same color config across all components
|
|
83
|
+
- ✅ **Zero Hardcoded Colors** - All colors derived from the 3 base colors
|
|
84
|
+
- ✅ **CSS-in-JS** - Pure inline styles with CSSProperties, no external dependencies
|
|
85
|
+
- ✅ **TypeScript Strict** - Complete type safety
|
|
86
|
+
- ✅ **Built with tsup** - Optimized ESM + CJS builds
|
|
87
|
+
- ✅ **Framer Motion** - Smooth animations in Gallery and other components
|
|
88
|
+
|
|
89
|
+
## � Quick Start
|
|
90
|
+
|
|
91
|
+
### 1. Define Your Color Palette
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { BaseColorConfig, ExtendedColorConfig } from '@khraben/flowui';
|
|
95
|
+
|
|
96
|
+
// For most components (Button, Input, Table, etc.)
|
|
97
|
+
const myColors: BaseColorConfig = {
|
|
98
|
+
primary: '#3B82F6', // Main brand color
|
|
99
|
+
secondary: '#8B5CF6', // Background/secondary elements
|
|
100
|
+
accent: '#EC4899', // Highlights and focus states
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// For modals and components that need status colors
|
|
104
|
+
const extendedColors: ExtendedColorConfig = {
|
|
105
|
+
primary: '#3B82F6',
|
|
106
|
+
secondary: '#8B5CF6',
|
|
107
|
+
accent: '#EC4899',
|
|
108
|
+
warning: '#F59E0B', // Warning states
|
|
109
|
+
success: '#10B981', // Success states
|
|
110
|
+
danger: '#EF4444', // Danger/delete actions
|
|
111
|
+
};
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 2. Use Across All Components
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import { Button, Input, Table, BaseModal } from '@khraben/flowui';
|
|
118
|
+
|
|
119
|
+
// Same color config works everywhere
|
|
120
|
+
<Button colors={myColors} variant="primary">Click me</Button>
|
|
121
|
+
<Input colors={myColors} label="Username" />
|
|
122
|
+
<Table colors={myColors} columns={columns} data={data} />
|
|
123
|
+
<BaseModal colors={extendedColors} title="Success" />
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 3. Customize When Needed
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
// Override specific colors while keeping the base theme
|
|
130
|
+
<Button
|
|
131
|
+
colors={myColors}
|
|
132
|
+
customBg="#EF4444" // Custom red background
|
|
133
|
+
customTextColor="#FFFFFF"
|
|
134
|
+
>
|
|
135
|
+
Delete
|
|
136
|
+
</Button>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## 📚 Components
|
|
140
|
+
|
|
141
|
+
### Button
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
import { Button, BaseColorConfig } from '@khraben/flowui';
|
|
145
|
+
|
|
146
|
+
const colors: BaseColorConfig = {
|
|
147
|
+
primary: '#3B82F6', // Blue
|
|
148
|
+
secondary: '#8B5CF6', // Purple
|
|
149
|
+
accent: '#EC4899' // Pink
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// Basic usage - hover, disabled, focus states auto-calculated
|
|
153
|
+
<Button colors={colors} variant="primary">
|
|
154
|
+
Click me
|
|
155
|
+
</Button>
|
|
156
|
+
|
|
157
|
+
// Custom override when needed
|
|
158
|
+
<Button
|
|
159
|
+
colors={colors}
|
|
160
|
+
customBg="#EF4444"
|
|
161
|
+
customTextColor="#FFFFFF"
|
|
162
|
+
>
|
|
163
|
+
Danger Button
|
|
164
|
+
</Button>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**New Props:**
|
|
168
|
+
|
|
169
|
+
- `colors?: BaseColorConfig` - Color configuration (primary, secondary, accent)
|
|
170
|
+
- `customBg?: string` - Override background color
|
|
171
|
+
- `customTextColor?: string` - Override text color
|
|
172
|
+
- `customBorderColor?: string` - Override border color
|
|
173
|
+
|
|
174
|
+
**Auto-calculated:**
|
|
175
|
+
|
|
176
|
+
- Hover colors (lighter/darker based on luminosity)
|
|
177
|
+
- Disabled states (reduced opacity)
|
|
178
|
+
- Focus rings (adjusted opacity)
|
|
179
|
+
- Text contrast (black/white for readability)
|
|
180
|
+
|
|
181
|
+
### Input
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
import { Input, BaseColorConfig } from '@khraben/flowui';
|
|
185
|
+
|
|
186
|
+
const colors: BaseColorConfig = {
|
|
187
|
+
primary: '#3B82F6',
|
|
188
|
+
secondary: '#8B5CF6',
|
|
189
|
+
accent: '#EC4899',
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
<Input
|
|
193
|
+
colors={colors}
|
|
194
|
+
label="Username"
|
|
195
|
+
placeholder="Enter username"
|
|
196
|
+
/>
|
|
197
|
+
|
|
198
|
+
// With custom overrides
|
|
199
|
+
<Input
|
|
200
|
+
colors={colors}
|
|
201
|
+
customBg="#F3F4F6"
|
|
202
|
+
customTextColor="#1F2937"
|
|
203
|
+
label="Email"
|
|
204
|
+
/>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**New Props:**
|
|
208
|
+
|
|
209
|
+
- `colors?: BaseColorConfig` - Color configuration (primary, secondary, accent)
|
|
210
|
+
- `customBg?: string` - Override input background
|
|
211
|
+
- `customTextColor?: string` - Override text color
|
|
212
|
+
- `customBorderColor?: string` - Override border color
|
|
213
|
+
|
|
214
|
+
**Auto-calculated:**
|
|
215
|
+
|
|
216
|
+
- Border and focus colors (from primary)
|
|
217
|
+
- Label colors (active and inactive states)
|
|
218
|
+
- Icon colors and hover states
|
|
219
|
+
- Placeholder color
|
|
220
|
+
- Focus shadow
|
|
221
|
+
|
|
222
|
+
### ActionIcon
|
|
223
|
+
|
|
224
|
+
Icon button with hover effects and smooth animations.
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
import { ActionIcon, BaseColorConfig } from '@khraben/flowui';
|
|
228
|
+
import { Heart } from 'lucide-react';
|
|
229
|
+
|
|
230
|
+
const colors: BaseColorConfig = {
|
|
231
|
+
primary: '#3B82F6',
|
|
232
|
+
secondary: '#8B5CF6',
|
|
233
|
+
accent: '#EC4899',
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
<ActionIcon
|
|
237
|
+
icon={Heart}
|
|
238
|
+
onClick={() => console.log('clicked')}
|
|
239
|
+
title="Like"
|
|
240
|
+
size="md"
|
|
241
|
+
colors={colors}
|
|
242
|
+
/>
|
|
243
|
+
|
|
244
|
+
// With custom color override
|
|
245
|
+
<ActionIcon
|
|
246
|
+
icon={Heart}
|
|
247
|
+
colors={colors}
|
|
248
|
+
customColor="#EF4444"
|
|
249
|
+
title="Delete"
|
|
250
|
+
/>
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Props:**
|
|
254
|
+
|
|
255
|
+
- `icon` - Icon component (e.g., from lucide-react)
|
|
256
|
+
- `onClick` - Click callback function
|
|
257
|
+
- `title` - Tooltip text
|
|
258
|
+
- `size` - Size: `'sm' | 'md' | 'lg'` (default: `'md'`)
|
|
259
|
+
- `colors?: BaseColorConfig` - Color configuration
|
|
260
|
+
- `customColor?: string` - Override icon color
|
|
261
|
+
- `customBg?: string` - Override background color
|
|
262
|
+
- `disabled` - Disabled state
|
|
263
|
+
- `className` - Additional CSS classes
|
|
264
|
+
|
|
265
|
+
**Auto-calculated:**
|
|
266
|
+
|
|
267
|
+
- Hover color (based on icon color)
|
|
268
|
+
- Hover background (semi-transparent)
|
|
269
|
+
- Disabled state (reduced opacity)
|
|
270
|
+
|
|
271
|
+
### Loading
|
|
272
|
+
|
|
273
|
+
Modern loading component with pure CSS animations. Includes 3 variants: spinner, dots, and pulse.
|
|
274
|
+
|
|
275
|
+
```tsx
|
|
276
|
+
import { Loading, BaseColorConfig } from '@khraben/flowui';
|
|
277
|
+
|
|
278
|
+
const colors: BaseColorConfig = {
|
|
279
|
+
primary: '#3B82F6',
|
|
280
|
+
secondary: '#8B5CF6',
|
|
281
|
+
accent: '#EC4899',
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
<Loading
|
|
285
|
+
variant="spinner"
|
|
286
|
+
size="md"
|
|
287
|
+
text="Loading..."
|
|
288
|
+
colors={colors}
|
|
289
|
+
showOverlay={true}
|
|
290
|
+
/>
|
|
291
|
+
|
|
292
|
+
// With custom overrides
|
|
293
|
+
<Loading
|
|
294
|
+
colors={colors}
|
|
295
|
+
customSpinnerColor="#EF4444"
|
|
296
|
+
customOverlayColor="rgba(0, 0, 0, 0.5)"
|
|
297
|
+
/>
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Variants:**
|
|
301
|
+
|
|
302
|
+
1. **Spinner**: Rotating ring with gradient effect and pulsing ring
|
|
303
|
+
2. **Dots**: Three dots with staggered bounce animation
|
|
304
|
+
3. **Pulse**: Pulse effect with expanding ring
|
|
305
|
+
|
|
306
|
+
**Props:**
|
|
307
|
+
|
|
308
|
+
- `variant` - Loader type: `'spinner' | 'dots' | 'pulse'` (default: `'spinner'`)
|
|
309
|
+
- `size` - Size: `'sm' | 'md' | 'lg'` (default: `'md'`)
|
|
310
|
+
- `text` - Optional text below loader
|
|
311
|
+
- `colors?: BaseColorConfig` - Color configuration
|
|
312
|
+
- `customSpinnerColor?: string` - Override spinner color
|
|
313
|
+
- `customOverlayColor?: string` - Override overlay color
|
|
314
|
+
- `showOverlay` - Show background overlay (default: `true`)
|
|
315
|
+
|
|
316
|
+
**Features:**
|
|
317
|
+
|
|
318
|
+
- ✅ 100% pure CSS, no external icons
|
|
319
|
+
- ✅ Portal rendering (mounts to document.body)
|
|
320
|
+
- ✅ Backdrop blur for modern effect
|
|
321
|
+
- ✅ Smooth animations with cubic-bezier
|
|
322
|
+
- ✅ Responsive and accessible
|
|
323
|
+
|
|
324
|
+
### LanguageSelector
|
|
325
|
+
|
|
326
|
+
Language selector with dropdown and support for 9 languages. Names are automatically translated to the selected language.
|
|
327
|
+
|
|
328
|
+
```tsx
|
|
329
|
+
import { LanguageSelector, DEFAULT_AVAILABLE_LANGUAGES, BaseColorConfig } from '@khraben/flowui';
|
|
330
|
+
|
|
331
|
+
const colors: BaseColorConfig = {
|
|
332
|
+
primary: '#3B82F6',
|
|
333
|
+
secondary: '#8B5CF6',
|
|
334
|
+
accent: '#EC4899',
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
<LanguageSelector
|
|
338
|
+
selectedLanguage="en"
|
|
339
|
+
onLanguageChange={(langCode) => console.log(langCode)}
|
|
340
|
+
availableLanguages={DEFAULT_AVAILABLE_LANGUAGES}
|
|
341
|
+
size="md"
|
|
342
|
+
colors={colors}
|
|
343
|
+
/>
|
|
344
|
+
|
|
345
|
+
// With custom overrides
|
|
346
|
+
<LanguageSelector
|
|
347
|
+
colors={colors}
|
|
348
|
+
customBgColor="#F3F4F6"
|
|
349
|
+
customBorderColor="#D1D5DB"
|
|
350
|
+
customTextColor="#1F2937"
|
|
351
|
+
/>
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
**Available Languages:**
|
|
355
|
+
|
|
356
|
+
- `en` - English
|
|
357
|
+
- `es` - Spanish / Español
|
|
358
|
+
- `pt` - Portuguese / Português
|
|
359
|
+
- `fr` - French / Français
|
|
360
|
+
- `it` - Italian / Italiano
|
|
361
|
+
- `ru` - Russian / Русский
|
|
362
|
+
- `ja` - Japanese / 日本語
|
|
363
|
+
- `de` - German / Deutsch
|
|
364
|
+
- `zh` - Chinese (Simplified) / 简体中文
|
|
365
|
+
|
|
366
|
+
**Props:**
|
|
367
|
+
|
|
368
|
+
- `selectedLanguage` - Selected language code (default: `'en'`)
|
|
369
|
+
- `onLanguageChange` - Callback when language changes
|
|
370
|
+
- `availableLanguages` - Array of language codes to display
|
|
371
|
+
- `size` - Size: `'sm' | 'md' | 'lg'` (default: `'md'`)
|
|
372
|
+
- `colors?: BaseColorConfig` - Color configuration
|
|
373
|
+
- `customBorderColor?: string` - Override button border
|
|
374
|
+
- `customBgColor?: string` - Override button background
|
|
375
|
+
- `customTextColor?: string` - Override text color
|
|
376
|
+
|
|
377
|
+
**Auto-calculated:**
|
|
378
|
+
|
|
379
|
+
- Dropdown background (from secondary)
|
|
380
|
+
- Item hover states
|
|
381
|
+
- Active item background
|
|
382
|
+
- Check icon color (from primary)
|
|
383
|
+
- Border hover states
|
|
384
|
+
|
|
385
|
+
**Auto Translations:**
|
|
386
|
+
|
|
387
|
+
Language names are displayed in the selected language. For example:
|
|
388
|
+
|
|
389
|
+
- If `selectedLanguage="en"`: Spanish, French, German
|
|
390
|
+
- If `selectedLanguage="es"`: Español, Francés, Alemán
|
|
391
|
+
- If `selectedLanguage="fr"`: Espagnol, Français, Allemand
|
|
392
|
+
|
|
393
|
+
### Table
|
|
394
|
+
|
|
395
|
+
Data table with sorting, pagination, and custom styling.
|
|
396
|
+
|
|
397
|
+
```tsx
|
|
398
|
+
import { Table, BaseColorConfig } from '@khraben/flowui';
|
|
399
|
+
|
|
400
|
+
const colors: BaseColorConfig = {
|
|
401
|
+
primary: '#3B82F6',
|
|
402
|
+
secondary: '#8B5CF6',
|
|
403
|
+
accent: '#EC4899',
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
<Table
|
|
407
|
+
columns={[
|
|
408
|
+
{ key: 'name', label: 'Name', sortable: true },
|
|
409
|
+
{ key: 'email', label: 'Email' },
|
|
410
|
+
]}
|
|
411
|
+
data={users}
|
|
412
|
+
onEdit={(user) => console.log(user)}
|
|
413
|
+
onDelete={(user) => console.log(user)}
|
|
414
|
+
colors={colors}
|
|
415
|
+
/>
|
|
416
|
+
|
|
417
|
+
// With custom overrides
|
|
418
|
+
<Table
|
|
419
|
+
columns={columns}
|
|
420
|
+
data={data}
|
|
421
|
+
colors={colors}
|
|
422
|
+
customHeaderBg="#1F2937"
|
|
423
|
+
customRowBg="#111827"
|
|
424
|
+
/>
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
**Props:**
|
|
428
|
+
|
|
429
|
+
- `columns` - Array of column definitions
|
|
430
|
+
- `data` - Array of data objects
|
|
431
|
+
- `onEdit?` - Edit callback function
|
|
432
|
+
- `onDelete?` - Delete callback function
|
|
433
|
+
- `colors?: BaseColorConfig` - Color configuration
|
|
434
|
+
- `customHeaderBg?: string` - Override header background
|
|
435
|
+
- `customRowBg?: string` - Override row background
|
|
436
|
+
|
|
437
|
+
**Auto-calculated:**
|
|
438
|
+
|
|
439
|
+
- Header text color (based on contrast)
|
|
440
|
+
- Row hover states
|
|
441
|
+
- Border colors
|
|
442
|
+
- Action icon colors
|
|
443
|
+
- Sort indicator colors
|
|
444
|
+
|
|
445
|
+
### BaseModal
|
|
446
|
+
|
|
447
|
+
Modal foundation with gradient headers and animations.
|
|
448
|
+
|
|
449
|
+
```tsx
|
|
450
|
+
import { BaseModal, ExtendedColorConfig } from '@khraben/flowui';
|
|
451
|
+
import { CheckCircle } from 'lucide-react';
|
|
452
|
+
|
|
453
|
+
const colors: ExtendedColorConfig = {
|
|
454
|
+
primary: '#3B82F6',
|
|
455
|
+
secondary: '#8B5CF6',
|
|
456
|
+
accent: '#EC4899',
|
|
457
|
+
warning: '#F59E0B',
|
|
458
|
+
success: '#10B981',
|
|
459
|
+
danger: '#EF4444',
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
<BaseModal
|
|
463
|
+
isOpen={true}
|
|
464
|
+
onClose={() => setOpen(false)}
|
|
465
|
+
title="Success"
|
|
466
|
+
icon={CheckCircle}
|
|
467
|
+
colors={colors}
|
|
468
|
+
>
|
|
469
|
+
<p>Operation completed successfully</p>
|
|
470
|
+
</BaseModal>
|
|
471
|
+
|
|
472
|
+
// With custom overrides
|
|
473
|
+
<BaseModal
|
|
474
|
+
colors={colors}
|
|
475
|
+
customOverlayBg="rgba(0, 0, 0, 0.8)"
|
|
476
|
+
customModalBg="#1F2937"
|
|
477
|
+
title="Custom Modal"
|
|
478
|
+
>
|
|
479
|
+
<p>Content here</p>
|
|
480
|
+
</BaseModal>
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
**Props:**
|
|
484
|
+
|
|
485
|
+
- `isOpen` - Modal visibility state
|
|
486
|
+
- `onClose` - Close callback
|
|
487
|
+
- `title` - Modal title
|
|
488
|
+
- `icon?` - Header icon component
|
|
489
|
+
- `colors?: ExtendedColorConfig` - Color configuration
|
|
490
|
+
- `customOverlayBg?: string` - Override overlay background
|
|
491
|
+
- `customModalBg?: string` - Override modal background
|
|
492
|
+
- `hasUnsavedChanges?` - Show confirmation on close
|
|
493
|
+
|
|
494
|
+
**Auto-calculated:**
|
|
495
|
+
|
|
496
|
+
- Header gradient (primary to secondary)
|
|
497
|
+
- Header text color (based on contrast)
|
|
498
|
+
- Close button states
|
|
499
|
+
- Stats section colors
|
|
500
|
+
- Scrollbar styling
|
|
501
|
+
- Confirmation dialog colors
|
|
502
|
+
|
|
503
|
+
### ConfirmationModal
|
|
504
|
+
|
|
505
|
+
Pre-built confirmation dialog with async support.
|
|
506
|
+
|
|
507
|
+
```tsx
|
|
508
|
+
import { ConfirmationModal, ExtendedColorConfig } from '@khraben/flowui';
|
|
509
|
+
|
|
510
|
+
const colors: ExtendedColorConfig = {
|
|
511
|
+
primary: '#3B82F6',
|
|
512
|
+
secondary: '#8B5CF6',
|
|
513
|
+
accent: '#EC4899',
|
|
514
|
+
warning: '#F59E0B',
|
|
515
|
+
success: '#10B981',
|
|
516
|
+
danger: '#EF4444',
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
<ConfirmationModal
|
|
520
|
+
isOpen={true}
|
|
521
|
+
onClose={() => setOpen(false)}
|
|
522
|
+
onConfirm={async () => {
|
|
523
|
+
await deleteUser();
|
|
524
|
+
}}
|
|
525
|
+
message="Are you sure you want to delete this user?"
|
|
526
|
+
confirmText="Delete"
|
|
527
|
+
cancelText="Cancel"
|
|
528
|
+
colors={colors}
|
|
529
|
+
/>;
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
**Props:**
|
|
533
|
+
|
|
534
|
+
- `isOpen` - Modal visibility state
|
|
535
|
+
- `onClose` - Close callback
|
|
536
|
+
- `onConfirm` - Confirm callback (can be async)
|
|
537
|
+
- `message` - Confirmation message
|
|
538
|
+
- `confirmText?` - Confirm button text
|
|
539
|
+
- `cancelText?` - Cancel button text
|
|
540
|
+
- `colors?: ExtendedColorConfig` - Color configuration
|
|
541
|
+
- `loadingContent?` - Custom loading component
|
|
542
|
+
|
|
543
|
+
**Auto-calculated:**
|
|
544
|
+
|
|
545
|
+
All colors are automatically managed through the BaseModal component.
|
|
546
|
+
|
|
547
|
+
### SideBar
|
|
548
|
+
|
|
549
|
+
Collapsible navigation sidebar with top and bottom sections.
|
|
550
|
+
|
|
551
|
+
```tsx
|
|
552
|
+
import { SideBar, BaseColorConfig } from '@khraben/flowui';
|
|
553
|
+
import { Home, Users, Settings, LogOut } from 'lucide-react';
|
|
554
|
+
|
|
555
|
+
const colors: BaseColorConfig = {
|
|
556
|
+
primary: '#3B82F6',
|
|
557
|
+
secondary: '#8B5CF6',
|
|
558
|
+
accent: '#EC4899',
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
const menuItems = [
|
|
562
|
+
{
|
|
563
|
+
id: 'home',
|
|
564
|
+
label: 'Home',
|
|
565
|
+
icon: <Home />,
|
|
566
|
+
onClick: () => router.push('/'),
|
|
567
|
+
section: 'top', // Optional: 'top' | 'bottom'
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
id: 'users',
|
|
571
|
+
label: 'Users',
|
|
572
|
+
icon: <Users />,
|
|
573
|
+
onClick: () => router.push('/users'),
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
id: 'settings',
|
|
577
|
+
label: 'Settings',
|
|
578
|
+
icon: <Settings />,
|
|
579
|
+
onClick: () => router.push('/settings'),
|
|
580
|
+
section: 'bottom',
|
|
581
|
+
},
|
|
582
|
+
];
|
|
583
|
+
|
|
584
|
+
const logoutButton = {
|
|
585
|
+
label: 'Logout',
|
|
586
|
+
icon: <LogOut />,
|
|
587
|
+
onClick: () => handleLogout(),
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
<SideBar
|
|
591
|
+
menuItems={menuItems}
|
|
592
|
+
logoutButton={logoutButton}
|
|
593
|
+
isOpen={isOpen}
|
|
594
|
+
onToggle={(open) => setIsOpen(open)}
|
|
595
|
+
colors={colors}
|
|
596
|
+
/>;
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
### NavBar
|
|
600
|
+
|
|
601
|
+
Modern responsive navigation bar with logo, menu items, and action buttons.
|
|
602
|
+
|
|
603
|
+
````tsx
|
|
604
|
+
import { NavBar, BaseColorConfig } from '@khraben/flowui';
|
|
605
|
+
import { ShoppingCart } from 'lucide-react';
|
|
606
|
+
|
|
607
|
+
const colors: BaseColorConfig = {
|
|
608
|
+
primary: '#3B82F6',
|
|
609
|
+
secondary: '#8B5CF6',
|
|
610
|
+
accent: '#EC4899',
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
const logo = {
|
|
614
|
+
text: 'MyApp',
|
|
615
|
+
href: '/',
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
const menuItems = [
|
|
619
|
+
{
|
|
620
|
+
id: 'home',
|
|
621
|
+
label: 'Home',
|
|
622
|
+
onClick: () => router.push('/'),
|
|
623
|
+
isActive: pathname === '/',
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
id: 'products',
|
|
627
|
+
label: 'Products',
|
|
628
|
+
href: '/products',
|
|
629
|
+
isActive: pathname === '/products',
|
|
630
|
+
},
|
|
631
|
+
];
|
|
632
|
+
|
|
633
|
+
const actions = [
|
|
634
|
+
{
|
|
635
|
+
id: 'cart',
|
|
636
|
+
label: 'Cart',
|
|
637
|
+
icon: <ShoppingCart size={16} />,
|
|
638
|
+
onClick: () => router.push('/cart'),
|
|
639
|
+
variant: 'outline',
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
id: 'signup',
|
|
643
|
+
label: 'Sign Up',
|
|
644
|
+
onClick: () => router.push('/signup'),
|
|
645
|
+
variant: 'primary',
|
|
646
|
+
},
|
|
647
|
+
];
|
|
648
|
+
|
|
649
|
+
<NavBar
|
|
650
|
+
logo={logo}
|
|
651
|
+
menuItems={menuItems}
|
|
652
|
+
actions={actions}
|
|
653
|
+
colors={colors}
|
|
654
|
+
/>
|
|
655
|
+
|
|
656
|
+
### Gallery
|
|
657
|
+
|
|
658
|
+
Responsive masonry gallery with lazy loading, infinite scroll, and smooth animations.
|
|
659
|
+
|
|
660
|
+
```tsx
|
|
661
|
+
import { Gallery } from '@khraben/flowui';
|
|
662
|
+
|
|
663
|
+
const images = [
|
|
664
|
+
{
|
|
665
|
+
id: '1',
|
|
666
|
+
src: 'https://example.com/image1.jpg',
|
|
667
|
+
alt: 'Beautiful landscape',
|
|
668
|
+
width: 800,
|
|
669
|
+
height: 600,
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
id: '2',
|
|
673
|
+
src: 'https://example.com/image2.jpg',
|
|
674
|
+
alt: 'City skyline',
|
|
675
|
+
width: 600,
|
|
676
|
+
height: 800,
|
|
677
|
+
},
|
|
678
|
+
// ... more images
|
|
679
|
+
];
|
|
680
|
+
|
|
681
|
+
<Gallery
|
|
682
|
+
images={images}
|
|
683
|
+
batchSize={12}
|
|
684
|
+
enableAnimation={true}
|
|
685
|
+
colors={{
|
|
686
|
+
primary: '#1E90FF',
|
|
687
|
+
secondary: '#2C3135',
|
|
688
|
+
accent: '#00D4FF',
|
|
689
|
+
}}
|
|
690
|
+
/>;
|
|
691
|
+
````
|
|
692
|
+
|
|
693
|
+
**Props:**
|
|
694
|
+
|
|
695
|
+
- `images` - Array of image objects (id, src, alt, width, height)
|
|
696
|
+
- `batchSize?` - Number of images to load per batch (default: 12)
|
|
697
|
+
- `enableAnimation?` - Enable scroll animations (default: true)
|
|
698
|
+
- `className?` - Additional CSS classes
|
|
699
|
+
- `colors?` - BaseColorConfig for dynamic theming
|
|
700
|
+
- `customBorderColor?` - Override border color
|
|
701
|
+
- `customSkeletonBg?` - Override skeleton background
|
|
702
|
+
- `customOverlayColor?` - Override hover overlay color
|
|
703
|
+
|
|
704
|
+
**Features:**
|
|
705
|
+
|
|
706
|
+
- 📱 Responsive layout (1/2/3 columns)
|
|
707
|
+
- 🎨 CSS columns masonry layout
|
|
708
|
+
- 🖼️ Maintains original aspect ratios
|
|
709
|
+
- ⚡ Lazy loading with IntersectionObserver
|
|
710
|
+
- 🔄 Infinite scroll support
|
|
711
|
+
- ✨ Framer Motion animations
|
|
712
|
+
- 🎯 Hover effects with zoom and overlay
|
|
713
|
+
|
|
714
|
+
### DatePicker
|
|
715
|
+
|
|
716
|
+
Calendar date picker with range selection.
|
|
717
|
+
|
|
718
|
+
```tsx
|
|
719
|
+
import { DatePicker, BaseColorConfig } from '@khraben/flowui';
|
|
720
|
+
|
|
721
|
+
const colors: BaseColorConfig = {
|
|
722
|
+
primary: '#3B82F6',
|
|
723
|
+
secondary: '#8B5CF6',
|
|
724
|
+
accent: '#EC4899',
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
<DatePicker selected={date} onChange={(date) => setDate(date)} colors={colors} />;
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
## � Default Color System
|
|
731
|
+
|
|
732
|
+
All components use sensible defaults if no colors are provided:
|
|
733
|
+
|
|
734
|
+
```tsx
|
|
735
|
+
import { DEFAULT_COLOR_CONFIG } from '@khraben/flowui';
|
|
736
|
+
|
|
737
|
+
// Default theme (professional blue/purple)
|
|
738
|
+
DEFAULT_COLOR_CONFIG = {
|
|
739
|
+
primary: '#1E90FF',
|
|
740
|
+
secondary: '#2C3135',
|
|
741
|
+
accent: '#00D4FF'
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
// Components use defaults automatically
|
|
745
|
+
<Button variant="primary">Uses default colors</Button>
|
|
746
|
+
|
|
747
|
+
// Or provide your own
|
|
748
|
+
<Button colors={myColors} variant="primary">Uses custom colors</Button>
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
## 📖 Documentation
|
|
752
|
+
|
|
753
|
+
- [Constants System](docs/CONSTANTS.md) - Exported constants and TypeScript types
|
|
754
|
+
- [Color Utilities](src/app/utils/colorUtils.ts) - Helper functions for color manipulation
|
|
755
|
+
|
|
756
|
+
## 🔒 License
|
|
757
|
+
|
|
758
|
+
MIT - See [LICENSE](LICENSE) for details.
|