import React from 'react'; import { Loader2 } from 'lucide-react'; import type { LucideIcon } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; type ActionTone = 'primary' | 'secondary' | 'danger' | 'neutral'; export type FloatingAction = { key: string; label: string; icon: LucideIcon; onClick: () => void; tone?: ActionTone; disabled?: boolean; loading?: boolean; ariaLabel?: string; }; export function FloatingActionBar({ actions, className }: { actions: FloatingAction[]; className?: string }): React.ReactElement | null { if (!actions.length) { return null; } const toneClasses: Record = { primary: 'bg-primary text-primary-foreground shadow-primary/25 hover:bg-primary/90 focus-visible:ring-primary/70 border border-primary/20', secondary: 'bg-[var(--tenant-surface-strong)] text-[var(--tenant-foreground)] shadow-slate-300/60 hover:bg-[var(--tenant-surface)] focus-visible:ring-slate-200 border border-[var(--tenant-border-strong)]', neutral: 'bg-white/90 text-slate-900 shadow-slate-200/80 hover:bg-white focus-visible:ring-slate-200 border border-slate-200 dark:bg-slate-800/80 dark:text-white dark:border-slate-700', danger: 'bg-rose-500 text-white shadow-rose-300/50 hover:bg-rose-600 focus-visible:ring-rose-200 border border-rose-400/80', }; return (
{actions.map((action) => { const Icon = action.icon; const tone = action.tone ?? 'primary'; return ( ); })}
); }