@andy-defer/react-pdf-builder 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import { ReactNode, CSSProperties } from 'react';
2
+
3
+ export interface BadgeProps {
4
+ children: ReactNode;
5
+ variant?: 'success' | 'warning' | 'danger' | 'info' | 'default';
6
+ size?: 'sm' | 'md' | 'lg';
7
+ rounded?: boolean;
8
+ className?: string;
9
+ style?: CSSProperties;
10
+ }
11
+ export declare function Badge({ children, variant, size, rounded, className, style, }: BadgeProps): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export interface BarcodeProps {
4
+ value: string;
5
+ format?: 'CODE128' | 'CODE39' | 'EAN13' | 'EAN8' | 'UPC' | 'ITF' | 'ITF14' | 'MSI' | 'CODABAR' | 'PHARMACODE';
6
+ width?: number;
7
+ height?: number;
8
+ displayValue?: boolean;
9
+ fontSize?: number;
10
+ font?: string;
11
+ textAlign?: 'left' | 'center' | 'right';
12
+ textPosition?: 'top' | 'bottom';
13
+ textMargin?: number;
14
+ margin?: number;
15
+ marginTop?: number;
16
+ marginBottom?: number;
17
+ marginLeft?: number;
18
+ marginRight?: number;
19
+ background?: string;
20
+ lineColor?: string;
21
+ className?: string;
22
+ style?: CSSProperties;
23
+ }
24
+ export declare function Barcode({ value, format, width, height, displayValue, fontSize, font, textAlign, textPosition, textMargin, margin, marginTop, marginBottom, marginLeft, marginRight, background, lineColor, className, style, }: BarcodeProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { ReactNode, CSSProperties } from 'react';
2
+
3
+ export interface BoxProps {
4
+ children: ReactNode;
5
+ padding?: number;
6
+ margin?: number;
7
+ border?: boolean;
8
+ rounded?: boolean;
9
+ shadow?: 'none' | 'sm' | 'md' | 'lg';
10
+ className?: string;
11
+ style?: CSSProperties;
12
+ }
13
+ export declare function Box({ children, padding, margin, border, rounded, shadow, className, style, }: BoxProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export interface DividerProps {
4
+ variant?: 'solid' | 'dashed' | 'dotted';
5
+ size?: number;
6
+ color?: string;
7
+ className?: string;
8
+ style?: CSSProperties;
9
+ }
10
+ export declare function Divider({ variant, size, color, className, style, }: DividerProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { ReactNode, CSSProperties } from 'react';
2
+
3
+ export interface FlexProps {
4
+ children: ReactNode;
5
+ direction?: 'row' | 'column';
6
+ gap?: number;
7
+ align?: 'start' | 'center' | 'end' | 'stretch';
8
+ justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
9
+ wrap?: boolean;
10
+ className?: string;
11
+ style?: CSSProperties;
12
+ }
13
+ export declare function Flex({ children, direction, gap, align, justify, wrap, className, style, }: FlexProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { ReactNode, CSSProperties } from 'react';
2
+
3
+ export interface GridProps {
4
+ children: ReactNode;
5
+ columns?: number;
6
+ gap?: number;
7
+ className?: string;
8
+ style?: CSSProperties;
9
+ }
10
+ export declare function Grid({ children, columns, gap, className, style, }: GridProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { default as React, ReactNode, CSSProperties } from 'react';
2
+
3
+ export interface HeadingProps {
4
+ children: ReactNode;
5
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
6
+ color?: 'primary' | 'secondary' | 'muted';
7
+ className?: string;
8
+ style?: CSSProperties;
9
+ }
10
+ export declare function Heading({ children, level, color, className, style, }: HeadingProps): React.ReactElement<{
11
+ className: string;
12
+ style: React.CSSProperties;
13
+ }, string | React.JSXElementConstructor<any>>;
@@ -0,0 +1,14 @@
1
+ import { default as React, CSSProperties } from 'react';
2
+
3
+ export interface ImageProps {
4
+ src: string;
5
+ alt?: string;
6
+ width?: number;
7
+ height?: number;
8
+ fit?: 'contain' | 'cover' | 'fill' | 'none';
9
+ rounded?: boolean | 'full';
10
+ fallback?: string;
11
+ className?: string;
12
+ style?: CSSProperties;
13
+ }
14
+ export declare function Image({ src, alt, width, height, fit, rounded, fallback, className, style, }: ImageProps): React.JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { ReactNode, CSSProperties } from 'react';
2
+ import { PDFGeneratorRef } from '../types/pdf';
3
+
4
+ export interface PDFGeneratorProps {
5
+ children: ReactNode;
6
+ format?: 'a4' | 'a3' | 'letter' | 'legal';
7
+ orientation?: 'portrait' | 'landscape';
8
+ scale?: number;
9
+ margin?: number;
10
+ border?: boolean;
11
+ borderColor?: string;
12
+ borderWidth?: number;
13
+ borderRadius?: number;
14
+ className?: string;
15
+ style?: CSSProperties;
16
+ onGenerate?: (base64: string) => void;
17
+ onDownload?: (pdf: any) => void;
18
+ }
19
+ export declare const PDFGenerator: import('react').ForwardRefExoticComponent<PDFGeneratorProps & import('react').RefAttributes<PDFGeneratorRef>>;
@@ -0,0 +1,8 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+
3
+ export interface PageProps {
4
+ children: ReactNode;
5
+ className?: string;
6
+ style?: CSSProperties;
7
+ }
8
+ export declare function Page({ children, className, style, }: PageProps): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export interface QRCodeProps {
4
+ value: string;
5
+ size?: number;
6
+ bgColor?: string;
7
+ fgColor?: string;
8
+ level?: 'L' | 'M' | 'Q' | 'H';
9
+ includeMargin?: boolean;
10
+ imageSettings?: {
11
+ src: string;
12
+ height: number;
13
+ width: number;
14
+ excavate: boolean;
15
+ };
16
+ className?: string;
17
+ style?: CSSProperties;
18
+ }
19
+ export declare function QRCode({ value, size, bgColor, fgColor, level, includeMargin, imageSettings, className, style, }: QRCodeProps): import("react").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export interface Column {
4
+ key: string;
5
+ label: string;
6
+ width?: string;
7
+ align?: 'left' | 'center' | 'right';
8
+ }
9
+ export interface TableProps {
10
+ columns: Column[];
11
+ data: Record<string, any>[];
12
+ bordered?: boolean;
13
+ striped?: boolean;
14
+ hoverable?: boolean;
15
+ className?: string;
16
+ style?: CSSProperties;
17
+ }
18
+ export declare function Table({ columns, data, bordered, striped, hoverable, className, style, }: TableProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { ReactNode, CSSProperties } from 'react';
2
+
3
+ export interface TableCellProps {
4
+ children: ReactNode;
5
+ align?: 'left' | 'center' | 'right';
6
+ className?: string;
7
+ style?: CSSProperties;
8
+ }
9
+ export declare function TableCell({ children, align, className, style, }: TableCellProps): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { ReactNode, CSSProperties } from 'react';
2
+
3
+ export interface TableRowProps {
4
+ children: ReactNode;
5
+ className?: string;
6
+ style?: CSSProperties;
7
+ }
8
+ export declare function TableRow({ children, className, style, }: TableRowProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { ReactNode, CSSProperties } from 'react';
2
+
3
+ export interface TextProps {
4
+ children: ReactNode;
5
+ variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'body' | 'small';
6
+ color?: 'primary' | 'secondary' | 'muted' | 'danger' | 'success' | 'warning';
7
+ align?: 'left' | 'center' | 'right' | 'justify';
8
+ bold?: boolean;
9
+ truncate?: boolean;
10
+ className?: string;
11
+ style?: CSSProperties;
12
+ }
13
+ export declare function Text({ children, variant, color, align, bold, truncate, className, style, }: TextProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export interface TotalBoxProps {
4
+ subtotal: number;
5
+ discount?: number;
6
+ tax?: number;
7
+ shipping?: number;
8
+ total: number;
9
+ currency?: string;
10
+ className?: string;
11
+ style?: CSSProperties;
12
+ }
13
+ export declare function TotalBox({ subtotal, discount, tax, shipping, total, currency, className, style, }: TotalBoxProps): import("react").JSX.Element;
@@ -0,0 +1,32 @@
1
+ export { PDFGenerator } from './PDFGenerator';
2
+ export type { PDFGeneratorProps } from './PDFGenerator';
3
+ export { Flex } from './Flex';
4
+ export type { FlexProps } from './Flex';
5
+ export { Grid } from './Grid';
6
+ export type { GridProps } from './Grid';
7
+ export { Box } from './Box';
8
+ export type { BoxProps } from './Box';
9
+ export { Text } from './Text';
10
+ export type { TextProps } from './Text';
11
+ export { Heading } from './Heading';
12
+ export type { HeadingProps } from './Heading';
13
+ export { Image } from './Image';
14
+ export type { ImageProps } from './Image';
15
+ export { Table } from './Table';
16
+ export type { TableProps, Column } from './Table';
17
+ export { TableRow } from './TableRow';
18
+ export type { TableRowProps } from './TableRow';
19
+ export { TableCell } from './TableCell';
20
+ export type { TableCellProps } from './TableCell';
21
+ export { Badge } from './Badge';
22
+ export type { BadgeProps } from './Badge';
23
+ export { Divider } from './Divider';
24
+ export type { DividerProps } from './Divider';
25
+ export { TotalBox } from './TotalBox';
26
+ export type { TotalBoxProps } from './TotalBox';
27
+ export { QRCode } from './QRCode';
28
+ export type { QRCodeProps } from './QRCode';
29
+ export { Barcode } from './Barcode';
30
+ export type { BarcodeProps } from './Barcode';
31
+ export { Page } from './Page';
32
+ export type { PageProps } from './Page';
@@ -0,0 +1,22 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface PDFConfig {
4
+ format: 'a4' | 'a3' | 'letter' | 'legal';
5
+ orientation: 'portrait' | 'landscape';
6
+ scale: number;
7
+ margin: number;
8
+ }
9
+ interface PDFContextType {
10
+ config: PDFConfig;
11
+ setConfig: (config: Partial<PDFConfig>) => void;
12
+ loading: boolean;
13
+ setLoading: (loading: boolean) => void;
14
+ error: string | null;
15
+ setError: (error: string | null) => void;
16
+ }
17
+ export declare function PDFProvider({ children, initialConfig, }: {
18
+ children: ReactNode;
19
+ initialConfig?: Partial<PDFConfig>;
20
+ }): import("react").JSX.Element;
21
+ export declare function usePDFContext(): PDFContextType;
22
+ export {};
@@ -0,0 +1,2 @@
1
+ export { PDFProvider, usePDFContext } from './PDFContext';
2
+ export type { PDFConfig } from './PDFContext';
@@ -0,0 +1,12 @@
1
+ import { PDFOptions } from '../types';
2
+
3
+ export declare function usePDF(): {
4
+ generate: (element: HTMLElement, options?: Partial<PDFOptions>) => Promise<string>;
5
+ download: (elements: HTMLElement | HTMLElement[], options?: Partial<PDFOptions>) => Promise<void>;
6
+ preview: (element: HTMLElement, containerId: string) => void;
7
+ config: import('../context').PDFConfig;
8
+ updateConfig: (newConfig: Partial<import('../context').PDFConfig>) => void;
9
+ loading: boolean;
10
+ error: string | null;
11
+ setError: (error: string | null) => void;
12
+ };
@@ -0,0 +1,20 @@
1
+
2
+ export { PDFGenerator } from './components/PDFGenerator';
3
+ export { Flex } from './components/Flex';
4
+ export { Grid } from './components/Grid';
5
+ export { Box } from './components/Box';
6
+ export { Text } from './components/Text';
7
+ export { Heading } from './components/Heading';
8
+ export { Image } from './components/Image';
9
+ export { Table } from './components/Table';
10
+ export { TableRow } from './components/TableRow';
11
+ export { TableCell } from './components/TableCell';
12
+ export { Badge } from './components/Badge';
13
+ export { Divider } from './components/Divider';
14
+ export { TotalBox } from './components/TotalBox';
15
+ export { QRCode } from './components/QRCode';
16
+ export { Barcode } from './components/Barcode';
17
+ export { Page } from './components/Page';
18
+ export { usePDF } from './hooks/usePDF';
19
+ export { PDFProvider, usePDFContext } from './context';
20
+ export * from './types';