{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "invoice",
  "title": "Invoice",
  "description": "Primitives for printable documents such as invoices, receipts, quotes and packing slips: totals that add up to the cent with discounts, tax per rate, shipping and balance due, a sheet that prints black on white, a toolbar hidden in print, a header, a headline amount with a sentence, parties, dates, a line items table with optional checkboxes, totals, notes and a Code 39 barcode.",
  "registryDependencies": [
    "button",
    "checkbox",
    "https://www.dashboardblocks.com/r/radix/format.json",
    "https://www.dashboardblocks.com/r/radix/block-state.json",
    "https://www.dashboardblocks.com/r/radix/details.json",
    "https://www.dashboardblocks.com/r/radix/table.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/invoice.tsx",
      "content": "'use client'\n\nimport {\n  BlockStateText,\n  SkeletonText,\n  useBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport { Details } from '@/registry/components/dashboardblocks/details'\nimport {\n  DataTable,\n  DataTableBody,\n  DataTableCell,\n  DataTableHead,\n  DataTableHeader,\n  DataTableRow,\n  DataTableStateRows,\n} from '@/registry/components/dashboardblocks/table'\nimport { IconPlaceholder } from '@/registry/icons/icon-placeholder'\nimport {\n  formatCurrency,\n  formatPercent,\n  formatSigned,\n  getCurrencyDigits,\n  toMinorUnits,\n} from '@/registry/lib/dashboardblocks/format'\nimport { type ComponentProps, type ReactNode, useId } from 'react'\n\nimport { Button } from '@/components/ui/button'\nimport { Checkbox } from '@/components/ui/checkbox'\n\nimport { cn } from '@/lib/utils'\n\ninterface DocumentLine {\n  detail?: string\n  description: string\n  id: string\n  optional?: boolean\n  quantity: number\n  sku?: string\n  /** This line's tax rate, 0.2 for 20%, instead of the document's. */\n  taxRate?: number\n  unit?: string\n  unitPrice: number\n}\n\ninterface DocumentTotalsOptions {\n  /** Amounts round to its smallest unit, cents for USD. */\n  currency?: string\n  discount?: number\n  /** A share off the subtotal, 0.1 for 10%. */\n  discountRate?: number\n  paid?: number\n  /** Added after tax and not taxed. */\n  shipping?: number\n  /** The rate for lines without their own, 0.2 for 20%. */\n  taxRate?: number\n}\n\ninterface DocumentTax {\n  amount: number\n  rate: number\n  taxable: number\n}\n\ninterface DocumentAmounts {\n  balanceDue: number\n  /** A positive amount. */\n  discount: number\n  paid: number\n  shipping: number\n  subtotal: number\n  tax: number\n  /** One entry per rate above zero, in the order the rates first appear. */\n  taxes: DocumentTax[]\n  total: number\n}\n\nfunction formatDocumentAmount(value: number, currency = 'USD') {\n  const format = (amount: number) =>\n    formatCurrency(amount, { currency, precision: 'exact' })\n  return value < 0 ? formatSigned(value, format) : format(value)\n}\n\nfunction getLineAmount(\n  line: Pick<DocumentLine, 'quantity' | 'unitPrice'>,\n  currency = 'USD',\n) {\n  const scale = 10 ** getCurrencyDigits(currency)\n  return toMinorUnits(line.quantity * line.unitPrice, currency) / scale\n}\n\nfunction getDocumentTotals(\n  lines: Pick<DocumentLine, 'quantity' | 'taxRate' | 'unitPrice'>[],\n  options: DocumentTotalsOptions = {},\n): DocumentAmounts {\n  const {\n    currency = 'USD',\n    discount,\n    discountRate = 0,\n    paid = 0,\n    shipping = 0,\n    taxRate = 0,\n  } = options\n  const scale = 10 ** getCurrencyDigits(currency)\n  const minor = (value: number) => toMinorUnits(value, currency)\n\n  const groups = new Map<number, number>()\n  let subtotal = 0\n  for (const line of lines) {\n    const amount = minor(line.quantity * line.unitPrice)\n    const rate = line.taxRate ?? taxRate\n    groups.set(rate, (groups.get(rate) ?? 0) + amount)\n    subtotal += amount\n  }\n\n  const requested =\n    discount !== undefined ? minor(discount) : minor((subtotal / scale) * discountRate)\n  const discountTotal = Math.min(Math.max(requested, 0), Math.max(subtotal, 0))\n\n  const taxes: DocumentTax[] = []\n  let allocated = 0\n  let tax = 0\n  const entries = [...groups]\n  entries.forEach(([rate, base], index) => {\n    const share =\n      index === entries.length - 1\n        ? discountTotal - allocated\n        : subtotal === 0\n          ? 0\n          : Math.round((discountTotal * base) / subtotal)\n    allocated += share\n    const taxable = base - share\n    const amount = minor((taxable / scale) * rate)\n    tax += amount\n    if (rate > 0) taxes.push({ amount: amount / scale, rate, taxable: taxable / scale })\n  })\n\n  const shippingTotal = minor(shipping)\n  const total = subtotal - discountTotal + tax + shippingTotal\n  const paidTotal = minor(paid)\n\n  return {\n    balanceDue: (total - paidTotal) / scale,\n    discount: discountTotal / scale,\n    paid: paidTotal / scale,\n    shipping: shippingTotal / scale,\n    subtotal: subtotal / scale,\n    tax: tax / scale,\n    taxes,\n    total: total / scale,\n  }\n}\n\nfunction formatRate(rate: number) {\n  return formatPercent(rate, { maximumFractionDigits: 3 })\n}\n\ninterface DocumentTotalRow {\n  /** `total` rules a line above the row. */\n  emphasis?: 'due' | 'total'\n  id: string\n  label: ReactNode\n  /** Negative for amounts taken off, such as a discount or a payment. */\n  value: number\n}\n\ninterface DocumentTotalLabels {\n  /** @default 'Discount' */\n  discount?: string\n  /** @default 'Balance due' */\n  due?: string\n  /** @default 'Amount paid' */\n  paid?: string\n  /** @default 'Shipping' */\n  shipping?: string\n  /** Followed by the rate. */\n  tax?: string\n  /** @default 'Total' */\n  total?: string\n}\n\nfunction getTotalRows(amounts: DocumentAmounts, labels: DocumentTotalLabels = {}) {\n  const rows: DocumentTotalRow[] = []\n  if (amounts.discount > 0 || amounts.taxes.length > 0 || amounts.shipping > 0) {\n    rows.push({ id: 'subtotal', label: 'Subtotal', value: amounts.subtotal })\n  }\n  if (amounts.discount > 0) {\n    rows.push({\n      id: 'discount',\n      label: labels.discount ?? 'Discount',\n      value: -amounts.discount,\n    })\n  }\n  for (const tax of amounts.taxes) {\n    rows.push({\n      id: `tax-${tax.rate}`,\n      label: `${labels.tax ?? 'Tax'} (${formatRate(tax.rate)})`,\n      value: tax.amount,\n    })\n  }\n  if (amounts.shipping > 0) {\n    rows.push({\n      id: 'shipping',\n      label: labels.shipping ?? 'Shipping',\n      value: amounts.shipping,\n    })\n  }\n  if (amounts.paid === 0) {\n    rows.push({\n      emphasis: 'due',\n      id: 'total',\n      label: labels.total ?? 'Total',\n      value: amounts.total,\n    })\n    return rows\n  }\n  rows.push(\n    {\n      emphasis: 'total',\n      id: 'total',\n      label: labels.total ?? 'Total',\n      value: amounts.total,\n    },\n    { id: 'paid', label: labels.paid ?? 'Amount paid', value: -amounts.paid },\n    {\n      emphasis: 'due',\n      id: 'due',\n      label: labels.due ?? 'Balance due',\n      value: amounts.balanceDue,\n    },\n  )\n  return rows\n}\n\nfunction DocumentLayout({\n  children,\n  className,\n}: {\n  children: ReactNode\n  className?: string\n}) {\n  return (\n    <div\n      className={cn(\n        'mx-auto flex w-full max-w-3xl flex-col gap-4 print:max-w-none print:gap-0',\n        className,\n      )}\n    >\n      {children}\n    </div>\n  )\n}\n\nfunction DocumentToolbar({\n  children,\n  className,\n  description,\n}: {\n  children: ReactNode\n  className?: string\n  description?: ReactNode\n}) {\n  return (\n    <div\n      className={cn(\n        'flex flex-wrap items-center justify-end gap-x-4 gap-y-3 print:hidden',\n        className,\n      )}\n    >\n      {description && (\n        <div className='text-muted-foreground mr-auto min-w-0 text-sm text-pretty'>\n          {description}\n        </div>\n      )}\n      <div className='flex flex-wrap items-center gap-2'>{children}</div>\n    </div>\n  )\n}\n\nfunction PrintButton({\n  children = 'Print',\n  className,\n  onPrint,\n}: {\n  /** @default 'Print' */\n  children?: ReactNode\n  className?: string\n  /** Replaces `window.print()`, for example to print a server-rendered PDF. */\n  onPrint?: () => void\n}) {\n  const state = useBlockState()\n  return (\n    <Button\n      variant='outline'\n      size='sm'\n      className={className}\n      disabled={!!state}\n      onClick={() => (onPrint ? onPrint() : window.print())}\n    >\n      <IconPlaceholder\n        lucide='PrinterIcon'\n        tabler='IconPrinter'\n        hugeicons='PrinterIcon'\n        phosphor='PrinterIcon'\n        remixicon='RiPrinterLine'\n        aria-hidden\n      />\n      {children}\n    </Button>\n  )\n}\n\nconst printColors =\n  'print:[color-scheme:light] print:[--background:#fff] print:[--border:#d4d4d4] print:[--card-foreground:#000] print:[--card:#fff] print:[--foreground:#000] print:[--input:#a3a3a3] print:[--muted-foreground:#525252] print:[--muted:#f5f5f5] print:[--primary-foreground:#fff] print:[--primary:#000]'\n\nfunction DocumentPage({\n  children,\n  className,\n  ...props\n}: {\n  children: ReactNode\n  className?: string\n} & Pick<ComponentProps<'article'>, 'aria-label' | 'aria-labelledby'>) {\n  return (\n    <article\n      {...props}\n      className={cn(\n        '@container/document flex flex-col gap-8 border-t pt-6 print:bg-background print:text-foreground print:border-0 print:pt-0',\n        printColors,\n        className,\n      )}\n    >\n      {children}\n    </article>\n  )\n}\n\nfunction DocumentBrand({\n  className,\n  detail,\n  logo,\n  name,\n}: {\n  className?: string\n  detail?: ReactNode\n  /** Print-safe: an SVG or image, not a coloured background with light text. */\n  logo?: ReactNode\n  name: string\n}) {\n  return (\n    <div className={cn('flex min-w-0 items-center gap-3', className)}>\n      {logo && <span className='flex shrink-0 [&_svg]:size-9'>{logo}</span>}\n      <div className='flex min-w-0 flex-col'>\n        <span className='font-semibold'>{name}</span>\n        {detail && <span className='text-muted-foreground text-sm'>{detail}</span>}\n      </div>\n    </div>\n  )\n}\n\nfunction DocumentHeader({\n  brand,\n  children,\n  className,\n  number,\n  status,\n  title,\n}: {\n  brand: ReactNode\n  children?: ReactNode\n  className?: string\n  number: string\n  status?: ReactNode\n  title: string\n}) {\n  const state = useBlockState()\n  return (\n    <header\n      className={cn(\n        'flex flex-col gap-6 break-inside-avoid @xl/document:flex-row @xl/document:items-start @xl/document:justify-between print:flex-row print:items-start print:justify-between',\n        className,\n      )}\n    >\n      {brand}\n      <div className='flex flex-col gap-1 @xl/document:items-end @xl/document:text-right print:items-end print:text-right'>\n        <div className='flex flex-wrap items-center gap-x-3 gap-y-1 @xl/document:flex-row-reverse print:flex-row-reverse'>\n          <h1 className='text-2xl/6 font-semibold tracking-tight'>{title}</h1>\n          {status && !state && <span className='print:*:text-black!'>{status}</span>}\n        </div>\n        {state === 'loading' ? (\n          <SkeletonText className='w-28 text-sm' />\n        ) : (\n          !state && <p className='text-muted-foreground font-mono text-sm'>{number}</p>\n        )}\n        {!state && children}\n      </div>\n    </header>\n  )\n}\n\nfunction DocumentHeadline({\n  children,\n  className,\n  label,\n  value,\n}: {\n  children?: ReactNode\n  className?: string\n  label: string\n  value: ReactNode\n}) {\n  const state = useBlockState()\n  return (\n    <div className={cn('flex min-w-0 flex-col gap-1 break-inside-avoid', className)}>\n      <p className='text-muted-foreground text-sm'>{label}</p>\n      <div className='text-4xl font-light tracking-tight tabular-nums'>\n        {state === 'loading' ? (\n          <SkeletonText className='w-[4.5em]' />\n        ) : state ? (\n          <BlockStateText variant='short' />\n        ) : (\n          value\n        )}\n      </div>\n      {state === 'loading' ? (\n        <BlockStateText className='text-sm' />\n      ) : (\n        !state &&\n        children && (\n          <p className='text-muted-foreground text-sm text-pretty'>{children}</p>\n        )\n      )}\n    </div>\n  )\n}\n\nfunction DocumentSummary({\n  children,\n  className,\n}: {\n  children: ReactNode\n  className?: string\n}) {\n  return (\n    <div\n      className={cn(\n        'grid gap-6 border-y py-6 break-inside-avoid @xl/document:grid-cols-2 print:grid-cols-2',\n        className,\n      )}\n    >\n      {children}\n    </div>\n  )\n}\n\ninterface DocumentMetaItem {\n  label: string\n  note?: ReactNode\n  value: ReactNode\n}\n\nfunction DocumentMeta({\n  className,\n  items,\n}: {\n  className?: string\n  items: DocumentMetaItem[]\n}) {\n  const state = useBlockState()\n  if (state === 'empty' || state === 'error') return null\n  return (\n    <dl\n      className={cn(\n        'grid grid-cols-2 content-start gap-x-6 gap-y-4 break-inside-avoid',\n        className,\n      )}\n    >\n      {items.map((item) => (\n        <div key={item.label} className='flex min-w-0 flex-col gap-1'>\n          <dt className='text-muted-foreground text-sm'>{item.label}</dt>\n          <dd className='text-sm font-medium break-words tabular-nums'>\n            {state === 'loading' ? <SkeletonText className='w-20' /> : item.value}\n          </dd>\n          {item.note && !state && (\n            <dd className='text-muted-foreground text-xs'>{item.note}</dd>\n          )}\n        </div>\n      ))}\n    </dl>\n  )\n}\n\ninterface DocumentParty {\n  label: string\n  lines: string[]\n  name: string\n}\n\nfunction DocumentParties({\n  className,\n  parties,\n}: {\n  className?: string\n  parties: DocumentParty[]\n}) {\n  const state = useBlockState()\n  if (state === 'empty' || state === 'error') return null\n  return (\n    <div\n      className={cn(\n        'grid gap-6 break-inside-avoid @md/document:grid-cols-2 @2xl/document:auto-cols-fr @2xl/document:grid-flow-col @2xl/document:grid-cols-none print:auto-cols-fr print:grid-flow-col print:grid-cols-none',\n        className,\n      )}\n    >\n      {parties.map((party) => (\n        <section key={party.label} className='flex min-w-0 flex-col gap-1.5 text-sm'>\n          <h2 className='text-muted-foreground'>{party.label}</h2>\n          {state === 'loading' ? (\n            <span className='flex flex-col gap-1.5'>\n              <SkeletonText className='w-32' />\n              <SkeletonText className='w-40' />\n              <SkeletonText className='w-28' />\n            </span>\n          ) : (\n            <address className='not-italic'>\n              <span className='block font-medium'>{party.name}</span>\n              {party.lines.map((line, index) => (\n                <span key={index} className='text-muted-foreground block break-words'>\n                  {line}\n                </span>\n              ))}\n            </address>\n          )}\n        </section>\n      ))}\n    </div>\n  )\n}\n\ninterface LineSelection {\n  isSelectable?: (line: DocumentLine) => boolean\n  label: (line: DocumentLine) => string\n  onChange: (id: string, selected: boolean) => void\n  selected: string[]\n}\n\ninterface LineItemsTableProps {\n  caption?: string\n  className?: string\n  /** @default 'USD' */\n  currency?: string\n  hidePrices?: boolean\n  lines: DocumentLine[]\n  selection?: LineSelection\n}\n\nfunction LineItemsTable({\n  caption = 'Line items',\n  className,\n  currency = 'USD',\n  hidePrices = false,\n  lines,\n  selection,\n}: LineItemsTableProps) {\n  const state = useBlockState()\n  const selected = new Set(selection?.selected)\n  const hasSelection = Boolean(selection)\n  const wide = 'hidden @md/line-items:table-cell print:table-cell'\n\n  return (\n    <div className={cn('@container/line-items print:*:overflow-visible', className)}>\n      <DataTable caption={caption} density='compact'>\n        <DataTableHeader>\n          <DataTableRow>\n            {hasSelection && (\n              <DataTableHead className='w-8 pe-0'>\n                <span className='sr-only'>Selected</span>\n              </DataTableHead>\n            )}\n            <DataTableHead>Description</DataTableHead>\n            <DataTableHead align='end' className={cn(!hidePrices && wide)}>\n              Qty\n            </DataTableHead>\n            {!hidePrices && (\n              <>\n                <DataTableHead align='end' className={wide}>\n                  Unit price\n                </DataTableHead>\n                <DataTableHead align='end'>Amount</DataTableHead>\n              </>\n            )}\n          </DataTableRow>\n        </DataTableHeader>\n        <DataTableBody>\n          <DataTableStateRows\n            colSpan={(hasSelection ? 1 : 0) + (hidePrices ? 2 : 4)}\n            rows={Math.min(Math.max(lines.length, 3), 6)}\n          />\n          {!state &&\n            lines.map((line) => {\n              const isSelectable = selection && (selection.isSelectable?.(line) ?? true)\n              const isExcluded = isSelectable && line.optional && !selected.has(line.id)\n              const quantity = `${line.quantity}${line.unit ? ` ${line.unit}` : ''}`\n              return (\n                <DataTableRow key={line.id} className='break-inside-avoid'>\n                  {hasSelection && (\n                    <DataTableCell className='pe-0 align-top'>\n                      {isSelectable && (\n                        <Checkbox\n                          aria-label={selection.label(line)}\n                          checked={selected.has(line.id)}\n                          onCheckedChange={(checked) =>\n                            selection.onChange(line.id, checked === true)\n                          }\n                          className='mt-0.5 print:bg-transparent! print:[&_svg]:text-black!'\n                        />\n                      )}\n                    </DataTableCell>\n                  )}\n                  <DataTableCell className='align-top'>\n                    <span className='block font-medium'>{line.description}</span>\n                    {(line.sku || line.optional || line.detail) && (\n                      <Details className='text-muted-foreground mt-0.5 block text-xs'>\n                        {line.sku && <span className='font-mono'>{line.sku}</span>}\n                        {line.optional && 'Optional'}\n                        {line.detail}\n                      </Details>\n                    )}\n                    {!hidePrices && (\n                      <span className='text-muted-foreground mt-0.5 block text-xs tabular-nums @md/line-items:hidden print:hidden'>\n                        {quantity} × {formatDocumentAmount(line.unitPrice, currency)}\n                      </span>\n                    )}\n                  </DataTableCell>\n                  <DataTableCell\n                    align='end'\n                    className={cn('align-top', !hidePrices && wide)}\n                  >\n                    {quantity}\n                  </DataTableCell>\n                  {!hidePrices && (\n                    <>\n                      <DataTableCell align='end' className={cn('align-top', wide)}>\n                        {formatDocumentAmount(line.unitPrice, currency)}\n                      </DataTableCell>\n                      <DataTableCell\n                        align='end'\n                        className={cn(\n                          'align-top font-medium',\n                          isExcluded && 'text-muted-foreground font-normal',\n                        )}\n                      >\n                        {formatDocumentAmount(getLineAmount(line, currency), currency)}\n                        {isExcluded && <span className='sr-only'>, not included</span>}\n                      </DataTableCell>\n                    </>\n                  )}\n                </DataTableRow>\n              )\n            })}\n        </DataTableBody>\n      </DataTable>\n    </div>\n  )\n}\n\nfunction DocumentTotals({\n  className,\n  currency = 'USD',\n  rows,\n}: {\n  className?: string\n  /** @default 'USD' */\n  currency?: string\n  rows: DocumentTotalRow[]\n}) {\n  const state = useBlockState()\n  if (state === 'empty' || state === 'error') return null\n  return (\n    <dl\n      className={cn(\n        'ml-auto flex w-full max-w-sm flex-col gap-2.5 text-sm break-inside-avoid',\n        className,\n      )}\n    >\n      {rows.map((row) => (\n        <div\n          key={row.id}\n          className={cn(\n            'flex items-baseline justify-between gap-4 px-[var(--data-table-inset,0.75rem)]',\n            row.emphasis && 'border-t pt-2.5 font-medium',\n          )}\n        >\n          <dt className={cn(!row.emphasis && 'text-muted-foreground')}>{row.label}</dt>\n          <dd className='text-right tabular-nums'>\n            {state === 'loading' ? (\n              <SkeletonText className='w-16' />\n            ) : (\n              formatDocumentAmount(row.value, currency)\n            )}\n          </dd>\n        </div>\n      ))}\n    </dl>\n  )\n}\n\nfunction DocumentSection({\n  children,\n  className,\n  title,\n}: {\n  children: ReactNode\n  className?: string\n  title: string\n}) {\n  const id = useId()\n  return (\n    <section\n      aria-labelledby={id}\n      className={cn('flex min-w-0 flex-col gap-2 text-sm break-inside-avoid', className)}\n    >\n      <h2 id={id} className='font-medium'>\n        {title}\n      </h2>\n      {children}\n    </section>\n  )\n}\n\nfunction DocumentFooter({\n  children,\n  className,\n  parts,\n}: {\n  children?: ReactNode\n  className?: string\n  /** Short facts about the sender, such as the legal name, address and tax ID. */\n  parts?: string[]\n}) {\n  return (\n    <footer\n      className={cn(\n        'text-muted-foreground border-t pt-6 text-xs text-pretty break-inside-avoid',\n        className,\n      )}\n    >\n      {parts && (\n        <Details>\n          {parts.map((part) => (\n            <span key={part}>{part}</span>\n          ))}\n        </Details>\n      )}\n      {children}\n    </footer>\n  )\n}\n\nconst code39: Record<string, string> = {\n  ' ': '011000100',\n  $: '010101000',\n  '%': '000101010',\n  '*': '010010100',\n  '+': '010001010',\n  '-': '010000101',\n  '.': '110000100',\n  '/': '010100010',\n  '0': '000110100',\n  '1': '100100001',\n  '2': '001100001',\n  '3': '101100000',\n  '4': '000110001',\n  '5': '100110000',\n  '6': '001110000',\n  '7': '000100101',\n  '8': '100100100',\n  '9': '001100100',\n  A: '100001001',\n  B: '001001001',\n  C: '101001000',\n  D: '000011001',\n  E: '100011000',\n  F: '001011000',\n  G: '000001101',\n  H: '100001100',\n  I: '001001100',\n  J: '000011100',\n  K: '100000011',\n  L: '001000011',\n  M: '101000010',\n  N: '000010011',\n  O: '100010010',\n  P: '001010010',\n  Q: '000000111',\n  R: '100000110',\n  S: '001000110',\n  T: '000010110',\n  U: '110000001',\n  V: '011000001',\n  W: '111000000',\n  X: '010010001',\n  Y: '110010000',\n  Z: '011010000',\n}\n\nconst QUIET_ZONE = 10\nconst WIDE = 3\nconst INTER_CHARACTER_GAP = 1\n\nfunction getBarcodeBars(value: string) {\n  const text = value\n    .toUpperCase()\n    .split('')\n    .filter((char) => char !== '*' && char in code39)\n  const bars: { width: number; x: number }[] = []\n  let x = QUIET_ZONE\n  for (const char of ['*', ...text, '*']) {\n    const pattern = code39[char]\n    for (let index = 0; index < pattern.length; index++) {\n      const width = pattern[index] === '1' ? WIDE : 1\n      if (index % 2 === 0) bars.push({ width, x })\n      x += width\n    }\n    x += INTER_CHARACTER_GAP\n  }\n  return {\n    bars,\n    text: text.join(''),\n    width: x - INTER_CHARACTER_GAP + QUIET_ZONE,\n  }\n}\n\nfunction Barcode({\n  className,\n  moduleWidth = 1.5,\n  value,\n}: {\n  className?: string\n  /** The width of a narrow bar in pixels. */\n  moduleWidth?: number\n  value: string\n}) {\n  const { bars, text, width } = getBarcodeBars(value)\n  return (\n    <div className={cn('flex flex-col items-center gap-1', className)}>\n      <svg\n        aria-hidden\n        className='h-12 max-w-full'\n        fill='currentColor'\n        preserveAspectRatio='none'\n        shapeRendering='crispEdges'\n        viewBox={`0 0 ${width} 1`}\n        width={width * moduleWidth}\n      >\n        {bars.map((bar) => (\n          <rect key={bar.x} height={1} width={bar.width} x={bar.x} y={0} />\n        ))}\n      </svg>\n      <span className='font-mono text-xs tracking-[0.3em]'>{text}</span>\n    </div>\n  )\n}\n\nexport {\n  Barcode,\n  DocumentBrand,\n  DocumentFooter,\n  DocumentHeader,\n  DocumentHeadline,\n  DocumentLayout,\n  DocumentMeta,\n  DocumentPage,\n  DocumentParties,\n  DocumentSection,\n  DocumentSummary,\n  DocumentTotals,\n  DocumentToolbar,\n  LineItemsTable,\n  PrintButton,\n  formatDocumentAmount,\n  formatRate,\n  getBarcodeBars,\n  getCurrencyDigits,\n  getDocumentTotals,\n  getLineAmount,\n  getTotalRows,\n  toMinorUnits,\n}\n\nexport type {\n  DocumentAmounts,\n  DocumentLine,\n  DocumentMetaItem,\n  DocumentParty,\n  DocumentTax,\n  DocumentTotalLabels,\n  DocumentTotalRow,\n  DocumentTotalsOptions,\n  LineItemsTableProps,\n  LineSelection,\n}\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/invoice.tsx"
    }
  ],
  "type": "registry:component"
}
