@diyet24/design-system 0.1.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/README.md ADDED
@@ -0,0 +1,592 @@
1
+ # Diyet24 Design System
2
+
3
+ A production-ready React component library built with TypeScript, Tailwind CSS v4, and Radix UI primitives. Designed for Next.js App Router with full RSC support, comprehensive Storybook documentation, and advanced animation system
4
+
5
+ ## ✨ Features
6
+
7
+ - 🎨 **50+ Production-Ready Components** - Complete UI toolkit with shadcn/ui integration
8
+ - 🚀 **Next.js 15 App Router Ready** - Full RSC support with "use client" directives
9
+ - 📚 **Comprehensive Storybook** - Interactive documentation with accessibility testing
10
+ - 🎯 **TypeScript First** - Full type safety, strict mode, and IntelliSense
11
+ - 🎨 **Tailwind CSS v4** - CSS-first architecture with design tokens
12
+ - ♿ **Accessibility** - WCAG 2.1 AA compliant with ARIA support
13
+ - 🌙 **Dark Mode** - Built-in theme system with CSS variables
14
+ - 📦 **Tree Shakable** - Optimized bundle size with ESM/CJS support
15
+ - 🔧 **Radix UI Powered** - Accessible, unstyled primitives
16
+ - ⚡ **Advanced Animations** - Smooth transitions with Radix transform-origin support
17
+ - 🎭 **CVA Integration** - Type-safe component variants with class-variance-authority
18
+ - 🔄 **Dynamic Interactions** - Ripple effects, scroll overlays, and micro-animations
19
+
20
+ ## 📦 Installation
21
+
22
+ ```bash
23
+ npm install @diyet24/design-system
24
+ # or
25
+ pnpm add @diyet24/design-system
26
+ # or
27
+ yarn add @diyet24/design-system
28
+ ```
29
+
30
+ ### Peer Dependencies
31
+ ```bash
32
+ npm install react@^18.0.0 react-dom@^18.0.0 lucide-react
33
+ ```
34
+
35
+ ## 🚀 Quick Start
36
+
37
+ ### 1. Setup Tailwind CSS v4
38
+
39
+ **Install Tailwind CSS v4:**
40
+ ```bash
41
+ npm install tailwindcss@next @tailwindcss/postcss@next
42
+ ```
43
+
44
+ **Configure your CSS file (e.g., `app/globals.css`):**
45
+ ```css
46
+ @import "tailwindcss";
47
+ @import "@diyet24/design-system/styles.css";
48
+
49
+ /* Your custom CSS */
50
+ ```
51
+
52
+ **⚠️ Important:** The order matters! Import `tailwindcss` first, then the design system styles.
53
+
54
+ ### 2. Configure Tailwind (Optional - for theme customization)
55
+
56
+ If you want to extend or customize the theme:
57
+
58
+ ```typescript
59
+ // tailwind.config.ts
60
+ import type { Config } from 'tailwindcss';
61
+ import { colors, spacing, shadows } from '@diyet24/design-system/tailwind';
62
+
63
+ const config: Config = {
64
+ content: [
65
+ './src/**/*.{js,ts,jsx,tsx,mdx}',
66
+ './node_modules/@diyet24/design-system/dist/**/*.{js,mjs}',
67
+ ],
68
+ theme: {
69
+ extend: {
70
+ colors, // Design system color palette
71
+ spacing, // Consistent spacing scale
72
+ boxShadow: shadows, // Elevation system
73
+ },
74
+ },
75
+ };
76
+
77
+ export default config;
78
+ ```
79
+
80
+ ### 3. Use Components
81
+
82
+ ```tsx
83
+ import { Button, Card, CardContent, CardHeader, CardTitle } from '@diyet24/design-system';
84
+
85
+ export default function MyPage() {
86
+ return (
87
+ <Card className="w-96">
88
+ <CardHeader>
89
+ <CardTitle>Welcome to Diyet24</CardTitle>
90
+ </CardHeader>
91
+ <CardContent>
92
+ <Button variant="contained" color="primary">
93
+ Get Started
94
+ </Button>
95
+ </CardContent>
96
+ </Card>
97
+ );
98
+ }
99
+ ```
100
+
101
+ ## 🎨 Component Categories
102
+
103
+ ### Form & Input (15 components)
104
+ - **Button** - 5 variants (contained, outline, ghost, tonal, link) × 6 colors with ripple effects
105
+ - **Input** - Text input with validation states
106
+ - **Textarea** - Multi-line text input
107
+ - **Checkbox** - Accessible checkbox with indeterminate state
108
+ - **Radio Group** - Radio button groups
109
+ - **Select** - Native-like dropdown with search
110
+ - **Combobox** - Searchable select with autocomplete
111
+ - **Switch** - Toggle switch component
112
+ - **Slider** - Range input slider
113
+ - **Calendar** - Date picker calendar
114
+ - **Date Picker** - Date selection with calendar popup
115
+ - **Input OTP** - One-time password input
116
+ - **Label** - Form field labels
117
+ - **Toggle** - Binary toggle button
118
+ - **Toggle Group** - Grouped toggle buttons
119
+
120
+ ### Layout & Navigation (12 components)
121
+ - **Card** - Container with header, content, and footer
122
+ - **Tabs** - Tabbed navigation
123
+ - **Accordion** - Collapsible content sections
124
+ - **Navigation Menu** - Complex navigation with dropdowns (with Portal support)
125
+ - **Breadcrumb** - Breadcrumb navigation trail
126
+ - **Pagination** - Page navigation component
127
+ - **Separator** - Visual divider
128
+ - **Aspect Ratio** - Aspect ratio container
129
+ - **Scroll Area** - Custom scrollable area with gradient overlays
130
+ - **Resizable** - Resizable panel layouts
131
+ - **Flex** - Flexbox utility component
132
+ - **Grid** - Grid utility component
133
+
134
+ ### Overlay & Modal (10 components)
135
+ - **Dialog** - Modal dialog with animations
136
+ - **Alert Dialog** - Confirmation dialog
137
+ - **Sheet** - Slide-in panel (4 directions with smooth slide animations)
138
+ - **Drawer** - Bottom drawer with drag gesture
139
+ - **Popover** - Floating content container (with transform-origin positioning)
140
+ - **Dropdown Menu** - Contextual menu (with transform-origin positioning)
141
+ - **Context Menu** - Right-click menu (with transform-origin positioning)
142
+ - **Hover Card** - Hover-triggered card (with transform-origin positioning)
143
+ - **Tooltip** - Informational tooltip
144
+ - **Command** - Command palette / Quick search
145
+
146
+ ### Feedback & Display (8 components)
147
+ - **Toast** - Notification system (with Sonner)
148
+ - **Alert** - Inline alert messages
149
+ - **Badge** - Status badges and labels
150
+ - **Avatar** - User avatar with fallback
151
+ - **Progress** - Progress bar indicator
152
+ - **Skeleton** - Loading placeholder
153
+ - **Spinner** - Loading spinner
154
+ - **Typography** - Text styling utilities
155
+
156
+ ### Data & Table (3 components)
157
+ - **Table** - Semantic HTML table
158
+ - **Data Table** - Advanced table with sorting, filtering, pagination (@tanstack/react-table)
159
+ - **Collapsible** - Collapsible content container
160
+
161
+ ### Advanced Components (4 components)
162
+ - **Carousel** - Image/content carousel (Embla)
163
+ - **Menubar** - Application menu bar
164
+ - **Dashboard** - Dashboard layout container
165
+ - **Section** - Semantic section wrapper
166
+ - **KBD** - Keyboard key display
167
+
168
+ ## 🎯 Advanced Features
169
+
170
+ ### Button Variants & Colors
171
+
172
+ The Button component uses a matrix system with CVA:
173
+
174
+ ```tsx
175
+ // 5 Variants × 6 Colors = 30 Combinations
176
+ <Button variant="contained" color="primary">Contained Primary</Button>
177
+ <Button variant="outline" color="danger">Outline Danger</Button>
178
+ <Button variant="ghost" color="success">Ghost Success</Button>
179
+ <Button variant="tonal" color="warning">Tonal Warning</Button>
180
+ <Button variant="link" color="info">Link Info</Button>
181
+
182
+ // Sizes
183
+ <Button size="sm">Small</Button>
184
+ <Button size="default">Default</Button>
185
+ <Button size="lg">Large</Button>
186
+ <Button size="xl">Extra Large</Button>
187
+ <Button size="icon-sm">Icon</Button>
188
+
189
+ // Ripple Effect (automatic)
190
+ // - White ripple on contained variants
191
+ // - Colored ripple (20% opacity) on outline/ghost/tonal/link
192
+ ```
193
+
194
+ ### Animation System
195
+
196
+ All portal-based components use Radix UI's transform-origin CSS variables for smooth, position-accurate animations:
197
+
198
+ ```css
199
+ /* Automatic transform-origin positioning */
200
+ .PopoverContent {
201
+ transform-origin: var(--radix-popover-content-transform-origin);
202
+ }
203
+
204
+ .DropdownMenuContent {
205
+ transform-origin: var(--radix-dropdown-menu-content-transform-origin);
206
+ }
207
+
208
+ .SelectContent {
209
+ transform-origin: var(--radix-select-content-transform-origin);
210
+ }
211
+
212
+ /* And more... */
213
+ ```
214
+
215
+ **Components with optimized animations:**
216
+ - Popover
217
+ - Dropdown Menu
218
+ - Context Menu
219
+ - Hover Card
220
+ - Select
221
+ - Menubar
222
+ - Navigation Menu
223
+ - Sheet (slide animations from 4 directions)
224
+
225
+ ### Scroll Area Enhancements
226
+
227
+ ScrollArea includes automatic gradient overlays that show/hide based on scroll position:
228
+
229
+ ```tsx
230
+ <ScrollArea className="h-72">
231
+ {/* Top gradient appears when scrolled down */}
232
+ {/* Bottom gradient appears when more content below */}
233
+ <YourContent />
234
+ </ScrollArea>
235
+ ```
236
+
237
+ ### Data Table Features
238
+
239
+ The DataTable component is production-ready with:
240
+
241
+ ```tsx
242
+ import { DataTable } from '@diyet24/design-system';
243
+ import { ColumnDef } from '@tanstack/react-table';
244
+
245
+ const columns: ColumnDef<User>[] = [
246
+ {
247
+ accessorKey: 'name',
248
+ header: 'Name',
249
+ enableSorting: true,
250
+ },
251
+ // ... more columns
252
+ ];
253
+
254
+ <DataTable
255
+ columns={columns}
256
+ data={users}
257
+ searchable
258
+ searchPlaceholder="Search users..."
259
+ pageSize={10}
260
+ />
261
+ ```
262
+
263
+ **Features:**
264
+ - Column sorting
265
+ - Global search with debounce
266
+ - Pagination with page size options
267
+ - Row selection
268
+ - Custom cell renderers
269
+ - Loading states
270
+ - Empty states
271
+
272
+ ## 🎨 Theme Configuration
273
+
274
+ ### Color System
275
+
276
+ The design system uses a comprehensive color palette with CSS variables:
277
+
278
+ ```typescript
279
+ import { colors } from '@diyet24/design-system/tailwind';
280
+
281
+ // Available colors:
282
+ colors.primary // #7367F0 (with shades 100-900)
283
+ colors.secondary // #808390
284
+ colors.success // #28C76F
285
+ colors.warning // #FF9F43
286
+ colors.danger // #FF4C51
287
+ colors.info // #00BAD1
288
+ ```
289
+
290
+ ### Dark Mode
291
+
292
+ Dark mode is handled automatically via CSS variables:
293
+
294
+ ```tsx
295
+ import { ThemeProvider } from 'next-themes';
296
+
297
+ function App({ children }) {
298
+ return (
299
+ <ThemeProvider attribute="class" defaultTheme="system">
300
+ {children}
301
+ </ThemeProvider>
302
+ );
303
+ }
304
+ ```
305
+
306
+ ### Customizing Theme
307
+
308
+ Override CSS variables in your global CSS:
309
+
310
+ ```css
311
+ :root {
312
+ --primary: #your-color;
313
+ --radius: 8px;
314
+ }
315
+
316
+ .dark {
317
+ --primary: #your-dark-color;
318
+ }
319
+ ```
320
+
321
+ ## 📖 Storybook
322
+
323
+ Explore all components interactively:
324
+
325
+ ```bash
326
+ cd design-system
327
+ npm run dev
328
+ # Opens http://localhost:6006
329
+ ```
330
+
331
+ **Storybook features:**
332
+ - 📝 Interactive component playground
333
+ - 🎨 All variants and states documented
334
+ - ♿ Accessibility testing (a11y addon)
335
+ - 📱 Responsive preview
336
+ - 🌙 Dark mode toggle
337
+ - 📋 Code snippets for each example
338
+
339
+ ## 🏗️ Development
340
+
341
+ ### Project Structure
342
+
343
+ ```
344
+ design-system/
345
+ ├── src/
346
+ │ ├── components/
347
+ │ │ └── ui/
348
+ │ │ ├── button/
349
+ │ │ │ ├── button.tsx
350
+ │ │ │ └── button.stories.tsx
351
+ │ │ ├── card/
352
+ │ │ └── ... (50+ components)
353
+ │ ├── styles/
354
+ │ │ └── index.css # Theme, animations, CSS variables
355
+ │ ├── tailwind/
356
+ │ │ └── index.ts # Exportable Tailwind config
357
+ │ └── index.ts # Main export file
358
+ ├── dist/
359
+ │ ├── index.js # ESM bundle
360
+ │ ├── index.cjs # CommonJS bundle
361
+ │ ├── index.d.ts # TypeScript definitions
362
+ │ └── styles.css # Compiled CSS
363
+ ├── package.json
364
+ ├── tsconfig.json
365
+ ├── tsup.config.ts # Build configuration
366
+ └── README.md
367
+ ```
368
+
369
+ ### Build System
370
+
371
+ The library uses **tsup** for bundling:
372
+
373
+ ```json
374
+ {
375
+ "exports": {
376
+ ".": {
377
+ "types": "./dist/index.d.ts",
378
+ "import": "./dist/index.js",
379
+ "require": "./dist/index.cjs"
380
+ },
381
+ "./tailwind": {
382
+ "types": "./dist/tailwind/index.d.ts",
383
+ "import": "./dist/tailwind/index.js",
384
+ "require": "./dist/tailwind/index.cjs"
385
+ },
386
+ "./styles.css": "./dist/styles.css",
387
+ "./styles": "./dist/styles.css"
388
+ }
389
+ }
390
+ ```
391
+
392
+ **Features:**
393
+ - ✅ Dual format (ESM + CJS)
394
+ - ✅ TypeScript declarations (.d.ts)
395
+ - ✅ Source maps
396
+ - ✅ Tree shaking support
397
+ - ✅ "use client" directive for all components
398
+ - ✅ External React/React-DOM (peer dependencies)
399
+
400
+ ### Scripts
401
+
402
+ ```bash
403
+ # Development
404
+ npm run dev # Start Storybook
405
+ npm run build # Build library
406
+ npm run build:storybook # Build Storybook static site
407
+
408
+ # Quality
409
+ npm run lint # ESLint
410
+ npm run format # Prettier
411
+ npm run typecheck # TypeScript check
412
+
413
+ # Publishing
414
+ npm run prepublishOnly # Runs build before publish
415
+ ```
416
+
417
+ ### Adding New Components
418
+
419
+ 1. **Create component directory:**
420
+ ```bash
421
+ mkdir src/components/ui/my-component
422
+ ```
423
+
424
+ 2. **Create component file:**
425
+ ```tsx
426
+ // src/components/ui/my-component/my-component.tsx
427
+ import * as React from "react";
428
+ import { cn } from "@/lib/utils";
429
+
430
+ export interface MyComponentProps extends React.HTMLAttributes<HTMLDivElement> {
431
+ variant?: "default" | "custom";
432
+ }
433
+
434
+ export const MyComponent = React.forwardRef<HTMLDivElement, MyComponentProps>(
435
+ ({ className, variant = "default", ...props }, ref) => {
436
+ return (
437
+ <div
438
+ ref={ref}
439
+ className={cn(
440
+ "base-styles",
441
+ variant === "custom" && "custom-styles",
442
+ className
443
+ )}
444
+ {...props}
445
+ />
446
+ );
447
+ }
448
+ );
449
+
450
+ MyComponent.displayName = "MyComponent";
451
+ ```
452
+
453
+ 3. **Create Storybook story:**
454
+ ```tsx
455
+ // src/components/ui/my-component/my-component.stories.tsx
456
+ import type { Meta, StoryObj } from '@storybook/react';
457
+ import { MyComponent } from './my-component';
458
+
459
+ const meta: Meta<typeof MyComponent> = {
460
+ title: 'Components/MyComponent',
461
+ component: MyComponent,
462
+ tags: ['autodocs'],
463
+ };
464
+
465
+ export default meta;
466
+ type Story = StoryObj<typeof MyComponent>;
467
+
468
+ export const Default: Story = {
469
+ args: {
470
+ variant: 'default',
471
+ },
472
+ };
473
+ ```
474
+
475
+ 4. **Export from index:**
476
+ ```tsx
477
+ // src/components/ui/index.ts
478
+ export * from './my-component/my-component';
479
+ ```
480
+
481
+ ## 🔧 Technical Details
482
+
483
+ ### TypeScript Configuration
484
+
485
+ ```json
486
+ {
487
+ "compilerOptions": {
488
+ "target": "ES2020",
489
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
490
+ "module": "ESNext",
491
+ "moduleResolution": "bundler",
492
+ "strict": true,
493
+ "skipLibCheck": true,
494
+ "jsx": "react-jsx",
495
+ "paths": {
496
+ "@/*": ["./src/*"]
497
+ }
498
+ }
499
+ }
500
+ ```
501
+
502
+ ### CSS Architecture
503
+
504
+ **Tailwind v4 CSS-first approach:**
505
+ ```css
506
+ @import "tailwindcss"; /* Tailwind base */
507
+ @custom-variant dark (&:is(.dark *));
508
+ @source "../"; /* Auto-scan components */
509
+
510
+ :root {
511
+ /* CSS Variables */
512
+ --primary: #7367F0;
513
+ /* ... */
514
+ }
515
+
516
+ .dark {
517
+ /* Dark mode overrides */
518
+ --primary: #7367F0;
519
+ /* ... */
520
+ }
521
+ ```
522
+
523
+ **Custom Animations:**
524
+ - Radix transform-origin integration
525
+ - Scale-based animations (zoom-in/out)
526
+ - Slide animations (4 directions)
527
+ - Fade transitions
528
+ - Accordion slide down/up
529
+ - Ripple effects
530
+
531
+ ### Bundle Size
532
+
533
+ **Optimizations:**
534
+ - Tree-shakable exports
535
+ - External React/React-DOM
536
+ - No runtime CSS-in-JS
537
+ - Minification disabled (consumer handles)
538
+ - Source maps for debugging
539
+
540
+ **Typical imports:**
541
+ ```tsx
542
+ // Only imports Button code
543
+ import { Button } from '@diyet24/design-system';
544
+ // ~15KB (gzipped)
545
+
546
+ // Only imports Table components
547
+ import { Table, TableBody, TableCell } from '@diyet24/design-system';
548
+ // ~8KB (gzipped)
549
+ ```
550
+
551
+ ## 🤝 Contributing
552
+
553
+ 1. Clone the repository
554
+ 2. Install dependencies: `pnpm install`
555
+ 3. Start Storybook: `pnpm dev`
556
+ 4. Make changes and test in Storybook
557
+ 5. Build: `pnpm build`
558
+ 6. Create pull request
559
+
560
+ ### Code Style
561
+
562
+ - Use TypeScript strict mode
563
+ - Follow React best practices
564
+ - Use forwardRef for components
565
+ - Include displayName
566
+ - Document with JSDoc comments
567
+ - Create Storybook stories
568
+ - Test accessibility
569
+
570
+ ## 📝 License
571
+
572
+ MIT © Diyet24
573
+
574
+ ## 🔗 Links
575
+
576
+ - [Storybook](http://localhost:6006) (local development)
577
+ - [Repository](https://github.com/diyet24/design-system)
578
+ - [NPM Package](https://www.npmjs.com/package/@diyet24/design-system)
579
+
580
+ ## 🙏 Acknowledgments
581
+
582
+ Built with:
583
+ - [Radix UI](https://www.radix-ui.com/) - Accessible primitives
584
+ - [Tailwind CSS](https://tailwindcss.com/) - Utility-first CSS
585
+ - [shadcn/ui](https://ui.shadcn.com/) - Component patterns
586
+ - [TanStack Table](https://tanstack.com/table) - Table functionality
587
+ - [Lucide Icons](https://lucide.dev/) - Icon system
588
+ - [Class Variance Authority](https://cva.style/) - Variant management
589
+
590
+ ---
591
+
592
+ **Built with ❤️ by Diyet24 Team**