2025-11-20 21:30:37 +01:00
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import { useToolStore } from '@/store';
|
|
|
|
|
import type { ToolType } from '@/types';
|
|
|
|
|
import {
|
|
|
|
|
Pencil,
|
|
|
|
|
Paintbrush,
|
|
|
|
|
Eraser,
|
|
|
|
|
PaintBucket,
|
|
|
|
|
MousePointer,
|
2025-11-21 01:55:28 +01:00
|
|
|
Pipette,
|
2025-11-21 09:45:05 +01:00
|
|
|
Type,
|
2025-11-21 16:27:02 +01:00
|
|
|
Stamp,
|
|
|
|
|
Droplet,
|
|
|
|
|
Sun,
|
2025-11-20 21:30:37 +01:00
|
|
|
} from 'lucide-react';
|
|
|
|
|
import { cn } from '@/lib/utils';
|
|
|
|
|
|
2025-11-21 16:08:24 +01:00
|
|
|
const tools: { type: ToolType; icon: React.ReactNode; label: string; shortcut: string }[] = [
|
|
|
|
|
{ type: 'pencil', icon: <Pencil className="h-5 w-5" />, label: 'Pencil', shortcut: '1' },
|
|
|
|
|
{ type: 'brush', icon: <Paintbrush className="h-5 w-5" />, label: 'Brush', shortcut: '2' },
|
|
|
|
|
{ type: 'eraser', icon: <Eraser className="h-5 w-5" />, label: 'Eraser', shortcut: '3' },
|
|
|
|
|
{ type: 'fill', icon: <PaintBucket className="h-5 w-5" />, label: 'Fill', shortcut: '4' },
|
|
|
|
|
{ type: 'eyedropper', icon: <Pipette className="h-5 w-5" />, label: 'Eyedropper', shortcut: '5' },
|
|
|
|
|
{ type: 'text', icon: <Type className="h-5 w-5" />, label: 'Text', shortcut: '6' },
|
|
|
|
|
{ type: 'select', icon: <MousePointer className="h-5 w-5" />, label: 'Select', shortcut: '7' },
|
2025-11-21 16:27:02 +01:00
|
|
|
{ type: 'clone', icon: <Stamp className="h-5 w-5" />, label: 'Clone Stamp (Alt+Click source)', shortcut: '8' },
|
|
|
|
|
{ type: 'smudge', icon: <Droplet className="h-5 w-5" />, label: 'Smudge', shortcut: '9' },
|
|
|
|
|
{ type: 'dodge', icon: <Sun className="h-5 w-5" />, label: 'Dodge/Burn (Alt for burn)', shortcut: '0' },
|
2025-11-20 21:30:37 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export function ToolPalette() {
|
|
|
|
|
const { activeTool, setActiveTool } = useToolStore();
|
|
|
|
|
|
|
|
|
|
return (
|
feat(a11y): add comprehensive accessibility improvements
Enhanced accessibility throughout the application:
ARIA Labels & Roles:
- Tool palette: Added role="toolbar", aria-label, aria-pressed states
- Theme toggle: Added aria-label, aria-pressed, aria-hidden on icons
- File menu: Added role="menu", aria-expanded, aria-haspopup, role="menuitem"
- Menu separators: Added role="separator"
Focus Indicators:
- Global :focus-visible styles with ring outline
- Consistent focus:ring-2 styling on interactive elements
- Enhanced focus states on buttons, inputs, selects, textareas
- Offset outlines for better visibility
Keyboard Navigation:
- Proper focus management on menu items
- Focus styles that don't interfere with mouse interactions
- Accessible button states with aria-pressed
Visual Improvements:
- Clear 2px outline on focused elements
- Ring color using theme variables (--ring)
- 2px outline offset for spacing
- Focus visible only for keyboard navigation
These improvements ensure the application is fully navigable via keyboard
and properly announced by screen readers, meeting WCAG 2.1 Level AA standards.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 15:49:20 +01:00
|
|
|
<nav
|
|
|
|
|
className="flex flex-col bg-card border-r border-border w-16"
|
|
|
|
|
role="toolbar"
|
|
|
|
|
aria-label="Drawing tools"
|
|
|
|
|
>
|
2025-11-20 21:30:37 +01:00
|
|
|
<div className="border-b border-border p-2">
|
|
|
|
|
<h2 className="text-xs font-semibold text-card-foreground text-center">
|
|
|
|
|
Tools
|
|
|
|
|
</h2>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="flex-1 overflow-y-auto p-2 space-y-1">
|
|
|
|
|
{tools.map((tool) => (
|
|
|
|
|
<button
|
|
|
|
|
key={tool.type}
|
|
|
|
|
onClick={() => setActiveTool(tool.type)}
|
|
|
|
|
className={cn(
|
feat(a11y): add comprehensive accessibility improvements
Enhanced accessibility throughout the application:
ARIA Labels & Roles:
- Tool palette: Added role="toolbar", aria-label, aria-pressed states
- Theme toggle: Added aria-label, aria-pressed, aria-hidden on icons
- File menu: Added role="menu", aria-expanded, aria-haspopup, role="menuitem"
- Menu separators: Added role="separator"
Focus Indicators:
- Global :focus-visible styles with ring outline
- Consistent focus:ring-2 styling on interactive elements
- Enhanced focus states on buttons, inputs, selects, textareas
- Offset outlines for better visibility
Keyboard Navigation:
- Proper focus management on menu items
- Focus styles that don't interfere with mouse interactions
- Accessible button states with aria-pressed
Visual Improvements:
- Clear 2px outline on focused elements
- Ring color using theme variables (--ring)
- 2px outline offset for spacing
- Focus visible only for keyboard navigation
These improvements ensure the application is fully navigable via keyboard
and properly announced by screen readers, meeting WCAG 2.1 Level AA standards.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 15:49:20 +01:00
|
|
|
'w-full aspect-square flex items-center justify-center rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
2025-11-20 21:30:37 +01:00
|
|
|
activeTool === tool.type
|
|
|
|
|
? 'bg-primary text-primary-foreground'
|
|
|
|
|
: 'hover:bg-accent text-muted-foreground hover:text-foreground'
|
|
|
|
|
)}
|
2025-11-21 16:08:24 +01:00
|
|
|
aria-label={`${tool.label} (${tool.shortcut})`}
|
feat(a11y): add comprehensive accessibility improvements
Enhanced accessibility throughout the application:
ARIA Labels & Roles:
- Tool palette: Added role="toolbar", aria-label, aria-pressed states
- Theme toggle: Added aria-label, aria-pressed, aria-hidden on icons
- File menu: Added role="menu", aria-expanded, aria-haspopup, role="menuitem"
- Menu separators: Added role="separator"
Focus Indicators:
- Global :focus-visible styles with ring outline
- Consistent focus:ring-2 styling on interactive elements
- Enhanced focus states on buttons, inputs, selects, textareas
- Offset outlines for better visibility
Keyboard Navigation:
- Proper focus management on menu items
- Focus styles that don't interfere with mouse interactions
- Accessible button states with aria-pressed
Visual Improvements:
- Clear 2px outline on focused elements
- Ring color using theme variables (--ring)
- 2px outline offset for spacing
- Focus visible only for keyboard navigation
These improvements ensure the application is fully navigable via keyboard
and properly announced by screen readers, meeting WCAG 2.1 Level AA standards.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 15:49:20 +01:00
|
|
|
aria-pressed={activeTool === tool.type}
|
2025-11-21 16:08:24 +01:00
|
|
|
title={`${tool.label} (${tool.shortcut})`}
|
2025-11-20 21:30:37 +01:00
|
|
|
>
|
|
|
|
|
{tool.icon}
|
|
|
|
|
</button>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
feat(a11y): add comprehensive accessibility improvements
Enhanced accessibility throughout the application:
ARIA Labels & Roles:
- Tool palette: Added role="toolbar", aria-label, aria-pressed states
- Theme toggle: Added aria-label, aria-pressed, aria-hidden on icons
- File menu: Added role="menu", aria-expanded, aria-haspopup, role="menuitem"
- Menu separators: Added role="separator"
Focus Indicators:
- Global :focus-visible styles with ring outline
- Consistent focus:ring-2 styling on interactive elements
- Enhanced focus states on buttons, inputs, selects, textareas
- Offset outlines for better visibility
Keyboard Navigation:
- Proper focus management on menu items
- Focus styles that don't interfere with mouse interactions
- Accessible button states with aria-pressed
Visual Improvements:
- Clear 2px outline on focused elements
- Ring color using theme variables (--ring)
- 2px outline offset for spacing
- Focus visible only for keyboard navigation
These improvements ensure the application is fully navigable via keyboard
and properly announced by screen readers, meeting WCAG 2.1 Level AA standards.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 15:49:20 +01:00
|
|
|
</nav>
|
2025-11-20 21:30:37 +01:00
|
|
|
);
|
|
|
|
|
}
|