@pdfme/ui 0.0.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.
Files changed (97) hide show
  1. package/README.md +9 -0
  2. package/__mocks__/assetsTransformer.js +7 -0
  3. package/__mocks__/form-render.js +7 -0
  4. package/__mocks__/lucide-react.js +19 -0
  5. package/dist/index.es.js +159393 -0
  6. package/dist/index.umd.js +1041 -0
  7. package/dist/types/__tests__/assets/helper.d.ts +3 -0
  8. package/dist/types/__tests__/components/Designer.test.d.ts +1 -0
  9. package/dist/types/__tests__/components/PluginIcon.test.d.ts +1 -0
  10. package/dist/types/__tests__/components/Preview.test.d.ts +1 -0
  11. package/dist/types/__tests__/helper.test.d.ts +1 -0
  12. package/dist/types/src/Designer.d.ts +21 -0
  13. package/dist/types/src/Form.d.ts +24 -0
  14. package/dist/types/src/Viewer.d.ts +15 -0
  15. package/dist/types/src/class.d.ts +89 -0
  16. package/dist/types/src/components/AppContextProvider.d.ts +11 -0
  17. package/dist/types/src/components/CtlBar.d.ts +14 -0
  18. package/dist/types/src/components/Designer/Canvas/Guides.d.ts +9 -0
  19. package/dist/types/src/components/Designer/Canvas/Mask.d.ts +4 -0
  20. package/dist/types/src/components/Designer/Canvas/Moveable.d.ts +37 -0
  21. package/dist/types/src/components/Designer/Canvas/Padding.d.ts +6 -0
  22. package/dist/types/src/components/Designer/Canvas/Selecto.d.ts +10 -0
  23. package/dist/types/src/components/Designer/Canvas/index.d.ts +22 -0
  24. package/dist/types/src/components/Designer/LeftSidebar.d.ts +8 -0
  25. package/dist/types/src/components/Designer/PluginIcon.d.ts +10 -0
  26. package/dist/types/src/components/Designer/RightSidebar/DetailView/AlignWidget.d.ts +4 -0
  27. package/dist/types/src/components/Designer/RightSidebar/DetailView/ButtonGroupWidget.d.ts +4 -0
  28. package/dist/types/src/components/Designer/RightSidebar/DetailView/WidgetRenderer.d.ts +7 -0
  29. package/dist/types/src/components/Designer/RightSidebar/DetailView/index.d.ts +8 -0
  30. package/dist/types/src/components/Designer/RightSidebar/ListView/Item.d.ts +45 -0
  31. package/dist/types/src/components/Designer/RightSidebar/ListView/SelectableSortableContainer.d.ts +4 -0
  32. package/dist/types/src/components/Designer/RightSidebar/ListView/SelectableSortableItem.d.ts +14 -0
  33. package/dist/types/src/components/Designer/RightSidebar/ListView/index.d.ts +4 -0
  34. package/dist/types/src/components/Designer/RightSidebar/index.d.ts +4 -0
  35. package/dist/types/src/components/Designer/RightSidebar/layout.d.ts +15 -0
  36. package/dist/types/src/components/Designer/index.d.ts +11 -0
  37. package/dist/types/src/components/ErrorScreen.d.ts +7 -0
  38. package/dist/types/src/components/Paper.d.ts +20 -0
  39. package/dist/types/src/components/Preview.d.ts +15 -0
  40. package/dist/types/src/components/Renderer.d.ts +13 -0
  41. package/dist/types/src/components/Root.d.ts +9 -0
  42. package/dist/types/src/components/Spinner.d.ts +3 -0
  43. package/dist/types/src/components/StaticSchema.d.ts +10 -0
  44. package/dist/types/src/components/UnitPager.d.ts +10 -0
  45. package/dist/types/src/constants.d.ts +11 -0
  46. package/dist/types/src/contexts.d.ts +10 -0
  47. package/dist/types/src/helper.d.ts +73 -0
  48. package/dist/types/src/hooks.d.ts +46 -0
  49. package/dist/types/src/i18n.d.ts +3 -0
  50. package/dist/types/src/index.d.ts +4 -0
  51. package/dist/types/src/theme.d.ts +2 -0
  52. package/dist/types/src/types.d.ts +19 -0
  53. package/eslint.config.mjs +41 -0
  54. package/package.json +127 -0
  55. package/src/Designer.tsx +107 -0
  56. package/src/Form.tsx +102 -0
  57. package/src/Viewer.tsx +59 -0
  58. package/src/class.ts +188 -0
  59. package/src/components/AppContextProvider.tsx +78 -0
  60. package/src/components/CtlBar.tsx +183 -0
  61. package/src/components/Designer/Canvas/Guides.tsx +49 -0
  62. package/src/components/Designer/Canvas/Mask.tsx +20 -0
  63. package/src/components/Designer/Canvas/Moveable.tsx +91 -0
  64. package/src/components/Designer/Canvas/Padding.tsx +56 -0
  65. package/src/components/Designer/Canvas/Selecto.tsx +45 -0
  66. package/src/components/Designer/Canvas/index.tsx +536 -0
  67. package/src/components/Designer/LeftSidebar.tsx +120 -0
  68. package/src/components/Designer/PluginIcon.tsx +87 -0
  69. package/src/components/Designer/RightSidebar/DetailView/AlignWidget.tsx +229 -0
  70. package/src/components/Designer/RightSidebar/DetailView/ButtonGroupWidget.tsx +78 -0
  71. package/src/components/Designer/RightSidebar/DetailView/WidgetRenderer.tsx +28 -0
  72. package/src/components/Designer/RightSidebar/DetailView/index.tsx +469 -0
  73. package/src/components/Designer/RightSidebar/ListView/Item.tsx +158 -0
  74. package/src/components/Designer/RightSidebar/ListView/SelectableSortableContainer.tsx +204 -0
  75. package/src/components/Designer/RightSidebar/ListView/SelectableSortableItem.tsx +88 -0
  76. package/src/components/Designer/RightSidebar/ListView/index.tsx +116 -0
  77. package/src/components/Designer/RightSidebar/index.tsx +72 -0
  78. package/src/components/Designer/RightSidebar/layout.tsx +75 -0
  79. package/src/components/Designer/index.tsx +389 -0
  80. package/src/components/ErrorScreen.tsx +33 -0
  81. package/src/components/Paper.tsx +117 -0
  82. package/src/components/Preview.tsx +220 -0
  83. package/src/components/Renderer.tsx +165 -0
  84. package/src/components/Root.tsx +38 -0
  85. package/src/components/Spinner.tsx +45 -0
  86. package/src/components/StaticSchema.tsx +50 -0
  87. package/src/components/UnitPager.tsx +119 -0
  88. package/src/constants.ts +21 -0
  89. package/src/contexts.ts +14 -0
  90. package/src/helper.ts +534 -0
  91. package/src/hooks.ts +308 -0
  92. package/src/i18n.ts +903 -0
  93. package/src/index.ts +5 -0
  94. package/src/theme.ts +20 -0
  95. package/src/types.ts +20 -0
  96. package/tsconfig.json +48 -0
  97. package/vite.config.mts +22 -0
@@ -0,0 +1,3 @@
1
+ import { Template } from '@pdfme/common';
2
+ export declare const setupUIMock: () => void;
3
+ export declare const getSampleTemplate: () => Template;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import { Template, DesignerProps } from '@pdfme/common';
2
+ import { BaseUIClass } from './class.js';
3
+ declare class Designer extends BaseUIClass {
4
+ private onSaveTemplateCallback?;
5
+ private onChangeTemplateCallback?;
6
+ private onPageChangeCallback?;
7
+ private pageCursor;
8
+ constructor(props: DesignerProps);
9
+ saveTemplate(): void;
10
+ updateTemplate(template: Template): void;
11
+ onSaveTemplate(cb: (template: Template) => void): void;
12
+ onChangeTemplate(cb: (template: Template) => void): void;
13
+ onPageChange(cb: (pageInfo: {
14
+ currentPage: number;
15
+ totalPages: number;
16
+ }) => void): void;
17
+ getPageCursor(): number;
18
+ getTotalPages(): number;
19
+ protected render(): void;
20
+ }
21
+ export default Designer;
@@ -0,0 +1,24 @@
1
+ import { PreviewProps } from '@pdfme/common';
2
+ import { PreviewUI } from './class.js';
3
+ declare class Form extends PreviewUI {
4
+ private onChangeInputCallback?;
5
+ private onPageChangeCallback?;
6
+ private pageCursor;
7
+ constructor(props: PreviewProps);
8
+ onChangeInput(cb: (arg: {
9
+ index: number;
10
+ value: string;
11
+ name: string;
12
+ }) => void): void;
13
+ onPageChange(cb: (pageInfo: {
14
+ currentPage: number;
15
+ totalPages: number;
16
+ }) => void): void;
17
+ getPageCursor(): number;
18
+ getTotalPages(): number;
19
+ setInputs(inputs: {
20
+ [key: string]: string;
21
+ }[]): void;
22
+ protected render(): void;
23
+ }
24
+ export default Form;
@@ -0,0 +1,15 @@
1
+ import { PreviewProps } from '@pdfme/common';
2
+ import { PreviewUI } from './class.js';
3
+ declare class Viewer extends PreviewUI {
4
+ private onPageChangeCallback?;
5
+ private pageCursor;
6
+ constructor(props: PreviewProps);
7
+ onPageChange(cb: (pageInfo: {
8
+ currentPage: number;
9
+ totalPages: number;
10
+ }) => void): void;
11
+ getPageCursor(): number;
12
+ getTotalPages(): number;
13
+ protected render(): void;
14
+ }
15
+ export default Viewer;
@@ -0,0 +1,89 @@
1
+ import { Template, Size, UIProps, UIOptions, PluginRegistry, PreviewProps } from '@pdfme/common';
2
+ export declare abstract class BaseUIClass {
3
+ protected domContainer: HTMLElement | null;
4
+ protected template: Template;
5
+ protected size: Size;
6
+ private lang;
7
+ private font;
8
+ private pluginsRegistry;
9
+ private options;
10
+ private readonly setSize;
11
+ resizeObserver: ResizeObserver;
12
+ constructor(props: UIProps);
13
+ protected getLang(): "en" | "zh" | "ja" | "ko" | "ar" | "th" | "pl" | "it" | "de" | "es" | "fr";
14
+ protected getFont(): Record<string, {
15
+ data: string | ArrayBuffer | Uint8Array<ArrayBuffer>;
16
+ fallback?: boolean | undefined;
17
+ subset?: boolean | undefined;
18
+ }>;
19
+ protected getPluginsRegistry(): PluginRegistry;
20
+ getOptions(): UIOptions;
21
+ getTemplate(): {
22
+ [x: string]: unknown;
23
+ schemas: {
24
+ [x: string]: unknown;
25
+ name: string;
26
+ type: string;
27
+ position: {
28
+ x: number;
29
+ y: number;
30
+ };
31
+ width: number;
32
+ height: number;
33
+ content?: string | undefined;
34
+ rotate?: number | undefined;
35
+ opacity?: number | undefined;
36
+ readOnly?: boolean | undefined;
37
+ required?: boolean | undefined;
38
+ __bodyRange?: {
39
+ start: number;
40
+ end?: number | undefined;
41
+ } | undefined;
42
+ __isSplit?: boolean | undefined;
43
+ }[][];
44
+ basePdf: string | ArrayBuffer | Uint8Array<ArrayBuffer> | {
45
+ width: number;
46
+ height: number;
47
+ padding: [number, number, number, number];
48
+ staticSchema?: {
49
+ [x: string]: unknown;
50
+ name: string;
51
+ type: string;
52
+ position: {
53
+ x: number;
54
+ y: number;
55
+ };
56
+ width: number;
57
+ height: number;
58
+ content?: string | undefined;
59
+ rotate?: number | undefined;
60
+ opacity?: number | undefined;
61
+ readOnly?: boolean | undefined;
62
+ required?: boolean | undefined;
63
+ __bodyRange?: {
64
+ start: number;
65
+ end?: number | undefined;
66
+ } | undefined;
67
+ __isSplit?: boolean | undefined;
68
+ }[] | undefined;
69
+ };
70
+ pdfmeVersion?: string | undefined;
71
+ };
72
+ updateTemplate(template: Template): void;
73
+ updateOptions(options: UIOptions): void;
74
+ destroy(): void;
75
+ protected abstract render(): void;
76
+ }
77
+ export declare abstract class PreviewUI extends BaseUIClass {
78
+ protected inputs: {
79
+ [key: string]: string;
80
+ }[];
81
+ constructor(props: PreviewProps);
82
+ getInputs(): {
83
+ [key: string]: string;
84
+ }[];
85
+ setInputs(inputs: {
86
+ [key: string]: string;
87
+ }[]): void;
88
+ protected abstract render(): void;
89
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { Font, Lang, UIOptions, PluginRegistry } from '@pdfme/common';
3
+ type Props = {
4
+ children: React.ReactNode;
5
+ lang: Lang;
6
+ font: Font;
7
+ plugins: PluginRegistry;
8
+ options: UIOptions;
9
+ };
10
+ declare const AppContextProvider: ({ children, lang, font, plugins, options }: Props) => React.JSX.Element;
11
+ export default AppContextProvider;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { Size } from '@pdfme/common';
3
+ type CtlBarProps = {
4
+ size: Size;
5
+ pageCursor: number;
6
+ pageNum: number;
7
+ setPageCursor: (page: number) => void;
8
+ zoomLevel: number;
9
+ setZoomLevel: (zoom: number) => void;
10
+ addPageAfter?: () => void;
11
+ removePage?: () => void;
12
+ };
13
+ declare const CtlBar: (props: CtlBarProps) => React.JSX.Element;
14
+ export default CtlBar;
@@ -0,0 +1,9 @@
1
+ import React, { Ref } from 'react';
2
+ import GuidesComponent from '@scena/react-guides';
3
+ import { Size } from '@pdfme/common';
4
+ declare const _Guides: ({ paperSize, horizontalRef, verticalRef, }: {
5
+ paperSize: Size;
6
+ horizontalRef: Ref<GuidesComponent> | undefined;
7
+ verticalRef: Ref<GuidesComponent> | undefined;
8
+ }) => React.JSX.Element;
9
+ export default _Guides;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { Size } from '@pdfme/common';
3
+ declare const Mask: ({ width, height }: Size) => React.JSX.Element;
4
+ export default Mask;
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import MoveableComponent, { OnDrag, OnRotate, OnRotateEnd, OnClick, OnResize } from 'react-moveable';
3
+ type Props = {
4
+ target: HTMLElement[];
5
+ bounds: {
6
+ left: number;
7
+ top: number;
8
+ bottom: number;
9
+ right: number;
10
+ };
11
+ horizontalGuidelines: number[];
12
+ verticalGuidelines: number[];
13
+ keepRatio: boolean;
14
+ rotatable: boolean;
15
+ onDrag: ({ target, left, top }: OnDrag) => void;
16
+ onDragEnd: ({ target }: {
17
+ target: HTMLElement | SVGElement;
18
+ }) => void;
19
+ onDragGroupEnd: ({ targets }: {
20
+ targets: (HTMLElement | SVGElement)[];
21
+ }) => void;
22
+ onRotate: ({ target, rotate }: OnRotate) => void;
23
+ onRotateEnd: ({ target }: OnRotateEnd) => void;
24
+ onRotateGroupEnd: ({ targets }: {
25
+ targets: (HTMLElement | SVGElement)[];
26
+ }) => void;
27
+ onResize: ({ target, width, height, direction }: OnResize) => void;
28
+ onResizeEnd: ({ target }: {
29
+ target: HTMLElement | SVGElement;
30
+ }) => void;
31
+ onResizeGroupEnd: ({ targets }: {
32
+ targets: (HTMLElement | SVGElement)[];
33
+ }) => void;
34
+ onClick: (e: OnClick) => void;
35
+ };
36
+ declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<MoveableComponent<{}>>>;
37
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { BasePdf } from '@pdfme/common';
3
+ declare const Padding: ({ basePdf }: {
4
+ basePdf: BasePdf;
5
+ }) => React.JSX.Element;
6
+ export default Padding;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { OnSelect as SelectoOnSelect, OnDragStart as SelectoOnDragStart } from 'react-selecto';
3
+ type Props = {
4
+ container: HTMLElement | null;
5
+ continueSelect: boolean;
6
+ onDragStart: (e: SelectoOnDragStart) => void;
7
+ onSelect: (e: SelectoOnSelect) => void;
8
+ };
9
+ declare const Selecto: (props: Props) => React.JSX.Element;
10
+ export default Selecto;
@@ -0,0 +1,22 @@
1
+ import React, { MutableRefObject } from 'react';
2
+ import { SchemaForUI, Size, ChangeSchemas, BasePdf } from '@pdfme/common';
3
+ interface Props {
4
+ basePdf: BasePdf;
5
+ height: number;
6
+ hoveringSchemaId: string | null;
7
+ onChangeHoveringSchemaId: (id: string | null) => void;
8
+ pageCursor: number;
9
+ schemasList: SchemaForUI[][];
10
+ scale: number;
11
+ backgrounds: string[];
12
+ pageSizes: Size[];
13
+ size: Size;
14
+ activeElements: HTMLElement[];
15
+ onEdit: (targets: HTMLElement[]) => void;
16
+ changeSchemas: ChangeSchemas;
17
+ removeSchemas: (ids: string[]) => void;
18
+ paperRefs: MutableRefObject<HTMLDivElement[]>;
19
+ sidebarOpen: boolean;
20
+ }
21
+ declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
22
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { BasePdf } from '@pdfme/common';
3
+ declare const LeftSidebar: ({ height, scale, basePdf, }: {
4
+ height: number;
5
+ scale: number;
6
+ basePdf: BasePdf;
7
+ }) => React.JSX.Element;
8
+ export default LeftSidebar;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Plugin, Schema } from '@pdfme/common';
3
+ interface PluginIconProps {
4
+ plugin: Plugin<Schema>;
5
+ label: string;
6
+ size?: number;
7
+ styles?: React.CSSProperties;
8
+ }
9
+ declare const PluginIcon: (props: PluginIconProps) => React.JSX.Element;
10
+ export default PluginIcon;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { PropPanelWidgetProps } from '@pdfme/common';
3
+ declare const AlignWidget: (props: PropPanelWidgetProps) => React.JSX.Element;
4
+ export default AlignWidget;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { PropPanelWidgetProps } from '@pdfme/common';
3
+ declare const ButtonGroupWidget: (props: PropPanelWidgetProps) => React.JSX.Element;
4
+ export default ButtonGroupWidget;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { PropPanelWidgetProps } from '@pdfme/common';
3
+ type Props = PropPanelWidgetProps & {
4
+ widget: (props: PropPanelWidgetProps) => void;
5
+ };
6
+ declare const WidgetRenderer: (props: Props) => React.JSX.Element;
7
+ export default WidgetRenderer;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { SchemaForUI } from '@pdfme/common';
3
+ import type { SidebarProps } from '../../../../types.js';
4
+ type DetailViewProps = Pick<SidebarProps, 'size' | 'schemas' | 'schemasList' | 'pageSize' | 'basePdf' | 'changeSchemas' | 'activeElements' | 'deselectSchema'> & {
5
+ activeSchema: SchemaForUI;
6
+ };
7
+ declare const _default: React.MemoExoticComponent<(props: DetailViewProps) => React.JSX.Element>;
8
+ export default _default;
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { DraggableSyntheticListeners } from '@dnd-kit/core';
3
+ interface Props {
4
+ /** Content to display in the item */
5
+ value: React.ReactNode;
6
+ /** Optional icon to display */
7
+ icon?: React.ReactNode;
8
+ /** Custom styles for the item */
9
+ style?: React.CSSProperties;
10
+ /** Status indicator for the item */
11
+ status?: 'is-warning' | 'is-danger';
12
+ /** Title attribute for the item */
13
+ title?: string;
14
+ /** Whether the item is required */
15
+ required?: boolean;
16
+ /** Whether the item is read-only */
17
+ readOnly?: boolean;
18
+ /** Whether the item is being dragged as an overlay */
19
+ dragOverlay?: boolean;
20
+ /** Click handler for the item */
21
+ onClick?: () => void;
22
+ /** Mouse enter handler */
23
+ onMouseEnter?: () => void;
24
+ /** Mouse leave handler */
25
+ onMouseLeave?: () => void;
26
+ /** Whether the item is currently being dragged */
27
+ dragging?: boolean;
28
+ /** Whether items are being sorted */
29
+ sorting?: boolean;
30
+ /** CSS transition value */
31
+ transition?: string;
32
+ /** Transform data for the item */
33
+ transform?: {
34
+ x: number;
35
+ y: number;
36
+ scaleX: number;
37
+ scaleY: number;
38
+ } | null;
39
+ /** Whether to fade the item in */
40
+ fadeIn?: boolean;
41
+ /** Drag listeners from dnd-kit */
42
+ listeners?: DraggableSyntheticListeners;
43
+ }
44
+ declare const Item: React.MemoExoticComponent<React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLLIElement>>>;
45
+ export default Item;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { SidebarProps } from '../../../../types.js';
3
+ declare const SelectableSortableContainer: (props: Pick<SidebarProps, "schemas" | "onEdit" | "onSortEnd" | "hoveringSchemaId" | "onChangeHoveringSchemaId">) => React.JSX.Element;
4
+ export default SelectableSortableContainer;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { SchemaForUI } from '@pdfme/common';
3
+ interface Props {
4
+ isSelected: boolean;
5
+ style?: React.CSSProperties;
6
+ onSelect: (id: string, isShiftSelect: boolean) => void;
7
+ onEdit: (id: string) => void;
8
+ schema: SchemaForUI;
9
+ schemas: SchemaForUI[];
10
+ onMouseEnter: () => void;
11
+ onMouseLeave: () => void;
12
+ }
13
+ declare const SelectableSortableItem: ({ isSelected, style, onSelect, onEdit, schema, schemas, onMouseEnter, onMouseLeave, }: Props) => React.JSX.Element;
14
+ export default SelectableSortableItem;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { SidebarProps } from '../../../../types.js';
3
+ declare const ListView: (props: Pick<SidebarProps, "schemas" | "onSortEnd" | "onEdit" | "hoveringSchemaId" | "onChangeHoveringSchemaId" | "changeSchemas">) => React.JSX.Element;
4
+ export default ListView;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { SidebarProps } from '../../../types.js';
3
+ declare const Sidebar: (props: SidebarProps) => React.JSX.Element;
4
+ export default Sidebar;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ export declare const SIDEBAR_H_PADDING_PX = 16;
3
+ export declare const SIDEBAR_V_PADDING_PX = 8;
4
+ export declare const SIDEBAR_HEADER_HEIGHT = 60;
5
+ type SectionProps = {
6
+ children: React.ReactNode;
7
+ };
8
+ type SidebarFrameProps = SectionProps & {
9
+ className?: string;
10
+ };
11
+ export declare const SidebarFrame: ({ children, className }: SidebarFrameProps) => React.JSX.Element;
12
+ export declare const SidebarHeader: ({ children }: SectionProps) => React.JSX.Element;
13
+ export declare const SidebarBody: ({ children }: SectionProps) => React.JSX.Element;
14
+ export declare const SidebarFooter: ({ children }: SectionProps) => React.JSX.Element;
15
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Template, DesignerProps, Size } from '@pdfme/common';
3
+ declare const TemplateEditor: ({ template, size, onSaveTemplate, onChangeTemplate, onPageCursorChange, }: Omit<DesignerProps, "domContainer"> & {
4
+ size: Size;
5
+ onSaveTemplate: (t: Template) => void;
6
+ onChangeTemplate: (t: Template) => void;
7
+ } & {
8
+ onChangeTemplate: (t: Template) => void;
9
+ onPageCursorChange: (newPageCursor: number, totalPages: number) => void;
10
+ }) => React.JSX.Element;
11
+ export default TemplateEditor;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { Size } from '@pdfme/common';
3
+ declare const ErrorScreen: ({ size, error }: {
4
+ size: Size;
5
+ error: Error;
6
+ }) => React.JSX.Element;
7
+ export default ErrorScreen;
@@ -0,0 +1,20 @@
1
+ import React, { MutableRefObject, ReactNode } from 'react';
2
+ import { SchemaForUI, Size } from '@pdfme/common';
3
+ declare const Paper: (props: {
4
+ paperRefs: MutableRefObject<HTMLDivElement[]>;
5
+ scale: number;
6
+ size: Size;
7
+ schemasList: SchemaForUI[][];
8
+ pageSizes: Size[];
9
+ backgrounds: string[];
10
+ renderPaper: (arg: {
11
+ index: number;
12
+ paperSize: Size;
13
+ }) => ReactNode;
14
+ renderSchema: (arg: {
15
+ index: number;
16
+ schema: SchemaForUI;
17
+ }) => ReactNode;
18
+ hasRulers?: boolean;
19
+ }) => React.JSX.Element | null;
20
+ export default Paper;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { PreviewProps, Size } from '@pdfme/common';
3
+ declare const Preview: ({ template, inputs, size, onChangeInput, onPageChange, }: Omit<PreviewProps, "domContainer"> & {
4
+ onChangeInput?: (args: {
5
+ index: number;
6
+ value: string;
7
+ name: string;
8
+ }) => void;
9
+ onPageChange?: (pageInfo: {
10
+ currentPage: number;
11
+ totalPages: number;
12
+ }) => void;
13
+ size: Size;
14
+ }) => React.JSX.Element;
15
+ export default Preview;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { UIRenderProps, SchemaForUI, BasePdf, Schema } from '@pdfme/common';
3
+ type RendererProps = Omit<UIRenderProps<Schema>, 'schema' | 'rootElement' | 'options' | 'theme' | 'i18n' | '_cache'> & {
4
+ basePdf: BasePdf;
5
+ schema: SchemaForUI;
6
+ value: string;
7
+ outline: string;
8
+ onChangeHoveringSchemaId?: (id: string | null) => void;
9
+ scale: number;
10
+ selectable?: boolean;
11
+ };
12
+ declare const Renderer: (props: RendererProps) => React.JSX.Element;
13
+ export default Renderer;
@@ -0,0 +1,9 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { Size } from '@pdfme/common';
3
+ type Props = {
4
+ size: Size;
5
+ scale: number;
6
+ children: ReactNode;
7
+ };
8
+ declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
9
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const Spinner: React.FC;
3
+ export default Spinner;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Template } from '@pdfme/common';
3
+ declare const StaticSchema: (props: {
4
+ template: Template;
5
+ input: Record<string, string>;
6
+ scale: number;
7
+ totalPages: number;
8
+ currentPage: number;
9
+ }) => React.JSX.Element | null;
10
+ export default StaticSchema;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Size } from '@pdfme/common';
3
+ type Props = {
4
+ size: Size;
5
+ unitCursor: number;
6
+ unitNum: number;
7
+ setUnitCursor: (page: number) => void;
8
+ };
9
+ declare const UnitPager: ({ size, unitCursor, unitNum, setUnitCursor }: Props) => React.JSX.Element | null;
10
+ export default UnitPager;
@@ -0,0 +1,11 @@
1
+ export declare const DEFAULT_LANG = "en";
2
+ export declare const DESTROYED_ERR_MSG = "[@pdfme/ui] this instance is already destroyed";
3
+ export declare const SELECTABLE_CLASSNAME = "selectable";
4
+ export declare const RULER_HEIGHT = 30;
5
+ export declare const PAGE_GAP = 10;
6
+ export declare const LEFT_SIDEBAR_WIDTH = 45;
7
+ export declare const RIGHT_SIDEBAR_WIDTH = 400;
8
+ export declare const BACKGROUND_COLOR = "rgb(74, 74, 74)";
9
+ export declare const DEFAULT_MAX_ZOOM = 2;
10
+ export declare const DESIGNER_CLASSNAME = "pdfme-designer-";
11
+ export declare const UI_CLASSNAME = "pdfme-ui-";
@@ -0,0 +1,10 @@
1
+ import { PluginRegistry, UIOptions } from '@pdfme/common';
2
+ export declare const I18nContext: import("react").Context<(key: keyof import("@pdfme/common").Dict, dict?: import("@pdfme/common").Dict) => string>;
3
+ export declare const FontContext: import("react").Context<Record<string, {
4
+ data: string | ArrayBuffer | Uint8Array<ArrayBuffer>;
5
+ fallback?: boolean | undefined;
6
+ subset?: boolean | undefined;
7
+ }>>;
8
+ export declare const PluginsRegistry: import("react").Context<PluginRegistry>;
9
+ export declare const OptionsContext: import("react").Context<UIOptions>;
10
+ export declare const CacheContext: import("react").Context<Map<string | number, unknown>>;