"use client";
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
import { cn } from "@stigmer/theme";
/**
 * Floating action bar that appears when items are selected in the
 * workbench. Shows selected count, available bulk actions, and a
 * cancel button.
 *
 * Uses `aria-live="polite"` so screen readers announce the selection
 * count when it changes.
 *
 * @example
 * ```tsx
 * {selection.hasSelection && (
 *   <BulkActionBar
 *     selectedCount={selection.selectedCount}
 *     selectedItems={selection.selectedItems}
 *     actions={agentBulkActions}
 *     onCancel={selection.clearSelection}
 *   />
 * )}
 * ```
 */
export function BulkActionBar({ selectedCount, selectedItems, actions, onCancel, className, }) {
    if (selectedCount === 0)
        return null;
    return (_jsxs("div", { role: "toolbar", "aria-label": "Bulk actions", "aria-live": "polite", className: cn("flex items-center gap-3 rounded-lg border border-border bg-card px-4 py-2 shadow-md", className), children: [_jsxs("span", { className: "text-xs font-medium text-foreground", children: [selectedCount, " ", selectedCount === 1 ? "item" : "items", " selected"] }), _jsx("span", { className: "h-4 w-px bg-border", "aria-hidden": "true" }), _jsx("div", { className: "flex items-center gap-1", children: actions.map((action) => (_jsx(BulkActionButton, { action: action, selectedItems: selectedItems }, action.id))) }), _jsx("button", { type: "button", onClick: onCancel, className: cn("ml-auto text-xs text-muted-foreground transition-colors", "hover:text-foreground", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:rounded-sm"), children: "Cancel" })] }));
}
function BulkActionButton({ action, selectedItems, }) {
    const isDestructive = action.variant === "destructive";
    return (_jsxs("button", { type: "button", disabled: action.disabled, onClick: () => action.onAction(selectedItems), className: cn("inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "disabled:pointer-events-none disabled:opacity-50", isDestructive
            ? "text-destructive hover:bg-destructive-subtle"
            : "text-foreground hover:bg-accent-hover"), children: [action.icon && (_jsx("span", { className: "shrink-0", "aria-hidden": "true", children: action.icon })), action.label] }));
}
//# sourceMappingURL=BulkActionBar.js.map