Files
xenia-pos-local/packages/ui/src/components/PrintArea.jsx
T
bonaminandClaude Opus 5.5 b77bb8bb40 feat(ui): IconButton tones, Switch info slot, wide right sheet, PrintArea / PrintSheet
- IconButton tone=danger|warning|info|success|special|accent: a pastel button (soft background,
  ink icon) for row actions that stand apart.
- Switch info: an element (InfoTip) right after the label instead of after the switch.
- Sheet size=wide: a 600 px drawer.
- PrintArea: content rendered into <body>, hidden on screen, the only thing printed while mounted;
  PrintSheet: cards to cut out (dashed cut lines, never split across pages).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:48:50 +02:00

28 lines
1.0 KiB
React

import { Portal } from '../internal/Portal.jsx'
import { cx } from '../internal/cx.js'
/**
* What goes on paper (2026-11-20). Rendered straight into <body>, hidden on screen; while it is
* mounted, printing (window.print()) prints only it — not the page, the menu or the dialogs.
*
* <PrintArea><PrintSheet>{cards}</PrintSheet></PrintArea>
* <Button onClick={() => window.print()}>Print</Button>
*
* Mount one at a time (the page's own print content).
*/
export function PrintArea({ className, children, ...rest }) {
return (
<Portal>
<div className={cx('x-print-area', className)} {...rest}>{children}</div>
</Portal>
)
}
/**
* Cards to cut out: a grid of equal cells with dashed cut lines between them, never split across
* pages. columns: cells per row on an A4 page (default 3).
*/
export function PrintSheet({ columns = 3, className, children, ...rest }) {
return <div className={cx('x-print-sheet', className)} style={{ '--x-print-columns': columns }} {...rest}>{children}</div>
}