UNPKG

@solid-bricks/barcode

Version:
46 lines (45 loc) 1.58 kB
import { JSX } from 'solid-js'; import type { Options as JsBarcodeOptions } from 'jsbarcode'; export declare type BarcodeElement = 'svg' | 'canvas' | 'img'; export declare type BarcodeFormat = 'CODE39' | 'CODE128' | 'CODE128A' | 'CODE128B' | 'CODE128C' | 'EAN13' | 'EAN8' | 'EAN5' | 'EAN2' | 'UPC' | 'UPCE' | 'ITF14' | 'ITF' | 'MSI' | 'MSI10' | 'MSI11' | 'MSI1010' | 'MSI1110' | 'pharmacode' | 'codabar'; export interface BarcodeOtions extends Omit<JsBarcodeOptions, 'format'> { format?: BarcodeFormat; } export interface BarcodeProps { /** * The element that displays the barcode. * * Default value: `svg` */ as?: BarcodeElement; /** * The rendered value. */ value: string; /** * `JsBarcode` options. * @see https://github.com/lindell/JsBarcode/wiki/Options * * Default value: `undefined` */ options?: BarcodeOtions | undefined; /** * Invoked whenever an error occurs while rendering the barcode. * * Default value: `console.error` */ onError?(reason: unknown): void; /** * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class */ class?: string | undefined; /** * @see https://www.solidjs.com/docs/latest/api#classlist */ classList?: JSX.IntrinsicElements['img']['classList']; /** * Additional element properties. */ elemProps?: JSX.IntrinsicElements['svg'] | JSX.IntrinsicElements['img'] | JSX.IntrinsicElements['canvas']; } export declare function Barcode(props: BarcodeProps): JSX.Element;