@alfadocs/ui-kit 0.10.0 → 0.11.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.10.0",
3
+ "packageVersion": "0.11.0",
4
4
  "components": [
5
5
  {
6
6
  "kind": "component",
@@ -1,4 +1,4 @@
1
- import { P as p, p as a } from "../../_chunks/pdf-viewer-CNETPubN.js";
1
+ import { P as p, p as a } from "../../_chunks/pdf-viewer-CnEJvmXC.js";
2
2
  export {
3
3
  p as PDFViewer,
4
4
  a as pdfViewerAgent
@@ -1,4 +1,30 @@
1
+ import { type ReactNode } from 'react';
1
2
  export type PDFZoomPreset = 'fit-width' | 'fit-page' | 'actual-size' | number;
3
+ export type PDFPageRotation = 0 | 90 | 180 | 270;
4
+ /**
5
+ * Arguments passed to `renderPageOverlay` for each rendered page.
6
+ *
7
+ * `pageWidthCss` and `pageHeightCss` are post-zoom, post-rotation CSS
8
+ * pixel dimensions — exactly the rendered box the consumer is
9
+ * positioning content over. They update on resize, zoom, and rotation
10
+ * changes; the render-prop re-runs on every change so positioned
11
+ * children stay in sync with the page geometry without the consumer
12
+ * touching a `ResizeObserver`.
13
+ */
14
+ export interface PDFPageOverlayArgs {
15
+ /** 1-based page number. */
16
+ pageNumber: number;
17
+ /** CSS-pixel width of the rendered page (post-zoom, post-rotation). */
18
+ pageWidthCss: number;
19
+ /** CSS-pixel height of the rendered page. */
20
+ pageHeightCss: number;
21
+ /**
22
+ * Effective rotation of the rendered viewport in degrees. Reflects
23
+ * `pageRotation` (if set) overriding the page's intrinsic `/Rotate`,
24
+ * otherwise the intrinsic rotation.
25
+ */
26
+ rotation: PDFPageRotation;
27
+ }
2
28
  export interface PDFViewerProps {
3
29
  /** Opaque instance id — emitted as `data-component-id` for the agent registry. */
4
30
  id?: string;
@@ -8,6 +34,42 @@ export interface PDFViewerProps {
8
34
  initialPage?: number;
9
35
  /** Initial zoom preset. Default 'fit-width'. */
10
36
  initialZoom?: PDFZoomPreset;
37
+ /**
38
+ * Force every page to render at this rotation, overriding the page's
39
+ * intrinsic `/Rotate` metadata. Useful for scanned PDFs that opened
40
+ * sideways, and for the signing-flow consumer that lets users
41
+ * straighten misrotated pages before placing signature fields.
42
+ * `undefined` (default) honours each page's intrinsic rotation.
43
+ */
44
+ pageRotation?: PDFPageRotation;
45
+ /**
46
+ * Render a layer of arbitrary React content positioned over each
47
+ * rendered PDF page — signature fields, redaction boxes, annotation
48
+ * pins, anything that needs to live in PDF coordinate space.
49
+ *
50
+ * The render-prop is invoked **only for pages currently inside the
51
+ * IntersectionObserver buffer** (visible ±1), and the returned tree
52
+ * unmounts when the page leaves the buffer. Consumer-held timers /
53
+ * fetches / subscriptions in overlay children therefore tear down
54
+ * automatically with the page. The overlay container is absolutely
55
+ * positioned, sized to the rendered page, and has
56
+ * `pointer-events: auto` so consumer children can be interactive.
57
+ * Consumers position children themselves (typically
58
+ * `position: absolute; inset-inline-start: %; inset-block-start: %`).
59
+ *
60
+ * The render-prop re-runs on resize, zoom, and rotation changes so
61
+ * positioned children stay aligned without the consumer wiring a
62
+ * `ResizeObserver`. Pages already declare `data-page-number` on the
63
+ * `<article>` ancestor; consumer-rendered children should be
64
+ * keyboard-reachable per the kit's a11y contract.
65
+ *
66
+ * Composition note: PDF.js's `AnnotationLayer` (for native form
67
+ * fields and link annotations) is not yet wired in — see the file
68
+ * header TODO. When it lands, `renderPageOverlay` will compose
69
+ * **above** the AnnotationLayer in z-order, since interactive
70
+ * consumer content should sit on top of intrinsic page widgets.
71
+ */
72
+ renderPageOverlay?: (args: PDFPageOverlayArgs) => ReactNode;
11
73
  /** Emits when the currently-most-visible page changes. */
12
74
  onPageChange?: (page: number) => void;
13
75
  /** Emits once the PDF document has loaded. */
@@ -827,7 +827,8 @@ const a = {
827
827
  print: "Print",
828
828
  download: "Download",
829
829
  loading: "Loading PDF…",
830
- error: "Failed to load PDF"
830
+ error: "Failed to load PDF",
831
+ pageOverlay: "Page {{page}} overlay"
831
832
  },
832
833
  paywall: {
833
834
  title: "Upgrade to keep going",
@@ -1777,7 +1778,8 @@ const a = {
1777
1778
  print: "Stampa",
1778
1779
  download: "Scarica",
1779
1780
  loading: "Caricamento PDF…",
1780
- error: "Impossibile caricare il PDF"
1781
+ error: "Impossibile caricare il PDF",
1782
+ pageOverlay: "Overlay pagina {{page}}"
1781
1783
  },
1782
1784
  paywall: {
1783
1785
  title: "Esegui l'upgrade per continuare",
@@ -2727,7 +2729,8 @@ const a = {
2727
2729
  print: "Drucken",
2728
2730
  download: "Herunterladen",
2729
2731
  loading: "PDF wird geladen …",
2730
- error: "PDF konnte nicht geladen werden"
2732
+ error: "PDF konnte nicht geladen werden",
2733
+ pageOverlay: "Seitenoverlay {{page}}"
2731
2734
  },
2732
2735
  paywall: {
2733
2736
  title: "Upgraden, um fortzufahren",
@@ -2888,13 +2891,13 @@ const a = {
2888
2891
  label: "{{state}} {{amount}}"
2889
2892
  }
2890
2893
  }
2891
- }, o = {}, p = ["en", "it", "de", "ar"], m = {
2894
+ }, o = {}, p = ["en", "it", "de", "ar"], g = {
2892
2895
  en: a,
2893
2896
  it: n,
2894
2897
  de: i,
2895
2898
  ar: o
2896
2899
  };
2897
- function g(r, s) {
2900
+ function m(r, s) {
2898
2901
  t.addResourceBundle(
2899
2902
  r,
2900
2903
  "ui",
@@ -2941,7 +2944,7 @@ export {
2941
2944
  b as default,
2942
2945
  a as enUi,
2943
2946
  n as itUi,
2944
- g as registerUiBundle,
2945
- m as uiResources
2947
+ m as registerUiBundle,
2948
+ g as uiResources
2946
2949
  };
2947
2950
  //# sourceMappingURL=config.js.map
@@ -840,6 +840,7 @@ export declare const enUi: {
840
840
  readonly download: "Download";
841
841
  readonly loading: "Loading PDF…";
842
842
  readonly error: "Failed to load PDF";
843
+ readonly pageOverlay: "Page {{page}} overlay";
843
844
  };
844
845
  readonly paywall: {
845
846
  readonly title: "Upgrade to keep going";
@@ -1812,6 +1813,7 @@ export declare const itUi: {
1812
1813
  readonly download: "Scarica";
1813
1814
  readonly loading: "Caricamento PDF…";
1814
1815
  readonly error: "Impossibile caricare il PDF";
1816
+ readonly pageOverlay: "Overlay pagina {{page}}";
1815
1817
  };
1816
1818
  readonly paywall: {
1817
1819
  readonly title: "Esegui l'upgrade per continuare";
@@ -2787,6 +2789,7 @@ export declare const deUi: {
2787
2789
  readonly download: "Herunterladen";
2788
2790
  readonly loading: "PDF wird geladen …";
2789
2791
  readonly error: "PDF konnte nicht geladen werden";
2792
+ readonly pageOverlay: "Seitenoverlay {{page}}";
2790
2793
  };
2791
2794
  readonly paywall: {
2792
2795
  readonly title: "Upgraden, um fortzufahren";
package/dist/index.js CHANGED
@@ -118,7 +118,7 @@ import { T as _n, t as Gn } from "./_chunks/transcript-panel-BpJqPr7I.js";
118
118
  import { T as Un } from "./_chunks/typing-indicator-DHeVN4ob.js";
119
119
  import { C as Yn, c as jn, r as zn } from "./_chunks/calendar-zy0tUUVG.js";
120
120
  import { P as Qn, f as Jn, p as Xn, a as Zn, s as $n, b as ai, c as ei } from "./_chunks/payment-form-CI77oIx1.js";
121
- import { P as oi, p as ti } from "./_chunks/pdf-viewer-CNETPubN.js";
121
+ import { P as oi, p as ti } from "./_chunks/pdf-viewer-CnEJvmXC.js";
122
122
  import { R as ni, e as ii, r as pi, t as mi, a as li, w as di } from "./_chunks/rich-text-editor-C7TCIlQO.js";
123
123
  import { S as gi, s as ci } from "./_chunks/signature-capture-DjMlFOzS.js";
124
124
  import { S as ui, f as Ai, i as Si } from "./_chunks/slot-grid-CgpYgBkW.js";
@@ -807,7 +807,8 @@
807
807
  "print": "Drucken",
808
808
  "download": "Herunterladen",
809
809
  "loading": "PDF wird geladen …",
810
- "error": "PDF konnte nicht geladen werden"
810
+ "error": "PDF konnte nicht geladen werden",
811
+ "pageOverlay": "Seitenoverlay {{page}}"
811
812
  },
812
813
  "paywall": {
813
814
  "title": "Upgraden, um fortzufahren",
@@ -838,7 +838,8 @@
838
838
  "print": "Print",
839
839
  "download": "Download",
840
840
  "loading": "Loading PDF…",
841
- "error": "Failed to load PDF"
841
+ "error": "Failed to load PDF",
842
+ "pageOverlay": "Page {{page}} overlay"
842
843
  },
843
844
  "paywall": {
844
845
  "title": "Upgrade to keep going",
@@ -807,7 +807,8 @@
807
807
  "print": "Stampa",
808
808
  "download": "Scarica",
809
809
  "loading": "Caricamento PDF…",
810
- "error": "Impossibile caricare il PDF"
810
+ "error": "Impossibile caricare il PDF",
811
+ "pageOverlay": "Overlay pagina {{page}}"
811
812
  },
812
813
  "paywall": {
813
814
  "title": "Esegui l'upgrade per continuare",