「請求書」は Pro に含まれます。解除するとプレビューが表示されます。
使い方
import { ShopInvoice } from './ShopInvoice.jsx'
// Without onPay or onDownload, both finish after a short wait.
<ShopInvoice
locale="en"
currency="USD"
invoice={invoice} // { number, order, status: 'paid' | 'due' | 'overdue', issued, due, taxRate, delivery, card, link, note, from: { name, tagline, lines, logo: '/logo.svg' }, to }
items={lines} // [{ id, name, variant, price, qty }]
loading={!invoice}
error={loadError}
onRetry={reload}
onPay={async (amount) => (await api.payInvoice(invoice.number)).ok}
onDownload={() => api.downloadPdf(invoice.number)}
/>プロパティ
| プロパティ | 型 | 既定値 | 説明 |
|---|---|---|---|
locale | 'en' | 'zh-CN' | 'es' | 'ja' | 'en' | 組み込みの文言とサンプル請求書の言語。 |
invoice | { number, order, status, lateDays?, issued, due, taxRate, delivery, card, link, note, from: { name, tagline, lines, logo?: string | ReactNode }, to: { name, lines } } | sample invoice | 請求書の情報。税は明細と送料に taxRate(0.08 で 8%)をかけて計算します。`from.logo` はお店のロゴで、画像の URL か独自の要素を指定します。なければ `from.name` の頭文字を表示します。 |
items | Array<{ id, name, variant, price, qty }> | sample lines | 請求書の明細。 |
status | 'paid' | 'due' | 'overdue' | invoice.status | 最初に表示する状態。支払うと支払い済みになります。 |
link / currency | string / string | invoice.link / by locale | コピーボタンでコピーするアドレスと、ISO 通貨コード。 |
loading / error | boolean / boolean | string | false | スケルトン、または再試行ボタン付きのエラーを表示します(文字列で説明を置き換え)。 |
onPay / onDownload / onRetry | (total) => Promise<boolean | void> / () => Promise<boolean | void> / () => void | — | 請求の支払い(false で支払いエラーを表示)、PDF のダウンロード、エラー後の再読み込み。 |
labels | object | — | 組み込みの文言を置き換えます(キーは copy.js と同じ)。 |
className | string | — | ルートの section に追加されます。 |
プロジェクトに追加
Pro にはこのブロックのソース一式が含まれます。指示をコピーしてエージェントに導入を依頼できます。
ShopInvoice.jsxshop-invoice.csscopy.jskit.jsxkit.cssui/base-button/ui/copy-button/ui/rolling-number/ui/status-tag/ui/alert-banner/ui/success-check/ui/skeleton-shimmer/tokens.cssREADME.md
ブロック本体、スタイルと文言、共通の kit、使っているコンポーネント、tokens.css が 1 つのフォルダにまとめて入ります。
