create-huenei-template 0.2.3 → 0.2.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.
Files changed (86) hide show
  1. package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
  2. package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
  3. package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
  4. package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
  5. package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
  6. package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
  7. package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
  8. package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
  9. package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
  10. package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
  11. package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
  12. package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
  13. package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
  14. package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
  15. package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
  16. package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
  17. package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
  18. package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
  19. package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
  20. package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
  21. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
  22. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
  23. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
  24. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
  25. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
  26. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
  27. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
  28. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
  29. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
  30. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
  31. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
  32. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
  33. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
  34. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
  35. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
  36. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
  37. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
  38. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
  39. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
  40. package/dist/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
  41. package/dist/templates/frontend/angular-base/package.json +0 -1
  42. package/dist/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
  43. package/package.json +1 -1
  44. package/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
  45. package/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
  46. package/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
  47. package/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
  48. package/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
  49. package/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
  50. package/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
  51. package/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
  52. package/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
  53. package/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
  54. package/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
  55. package/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
  56. package/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
  57. package/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
  58. package/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
  59. package/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
  60. package/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
  61. package/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
  62. package/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
  63. package/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
  64. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
  65. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
  66. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
  67. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
  68. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
  69. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
  70. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
  71. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
  72. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
  73. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
  74. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
  75. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
  76. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
  77. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
  78. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
  79. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
  80. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
  81. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
  82. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
  83. package/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
  84. package/templates/frontend/angular-base/package.json +0 -1
  85. package/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
  86. package/templates/frontend/angular-base/package-lock.json +0 -13321
@@ -0,0 +1,718 @@
1
+ ---
2
+ name: tailwindcss-advanced-components
3
+ description: Tailwind CSS advanced component patterns with CVA integration and variant management
4
+ ---
5
+
6
+ # Tailwind CSS Advanced Component Patterns
7
+
8
+ ## Component Variants with CVA
9
+
10
+ ### Class Variance Authority Integration
11
+
12
+ ```bash
13
+ npm install class-variance-authority
14
+ ```
15
+
16
+ ```typescript
17
+ // components/Button.tsx
18
+ import { cva, type VariantProps } from 'class-variance-authority';
19
+ import { cn } from '@/lib/utils';
20
+
21
+ const buttonVariants = cva(
22
+ // Base styles
23
+ 'inline-flex items-center justify-center rounded-lg font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
24
+ {
25
+ variants: {
26
+ variant: {
27
+ default: 'bg-brand-500 text-white hover:bg-brand-600 focus-visible:ring-brand-500',
28
+ secondary: 'bg-gray-100 text-gray-900 hover:bg-gray-200 focus-visible:ring-gray-500',
29
+ outline: 'border border-gray-300 bg-transparent hover:bg-gray-100 focus-visible:ring-gray-500',
30
+ ghost: 'hover:bg-gray-100 focus-visible:ring-gray-500',
31
+ destructive: 'bg-red-500 text-white hover:bg-red-600 focus-visible:ring-red-500',
32
+ link: 'text-brand-500 underline-offset-4 hover:underline',
33
+ },
34
+ size: {
35
+ sm: 'h-8 px-3 text-sm',
36
+ md: 'h-10 px-4 text-sm',
37
+ lg: 'h-12 px-6 text-base',
38
+ xl: 'h-14 px-8 text-lg',
39
+ icon: 'h-10 w-10',
40
+ },
41
+ fullWidth: {
42
+ true: 'w-full',
43
+ },
44
+ },
45
+ compoundVariants: [
46
+ {
47
+ variant: 'outline',
48
+ size: 'sm',
49
+ className: 'border',
50
+ },
51
+ {
52
+ variant: 'outline',
53
+ size: ['md', 'lg', 'xl'],
54
+ className: 'border-2',
55
+ },
56
+ ],
57
+ defaultVariants: {
58
+ variant: 'default',
59
+ size: 'md',
60
+ },
61
+ }
62
+ );
63
+
64
+ export interface ButtonProps
65
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
66
+ VariantProps<typeof buttonVariants> {
67
+ asChild?: boolean;
68
+ }
69
+
70
+ export function Button({
71
+ className,
72
+ variant,
73
+ size,
74
+ fullWidth,
75
+ asChild = false,
76
+ ...props
77
+ }: ButtonProps) {
78
+ return (
79
+ <button
80
+ className={cn(buttonVariants({ variant, size, fullWidth, className }))}
81
+ {...props}
82
+ />
83
+ );
84
+ }
85
+ ```
86
+
87
+ ### Usage
88
+
89
+ ```tsx
90
+ <Button>Default</Button>
91
+ <Button variant="secondary" size="lg">Large Secondary</Button>
92
+ <Button variant="destructive" fullWidth>Delete</Button>
93
+ <Button variant="ghost" size="icon"><IconMenu /></Button>
94
+ ```
95
+
96
+ ## Compound Components Pattern
97
+
98
+ ### Context-Based Component System
99
+
100
+ ```tsx
101
+ // components/Card/index.tsx
102
+ import { createContext, useContext, forwardRef } from 'react';
103
+ import { cn } from '@/lib/utils';
104
+
105
+ // Context for shared state
106
+ const CardContext = createContext<{ variant?: 'default' | 'elevated' | 'outline' }>({});
107
+
108
+ // Root component
109
+ interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
110
+ variant?: 'default' | 'elevated' | 'outline';
111
+ }
112
+
113
+ const Card = forwardRef<HTMLDivElement, CardProps>(
114
+ ({ className, variant = 'default', children, ...props }, ref) => {
115
+ const variants = {
116
+ default: 'bg-white border border-gray-200',
117
+ elevated: 'bg-white shadow-lg',
118
+ outline: 'bg-transparent border-2 border-gray-300',
119
+ };
120
+
121
+ return (
122
+ <CardContext.Provider value={{ variant }}>
123
+ <div
124
+ ref={ref}
125
+ className={cn(
126
+ 'rounded-xl',
127
+ variants[variant],
128
+ className
129
+ )}
130
+ {...props}
131
+ >
132
+ {children}
133
+ </div>
134
+ </CardContext.Provider>
135
+ );
136
+ }
137
+ );
138
+
139
+ // Sub-components
140
+ const CardHeader = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
141
+ ({ className, ...props }, ref) => (
142
+ <div
143
+ ref={ref}
144
+ className={cn('flex flex-col gap-1.5 p-6 pb-0', className)}
145
+ {...props}
146
+ />
147
+ )
148
+ );
149
+
150
+ const CardTitle = forwardRef<HTMLHeadingElement, React.HTMLAttributes<HTMLHeadingElement>>(
151
+ ({ className, ...props }, ref) => (
152
+ <h3
153
+ ref={ref}
154
+ className={cn('text-xl font-semibold leading-none tracking-tight', className)}
155
+ {...props}
156
+ />
157
+ )
158
+ );
159
+
160
+ const CardDescription = forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
161
+ ({ className, ...props }, ref) => (
162
+ <p
163
+ ref={ref}
164
+ className={cn('text-sm text-gray-500', className)}
165
+ {...props}
166
+ />
167
+ )
168
+ );
169
+
170
+ const CardContent = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
171
+ ({ className, ...props }, ref) => (
172
+ <div ref={ref} className={cn('p-6', className)} {...props} />
173
+ )
174
+ );
175
+
176
+ const CardFooter = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
177
+ ({ className, ...props }, ref) => (
178
+ <div
179
+ ref={ref}
180
+ className={cn('flex items-center p-6 pt-0', className)}
181
+ {...props}
182
+ />
183
+ )
184
+ );
185
+
186
+ // Named exports
187
+ Card.displayName = 'Card';
188
+ CardHeader.displayName = 'CardHeader';
189
+ CardTitle.displayName = 'CardTitle';
190
+ CardDescription.displayName = 'CardDescription';
191
+ CardContent.displayName = 'CardContent';
192
+ CardFooter.displayName = 'CardFooter';
193
+
194
+ export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter };
195
+ ```
196
+
197
+ ### Usage
198
+
199
+ ```tsx
200
+ <Card variant="elevated">
201
+ <CardHeader>
202
+ <CardTitle>Account Settings</CardTitle>
203
+ <CardDescription>Manage your account preferences</CardDescription>
204
+ </CardHeader>
205
+ <CardContent>
206
+ <form>...</form>
207
+ </CardContent>
208
+ <CardFooter className="justify-between">
209
+ <Button variant="ghost">Cancel</Button>
210
+ <Button>Save Changes</Button>
211
+ </CardFooter>
212
+ </Card>
213
+ ```
214
+
215
+ ## Data Attribute Variants
216
+
217
+ ### CSS-Based State Management
218
+
219
+ ```css
220
+ /* Define data attribute variants */
221
+ @custom-variant data-state-open (&[data-state="open"]);
222
+ @custom-variant data-state-closed (&[data-state="closed"]);
223
+ @custom-variant data-side-top (&[data-side="top"]);
224
+ @custom-variant data-side-bottom (&[data-side="bottom"]);
225
+ @custom-variant data-side-left (&[data-side="left"]);
226
+ @custom-variant data-side-right (&[data-side="right"]);
227
+ @custom-variant data-highlighted (&[data-highlighted]);
228
+ @custom-variant data-disabled (&[data-disabled]);
229
+ ```
230
+
231
+ ```tsx
232
+ // Dropdown component using data attributes
233
+ function DropdownContent({ children, ...props }) {
234
+ return (
235
+ <div
236
+ data-state={isOpen ? 'open' : 'closed'}
237
+ data-side={side}
238
+ className="
239
+ absolute z-50 min-w-[8rem] overflow-hidden rounded-md
240
+ border border-gray-200 bg-white p-1 shadow-lg
241
+
242
+ data-state-open:animate-in
243
+ data-state-open:fade-in-0
244
+ data-state-open:zoom-in-95
245
+
246
+ data-state-closed:animate-out
247
+ data-state-closed:fade-out-0
248
+ data-state-closed:zoom-out-95
249
+
250
+ data-side-top:slide-in-from-bottom-2
251
+ data-side-bottom:slide-in-from-top-2
252
+ data-side-left:slide-in-from-right-2
253
+ data-side-right:slide-in-from-left-2
254
+ "
255
+ {...props}
256
+ >
257
+ {children}
258
+ </div>
259
+ );
260
+ }
261
+
262
+ function DropdownItem({ children, disabled, ...props }) {
263
+ return (
264
+ <div
265
+ data-highlighted={isHighlighted || undefined}
266
+ data-disabled={disabled || undefined}
267
+ className="
268
+ relative flex cursor-pointer select-none items-center
269
+ rounded-sm px-2 py-1.5 text-sm outline-none
270
+
271
+ data-highlighted:bg-gray-100
272
+ data-disabled:pointer-events-none
273
+ data-disabled:opacity-50
274
+ "
275
+ {...props}
276
+ >
277
+ {children}
278
+ </div>
279
+ );
280
+ }
281
+ ```
282
+
283
+ ## Group and Peer Patterns
284
+
285
+ ### Complex State Propagation
286
+
287
+ ```html
288
+ <!-- Group pattern: Parent hover affects children -->
289
+ <div class="group relative overflow-hidden rounded-xl">
290
+ <img
291
+ src="image.jpg"
292
+ class="transition-transform duration-300 group-hover:scale-110"
293
+ />
294
+ <div class="
295
+ absolute inset-0 bg-gradient-to-t from-black/80 to-transparent
296
+ opacity-0 transition-opacity group-hover:opacity-100
297
+ ">
298
+ <div class="
299
+ absolute bottom-0 left-0 right-0 p-6
300
+ translate-y-4 transition-transform group-hover:translate-y-0
301
+ ">
302
+ <h3 class="text-xl font-bold text-white">Title</h3>
303
+ <p class="text-gray-200">Description</p>
304
+ </div>
305
+ </div>
306
+ </div>
307
+
308
+ <!-- Named groups for nested components -->
309
+ <div class="group/card">
310
+ <div class="group/header">
311
+ <button class="group-hover/header:text-blue-500">
312
+ Header Action
313
+ </button>
314
+ </div>
315
+ <div class="group-hover/card:bg-gray-50">
316
+ Card content
317
+ </div>
318
+ </div>
319
+
320
+ <!-- Peer pattern: Sibling state affects elements -->
321
+ <div class="relative">
322
+ <input
323
+ type="email"
324
+ class="peer w-full border rounded-lg px-4 py-2 placeholder-transparent"
325
+ placeholder="Email"
326
+ />
327
+ <label class="
328
+ absolute left-4 top-2 text-gray-500
329
+ transition-all
330
+ peer-placeholder-shown:top-2 peer-placeholder-shown:text-base
331
+ peer-focus:-top-6 peer-focus:text-sm peer-focus:text-blue-500
332
+ peer-[:not(:placeholder-shown)]:-top-6 peer-[:not(:placeholder-shown)]:text-sm
333
+ ">
334
+ Email address
335
+ </label>
336
+ </div>
337
+
338
+ <!-- Peer for form validation -->
339
+ <div>
340
+ <input
341
+ type="email"
342
+ class="peer"
343
+ required
344
+ />
345
+ <p class="hidden text-red-500 peer-invalid:block">
346
+ Please enter a valid email
347
+ </p>
348
+ </div>
349
+ ```
350
+
351
+ ## Slot Pattern with @apply
352
+
353
+ ### Reusable Component Slots
354
+
355
+ ```css
356
+ @layer components {
357
+ /* Base dialog structure */
358
+ .dialog {
359
+ @apply fixed inset-0 z-50 flex items-center justify-center;
360
+ }
361
+
362
+ .dialog-overlay {
363
+ @apply fixed inset-0 bg-black/50 backdrop-blur-sm;
364
+ @apply data-state-open:animate-in data-state-open:fade-in-0;
365
+ @apply data-state-closed:animate-out data-state-closed:fade-out-0;
366
+ }
367
+
368
+ .dialog-content {
369
+ @apply relative z-50 w-full max-w-lg rounded-xl bg-white p-6 shadow-xl;
370
+ @apply data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95;
371
+ @apply data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95;
372
+ }
373
+
374
+ .dialog-header {
375
+ @apply flex flex-col gap-1.5 text-center sm:text-left;
376
+ }
377
+
378
+ .dialog-title {
379
+ @apply text-lg font-semibold leading-none tracking-tight;
380
+ }
381
+
382
+ .dialog-description {
383
+ @apply text-sm text-gray-500;
384
+ }
385
+
386
+ .dialog-footer {
387
+ @apply flex flex-col-reverse gap-2 sm:flex-row sm:justify-end;
388
+ }
389
+
390
+ .dialog-close {
391
+ @apply absolute right-4 top-4 rounded-sm opacity-70 hover:opacity-100;
392
+ @apply focus:outline-none focus:ring-2 focus:ring-offset-2;
393
+ }
394
+ }
395
+ ```
396
+
397
+ ## Polymorphic Components
398
+
399
+ ### "as" Prop Pattern
400
+
401
+ ```tsx
402
+ import { forwardRef, ElementType, ComponentPropsWithoutRef } from 'react';
403
+ import { cn } from '@/lib/utils';
404
+
405
+ type PolymorphicRef<C extends ElementType> = ComponentPropsWithoutRef<C>['ref'];
406
+
407
+ type PolymorphicComponentProps<C extends ElementType, Props = {}> = Props & {
408
+ as?: C;
409
+ className?: string;
410
+ children?: React.ReactNode;
411
+ } & Omit<ComponentPropsWithoutRef<C>, 'as' | 'className' | keyof Props>;
412
+
413
+ // Text component that can be any element
414
+ interface TextProps {
415
+ size?: 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl';
416
+ weight?: 'normal' | 'medium' | 'semibold' | 'bold';
417
+ color?: 'default' | 'muted' | 'accent';
418
+ }
419
+
420
+ type TextComponent = <C extends ElementType = 'span'>(
421
+ props: PolymorphicComponentProps<C, TextProps> & { ref?: PolymorphicRef<C> }
422
+ ) => React.ReactElement | null;
423
+
424
+ export const Text: TextComponent = forwardRef(
425
+ <C extends ElementType = 'span'>(
426
+ {
427
+ as,
428
+ size = 'base',
429
+ weight = 'normal',
430
+ color = 'default',
431
+ className,
432
+ children,
433
+ ...props
434
+ }: PolymorphicComponentProps<C, TextProps>,
435
+ ref?: PolymorphicRef<C>
436
+ ) => {
437
+ const Component = as || 'span';
438
+
439
+ const sizes = {
440
+ xs: 'text-xs',
441
+ sm: 'text-sm',
442
+ base: 'text-base',
443
+ lg: 'text-lg',
444
+ xl: 'text-xl',
445
+ '2xl': 'text-2xl',
446
+ };
447
+
448
+ const weights = {
449
+ normal: 'font-normal',
450
+ medium: 'font-medium',
451
+ semibold: 'font-semibold',
452
+ bold: 'font-bold',
453
+ };
454
+
455
+ const colors = {
456
+ default: 'text-gray-900',
457
+ muted: 'text-gray-500',
458
+ accent: 'text-brand-500',
459
+ };
460
+
461
+ return (
462
+ <Component
463
+ ref={ref}
464
+ className={cn(sizes[size], weights[weight], colors[color], className)}
465
+ {...props}
466
+ >
467
+ {children}
468
+ </Component>
469
+ );
470
+ }
471
+ );
472
+ ```
473
+
474
+ ### Usage
475
+
476
+ ```tsx
477
+ <Text>Default span</Text>
478
+ <Text as="p" size="lg" color="muted">Large muted paragraph</Text>
479
+ <Text as="h1" size="2xl" weight="bold">Bold heading</Text>
480
+ <Text as="a" href="/link" color="accent">Accent link</Text>
481
+ ```
482
+
483
+ ## Headless Component Integration
484
+
485
+ ### Headless UI with Tailwind
486
+
487
+ ```tsx
488
+ import { Dialog, Transition } from '@headlessui/react';
489
+ import { Fragment } from 'react';
490
+
491
+ function Modal({ isOpen, onClose, title, children }) {
492
+ return (
493
+ <Transition appear show={isOpen} as={Fragment}>
494
+ <Dialog as="div" className="relative z-50" onClose={onClose}>
495
+ {/* Backdrop */}
496
+ <Transition.Child
497
+ as={Fragment}
498
+ enter="ease-out duration-300"
499
+ enterFrom="opacity-0"
500
+ enterTo="opacity-100"
501
+ leave="ease-in duration-200"
502
+ leaveFrom="opacity-100"
503
+ leaveTo="opacity-0"
504
+ >
505
+ <div className="fixed inset-0 bg-black/50 backdrop-blur-sm" />
506
+ </Transition.Child>
507
+
508
+ <div className="fixed inset-0 overflow-y-auto">
509
+ <div className="flex min-h-full items-center justify-center p-4">
510
+ <Transition.Child
511
+ as={Fragment}
512
+ enter="ease-out duration-300"
513
+ enterFrom="opacity-0 scale-95"
514
+ enterTo="opacity-100 scale-100"
515
+ leave="ease-in duration-200"
516
+ leaveFrom="opacity-100 scale-100"
517
+ leaveTo="opacity-0 scale-95"
518
+ >
519
+ <Dialog.Panel className="
520
+ w-full max-w-md transform overflow-hidden rounded-2xl
521
+ bg-white p-6 text-left align-middle shadow-xl transition-all
522
+ ">
523
+ <Dialog.Title className="text-lg font-medium leading-6 text-gray-900">
524
+ {title}
525
+ </Dialog.Title>
526
+ <div className="mt-2">
527
+ {children}
528
+ </div>
529
+ </Dialog.Panel>
530
+ </Transition.Child>
531
+ </div>
532
+ </div>
533
+ </Dialog>
534
+ </Transition>
535
+ );
536
+ }
537
+ ```
538
+
539
+ ### Radix UI with Tailwind
540
+
541
+ ```tsx
542
+ import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
543
+
544
+ function Dropdown() {
545
+ return (
546
+ <DropdownMenu.Root>
547
+ <DropdownMenu.Trigger className="
548
+ inline-flex items-center justify-center rounded-md
549
+ bg-white px-4 py-2 text-sm font-medium
550
+ border border-gray-300 hover:bg-gray-50
551
+ focus:outline-none focus:ring-2 focus:ring-brand-500
552
+ ">
553
+ Options
554
+ <ChevronDownIcon className="ml-2 h-4 w-4" />
555
+ </DropdownMenu.Trigger>
556
+
557
+ <DropdownMenu.Portal>
558
+ <DropdownMenu.Content
559
+ className="
560
+ min-w-[200px] rounded-md bg-white p-1 shadow-lg
561
+ border border-gray-200
562
+ animate-in fade-in-0 zoom-in-95
563
+ data-[side=bottom]:slide-in-from-top-2
564
+ data-[side=top]:slide-in-from-bottom-2
565
+ "
566
+ sideOffset={5}
567
+ >
568
+ <DropdownMenu.Item className="
569
+ relative flex cursor-pointer select-none items-center
570
+ rounded-sm px-2 py-2 text-sm outline-none
571
+ data-[highlighted]:bg-gray-100
572
+ ">
573
+ Profile
574
+ </DropdownMenu.Item>
575
+
576
+ <DropdownMenu.Separator className="my-1 h-px bg-gray-200" />
577
+
578
+ <DropdownMenu.Item className="
579
+ relative flex cursor-pointer select-none items-center
580
+ rounded-sm px-2 py-2 text-sm text-red-600 outline-none
581
+ data-[highlighted]:bg-red-50
582
+ ">
583
+ Delete
584
+ </DropdownMenu.Item>
585
+ </DropdownMenu.Content>
586
+ </DropdownMenu.Portal>
587
+ </DropdownMenu.Root>
588
+ );
589
+ }
590
+ ```
591
+
592
+ ## Animation Patterns
593
+
594
+ ### Staggered Animations
595
+
596
+ ```tsx
597
+ function StaggeredList({ items }) {
598
+ return (
599
+ <ul className="space-y-2">
600
+ {items.map((item, index) => (
601
+ <li
602
+ key={item.id}
603
+ className="animate-in fade-in-0 slide-in-from-left-4"
604
+ style={{ animationDelay: `${index * 100}ms` }}
605
+ >
606
+ {item.content}
607
+ </li>
608
+ ))}
609
+ </ul>
610
+ );
611
+ }
612
+ ```
613
+
614
+ ### Skeleton Loading
615
+
616
+ ```tsx
617
+ function Skeleton({ className, ...props }) {
618
+ return (
619
+ <div
620
+ className={cn(
621
+ 'animate-pulse rounded-md bg-gray-200',
622
+ className
623
+ )}
624
+ {...props}
625
+ />
626
+ );
627
+ }
628
+
629
+ function CardSkeleton() {
630
+ return (
631
+ <div className="rounded-xl border border-gray-200 p-6">
632
+ <div className="flex items-center gap-4">
633
+ <Skeleton className="h-12 w-12 rounded-full" />
634
+ <div className="space-y-2">
635
+ <Skeleton className="h-4 w-[200px]" />
636
+ <Skeleton className="h-3 w-[150px]" />
637
+ </div>
638
+ </div>
639
+ <div className="mt-4 space-y-2">
640
+ <Skeleton className="h-3 w-full" />
641
+ <Skeleton className="h-3 w-full" />
642
+ <Skeleton className="h-3 w-3/4" />
643
+ </div>
644
+ </div>
645
+ );
646
+ }
647
+ ```
648
+
649
+ ## Best Practices
650
+
651
+ ### 1. Use cn() Utility for Class Merging
652
+
653
+ ```typescript
654
+ // lib/utils.ts
655
+ import { clsx, type ClassValue } from 'clsx';
656
+ import { twMerge } from 'tailwind-merge';
657
+
658
+ export function cn(...inputs: ClassValue[]) {
659
+ return twMerge(clsx(inputs));
660
+ }
661
+ ```
662
+
663
+ ### 2. Extract Common Patterns
664
+
665
+ ```css
666
+ @layer components {
667
+ /* Consistent focus ring */
668
+ .focus-ring {
669
+ @apply focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500 focus-visible:ring-offset-2;
670
+ }
671
+
672
+ /* Consistent disabled state */
673
+ .disabled-state {
674
+ @apply disabled:pointer-events-none disabled:opacity-50;
675
+ }
676
+
677
+ /* Truncate text */
678
+ .truncate-lines-2 {
679
+ display: -webkit-box;
680
+ -webkit-line-clamp: 2;
681
+ -webkit-box-orient: vertical;
682
+ overflow: hidden;
683
+ }
684
+ }
685
+ ```
686
+
687
+ ### 3. Document Component APIs
688
+
689
+ ```tsx
690
+ /**
691
+ * Button component with multiple variants
692
+ *
693
+ * @example
694
+ * <Button variant="primary" size="lg">Click me</Button>
695
+ *
696
+ * @example
697
+ * <Button variant="ghost" size="icon">
698
+ * <IconMenu />
699
+ * </Button>
700
+ */
701
+ export function Button({ ... }) { ... }
702
+ ```
703
+
704
+ ### 4. Test Component Variants
705
+
706
+ ```tsx
707
+ // Button.test.tsx
708
+ describe('Button', () => {
709
+ it('renders all variants correctly', () => {
710
+ const variants = ['default', 'secondary', 'outline', 'ghost', 'destructive'];
711
+
712
+ variants.forEach(variant => {
713
+ render(<Button variant={variant}>Test</Button>);
714
+ // Assert classes are applied correctly
715
+ });
716
+ });
717
+ });
718
+ ```