@formepdf/react 0.7.13 → 0.8.1

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.
@@ -1,4 +1,4 @@
1
- import type { DocumentProps, PageProps, ViewProps, TextProps, ImageProps, TableProps, RowProps, CellProps, FixedProps, SvgProps, QrCodeProps, BarcodeProps, CanvasProps, WatermarkProps, BarChartProps, LineChartProps, PieChartProps, AreaChartProps, DotPlotProps } from './types.js';
1
+ import type { DocumentProps, PageProps, ViewProps, TextProps, ImageProps, TableProps, RowProps, CellProps, FixedProps, SvgProps, QrCodeProps, BarcodeProps, CanvasProps, WatermarkProps, BarChartProps, LineChartProps, PieChartProps, AreaChartProps, DotPlotProps, TextFieldProps, CheckboxProps, DropdownProps, RadioButtonProps } from './types.js';
2
2
  /**
3
3
  * Root document container. Must be the top-level element in every Forme document.
4
4
  *
@@ -330,3 +330,74 @@ export declare function AreaChart(_props: AreaChartProps): null;
330
330
  * @param props.showLegend - Show legend. Default: false
331
331
  */
332
332
  export declare function DotPlot(_props: DotPlotProps): null;
333
+ /**
334
+ * An interactive text input field (PDF AcroForm widget).
335
+ *
336
+ * @param props.name - Unique field name (PDF field identifier)
337
+ * @param props.width - Field width in points
338
+ * @param props.height - Field height in points. Default: 24
339
+ * @param props.value - Pre-filled value
340
+ * @param props.placeholder - Placeholder text shown when empty
341
+ * @param props.multiline - Allow multi-line input. Default: false
342
+ * @param props.password - Mask input. Default: false
343
+ * @param props.readOnly - Prevent editing. Default: false
344
+ * @param props.maxLength - Maximum character count
345
+ * @param props.fontSize - Font size in points. Default: 12
346
+ *
347
+ * @example
348
+ * ```tsx
349
+ * <TextField name="full_name" width={200} placeholder="Enter your name" />
350
+ * ```
351
+ */
352
+ export declare function TextField(_props: TextFieldProps): null;
353
+ /**
354
+ * An interactive checkbox (PDF AcroForm widget).
355
+ *
356
+ * @param props.name - Unique field name
357
+ * @param props.checked - Whether checked. Default: false
358
+ * @param props.width - Display width in points. Default: 14
359
+ * @param props.height - Display height in points. Default: 14
360
+ * @param props.readOnly - Prevent editing. Default: false
361
+ *
362
+ * @example
363
+ * ```tsx
364
+ * <Checkbox name="agree_terms" checked={false} />
365
+ * ```
366
+ */
367
+ export declare function Checkbox(_props: CheckboxProps): null;
368
+ /**
369
+ * An interactive dropdown / combo box (PDF AcroForm widget).
370
+ *
371
+ * @param props.name - Unique field name
372
+ * @param props.options - List of selectable options
373
+ * @param props.value - Pre-selected value
374
+ * @param props.width - Field width in points
375
+ * @param props.height - Field height in points. Default: 24
376
+ * @param props.readOnly - Prevent editing. Default: false
377
+ * @param props.fontSize - Font size in points. Default: 12
378
+ *
379
+ * @example
380
+ * ```tsx
381
+ * <Dropdown name="country" options={["US", "UK", "CA"]} width={200} />
382
+ * ```
383
+ */
384
+ export declare function Dropdown(_props: DropdownProps): null;
385
+ /**
386
+ * An interactive radio button (PDF AcroForm widget).
387
+ * Multiple RadioButtons with the same `name` form a mutually exclusive group.
388
+ *
389
+ * @param props.name - Group name (shared by all buttons in the group)
390
+ * @param props.value - The value this button represents
391
+ * @param props.checked - Whether selected. Default: false
392
+ * @param props.width - Display width in points. Default: 14
393
+ * @param props.height - Display height in points. Default: 14
394
+ * @param props.readOnly - Prevent editing. Default: false
395
+ *
396
+ * @example
397
+ * ```tsx
398
+ * <RadioButton name="plan" value="free" checked />
399
+ * <RadioButton name="plan" value="pro" />
400
+ * <RadioButton name="plan" value="team" />
401
+ * ```
402
+ */
403
+ export declare function RadioButton(_props: RadioButtonProps): null;
@@ -20,6 +20,8 @@
20
20
  export function Document(_props) {
21
21
  return null;
22
22
  }
23
+ /** Stable marker for cross-version identity checks (survives minification). */
24
+ Document.__formeType = 'Document';
23
25
  /**
24
26
  * A page boundary with explicit size and margin configuration.
25
27
  *
@@ -369,3 +371,82 @@ export function AreaChart(_props) {
369
371
  export function DotPlot(_props) {
370
372
  return null;
371
373
  }
374
+ /**
375
+ * An interactive text input field (PDF AcroForm widget).
376
+ *
377
+ * @param props.name - Unique field name (PDF field identifier)
378
+ * @param props.width - Field width in points
379
+ * @param props.height - Field height in points. Default: 24
380
+ * @param props.value - Pre-filled value
381
+ * @param props.placeholder - Placeholder text shown when empty
382
+ * @param props.multiline - Allow multi-line input. Default: false
383
+ * @param props.password - Mask input. Default: false
384
+ * @param props.readOnly - Prevent editing. Default: false
385
+ * @param props.maxLength - Maximum character count
386
+ * @param props.fontSize - Font size in points. Default: 12
387
+ *
388
+ * @example
389
+ * ```tsx
390
+ * <TextField name="full_name" width={200} placeholder="Enter your name" />
391
+ * ```
392
+ */
393
+ export function TextField(_props) {
394
+ return null;
395
+ }
396
+ /**
397
+ * An interactive checkbox (PDF AcroForm widget).
398
+ *
399
+ * @param props.name - Unique field name
400
+ * @param props.checked - Whether checked. Default: false
401
+ * @param props.width - Display width in points. Default: 14
402
+ * @param props.height - Display height in points. Default: 14
403
+ * @param props.readOnly - Prevent editing. Default: false
404
+ *
405
+ * @example
406
+ * ```tsx
407
+ * <Checkbox name="agree_terms" checked={false} />
408
+ * ```
409
+ */
410
+ export function Checkbox(_props) {
411
+ return null;
412
+ }
413
+ /**
414
+ * An interactive dropdown / combo box (PDF AcroForm widget).
415
+ *
416
+ * @param props.name - Unique field name
417
+ * @param props.options - List of selectable options
418
+ * @param props.value - Pre-selected value
419
+ * @param props.width - Field width in points
420
+ * @param props.height - Field height in points. Default: 24
421
+ * @param props.readOnly - Prevent editing. Default: false
422
+ * @param props.fontSize - Font size in points. Default: 12
423
+ *
424
+ * @example
425
+ * ```tsx
426
+ * <Dropdown name="country" options={["US", "UK", "CA"]} width={200} />
427
+ * ```
428
+ */
429
+ export function Dropdown(_props) {
430
+ return null;
431
+ }
432
+ /**
433
+ * An interactive radio button (PDF AcroForm widget).
434
+ * Multiple RadioButtons with the same `name` form a mutually exclusive group.
435
+ *
436
+ * @param props.name - Group name (shared by all buttons in the group)
437
+ * @param props.value - The value this button represents
438
+ * @param props.checked - Whether selected. Default: false
439
+ * @param props.width - Display width in points. Default: 14
440
+ * @param props.height - Display height in points. Default: 14
441
+ * @param props.readOnly - Prevent editing. Default: false
442
+ *
443
+ * @example
444
+ * ```tsx
445
+ * <RadioButton name="plan" value="free" checked />
446
+ * <RadioButton name="plan" value="pro" />
447
+ * <RadioButton name="plan" value="team" />
448
+ * ```
449
+ */
450
+ export function RadioButton(_props) {
451
+ return null;
452
+ }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Document, Page, View, Text, Image, Table, Row, Cell, Fixed, Svg, QrCode, Barcode, Canvas, Watermark, PageBreak, BarChart, LineChart, PieChart, AreaChart, DotPlot } from './components.js';
1
+ export { Document, Page, View, Text, Image, Table, Row, Cell, Fixed, Svg, QrCode, Barcode, Canvas, Watermark, PageBreak, BarChart, LineChart, PieChart, AreaChart, DotPlot, TextField, Checkbox, Dropdown, RadioButton } from './components.js';
2
2
  export { LegacyBarChart, LegacyLineChart, LegacyPieChart } from './charts.js';
3
3
  export { serialize, serializeTemplate, mapStyle, mapDimension, parseColor, expandEdges, expandCorners } from './serialize.js';
4
4
  export { StyleSheet } from './stylesheet.js';
@@ -7,4 +7,4 @@ export type { FontRegistration } from './font.js';
7
7
  export { createDataProxy, isRefMarker, isEachMarker, isExprMarker } from './template-proxy.js';
8
8
  export { expr } from './expr.js';
9
9
  export { render, renderToObject } from './render.js';
10
- export type { Style, GridTrackSize, Edges, Corners, EdgeColors, DocumentProps, PageProps, ViewProps, TextProps, ImageProps, ColumnDef, TableProps, RowProps, CellProps, FixedProps, SvgProps, QrCodeProps, BarcodeProps, BarcodeFormat, CanvasProps, CanvasContext, CanvasOp, WatermarkProps, ChartDataPoint, PieDataPoint, ChartSeries, DotPlotGroup, BarChartProps, LineChartProps, PieChartProps, AreaChartProps, DotPlotProps, TextRun, FormeDocument, FormeFont, FormeNode, FormeNodeKind, FormeStyle, FormePageConfig, FormePageSize, FormeEdges, FormeMetadata, FormeColumnDef, FormeColumnWidth, FormeDimension, FormeColor, FormeEdgeValues, FormeCornerValues, FormeGridTrackSize, FormeGridPlacement, } from './types.js';
10
+ export type { Style, GridTrackSize, Edges, Corners, EdgeColors, DocumentProps, PageProps, ViewProps, TextProps, ImageProps, ColumnDef, TableProps, RowProps, CellProps, FixedProps, SvgProps, QrCodeProps, BarcodeProps, BarcodeFormat, CanvasProps, CanvasContext, CanvasOp, WatermarkProps, ChartDataPoint, PieDataPoint, ChartSeries, DotPlotGroup, BarChartProps, LineChartProps, PieChartProps, AreaChartProps, DotPlotProps, TextFieldProps, CheckboxProps, DropdownProps, RadioButtonProps, TextRun, SignatureConfig, FormeDocument, FormeFont, FormeNode, FormeNodeKind, FormeStyle, FormePageConfig, FormePageSize, FormeEdges, FormeMetadata, FormeColumnDef, FormeColumnWidth, FormeDimension, FormeColor, FormeEdgeValues, FormeCornerValues, FormeGridTrackSize, FormeGridPlacement, } from './types.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // Components
2
- export { Document, Page, View, Text, Image, Table, Row, Cell, Fixed, Svg, QrCode, Barcode, Canvas, Watermark, PageBreak, BarChart, LineChart, PieChart, AreaChart, DotPlot } from './components.js';
2
+ export { Document, Page, View, Text, Image, Table, Row, Cell, Fixed, Svg, QrCode, Barcode, Canvas, Watermark, PageBreak, BarChart, LineChart, PieChart, AreaChart, DotPlot, TextField, Checkbox, Dropdown, RadioButton } from './components.js';
3
3
  export { LegacyBarChart, LegacyLineChart, LegacyPieChart } from './charts.js';
4
4
  // Serialization
5
5
  export { serialize, serializeTemplate, mapStyle, mapDimension, parseColor, expandEdges, expandCorners } from './serialize.js';
package/dist/serialize.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { isValidElement, Children, Fragment } from 'react';
2
- import { Document, Page, View, Text, Image, Table, Row, Cell, Fixed, Svg, QrCode, Barcode, Canvas, Watermark, PageBreak, BarChart, LineChart, PieChart, AreaChart, DotPlot } from './components.js';
2
+ import { Document, Page, View, Text, Image, Table, Row, Cell, Fixed, Svg, QrCode, Barcode, Canvas, Watermark, PageBreak, BarChart, LineChart, PieChart, AreaChart, DotPlot, TextField, Checkbox, Dropdown, RadioButton } from './components.js';
3
3
  import { Font } from './font.js';
4
4
  import { isRefMarker, getRefPath, isEachMarker, getEachPath, getEachTemplate, isExprMarker, getExpr, REF_SENTINEL, REF_SENTINEL_END, } from './template-proxy.js';
5
5
  const VALID_PARENTS = {
@@ -40,6 +40,22 @@ function extractSourceLocation(element) {
40
40
  }
41
41
  return undefined;
42
42
  }
43
+ // ─── Version-independent type checks ─────────────────────────────────
44
+ /**
45
+ * Check if a component type is `Document`, even across different package versions.
46
+ * Uses `__formeType` marker first (survives minification), then falls back to
47
+ * `displayName` / `name` for legacy builds without the marker.
48
+ */
49
+ function isDocumentType(type) {
50
+ if (type === Document)
51
+ return true;
52
+ if (typeof type === 'function') {
53
+ return type.__formeType === 'Document'
54
+ || type.displayName === 'Document'
55
+ || type.name === 'Document';
56
+ }
57
+ return false;
58
+ }
43
59
  // ─── Component resolution ────────────────────────────────────────────
44
60
  /**
45
61
  * Resolve wrapper function components (e.g. `<MyReport data={...} />`) by
@@ -49,7 +65,7 @@ function extractSourceLocation(element) {
49
65
  */
50
66
  function resolveElement(element) {
51
67
  let resolved = element;
52
- for (let i = 0; i < 10 && typeof resolved.type === 'function' && resolved.type !== Document; i++) {
68
+ for (let i = 0; i < 10 && typeof resolved.type === 'function' && !isDocumentType(resolved.type); i++) {
53
69
  const result = resolved.type(resolved.props);
54
70
  if (!isValidElement(result))
55
71
  break;
@@ -64,7 +80,7 @@ function resolveElement(element) {
64
80
  */
65
81
  export function serialize(element) {
66
82
  element = resolveElement(element);
67
- if (element.type !== Document) {
83
+ if (!isDocumentType(element.type)) {
68
84
  throw new Error('Top-level element must be <Document>');
69
85
  }
70
86
  const props = element.props;
@@ -126,6 +142,10 @@ export function serialize(element) {
126
142
  result.tagged = props.tagged;
127
143
  if (props.pdfa !== undefined)
128
144
  result.pdfa = props.pdfa;
145
+ if (props.pdfUa)
146
+ result.pdfUa = true;
147
+ if (props.signature)
148
+ result.signature = props.signature;
129
149
  if (mergedFonts.length > 0) {
130
150
  result.fonts = mergedFonts;
131
151
  }
@@ -226,6 +246,18 @@ function serializeChild(child, parent = null) {
226
246
  if (element.type === Barcode) {
227
247
  return serializeBarcode(element);
228
248
  }
249
+ if (element.type === TextField) {
250
+ return serializeTextField(element);
251
+ }
252
+ if (element.type === Checkbox) {
253
+ return serializeCheckbox(element);
254
+ }
255
+ if (element.type === Dropdown) {
256
+ return serializeDropdown(element);
257
+ }
258
+ if (element.type === RadioButton) {
259
+ return serializeRadioButton(element);
260
+ }
229
261
  if (element.type === Canvas) {
230
262
  return serializeCanvas(element);
231
263
  }
@@ -259,7 +291,7 @@ function serializeChild(child, parent = null) {
259
291
  validateNesting('Page', parent);
260
292
  return serializePage(element);
261
293
  }
262
- if (element.type === Document) {
294
+ if (isDocumentType(element.type)) {
263
295
  // Nested Document — just serialize its children
264
296
  const props = element.props;
265
297
  const childElements = flattenChildren(props.children);
@@ -469,6 +501,86 @@ function serializeBarcode(element) {
469
501
  sourceLocation: extractSourceLocation(element),
470
502
  };
471
503
  }
504
+ function serializeTextField(element) {
505
+ const props = element.props;
506
+ const kind = {
507
+ type: 'TextField',
508
+ name: props.name,
509
+ width: props.width,
510
+ height: props.height ?? 24,
511
+ multiline: props.multiline ?? false,
512
+ password: props.password ?? false,
513
+ read_only: props.readOnly ?? false,
514
+ font_size: props.fontSize ?? 12,
515
+ };
516
+ if (props.value !== undefined)
517
+ kind.value = props.value;
518
+ if (props.placeholder !== undefined)
519
+ kind.placeholder = props.placeholder;
520
+ if (props.maxLength !== undefined)
521
+ kind.max_length = props.maxLength;
522
+ return {
523
+ kind,
524
+ style: mapStyle(props.style),
525
+ children: [],
526
+ sourceLocation: extractSourceLocation(element),
527
+ };
528
+ }
529
+ function serializeCheckbox(element) {
530
+ const props = element.props;
531
+ const kind = {
532
+ type: 'Checkbox',
533
+ name: props.name,
534
+ checked: props.checked ?? false,
535
+ width: props.width ?? 14,
536
+ height: props.height ?? 14,
537
+ read_only: props.readOnly ?? false,
538
+ };
539
+ return {
540
+ kind,
541
+ style: mapStyle(props.style),
542
+ children: [],
543
+ sourceLocation: extractSourceLocation(element),
544
+ };
545
+ }
546
+ function serializeDropdown(element) {
547
+ const props = element.props;
548
+ const kind = {
549
+ type: 'Dropdown',
550
+ name: props.name,
551
+ options: props.options,
552
+ width: props.width,
553
+ height: props.height ?? 24,
554
+ read_only: props.readOnly ?? false,
555
+ font_size: props.fontSize ?? 12,
556
+ };
557
+ if (props.value !== undefined)
558
+ kind.value = props.value;
559
+ return {
560
+ kind,
561
+ style: mapStyle(props.style),
562
+ children: [],
563
+ sourceLocation: extractSourceLocation(element),
564
+ };
565
+ }
566
+ function serializeRadioButton(element) {
567
+ const props = element.props;
568
+ const kind = {
569
+ type: 'RadioButton',
570
+ name: props.name,
571
+ value: props.value,
572
+ checked: props.checked ?? false,
573
+ width: props.width ?? 14,
574
+ height: props.height ?? 14,
575
+ read_only: props.readOnly ?? false,
576
+ };
577
+ return {
578
+ kind,
579
+ style: mapStyle(props.style),
580
+ children: [],
581
+ sourceLocation: extractSourceLocation(element),
582
+ };
583
+ }
472
584
  function serializeCanvas(element) {
473
585
  const props = element.props;
474
586
  const operations = [];
@@ -1284,7 +1396,7 @@ function mergeFonts(globalFonts, docFonts) {
1284
1396
  */
1285
1397
  export function serializeTemplate(element) {
1286
1398
  element = resolveElement(element);
1287
- if (element.type !== Document) {
1399
+ if (!isDocumentType(element.type)) {
1288
1400
  throw new Error('Top-level element must be <Document>');
1289
1401
  }
1290
1402
  const props = element.props;
@@ -1342,6 +1454,10 @@ export function serializeTemplate(element) {
1342
1454
  result.tagged = props.tagged;
1343
1455
  if (props.pdfa !== undefined)
1344
1456
  result.pdfa = props.pdfa;
1457
+ if (props.pdfUa)
1458
+ result.pdfUa = true;
1459
+ if (props.signature)
1460
+ result.signature = props.signature;
1345
1461
  if (mergedFonts.length > 0) {
1346
1462
  result.fonts = mergedFonts;
1347
1463
  }
@@ -1438,6 +1554,14 @@ function serializeTemplateChild(child, parent = null) {
1438
1554
  return serializeQrCode(element);
1439
1555
  if (element.type === Barcode)
1440
1556
  return serializeBarcode(element);
1557
+ if (element.type === TextField)
1558
+ return serializeTextField(element);
1559
+ if (element.type === Checkbox)
1560
+ return serializeCheckbox(element);
1561
+ if (element.type === Dropdown)
1562
+ return serializeDropdown(element);
1563
+ if (element.type === RadioButton)
1564
+ return serializeRadioButton(element);
1441
1565
  if (element.type === Canvas)
1442
1566
  return serializeCanvas(element);
1443
1567
  if (element.type === Watermark)
package/dist/types.d.ts CHANGED
@@ -140,6 +140,28 @@ export interface Style {
140
140
  minWidowLines?: number;
141
141
  minOrphanLines?: number;
142
142
  }
143
+ export interface SignatureConfig {
144
+ /** PEM-encoded X.509 certificate. */
145
+ certificatePem: string;
146
+ /** PEM-encoded RSA private key (PKCS#8). */
147
+ privateKeyPem: string;
148
+ /** Reason for signing (e.g. "Approved"). */
149
+ reason?: string;
150
+ /** Location of signing (e.g. "New York, NY"). */
151
+ location?: string;
152
+ /** Contact info for the signer. */
153
+ contact?: string;
154
+ /** Whether to show a visible signature annotation on the page. */
155
+ visible?: boolean;
156
+ /** X coordinate in points for visible signature. */
157
+ x?: number;
158
+ /** Y coordinate in points for visible signature. */
159
+ y?: number;
160
+ /** Width in points for visible signature. */
161
+ width?: number;
162
+ /** Height in points for visible signature. */
163
+ height?: number;
164
+ }
143
165
  export interface DocumentProps {
144
166
  title?: string;
145
167
  author?: string;
@@ -153,6 +175,10 @@ export interface DocumentProps {
153
175
  tagged?: boolean;
154
176
  /** PDF/A conformance level. "2a" requires tagging, "2b" is visual-only compliance. */
155
177
  pdfa?: '2a' | '2b';
178
+ /** When true, the PDF claims PDF/UA-1 conformance. Forces tagging. */
179
+ pdfUa?: boolean;
180
+ /** Digital signature configuration. Signs the PDF with an X.509 certificate. */
181
+ signature?: SignatureConfig;
156
182
  fonts?: FontRegistration[];
157
183
  children?: ReactNode;
158
184
  }
@@ -356,6 +382,74 @@ export interface DotPlotProps {
356
382
  dotSize?: number;
357
383
  style?: Style;
358
384
  }
385
+ export interface TextFieldProps {
386
+ /** Unique field name (used as the PDF field identifier). */
387
+ name: string;
388
+ /** Pre-filled value. */
389
+ value?: string;
390
+ /** Placeholder text shown when empty. */
391
+ placeholder?: string;
392
+ /** Field width in points. */
393
+ width: number;
394
+ /** Field height in points. Default: 24. */
395
+ height?: number;
396
+ /** Allow multi-line input. Default: false. */
397
+ multiline?: boolean;
398
+ /** Mask input as password. Default: false. */
399
+ password?: boolean;
400
+ /** Prevent editing. Default: false. */
401
+ readOnly?: boolean;
402
+ /** Maximum number of characters. */
403
+ maxLength?: number;
404
+ /** Font size in points. Default: 12. */
405
+ fontSize?: number;
406
+ style?: Style;
407
+ }
408
+ export interface CheckboxProps {
409
+ /** Unique field name. */
410
+ name: string;
411
+ /** Whether the checkbox is checked. Default: false. */
412
+ checked?: boolean;
413
+ /** Display width in points. Default: 14. */
414
+ width?: number;
415
+ /** Display height in points. Default: 14. */
416
+ height?: number;
417
+ /** Prevent editing. Default: false. */
418
+ readOnly?: boolean;
419
+ style?: Style;
420
+ }
421
+ export interface DropdownProps {
422
+ /** Unique field name. */
423
+ name: string;
424
+ /** List of selectable options. */
425
+ options: string[];
426
+ /** Pre-selected value. */
427
+ value?: string;
428
+ /** Field width in points. */
429
+ width: number;
430
+ /** Field height in points. Default: 24. */
431
+ height?: number;
432
+ /** Prevent editing. Default: false. */
433
+ readOnly?: boolean;
434
+ /** Font size in points. Default: 12. */
435
+ fontSize?: number;
436
+ style?: Style;
437
+ }
438
+ export interface RadioButtonProps {
439
+ /** Field name — multiple RadioButtons with the same name form a group. */
440
+ name: string;
441
+ /** The value this button represents within the group. */
442
+ value: string;
443
+ /** Whether this button is selected. Default: false. */
444
+ checked?: boolean;
445
+ /** Display width in points. Default: 14. */
446
+ width?: number;
447
+ /** Display height in points. Default: 14. */
448
+ height?: number;
449
+ /** Prevent editing. Default: false. */
450
+ readOnly?: boolean;
451
+ style?: Style;
452
+ }
359
453
  export interface WatermarkProps {
360
454
  /** The watermark text (e.g. "DRAFT", "CONFIDENTIAL"). */
361
455
  text: string;
@@ -497,6 +591,9 @@ export interface FormeDocument {
497
591
  fonts?: FormeFont[];
498
592
  tagged?: boolean;
499
593
  pdfa?: '2a' | '2b';
594
+ pdfUa?: boolean;
595
+ flattenForms?: boolean;
596
+ signature?: SignatureConfig;
500
597
  }
501
598
  export interface FormeMetadata {
502
599
  title?: string;
@@ -644,6 +741,42 @@ export type FormeNodeKind = {
644
741
  text: string;
645
742
  font_size: number;
646
743
  angle: number;
744
+ } | {
745
+ type: 'TextField';
746
+ name: string;
747
+ width: number;
748
+ height: number;
749
+ value?: string;
750
+ placeholder?: string;
751
+ multiline: boolean;
752
+ password: boolean;
753
+ read_only: boolean;
754
+ max_length?: number;
755
+ font_size: number;
756
+ } | {
757
+ type: 'Checkbox';
758
+ name: string;
759
+ width: number;
760
+ height: number;
761
+ checked: boolean;
762
+ read_only: boolean;
763
+ } | {
764
+ type: 'Dropdown';
765
+ name: string;
766
+ options: string[];
767
+ width: number;
768
+ height: number;
769
+ value?: string;
770
+ read_only: boolean;
771
+ font_size: number;
772
+ } | {
773
+ type: 'RadioButton';
774
+ name: string;
775
+ value: string;
776
+ width: number;
777
+ height: number;
778
+ checked: boolean;
779
+ read_only: boolean;
647
780
  } | {
648
781
  type: 'PageBreak';
649
782
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formepdf/react",
3
- "version": "0.7.13",
3
+ "version": "0.8.1",
4
4
  "description": "JSX-to-JSON serializer for Forme PDF engine",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",