192 lines
3.7 KiB
TypeScript
192 lines
3.7 KiB
TypeScript
import {
|
|
MousePointer2,
|
|
Pipette,
|
|
createLucideIcon,
|
|
Glasses,
|
|
Cuboid,
|
|
Move,
|
|
CirclePlus,
|
|
Box,
|
|
Scan,
|
|
PenTool,
|
|
RectangleHorizontal,
|
|
Spline,
|
|
Undo2,
|
|
Redo2,
|
|
Activity,
|
|
AlertTriangle,
|
|
Boxes,
|
|
Building2,
|
|
Camera,
|
|
Check,
|
|
ChevronDown,
|
|
ChevronUp,
|
|
ChevronLeft,
|
|
ChevronRight,
|
|
Circle,
|
|
ClipboardList,
|
|
Copy,
|
|
Database,
|
|
Download,
|
|
Eye,
|
|
EyeOff,
|
|
ExternalLink,
|
|
FileText,
|
|
FolderOpen,
|
|
Globe2,
|
|
Image,
|
|
Inbox,
|
|
Info,
|
|
KeyRound,
|
|
Layers,
|
|
LayoutDashboard,
|
|
ListChecks,
|
|
LocateFixed,
|
|
LockKeyhole,
|
|
LockKeyholeOpen,
|
|
MailPlus,
|
|
Map,
|
|
Maximize2,
|
|
Minimize2,
|
|
Network,
|
|
PanelTop,
|
|
Pencil,
|
|
Play,
|
|
Pin,
|
|
Power,
|
|
Plus,
|
|
Minus,
|
|
RefreshCw,
|
|
RotateCw,
|
|
Save,
|
|
Search,
|
|
Settings,
|
|
ShieldCheck,
|
|
SlidersHorizontal,
|
|
Square,
|
|
Star,
|
|
Terminal,
|
|
Trash2,
|
|
UploadCloud,
|
|
UserCircle,
|
|
UsersRound,
|
|
Video,
|
|
X,
|
|
type LucideIcon,
|
|
type LucideProps,
|
|
} from "lucide-react";
|
|
|
|
// CAD vocabulary: dimension line, cutting plane and unframed information glyph.
|
|
const DimensionLine = createLucideIcon('DimensionLine', [
|
|
['path', {d:'M4 5v14M20 5v14M4 12h16M8 9l-4 3 4 3M16 9l4 3-4 3',key:'dimension'}],
|
|
]);
|
|
const SectionPlane = createLucideIcon('SectionPlane', [
|
|
['path', {d:'m5 7 7-4 7 4v10l-7 4-7-4V7m0 0 7 4 7-4M12 11v10',key:'model'}],
|
|
['path', {d:'m2 12 10-5 10 5-10 5-10-5Z',key:'plane'}],
|
|
]);
|
|
const InformationPlain = createLucideIcon('InformationPlain', [
|
|
['path', {d:'M12 4h.01M10 9h2v11M9 20h6',key:'information'}],
|
|
]);
|
|
const icons = {
|
|
pipette: Pipette,
|
|
"add-point": CirclePlus,
|
|
ruler: DimensionLine,
|
|
section: SectionPlane,
|
|
isolate: Glasses,
|
|
perspective: Cuboid,
|
|
orthographic: Box,
|
|
"fit-view": Scan,
|
|
select: MousePointer2,
|
|
move: Move,
|
|
pen: PenTool,
|
|
rectangle: RectangleHorizontal,
|
|
curve: Spline,
|
|
undo: Undo2,
|
|
redo: Redo2,
|
|
activity: Activity,
|
|
alert: AlertTriangle,
|
|
apps: Boxes,
|
|
building: Building2,
|
|
camera: Camera,
|
|
check: Check,
|
|
"chevron-down": ChevronDown,
|
|
"chevron-up": ChevronUp,
|
|
"chevron-left": ChevronLeft,
|
|
"chevron-right": ChevronRight,
|
|
circle: Circle,
|
|
clipboard: ClipboardList,
|
|
close: X,
|
|
copy: Copy,
|
|
database: Database,
|
|
pin: Pin,
|
|
download: Download,
|
|
edit: Pencil,
|
|
eye: Eye,
|
|
"eye-off": EyeOff,
|
|
expand: Maximize2,
|
|
external: ExternalLink,
|
|
file: FileText,
|
|
folder: FolderOpen,
|
|
globe: Globe2,
|
|
grid: LayoutDashboard,
|
|
image: Image,
|
|
inbox: Inbox,
|
|
info: Info,
|
|
"info-plain": InformationPlain,
|
|
key: KeyRound,
|
|
layers: Layers,
|
|
list: ListChecks,
|
|
target: LocateFixed,
|
|
lock: LockKeyhole,
|
|
unlock: LockKeyholeOpen,
|
|
mail: MailPlus,
|
|
minimize: Minimize2,
|
|
network: Network,
|
|
panel: PanelTop,
|
|
plan: Map,
|
|
play: Play,
|
|
power: Power,
|
|
plus: Plus,
|
|
minus: Minus,
|
|
profile: UserCircle,
|
|
refresh: RefreshCw,
|
|
"rotate-clockwise": RotateCw,
|
|
save: Save,
|
|
search: Search,
|
|
settings: Settings,
|
|
shield: ShieldCheck,
|
|
sliders: SlidersHorizontal,
|
|
stop: Square,
|
|
star: Star,
|
|
terminal: Terminal,
|
|
trash: Trash2,
|
|
upload: UploadCloud,
|
|
users: UsersRound,
|
|
video: Video,
|
|
} satisfies Record<string, LucideIcon>;
|
|
|
|
export type IconName = keyof typeof icons;
|
|
|
|
export interface IconProps extends Omit<LucideProps, "ref"> {
|
|
name: IconName;
|
|
label?: string;
|
|
}
|
|
|
|
export function Icon({ name, label, size = 16, strokeWidth = 1.6, fill, ...props }: IconProps) {
|
|
const IconComponent = icons[name];
|
|
const filledTransport = name === "play" || name === "stop";
|
|
|
|
return (
|
|
<IconComponent
|
|
size={size}
|
|
strokeWidth={filledTransport ? 0 : strokeWidth}
|
|
fill={fill ?? (filledTransport ? "currentColor" : "none")}
|
|
aria-hidden={label ? undefined : "true"}
|
|
aria-label={label}
|
|
role={label ? "img" : undefined}
|
|
focusable="false"
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|