import { useState } from 'react' // §22.4a SLICE-5 (PUC-2, UX §5.3): the sticky bulk action bar shown when ≥1 // catalog row is selected. Driven by the collection `fields:` schema — one // "Set " control per enum field, and an Add/Remove tag control per // tags field. Each gesture calls onApply({ op, field, value }); the parent // (Catalog) sends one bulk request and re-fetches. const labelFor = (name, def) => def?.label || name.charAt(0).toUpperCase() + name.slice(1) export default function BulkActionBar({ fields, count, onApply, onClear }) { const [tagValue, setTagValue] = useState('') const entries = Object.entries(fields || {}) const tagField = entries.find(([, d]) => d.type === 'tags') return (
{count} selected {entries .filter(([, d]) => d.type === 'enum') .map(([name, def]) => ( ))} {tagField && (
setTagValue(e.target.value)} />
)}
) }