@birhaus/core
v3.1.0
Published
BIRHAUS Core Components - UndoSystem, CommandPalette, AuditTimeline
Maintainers
Readme
@birhaus/core
Core functionality for the BIRHAUS design system, implementing the foundational undo-over-confirm pattern and command management.
Installation
npm install @birhaus/coreCore Components
UndoSystem
The heart of BIRHAUS design philosophy - replacing annoying confirmation dialogs with user-friendly undo patterns.
import { UndoSystem } from '@birhaus/core'
function DeleteButton() {
return (
<button
onClick={async () => {
await deleteItem(itemId)
UndoSystem.addAction({
messageEs: 'Elemento eliminado',
messageEn: 'Item deleted',
undoAction: () => restoreItem(itemId),
timeout: 10000
})
}}
>
Eliminar
</button>
)
}CommandPalette
Spanish-first command interface with cognitive load optimization.
import { CommandPalette } from '@birhaus/core'
const commands = [
{
id: 'new-donation',
labelEs: 'Nueva donación',
labelEn: 'New donation',
action: () => navigate('/donacion/nueva')
}
]
function App() {
return (
<div>
<CommandPalette
commands={commands}
placeholderEs="Buscar comando..."
placeholderEn="Search command..."
/>
</div>
)
}BIRHAUS Principles Implemented
- Undo over Confirm: Replace confirmation dialogs with undo actions
- Spanish-first: All text content supports bilingual labeling
- Cognitive Load Reduction: Command palette limits results to 7±2 items
- Accessibility: Full keyboard navigation and screen reader support
API Reference
UndoSystem
addAction(config)- Add undoable actionundo()- Undo last actionclear()- Clear undo historygetHistory()- Get undo action history
CommandPalette
Props:
commands- Array of command definitionsplaceholderEs/En- Search placeholder textmaxResults- Limit results (default: 7)onCommand- Command execution callback
Integration
Works seamlessly with:
@birhaus/primitives- Use with BirhausButton undo patterns@birhaus/patterns- Advanced workflow patterns@birhaus/themes- Consistent visual theming
License
MIT - see LICENSE for details.
