CashierSheet
CashierSheet is the signed-in cashier's sheet on the right edge, with the header, "Your sales today", "Hand the till to" and Sign out.
Import
import { CashierSheet, RegisterBar } from '@tallyui/components';Usage
const [open, setOpen] = useState(false);
<RegisterBar {...barProps} cashier={{ name: 'Sam Lee', onPress: () => setOpen(true) }} />
{open && (
<CashierSheet
cashier={{ name: 'Sam Lee' }}
description="Main Street · Till 2 · since 09:05"
salesToday={{ amountMinor: 123450, currency: 'EUR' }}
signOutDisabled={paying}
onSignOut={() => setSignOutConfirm(true)}
onOpenChange={setOpen}
/>
)}Behaviour
- Opening: the app mounts the sheet while it is open, usually from
RegisterBar'scashier.onPress. Dismissing it callsonOpenChange(false). - Header: the cashier's avatar (or initials) and name. The
descriptionline shows as given; the app joins the store, the register (when there are several) and "since HH:mm" with " · ". Without it the line is hidden. - Your sales today: the app's figure for the cashier's own sales on the store day, formatted in the given currency. Without
salesTodaythe row is hidden. The sheet does not compute the figure. - Drawer door: with
drawer, an "In the drawer" door sits under "Your sales today". It shows the app's figure: the expected cash, a blind count's number of sales, "—" while figures are pending, or "Register closed · last closure{n}". It also shows the opener line and the register verbs. Pressing it callsdrawer.onOpenand leaves the sheet open, anddrawer.disabledblocks it. The sheet computes nothing. - Sign out: a destructive button that calls
onSignOut. It never closes the sheet itself: the app decides, for example afterSwitchConfirmwithkind="signOut".signOutDisableddisables it while a payment or a switch is in progress. - Notices and "Hand the till to":
awaitingStoreabove 0 shows "Awaiting store ·nsales" with "Sent when you are signed in online.";payingshows "Finish the payment first". WithhandTo, a row per other cashier (with "nopen carts" when above 0) callshandTo.onHandTo(id)and leaves the sheet open, so the app can showSwitchConfirmwithkind="cashier"; the rows are disabled whilehandTo.disabled,payingorhandTo.counting, and counting adds "Finish or abandon the count first" to the header unless paying. The app passes the list without the signed-in cashier and counts the carts. - Store and Register rows: with
storeandregister, a row each, Store first, shows "Store" or "Register" with the name. WithonSwitch, a "Switch" verb calls it and leaves the sheet open, so the app opens its own picker (RegisterPickerfor registers). Switch is disabled whiledisabled,payingorheldReason, andheldReasonshows as a line under the row unless paying. The app passesregisteronly when bound with two or more registers, and decides the reason (for example "Needs the store to switch" offline). The sheet writes nothing.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
cashier | { name: string; avatar?: string } | required | The signed-in cashier |
description | string | --- | The header line, already joined; hidden when absent |
salesToday | { amountMinor: number; currency: string } | --- | "Your sales today" in integer minor units; hidden when absent |
onSignOut | () => void | required | Called when Sign out is pressed |
signOutDisabled | boolean | false | Disables Sign out |
onOpenChange | (open: boolean) => void | required | Called with false when the sheet is dismissed |
drawer | CashierSheetDrawer | --- | The drawer door; hidden when absent |
handTo | CashierSheetHandTo | --- | "Hand the till to"; hidden when absent or empty |
paying | boolean | false | Shows "Finish the payment first" and disables the hand-to rows |
awaitingStore | number | 0 | Sales the store has still to hear; the notice is hidden at 0 |
store | CashierSheetPlace | --- | The Store row; hidden when absent |
register | CashierSheetPlace | --- | The Register row; hidden when absent |
CashierSheetDrawer
type CashierSheetDrawer = {
onOpen: () => void; // the door was pressed: open the register panel
disabled?: boolean; // a payment or a switch is in progress
} & (
| { state: 'closed'; lastClosure?: string | number } // default "—"
| {
state: 'open' | 'counting';
figure: { kind: 'cash'; amountMinor: number; currency: string } | { kind: 'blind'; salesCount: number } | { kind: 'pending' };
openedAt: string; // already formatted, "HH:mm" in the store's zone
opener: { name: string; avatar?: string };
registerName?: string; // only when there is more than one register
countingSince?: string; // state "counting" only, already formatted; default "—"
}
);CashierSheetHandTo
interface CashierSheetCashier {
id: string;
name: string;
avatar?: string;
openCarts?: number; // this cashier's open carts on this register; hidden at 0
}
interface CashierSheetHandTo {
cashiers: CashierSheetCashier[]; // the other cashiers, without the one signed in
onHandTo: (id: string) => void; // a row was pressed: show SwitchConfirm kind="cashier"
disabled?: boolean; // a switch is in progress
counting?: boolean; // a count is open on this register
}CashierSheetPlace
interface CashierSheetPlace {
name: string; // the current store's or register's name
onSwitch?: () => void; // "Switch" was pressed: open the app's picker; absent hides the verb
heldReason?: string; // why Switch is held; drawn under the row unless paying, and disables Switch
disabled?: boolean; // a switch is in progress: Switch is disabled, with no line
}