2025-12-03 21:56:50 +00:00
|
|
|
import * as React from 'react';
|
|
|
|
|
import { cn } from '@/lib/utils';
|
|
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
/**
|
|
|
|
|
* TextareaProps - Propriétés du composant Textarea
|
2026-01-13 18:47:57 +00:00
|
|
|
*
|
2026-01-07 09:31:02 +00:00
|
|
|
* @interface TextareaProps
|
|
|
|
|
* @extends React.TextareaHTMLAttributes<HTMLTextAreaElement>
|
|
|
|
|
*/
|
2026-01-13 18:47:57 +00:00
|
|
|
export interface TextareaProps
|
|
|
|
|
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
2026-01-07 09:31:02 +00:00
|
|
|
/**
|
|
|
|
|
* Label à afficher au-dessus du champ de texte
|
2026-01-13 18:47:57 +00:00
|
|
|
*
|
2026-01-07 09:31:02 +00:00
|
|
|
* @example
|
|
|
|
|
* ```tsx
|
|
|
|
|
* <Textarea label="Description" />
|
|
|
|
|
* ```
|
|
|
|
|
*/
|
|
|
|
|
label?: string;
|
2026-01-13 18:47:57 +00:00
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
/**
|
|
|
|
|
* Message d'erreur à afficher sous le champ
|
|
|
|
|
* Si fourni, la bordure devient rouge et le message s'affiche
|
2026-01-13 18:47:57 +00:00
|
|
|
*
|
2026-01-07 09:31:02 +00:00
|
|
|
* @example
|
|
|
|
|
* ```tsx
|
2026-01-13 18:47:57 +00:00
|
|
|
* <Textarea
|
2026-01-07 09:31:02 +00:00
|
|
|
* error={errors.description}
|
|
|
|
|
* label="Description"
|
|
|
|
|
* />
|
|
|
|
|
* ```
|
|
|
|
|
*/
|
|
|
|
|
error?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Textarea - Composant de zone de texte avec design system Kodo
|
2026-01-13 18:47:57 +00:00
|
|
|
*
|
2026-01-07 09:31:02 +00:00
|
|
|
* Composant de zone de texte multiligne avec support pour les labels et les messages d'erreur.
|
|
|
|
|
* Utilise le design system Kodo avec des styles cohérents et une hauteur minimale de 100px.
|
2026-01-13 18:47:57 +00:00
|
|
|
*
|
2026-01-07 09:31:02 +00:00
|
|
|
* @example
|
|
|
|
|
* ```tsx
|
|
|
|
|
* // Textarea simple
|
|
|
|
|
* <Textarea placeholder="Entrez votre message..." />
|
2026-01-13 18:47:57 +00:00
|
|
|
*
|
2026-01-07 09:31:02 +00:00
|
|
|
* // Textarea avec label
|
|
|
|
|
* <Textarea label="Description" placeholder="Décrivez..." />
|
2026-01-13 18:47:57 +00:00
|
|
|
*
|
2026-01-07 09:31:02 +00:00
|
|
|
* // Textarea avec validation d'erreur
|
2026-01-13 18:47:57 +00:00
|
|
|
* <Textarea
|
2026-01-07 09:31:02 +00:00
|
|
|
* label="Commentaire"
|
|
|
|
|
* error={errors.comment}
|
|
|
|
|
* value={comment}
|
|
|
|
|
* onChange={(e) => setComment(e.target.value)}
|
|
|
|
|
* />
|
2026-01-13 18:47:57 +00:00
|
|
|
*
|
2026-01-07 09:31:02 +00:00
|
|
|
* // Textarea contrôlée
|
2026-01-13 18:47:57 +00:00
|
|
|
* <Textarea
|
|
|
|
|
* value={value}
|
2026-01-07 09:31:02 +00:00
|
|
|
* onChange={(e) => setValue(e.target.value)}
|
|
|
|
|
* rows={5}
|
|
|
|
|
* />
|
|
|
|
|
* ```
|
2026-01-13 18:47:57 +00:00
|
|
|
*
|
2026-01-07 09:31:02 +00:00
|
|
|
* @component
|
|
|
|
|
* @param {TextareaProps} props - Propriétés du composant
|
|
|
|
|
* @returns {JSX.Element} Élément textarea stylisé avec label et erreur optionnels
|
|
|
|
|
*/
|
2025-12-03 21:56:50 +00:00
|
|
|
|
|
|
|
|
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
2026-01-07 09:31:02 +00:00
|
|
|
({ label, error, className, ...props }, ref) => {
|
2025-12-03 21:56:50 +00:00
|
|
|
return (
|
2026-01-07 09:31:02 +00:00
|
|
|
<div className="w-full">
|
|
|
|
|
{label && (
|
2026-02-08 23:04:51 +00:00
|
|
|
<label className="block text-sm font-medium text-muted-foreground mb-2 font-body">
|
2026-01-07 09:31:02 +00:00
|
|
|
{label}
|
|
|
|
|
</label>
|
|
|
|
|
)}
|
|
|
|
|
<textarea
|
|
|
|
|
ref={ref}
|
|
|
|
|
className={cn(
|
aesthetic-improvements: align spacing to 8px grid (Action 11.2.1.3)
- Created automated script (scripts/align-8px-grid.py) to align all spacing to 8px grid
- Replaced non-8px-aligned spacing: gap-3/p-3/m-3 (12px) → gap-4/p-4/m-4 (16px), gap-5/p-5/m-5 (20px) → gap-6/p-6/m-6 (24px), gap-10/p-10/m-10 (40px) → gap-12/p-12/m-12 (48px), gap-20/p-20/m-20 (80px) → gap-24/p-24/m-24 (96px)
- Preserved: 4px values (gap-1, p-1, m-1) as they may be intentional fine-tuning, responsive breakpoints (sm:, md:, lg:), test files, documentation
- Modified files across all components to ensure consistent 8px grid alignment
- Action 11.2.1.3: Align all elements to 8px grid - COMPLETE
2026-01-16 10:50:46 +00:00
|
|
|
'w-full px-4 py-4',
|
2026-01-07 09:31:02 +00:00
|
|
|
'bg-kodo-graphite border',
|
ui(tokens): migrate border-kodo-steel to border-border (86 files, 269 instances)
Replace legacy hardcoded border-kodo-steel (RGB 59,69,84, theme-unaware)
with semantic border-border token across 86 user-facing components.
Covers UI primitives (checkbox, badge, modal, table, textarea, alert,
radio-group, avatar), all modals, settings views, social features,
playlist views, inventory, chat, commerce, and cloud file browser.
Only story/test files retain the legacy token.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 23:07:00 +00:00
|
|
|
error ? 'border-kodo-red' : 'border-border',
|
2026-01-07 09:31:02 +00:00
|
|
|
'text-white placeholder-gray-500',
|
|
|
|
|
'font-body text-base',
|
|
|
|
|
'rounded-lg',
|
ui(tokens): migrate border-kodo-steel to border-border (86 files, 269 instances)
Replace legacy hardcoded border-kodo-steel (RGB 59,69,84, theme-unaware)
with semantic border-border token across 86 user-facing components.
Covers UI primitives (checkbox, badge, modal, table, textarea, alert,
radio-group, avatar), all modals, settings views, social features,
playlist views, inventory, chat, commerce, and cloud file browser.
Only story/test files retain the legacy token.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 23:07:00 +00:00
|
|
|
'focus:outline-none focus:border-border focus:ring-1 focus:ring-kodo-steel',
|
feat(web): UI premium Discord/Spotify-like — tokens, shadows, focus, layout
Plan UI premium 6–8 semaines (design system, shell, Storybook, a11y):
- Design system: DESIGN_TOKENS.md, APP_SHELL.md, FULL_LAYOUT_PAGE.md. Single source
for layout/shell (index.css), shadows (design-system.css), durations/easing.
- Tokens: shadow-cover-depth, shadow-gold-glow, shadow-fab-glow; layout max-height
(max-h-layout-drawer, max-h-layout-panel, max-h-layout-list). All duration-200/300/500
replaced by --duration-fast/normal/slow. Arbitrary shadows replaced by token classes.
- Shell & player: Sidebar, Header, GlobalPlayer, MiniPlayer, PlayerQueue, PlayerControls,
AudioPlayer use tokens; focus-visible on Sidebar, PlayerQueue, DropdownMenuTrigger/Item,
TabsTrigger. Typography: text-[10px]/[9px] → text-xs where applicable.
- ESLint: no-restricted-syntax (warn) for w-/h-/rounded-/shadow-/text-/spacing arbitrary.
- Scripts: report-arbitrary-values.mjs, capture/compare/generate visual; visual-complete.spec.ts.
- Stories full layout: Dashboard, Playlists, Library, Settings, Profile in DashboardLayout.stories.
- .cursorrules + README: DESIGN_TOKENS, APP_SHELL, visual commands, no arbitrary without justification.
- apps/web/.gitignore: e2e test artifacts (test-results-visual, playwright-report-visual).
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 16:15:58 +00:00
|
|
|
'transition-all duration-[var(--duration-fast)]',
|
2026-01-07 09:31:02 +00:00
|
|
|
'min-h-[100px] resize-y',
|
2026-01-13 18:47:57 +00:00
|
|
|
className,
|
2026-01-07 09:31:02 +00:00
|
|
|
)}
|
|
|
|
|
{...props}
|
|
|
|
|
/>
|
2026-01-13 18:47:57 +00:00
|
|
|
{error && <p className="mt-1 text-xs text-kodo-red">{error}</p>}
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
2025-12-03 21:56:50 +00:00
|
|
|
);
|
2026-01-13 18:47:57 +00:00
|
|
|
},
|
2025-12-03 21:56:50 +00:00
|
|
|
);
|
|
|
|
|
Textarea.displayName = 'Textarea';
|
|
|
|
|
|
|
|
|
|
export { Textarea };
|