AuctionEditor
Headless compound primitive for auction editing, composed with the auction components.
Import from @workspace/ui-bridge/primitives/editor/auction-editor.
Overview
AuctionEditor.Root holds one Auction ({ first, moves }, the stored shape of Deal.auction), its comments and alerts, and derives the bid-pad flags, the next bidder and the contract. It renders no DOM: children read the state through useAuctionEditor() and compose the auction components (AuctionGrid, AuctionBidPad, AuctionNextBidder) from @workspace/ui-bridge/components/auction/*.
import { AuctionBidPad } from '@workspace/ui-bridge/components/auction/auction-bid-pad';
import { AuctionGrid } from '@workspace/ui-bridge/components/auction/auction-grid';
import { AuctionEditor, useAuctionEditor } from '@workspace/ui-bridge/primitives/editor/auction-editor';
function Pad() {
const { nextBidder } = useAuctionEditor();
return <AuctionBidPad labels={{ nextBidder: `Next: ${nextBidder}` }} />;
}
<AuctionEditor.Root
auction={auction}
onAuctionChange={setAuction}
comments={comments}
onCommentsChange={setComments}
vulnerability="NS"
>
<AuctionEditor.Table>
<AuctionGrid minRows={4} />
</AuctionEditor.Table>
<Pad />
</AuctionEditor.Root>Controlled (auction / onAuctionChange) or uncontrolled (defaultAuction); same for comments. A call's seat is derived from first and its index, so changing the dealer moves every call with the seats. Grid cells come from auctionEntries.
Parts
| Part | Role |
|---|---|
AuctionEditor.Root | State owner: auction, comments, alerts, bid-pad flags, next bidder, contract |
AuctionEditor.Table | Groups the moves into rows for the grid (minRows) |
useAuctionEditor() | Reads the state and the actions (addBid, undo, setComment, toggleAlert, …) |
useAuctionTable() | Rows and column order inside AuctionEditor.Table |
useGridHeaderItems() | Header cells with dealer and vulnerability markers |
Read-only mode
Pass readOnly to freeze the auction: the bid pad disables every key and the grid ignores clicks.
Props
Prop
Type
Prop
Type
Notes
- Wrapped with
withBridgeContext: usable outside aBridgeProviderthrough thecontextprop. autoPassOpponentsappends a Pass after each N/S call so the turn comes back to N/S; it never rewrites the existing sequence.