@osdk/react-components 0.2.0-beta.25 → 0.2.0-beta.27

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 (107) hide show
  1. package/AGENTS.md +1 -0
  2. package/CHANGELOG.md +28 -0
  3. package/build/browser/action-form/ActionForm.js +15 -11
  4. package/build/browser/action-form/ActionForm.js.map +1 -1
  5. package/build/browser/action-form/FormFieldApi.js.map +1 -1
  6. package/build/browser/action-form/fields/CustomField.js +30 -0
  7. package/build/browser/action-form/fields/CustomField.js.map +1 -0
  8. package/build/browser/action-form/fields/FormFieldRenderer.js +13 -21
  9. package/build/browser/action-form/fields/FormFieldRenderer.js.map +1 -1
  10. package/build/browser/action-form/fields/RadioButtonsField.js +1 -1
  11. package/build/browser/action-form/fields/RadioButtonsField.js.map +1 -1
  12. package/build/browser/action-form/utils/getDefaultFieldDefinitions.js +97 -10
  13. package/build/browser/action-form/utils/getDefaultFieldDefinitions.js.map +1 -1
  14. package/build/browser/base-components/dialog/Dialog.js +4 -2
  15. package/build/browser/base-components/dialog/Dialog.js.map +1 -1
  16. package/build/browser/object-table/ObjectTableApi.js.map +1 -1
  17. package/build/browser/object-table/hooks/useFunctionColumnsData.js +57 -192
  18. package/build/browser/object-table/hooks/useFunctionColumnsData.js.map +1 -1
  19. package/build/browser/pdf-viewer/PdfViewer.js +10 -5
  20. package/build/browser/pdf-viewer/PdfViewer.js.map +1 -1
  21. package/build/browser/pdf-viewer/PdfViewerContext.js +108 -0
  22. package/build/browser/pdf-viewer/PdfViewerContext.js.map +1 -0
  23. package/build/browser/pdf-viewer/hooks/usePdfFormFields.js +26 -11
  24. package/build/browser/pdf-viewer/hooks/usePdfFormFields.js.map +1 -1
  25. package/build/browser/pdf-viewer/hooks/usePdfHighlightMode.js +29 -1
  26. package/build/browser/pdf-viewer/hooks/usePdfHighlightMode.js.map +1 -1
  27. package/build/browser/pdf-viewer/hooks/usePdfViewerCore.js +3 -3
  28. package/build/browser/pdf-viewer/hooks/usePdfViewerCore.js.map +1 -1
  29. package/build/browser/pdf-viewer/hooks/usePdfViewerSearch.js +3 -3
  30. package/build/browser/pdf-viewer/hooks/usePdfViewerSearch.js.map +1 -1
  31. package/build/browser/pdf-viewer/hooks/usePdfViewerState.js +3 -3
  32. package/build/browser/pdf-viewer/hooks/usePdfViewerState.js.map +1 -1
  33. package/build/browser/pdf-viewer/types.js.map +1 -1
  34. package/build/browser/public/experimental.js +2 -0
  35. package/build/browser/public/experimental.js.map +1 -1
  36. package/build/cjs/{chunk-GT6IV6LV.cjs → chunk-MRRRZN44.cjs} +6 -4
  37. package/build/cjs/chunk-MRRRZN44.cjs.map +1 -0
  38. package/build/cjs/public/experimental.cjs +1384 -1343
  39. package/build/cjs/public/experimental.cjs.map +1 -1
  40. package/build/cjs/public/experimental.d.cts +115 -8
  41. package/build/cjs/public/primitives.cjs +5 -5
  42. package/build/cjs/public/primitives.d.cts +3 -2
  43. package/build/esm/action-form/ActionForm.js +15 -11
  44. package/build/esm/action-form/ActionForm.js.map +1 -1
  45. package/build/esm/action-form/FormFieldApi.js.map +1 -1
  46. package/build/esm/action-form/fields/CustomField.js +30 -0
  47. package/build/esm/action-form/fields/CustomField.js.map +1 -0
  48. package/build/esm/action-form/fields/FormFieldRenderer.js +13 -21
  49. package/build/esm/action-form/fields/FormFieldRenderer.js.map +1 -1
  50. package/build/esm/action-form/fields/RadioButtonsField.js +1 -1
  51. package/build/esm/action-form/fields/RadioButtonsField.js.map +1 -1
  52. package/build/esm/action-form/utils/getDefaultFieldDefinitions.js +97 -10
  53. package/build/esm/action-form/utils/getDefaultFieldDefinitions.js.map +1 -1
  54. package/build/esm/base-components/dialog/Dialog.js +4 -2
  55. package/build/esm/base-components/dialog/Dialog.js.map +1 -1
  56. package/build/esm/object-table/ObjectTableApi.js.map +1 -1
  57. package/build/esm/object-table/hooks/useFunctionColumnsData.js +57 -192
  58. package/build/esm/object-table/hooks/useFunctionColumnsData.js.map +1 -1
  59. package/build/esm/pdf-viewer/PdfViewer.js +10 -5
  60. package/build/esm/pdf-viewer/PdfViewer.js.map +1 -1
  61. package/build/esm/pdf-viewer/PdfViewerContext.js +108 -0
  62. package/build/esm/pdf-viewer/PdfViewerContext.js.map +1 -0
  63. package/build/esm/pdf-viewer/hooks/usePdfFormFields.js +26 -11
  64. package/build/esm/pdf-viewer/hooks/usePdfFormFields.js.map +1 -1
  65. package/build/esm/pdf-viewer/hooks/usePdfHighlightMode.js +29 -1
  66. package/build/esm/pdf-viewer/hooks/usePdfHighlightMode.js.map +1 -1
  67. package/build/esm/pdf-viewer/hooks/usePdfViewerCore.js +3 -3
  68. package/build/esm/pdf-viewer/hooks/usePdfViewerCore.js.map +1 -1
  69. package/build/esm/pdf-viewer/hooks/usePdfViewerSearch.js +3 -3
  70. package/build/esm/pdf-viewer/hooks/usePdfViewerSearch.js.map +1 -1
  71. package/build/esm/pdf-viewer/hooks/usePdfViewerState.js +3 -3
  72. package/build/esm/pdf-viewer/hooks/usePdfViewerState.js.map +1 -1
  73. package/build/esm/pdf-viewer/types.js.map +1 -1
  74. package/build/esm/public/experimental.js +2 -0
  75. package/build/esm/public/experimental.js.map +1 -1
  76. package/build/types/action-form/FormFieldApi.d.ts +3 -3
  77. package/build/types/action-form/FormFieldApi.d.ts.map +1 -1
  78. package/build/types/action-form/fields/CustomField.d.ts +9 -0
  79. package/build/types/action-form/fields/CustomField.d.ts.map +1 -0
  80. package/build/types/action-form/fields/FormFieldRenderer.d.ts.map +1 -1
  81. package/build/types/action-form/fields/RadioButtonsField.d.ts +2 -2
  82. package/build/types/action-form/fields/RadioButtonsField.d.ts.map +1 -1
  83. package/build/types/action-form/utils/getDefaultFieldDefinitions.d.ts +7 -4
  84. package/build/types/action-form/utils/getDefaultFieldDefinitions.d.ts.map +1 -1
  85. package/build/types/base-components/dialog/Dialog.d.ts +3 -2
  86. package/build/types/base-components/dialog/Dialog.d.ts.map +1 -1
  87. package/build/types/object-table/ObjectTableApi.d.ts +4 -3
  88. package/build/types/object-table/ObjectTableApi.d.ts.map +1 -1
  89. package/build/types/object-table/hooks/useFunctionColumnsData.d.ts.map +1 -1
  90. package/build/types/pdf-viewer/PdfViewer.d.ts +2 -2
  91. package/build/types/pdf-viewer/PdfViewer.d.ts.map +1 -1
  92. package/build/types/pdf-viewer/PdfViewerContext.d.ts +64 -0
  93. package/build/types/pdf-viewer/PdfViewerContext.d.ts.map +1 -0
  94. package/build/types/pdf-viewer/hooks/usePdfHighlightMode.d.ts +1 -0
  95. package/build/types/pdf-viewer/hooks/usePdfHighlightMode.d.ts.map +1 -1
  96. package/build/types/pdf-viewer/types.d.ts +47 -0
  97. package/build/types/pdf-viewer/types.d.ts.map +1 -1
  98. package/build/types/public/experimental.d.ts +2 -0
  99. package/build/types/public/experimental.d.ts.map +1 -1
  100. package/package.json +9 -9
  101. package/build/browser/action-form/utils/getDefaultFieldComponent.js +0 -56
  102. package/build/browser/action-form/utils/getDefaultFieldComponent.js.map +0 -1
  103. package/build/cjs/chunk-GT6IV6LV.cjs.map +0 -1
  104. package/build/esm/action-form/utils/getDefaultFieldComponent.js +0 -56
  105. package/build/esm/action-form/utils/getDefaultFieldComponent.js.map +0 -1
  106. package/build/types/action-form/utils/getDefaultFieldComponent.d.ts +0 -6
  107. package/build/types/action-form/utils/getDefaultFieldComponent.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"usePdfViewerCore.js","names":["useCallback","useRef","useState","usePdfAnnotationPortals","usePdfDocument","usePdfViewer","usePdfViewerSync","usePdfViewerCore","src","initialPage","initialScale","document","numPages","loading","error","scale","setScale","currentPage","setCurrentPage","containerRef","viewerRef","pdfViewerRef","eventBusRef","findControllerRef","handleScaleChange","newScale","handlePageChange","page","scrollToPage","syncScrollToPage","onScaleChange","onPageChange","portalTargets"],"sources":["usePdfViewerCore.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PDFDocumentProxy } from \"pdfjs-dist\";\nimport type {\n EventBus,\n PDFFindController,\n PDFViewer,\n} from \"pdfjs-dist/web/pdf_viewer.mjs\";\nimport type { RefObject } from \"react\";\nimport { useCallback, useRef, useState } from \"react\";\nimport type { AnnotationPortalTarget } from \"./usePdfAnnotationPortals.js\";\nimport { usePdfAnnotationPortals } from \"./usePdfAnnotationPortals.js\";\nimport { usePdfDocument } from \"./usePdfDocument.js\";\nimport { usePdfViewer } from \"./usePdfViewer.js\";\nimport { usePdfViewerSync } from \"./usePdfViewerSync.js\";\n\nexport interface UsePdfViewerCoreOptions {\n /** PDF source — URL string or ArrayBuffer */\n src: string | ArrayBuffer;\n /** Initial page number (1-indexed, default 1) */\n initialPage?: number;\n /** Initial zoom scale (default 1.0) */\n initialScale?: number;\n}\n\nexport interface UsePdfViewerCoreResult {\n /** The loaded PDF document, or undefined while loading */\n document: PDFDocumentProxy | undefined;\n /** Total number of pages in the document */\n numPages: number;\n /** Whether the document is currently loading */\n loading: boolean;\n /** Error encountered while loading the document */\n error: Error | undefined;\n\n /** Ref to attach to the scroll-container div */\n containerRef: RefObject<HTMLDivElement>;\n /** Ref to attach to the inner viewer div (className=\"pdfViewer\") */\n viewerRef: RefObject<HTMLDivElement>;\n\n /** Current page number (1-indexed) */\n currentPage: number;\n /** Navigate to a specific page (updates state and scrolls the viewer) */\n scrollToPage: (page: number) => void;\n\n /** Current zoom scale */\n scale: number;\n /** Set the zoom scale directly */\n setScale: (scale: number) => void;\n\n /** Portal targets for rendering annotation overlays on each page */\n portalTargets: AnnotationPortalTarget[];\n\n /** Ref to the internal pdfjs PDFViewer instance */\n pdfViewerRef: RefObject<PDFViewer | null>;\n /** Ref to the internal pdfjs EventBus instance */\n eventBusRef: RefObject<EventBus | null>;\n /** Ref to the internal pdfjs PDFFindController instance */\n findControllerRef: RefObject<PDFFindController | null>;\n}\n\nexport function usePdfViewerCore({\n src,\n initialPage = 1,\n initialScale = 1.0,\n}: UsePdfViewerCoreOptions): UsePdfViewerCoreResult {\n const { document, numPages, loading, error } = usePdfDocument(src);\n const [scale, setScale] = useState(initialScale);\n const [currentPage, setCurrentPage] = useState(initialPage);\n const containerRef = useRef<HTMLDivElement>(null);\n const viewerRef = useRef<HTMLDivElement>(null);\n\n const { pdfViewerRef, eventBusRef, findControllerRef } = usePdfViewer(\n containerRef,\n viewerRef,\n document,\n initialScale,\n initialPage,\n );\n\n const handleScaleChange = useCallback((newScale: number) => {\n setScale(newScale);\n }, []);\n\n const handlePageChange = useCallback((page: number) => {\n setCurrentPage(page);\n }, []);\n\n const { scrollToPage: syncScrollToPage } = usePdfViewerSync({\n pdfViewerRef,\n eventBusRef,\n document,\n scale,\n onScaleChange: handleScaleChange,\n onPageChange: handlePageChange,\n });\n\n const scrollToPage = useCallback(\n (page: number) => {\n setCurrentPage(page);\n syncScrollToPage(page);\n },\n [syncScrollToPage],\n );\n\n const portalTargets = usePdfAnnotationPortals(\n pdfViewerRef,\n eventBusRef,\n document,\n );\n\n return {\n document,\n numPages,\n loading,\n error,\n containerRef,\n viewerRef,\n currentPage,\n scrollToPage,\n scale,\n setScale,\n portalTargets,\n pdfViewerRef,\n eventBusRef,\n findControllerRef,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAErD,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,YAAY,QAAQ,mBAAmB;AAChD,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B,CAAC;EAED,MAAMG,aAAa,GAAG7B,uBAAuB,CAC3CkB,YAAY,EACZC,WAAW,EACXX,QACF,CAAC;EAED,OAAO;IACLA,QAAQ;IACRC,QAAQ;IACRC,OAAO;IACPC,KAAK;IACLK,YAAY;IACZC,SAAS;IACTH,WAAW;IACXW,YAAY;IACZb,KAAK;IACLC,QAAQ;IACRgB,aAAa;IACbX,YAAY;IACZC,WAAW;IACXC;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"usePdfViewerCore.js","names":["useCallback","useMemo","useRef","useState","usePdfAnnotationPortals","usePdfDocument","usePdfViewer","usePdfViewerSync","usePdfViewerCore","src","initialPage","initialScale","document","numPages","loading","error","scale","setScale","currentPage","setCurrentPage","containerRef","viewerRef","pdfViewerRef","eventBusRef","findControllerRef","handleScaleChange","newScale","handlePageChange","page","scrollToPage","syncScrollToPage","onScaleChange","onPageChange","portalTargets"],"sources":["usePdfViewerCore.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PDFDocumentProxy } from \"pdfjs-dist\";\nimport type {\n EventBus,\n PDFFindController,\n PDFViewer,\n} from \"pdfjs-dist/web/pdf_viewer.mjs\";\nimport type { RefObject } from \"react\";\nimport { useCallback, useMemo, useRef, useState } from \"react\";\nimport type { AnnotationPortalTarget } from \"./usePdfAnnotationPortals.js\";\nimport { usePdfAnnotationPortals } from \"./usePdfAnnotationPortals.js\";\nimport { usePdfDocument } from \"./usePdfDocument.js\";\nimport { usePdfViewer } from \"./usePdfViewer.js\";\nimport { usePdfViewerSync } from \"./usePdfViewerSync.js\";\n\nexport interface UsePdfViewerCoreOptions {\n /** PDF source — URL string or ArrayBuffer */\n src: string | ArrayBuffer;\n /** Initial page number (1-indexed, default 1) */\n initialPage?: number;\n /** Initial zoom scale (default 1.0) */\n initialScale?: number;\n}\n\nexport interface UsePdfViewerCoreResult {\n /** The loaded PDF document, or undefined while loading */\n document: PDFDocumentProxy | undefined;\n /** Total number of pages in the document */\n numPages: number;\n /** Whether the document is currently loading */\n loading: boolean;\n /** Error encountered while loading the document */\n error: Error | undefined;\n\n /** Ref to attach to the scroll-container div */\n containerRef: RefObject<HTMLDivElement>;\n /** Ref to attach to the inner viewer div (className=\"pdfViewer\") */\n viewerRef: RefObject<HTMLDivElement>;\n\n /** Current page number (1-indexed) */\n currentPage: number;\n /** Navigate to a specific page (updates state and scrolls the viewer) */\n scrollToPage: (page: number) => void;\n\n /** Current zoom scale */\n scale: number;\n /** Set the zoom scale directly */\n setScale: (scale: number) => void;\n\n /** Portal targets for rendering annotation overlays on each page */\n portalTargets: AnnotationPortalTarget[];\n\n /** Ref to the internal pdfjs PDFViewer instance */\n pdfViewerRef: RefObject<PDFViewer | null>;\n /** Ref to the internal pdfjs EventBus instance */\n eventBusRef: RefObject<EventBus | null>;\n /** Ref to the internal pdfjs PDFFindController instance */\n findControllerRef: RefObject<PDFFindController | null>;\n}\n\nexport function usePdfViewerCore({\n src,\n initialPage = 1,\n initialScale = 1.0,\n}: UsePdfViewerCoreOptions): UsePdfViewerCoreResult {\n const { document, numPages, loading, error } = usePdfDocument(src);\n const [scale, setScale] = useState(initialScale);\n const [currentPage, setCurrentPage] = useState(initialPage);\n const containerRef = useRef<HTMLDivElement>(null);\n const viewerRef = useRef<HTMLDivElement>(null);\n\n const { pdfViewerRef, eventBusRef, findControllerRef } = usePdfViewer(\n containerRef,\n viewerRef,\n document,\n initialScale,\n initialPage,\n );\n\n const handleScaleChange = useCallback((newScale: number) => {\n setScale(newScale);\n }, []);\n\n const handlePageChange = useCallback((page: number) => {\n setCurrentPage(page);\n }, []);\n\n const { scrollToPage: syncScrollToPage } = usePdfViewerSync({\n pdfViewerRef,\n eventBusRef,\n document,\n scale,\n onScaleChange: handleScaleChange,\n onPageChange: handlePageChange,\n });\n\n const scrollToPage = useCallback(\n (page: number) => {\n setCurrentPage(page);\n syncScrollToPage(page);\n },\n [syncScrollToPage],\n );\n\n const portalTargets = usePdfAnnotationPortals(\n pdfViewerRef,\n eventBusRef,\n document,\n );\n\n return useMemo((): UsePdfViewerCoreResult => ({\n document,\n numPages,\n loading,\n error,\n containerRef,\n viewerRef,\n currentPage,\n scrollToPage,\n scale,\n setScale,\n portalTargets,\n pdfViewerRef,\n eventBusRef,\n findControllerRef,\n }), [\n document,\n numPages,\n loading,\n error,\n currentPage,\n scrollToPage,\n scale,\n setScale,\n portalTargets,\n ]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAE9D,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,gBAAgB,QAAQ,uBAAuB;AA+CxD,OAAO,SAASC,gBAAgBA,CAAC;EAC/BC,GAAG;EACHC,WAAW,GAAG,CAAC;EACfC,YAAY,GAAG;AACQ,CAAC,EAA0B;EAClD,MAAM;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGV,cAAc,CAACI,GAAG,CAAC;EAClE,MAAM,CAACO,KAAK,EAAEC,QAAQ,CAAC,GAAGd,QAAQ,CAACQ,YAAY,CAAC;EAChD,MAAM,CAACO,WAAW,EAAEC,cAAc,CAAC,GAAGhB,QAAQ,CAACO,WAAW,CAAC;EAC3D,MAAMU,YAAY,GAAGlB,MA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AC;AACJ","ignoreList":[]}
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { useCallback, useEffect, useState } from "react";
17
+ import { useCallback, useEffect, useMemo, useState } from "react";
18
18
  import { EMPTY_STRING, FIND_EVENT, UPDATE_FIND_CONTROL_STATE_EVENT, UPDATE_FIND_MATCHES_COUNT_EVENT } from "../constants.js";
19
19
  export function usePdfViewerSearch(eventBusRef, findControllerRef, document) {
20
20
  const [query, setQueryState] = useState(EMPTY_STRING);
@@ -91,7 +91,7 @@ export function usePdfViewerSearch(eventBusRef, findControllerRef, document) {
91
91
  eventBus.off(UPDATE_FIND_CONTROL_STATE_EVENT, handleControlState);
92
92
  };
93
93
  }, [eventBusRef, findControllerRef, document]);
94
- return {
94
+ return useMemo(() => ({
95
95
  query,
96
96
  totalMatches,
97
97
  currentMatchIndex,
@@ -101,6 +101,6 @@ export function usePdfViewerSearch(eventBusRef, findControllerRef, document) {
101
101
  prevMatch,
102
102
  openSearch,
103
103
  closeSearch
104
- };
104
+ }), [query, totalMatches, currentMatchIndex, isSearchOpen, setQuery, nextMatch, prevMatch, openSearch, closeSearch]);
105
105
  }
106
106
  //# sourceMappingURL=usePdfViewerSearch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePdfViewerSearch.js","names":["useCallback","useEffect","useState","EMPTY_STRING","FIND_EVENT","UPDATE_FIND_CONTROL_STATE_EVENT","UPDATE_FIND_MATCHES_COUNT_EVENT","usePdfViewerSearch","eventBusRef","findControllerRef","document","query","setQueryState","totalMatches","setTotalMatches","currentMatchIndex","setCurrentMatchIndex","isSearchOpen","setIsSearchOpen","dispatchFind","queryString","findPrevious","current","dispatch","source","undefined","type","caseSensitive","highlightAll","phraseSearch","dispatchFindAgain","setQuery","input","nextMatch","prevMatch","openSearch","closeSearch","eventBus","handleMatchesCount","evt","matchesCount","total","handleControlState","on","off"],"sources":["usePdfViewerSearch.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PDFDocumentProxy } from \"pdfjs-dist\";\nimport type {\n EventBus,\n PDFFindController,\n} from \"pdfjs-dist/web/pdf_viewer.mjs\";\nimport type { RefObject } from \"react\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport {\n EMPTY_STRING,\n FIND_EVENT,\n UPDATE_FIND_CONTROL_STATE_EVENT,\n UPDATE_FIND_MATCHES_COUNT_EVENT,\n} from \"../constants.js\";\n\nexport interface UsePdfViewerSearchResult {\n query: string;\n totalMatches: number;\n currentMatchIndex: number;\n isSearchOpen: boolean;\n setQuery: (query: string) => void;\n nextMatch: () => void;\n prevMatch: () => void;\n openSearch: () => void;\n closeSearch: () => void;\n}\n\nexport function usePdfViewerSearch(\n eventBusRef: RefObject<EventBus | null>,\n findControllerRef: RefObject<PDFFindController | null>,\n document: PDFDocumentProxy | undefined,\n): UsePdfViewerSearchResult {\n const [query, setQueryState] = useState(EMPTY_STRING);\n const [totalMatches, setTotalMatches] = useState(0);\n const [currentMatchIndex, setCurrentMatchIndex] = useState(0);\n const [isSearchOpen, setIsSearchOpen] = useState(false);\n\n const dispatchFind = useCallback(\n (queryString: string, findPrevious: boolean) => {\n eventBusRef.current?.dispatch(FIND_EVENT, {\n source: undefined,\n type: \"\",\n query: queryString,\n caseSensitive: false,\n highlightAll: true,\n phraseSearch: true,\n findPrevious,\n });\n },\n [eventBusRef],\n );\n\n const dispatchFindAgain = useCallback(\n (findPrevious: boolean) => {\n eventBusRef.current?.dispatch(FIND_EVENT, {\n source: undefined,\n type: \"again\",\n query,\n caseSensitive: false,\n highlightAll: true,\n phraseSearch: true,\n findPrevious,\n });\n },\n [eventBusRef, query],\n );\n\n const setQuery = useCallback(\n (input: string) => {\n setQueryState(input);\n\n if (input === EMPTY_STRING) {\n setTotalMatches(0);\n setCurrentMatchIndex(0);\n // Dispatch empty query to clear highlights\n dispatchFind(EMPTY_STRING, false);\n return;\n }\n\n dispatchFind(input, false);\n },\n [dispatchFind],\n );\n\n const nextMatch = useCallback(() => {\n dispatchFindAgain(false);\n }, [dispatchFindAgain]);\n\n const prevMatch = useCallback(() => {\n dispatchFindAgain(true);\n }, [dispatchFindAgain]);\n\n const openSearch = useCallback(() => {\n setIsSearchOpen(true);\n }, []);\n\n const closeSearch = useCallback(() => {\n setIsSearchOpen(false);\n setQueryState(EMPTY_STRING);\n setTotalMatches(0);\n setCurrentMatchIndex(0);\n // Clear highlights\n dispatchFind(EMPTY_STRING, false);\n }, [dispatchFind]);\n\n useEffect(function subscribeSearchEvents() {\n const eventBus = eventBusRef.current;\n if (eventBus == null) {\n return;\n }\n\n const handleMatchesCount = (evt: {\n matchesCount: { current: number; total: number };\n }) => {\n setTotalMatches(evt.matchesCount.total);\n setCurrentMatchIndex(\n evt.matchesCount.current > 0 ? evt.matchesCount.current - 1 : 0,\n );\n };\n\n const handleControlState = (evt: {\n state: number;\n matchesCount: { current: number; total: number };\n }) => {\n setTotalMatches(evt.matchesCount.total);\n setCurrentMatchIndex(\n evt.matchesCount.current > 0 ? evt.matchesCount.current - 1 : 0,\n );\n };\n\n eventBus.on(UPDATE_FIND_MATCHES_COUNT_EVENT, handleMatchesCount);\n eventBus.on(UPDATE_FIND_CONTROL_STATE_EVENT, handleControlState);\n\n return () => {\n eventBus.off(UPDATE_FIND_MATCHES_COUNT_EVENT, handleMatchesCount);\n eventBus.off(UPDATE_FIND_CONTROL_STATE_EVENT, handleControlState);\n };\n }, [eventBusRef, findControllerRef, document]);\n\n return {\n query,\n totalMatches,\n currentMatchIndex,\n isSearchOpen,\n setQuery,\n nextMatch,\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C,GAE3B,IAAK;MACJzB,eAAe,CAACyB,GAAG,CAACC,YAAY,CAACC,KAAK,CAAC;MACvCzB,oBAAoB,CAClBuB,GAAG,CAACC,YAAY,CAAClB,OAAO,GAAG,CAAC,GAAGiB,GAAG,CAACC,YAAY,CAAClB,OAAO,GAAG,CAAC,GAAG,CAChE,CAAC;IACH,CAAC;IAED,MAAMoB,kBAAkB,GAAIH,GAG3B,IAAK;MACJzB,eAAe,CAACyB,GAAG,CAACC,YAAY,CAACC,KAAK,CAAC;MACvCzB,oBAAoB,CAClBuB,GAAG,CAACC,YAAY,CAAClB,OAAO,GAAG,CAAC,GAAGiB,GAAG,CAACC,YAAY,CAAClB,OAAO,GAAG,CAAC,GAAG,CAChE,CAAC;IACH,CAAC;IAEDe,QAAQ,CAACM,EAAE,CAACrC,+BAA+B,EAAEgC,kBAAkB,CAAC;IAChED,QAAQ,CAACM,EAAE,CAACtC,+BAA+B,EAAEqC,kBAAkB,CAAC;IAEhE,OAAO,MAAM;MACXL,QAAQ,CAACO,GAAG,CAACtC,+BAA+B,EAAEgC,kBAAkB,CAAC;MACjED,QAAQ,CAACO,GAAG,CAACvC,+BAA+B,EAAEqC,kBAAkB,CAAC;IACnE,CAAC;EACH,CAAC,EAAE,CAAClC,WAAW,EAAEC,iBAAiB,EAAEC,QAAQ,CAAC,CAAC;EAE9C,OAAO;IACLC,KAAK;IACLE,YAAY;IACZE,iBAAiB;IACjBE,YAAY;IACZc,QAAQ;IACRE,SAAS;IACTC,SAAS;IACTC,UAAU;IACVC;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"usePdfViewerSearch.js","names":["useCallback","useEffect","useMemo","useState","EMPTY_STRING","FIND_EVENT","UPDATE_FIND_CONTROL_STATE_EVENT","UPDATE_FIND_MATCHES_COUNT_EVENT","usePdfViewerSearch","eventBusRef","findControllerRef","document","query","setQueryState","totalMatches","setTotalMatches","currentMatchIndex","setCurrentMatchIndex","isSearchOpen","setIsSearchOpen","dispatchFind","queryString","findPrevious","current","dispatch","source","undefined","type","caseSensitive","highlightAll","phraseSearch","dispatchFindAgain","setQuery","input","nextMatch","prevMatch","openSearch","closeSearch","eventBus","handleMatchesCount","evt","matchesCount","total","handleControlState","on","off"],"sources":["usePdfViewerSearch.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PDFDocumentProxy } from \"pdfjs-dist\";\nimport type {\n EventBus,\n PDFFindController,\n} from \"pdfjs-dist/web/pdf_viewer.mjs\";\nimport type { RefObject } from \"react\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport {\n EMPTY_STRING,\n FIND_EVENT,\n UPDATE_FIND_CONTROL_STATE_EVENT,\n UPDATE_FIND_MATCHES_COUNT_EVENT,\n} from \"../constants.js\";\n\nexport interface UsePdfViewerSearchResult {\n query: string;\n totalMatches: number;\n currentMatchIndex: number;\n isSearchOpen: boolean;\n setQuery: (query: string) => void;\n nextMatch: () => void;\n prevMatch: () => void;\n openSearch: () => void;\n closeSearch: () => void;\n}\n\nexport function usePdfViewerSearch(\n eventBusRef: RefObject<EventBus | null>,\n findControllerRef: RefObject<PDFFindController | null>,\n document: PDFDocumentProxy | undefined,\n): UsePdfViewerSearchResult {\n const [query, setQueryState] = useState(EMPTY_STRING);\n const [totalMatches, setTotalMatches] = useState(0);\n const [currentMatchIndex, setCurrentMatchIndex] = useState(0);\n const [isSearchOpen, setIsSearchOpen] = useState(false);\n\n const dispatchFind = useCallback(\n (queryString: string, findPrevious: boolean) => {\n eventBusRef.current?.dispatch(FIND_EVENT, {\n source: undefined,\n type: \"\",\n query: queryString,\n caseSensitive: false,\n highlightAll: true,\n phraseSearch: true,\n findPrevious,\n });\n },\n [eventBusRef],\n );\n\n const dispatchFindAgain = useCallback(\n (findPrevious: boolean) => {\n eventBusRef.current?.dispatch(FIND_EVENT, {\n source: undefined,\n type: \"again\",\n query,\n caseSensitive: false,\n highlightAll: true,\n phraseSearch: true,\n findPrevious,\n });\n },\n [eventBusRef, query],\n );\n\n const setQuery = useCallback(\n (input: string) => {\n setQueryState(input);\n\n if (input === EMPTY_STRING) {\n setTotalMatches(0);\n setCurrentMatchIndex(0);\n // Dispatch empty query to clear highlights\n dispatchFind(EMPTY_STRING, false);\n return;\n }\n\n dispatchFind(input, false);\n },\n [dispatchFind],\n );\n\n const nextMatch = useCallback(() => {\n dispatchFindAgain(false);\n }, [dispatchFindAgain]);\n\n const prevMatch = useCallback(() => {\n dispatchFindAgain(true);\n }, [dispatchFindAgain]);\n\n const openSearch = useCallback(() => {\n setIsSearchOpen(true);\n }, []);\n\n const closeSearch = useCallback(() => {\n setIsSearchOpen(false);\n setQueryState(EMPTY_STRING);\n setTotalMatches(0);\n setCurrentMatchIndex(0);\n // Clear highlights\n dispatchFind(EMPTY_STRING, false);\n }, [dispatchFind]);\n\n useEffect(function subscribeSearchEvents() {\n const eventBus = eventBusRef.current;\n if (eventBus == null) {\n return;\n }\n\n const handleMatchesCount = (evt: {\n matchesCount: { current: number; total: number };\n }) => {\n setTotalMatches(evt.matchesCount.total);\n setCurrentMatchIndex(\n evt.matchesCount.current > 0 ? evt.matchesCount.current - 1 : 0,\n );\n };\n\n const handleControlState = (evt: {\n state: number;\n matchesCount: { current: number; total: number };\n }) => {\n setTotalMatches(evt.matchesCount.total);\n setCurrentMatchIndex(\n evt.matchesCount.current > 0 ? evt.matchesCount.current - 1 : 0,\n );\n };\n\n eventBus.on(UPDATE_FIND_MATCHES_COUNT_EVENT, handleMatchesCount);\n eventBus.on(UPDATE_FIND_CONTROL_STATE_EVENT, handleControlState);\n\n return () => {\n eventBus.off(UPDATE_FIND_MATCHES_COUNT_EVENT, handleMatchesCount);\n eventBus.off(UPDATE_FIND_CONTROL_STATE_EVENT, handleControlState);\n };\n }, [eventBusRef, findControllerRef, document]);\n\n return useMemo((): UsePdfViewerSearchResult => ({\n query,\n totalMatches,\n currentMatchIndex,\n isSearchOpen,\n setQuery,\n nextMatch,\n prevMatch,\n openSearch,\n closeSearch,\n }), [\n query,\n totalMatches,\n currentMatchIndex,\n isSearchOpen,\n setQuery,\n nextMatch,\n prevMatch,\n openSearch,\n closeSearch,\n ]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACjE,SACEC,YAAY,EACZC,UAAU,EACVC,+BAA+B,EAC/BC,+BAA+B,QAC1B,iBAAiB;AAcxB,OAAO,SAASC,kBAAkBA,CAChCC,WAAuC,EACvCC,iBAAsD,EACtDC,QAAsC,EACZ;EAC1B,MAAM,CAACC,KAAK,EAAEC,aAAa,CAAC,GAAGV,QAAQ,CAACC,YAAY,CAAC;EACrD,MAAM,CAACU,YAAY,EAAEC,eAAe,CAAC,GAAGZ,QAAQ,CAAC,CAAC,CAAC;EACnD,MAAM,CAACa,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGd,QAAQ,CAAC,CAAC,CAAC;EAC7D,MAAM,CAACe,YAAY,EAAEC,eAAe,CAAC,GAAGhB,QAAQ,CAAC,KAAK,CAAC;EAEvD,MAAMiB,YAAY,GAAGpB,WAAW,CAC9B,CAACqB,WAAmB,EAAEC,YAAqB,KAAK;IAC9Cb,WAAW,CAACc,OAAO,EAAEC,QAAQ,CAACnB,UAAU,EAAE;MACxCoB,MAAM,EAAEC,SAAS;MACjBC,IAAI,EAAE,EAAE;MACRf,KAAK,EAAES,WAAW;MAClBO,aAAa,EAAE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YAAY;IACZE,iBAAiB;IACjBE,YAAY;IACZc,QAAQ;IACRE,SAAS;IACTC,SAAS;IACTC,UAAU;IACVC;EACF,CAAC,CAAC,EAAE,CACFzB,KAAK,EACLE,YAAY,EACZE,iBAAiB,EACjBE,YAAY,EACZc,QAAQ,EACRE,SAAS,EACTC,SAAS,EACTC,UAAU,EACVC,WAAW,CACZ,CAAC;AACJ","ignoreList":[]}
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { useCallback, useEffect, useState } from "react";
17
+ import { useCallback, useEffect, useMemo, useState } from "react";
18
18
  import { MAX_SCALE, MIN_SCALE, SCALE_STEP } from "../constants.js";
19
19
  import { usePdfOutline } from "./usePdfOutline.js";
20
20
  import { usePdfViewerCore } from "./usePdfViewerCore.js";
@@ -105,7 +105,7 @@ export function usePdfViewerState({
105
105
  });
106
106
  });
107
107
  }, [core.document, src, onDownload]);
108
- return {
108
+ return useMemo(() => ({
109
109
  ...core,
110
110
  zoomIn,
111
111
  zoomOut,
@@ -119,7 +119,7 @@ export function usePdfViewerState({
119
119
  search,
120
120
  outlineItems,
121
121
  download
122
- };
122
+ }), [core, zoomIn, zoomOut, rotation, rotateLeft, rotateRight, sidebarOpen, sidebarMode, setSidebarMode, toggleSidebar, search, outlineItems, download]);
123
123
  }
124
124
 
125
125
  /** Derive a download filename from an explicit name, the src URL, or a fallback. */
@@ -1 +1 @@
1
- {"version":3,"file":"usePdfViewerState.js","names":["useCallback","useEffect","useState","MAX_SCALE","MIN_SCALE","SCALE_STEP","usePdfOutline","usePdfViewerCore","usePdfViewerSearch","usePdfViewerState","src","initialPage","initialScale","initialSidebarOpen","sidebarMode","sidebarModeProp","onDownload","core","rotation","setRotation","sidebarOpen","setSidebarOpen","setSidebarMode","search","eventBusRef","findControllerRef","document","outlineItems","pdfViewer","pdfViewerRef","current","pagesRotation","handleKeyDown","e","ctrlKey","metaKey","key","preventDefault","openSearch","window","addEventListener","removeEventListener","zoomIn","setScale","Math","min","scale","zoomOut","max","rotateLeft","prev","rotateRight","toggleSidebar","download","filename","getData","then","data","blob","Blob","buffer","type","url","URL","createObjectURL","resolvedFilename","resolveDownloadFilename","a","globalThis","createElement","href","click","revokeObjectURL","success","catch","err","error","Error","split","pop"],"sources":["usePdfViewerState.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useEffect, useState } from \"react\";\nimport { MAX_SCALE, MIN_SCALE, SCALE_STEP } from \"../constants.js\";\nimport type { PdfDownloadResult, SidebarMode } from \"../types.js\";\nimport { usePdfOutline } from \"./usePdfOutline.js\";\nimport type {\n UsePdfViewerCoreOptions,\n UsePdfViewerCoreResult,\n} from \"./usePdfViewerCore.js\";\nimport { usePdfViewerCore } from \"./usePdfViewerCore.js\";\nimport type { UsePdfViewerSearchResult } from \"./usePdfViewerSearch.js\";\nimport { usePdfViewerSearch } from \"./usePdfViewerSearch.js\";\n\nexport interface UsePdfViewerStateOptions extends UsePdfViewerCoreOptions {\n /** Whether the sidebar is initially open (default false) */\n initialSidebarOpen?: boolean;\n /** Which sidebar panel to show (default \"thumbnails\") */\n sidebarMode?: SidebarMode;\n /** Callback fired when a download completes or fails */\n onDownload?: (result: PdfDownloadResult) => void;\n}\n\nexport interface UsePdfViewerStateResult extends UsePdfViewerCoreResult {\n /** Zoom in by one step */\n zoomIn: () => void;\n /** Zoom out by one step */\n zoomOut: () => void;\n\n /** Current rotation in degrees (0, 90, 180, 270) */\n rotation: number;\n /** Rotate 90 degrees counter-clockwise */\n rotateLeft: () => void;\n /** Rotate 90 degrees clockwise */\n rotateRight: () => void;\n\n /** Whether the sidebar panel is open */\n sidebarOpen: boolean;\n /** Which sidebar panel is active */\n sidebarMode: SidebarMode;\n /** Change the active sidebar panel */\n setSidebarMode: (mode: SidebarMode) => void;\n /** Toggle sidebar open/closed */\n toggleSidebar: () => void;\n\n /** Search state and actions */\n search: UsePdfViewerSearchResult;\n\n /** Document outline items (from bookmarks or text extraction) */\n outlineItems: ReturnType<typeof usePdfOutline>;\n\n /** Download the PDF as a file */\n download: (filename?: string) => void;\n}\n\nexport function usePdfViewerState({\n src,\n initialPage,\n initialScale,\n initialSidebarOpen = false,\n sidebarMode: sidebarModeProp = \"thumbnails\",\n onDownload,\n}: UsePdfViewerStateOptions): UsePdfViewerStateResult {\n const core = usePdfViewerCore({ src, initialPage, initialScale });\n\n const [rotation, setRotation] = useState(0);\n const [sidebarOpen, setSidebarOpen] = useState(initialSidebarOpen);\n const [sidebarMode, setSidebarMode] = useState<SidebarMode>(sidebarModeProp);\n\n const search = usePdfViewerSearch(\n core.eventBusRef,\n core.findControllerRef,\n core.document,\n );\n\n const outlineItems = usePdfOutline(core.document);\n\n // Sync sidebarMode prop changes to state\n useEffect(function syncSidebarMode() {\n setSidebarMode(sidebarModeProp);\n }, [sidebarModeProp]);\n\n // Sync rotation → PDFViewer\n useEffect(function syncRotationToViewer() {\n const pdfViewer = core.pdfViewerRef.current;\n if (pdfViewer != null) {\n pdfViewer.pagesRotation = rotation;\n }\n }, [core.pdfViewerRef, rotation]);\n\n // Ctrl+F keyboard shortcut\n useEffect(function registerSearchShortcut() {\n const handleKeyDown = (e: KeyboardEvent) => {\n if ((e.ctrlKey || e.metaKey) && e.key === \"f\") {\n e.preventDefault();\n search.openSearch();\n }\n };\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [search.openSearch]);\n\n const zoomIn = useCallback(() => {\n core.setScale(Math.min(core.scale + SCALE_STEP, MAX_SCALE));\n }, [core.scale, core.setScale]);\n\n const zoomOut = useCallback(() => {\n core.setScale(Math.max(core.scale - SCALE_STEP, MIN_SCALE));\n }, [core.scale, core.setScale]);\n\n const rotateLeft = useCallback(() => {\n setRotation((prev) => (prev - 90 + 360) % 360);\n }, []);\n\n const rotateRight = useCallback(() => {\n setRotation((prev) => (prev + 90) % 360);\n }, []);\n\n const toggleSidebar = useCallback(() => {\n setSidebarOpen((prev) => !prev);\n }, []);\n\n const download = useCallback((filename?: string) => {\n if (core.document == null) {\n return;\n }\n void core.document.getData().then((data) => {\n const blob = new Blob([data.buffer as ArrayBuffer], {\n type: \"application/pdf\",\n });\n const url = URL.createObjectURL(blob);\n const resolvedFilename = resolveDownloadFilename(src, filename);\n const a = globalThis.document.createElement(\"a\");\n a.href = url;\n a.download = resolvedFilename;\n a.click();\n URL.revokeObjectURL(url);\n onDownload?.({ success: true, filename: resolvedFilename });\n }).catch((err: unknown) => {\n onDownload?.({\n success: false,\n error: err instanceof Error\n ? err\n : new Error(\"Failed to download PDF\"),\n });\n });\n }, [core.document, src, onDownload]);\n\n return {\n ...core,\n zoomIn,\n zoomOut,\n rotation,\n rotateLeft,\n rotateRight,\n sidebarOpen,\n sidebarMode,\n setSidebarMode,\n toggleSidebar,\n search,\n outlineItems,\n download,\n };\n}\n\n/** Derive a download filename from an explicit name, the src URL, or a fallback. */\nfunction resolveDownloadFilename(\n src: string | ArrayBuffer,\n filename: string | undefined,\n): string {\n if (filename != null) {\n return filename;\n }\n if (typeof src === \"string\") {\n return src.split(\"/\").pop()?.split(\"?\")[0] || \"document.pdf\";\n }\n return \"document.pdf\";\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACxD,SAASC,SAAS,EAAEC,SAAS,EAAEC,UAAU,QAAQ,iBAAiB;AAElE,SAASC,aAA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M;IACNK,OAAO;IACP7B,QAAQ;IACR+B,UAAU;IACVE,WAAW;IACX/B,WAAW;IACXN,WAAW;IACXQ,cAAc;IACd8B,aAAa;IACb7B,MAAM;IACNI,YAAY;IACZ0B;EACF,CAAC;AACH;;AAEA;AACA,SAASa,uBAAuBA,CAC9BxD,GAAyB,EACzB4C,QAA4B,EACpB;EACR,IAAIA,QAAQ,IAAI,IAAI,EAAE;IACpB,OAAOA,QAAQ;EACjB;EACA,IAAI,OAAO5C,GAAG,KAAK,QAAQ,EAAE;IAC3B,OAAOA,GAAG,CAACoE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAAC,CAAC,EAAED,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc;EAC9D;EACA,OAAO,cAAc;AACvB","ignoreList":[]}
1
+ {"version":3,"file":"usePdfViewerState.js","names":["useCallback","useEffect","useMemo","useState","MAX_SCALE","MIN_SCALE","SCALE_STEP","usePdfOutline","usePdfViewerCore","usePdfViewerSearch","usePdfViewerState","src","initialPage","initialScale","initialSidebarOpen","sidebarMode","sidebarModeProp","onDownload","core","rotation","setRotation","sidebarOpen","setSidebarOpen","setSidebarMode","search","eventBusRef","findControllerRef","document","outlineItems","pdfViewer","pdfViewerRef","current","pagesRotation","handleKeyDown","e","ctrlKey","metaKey","key","preventDefault","openSearch","window","addEventListener","removeEventListener","zoomIn","setScale","Math","min","scale","zoomOut","max","rotateLeft","prev","rotateRight","toggleSidebar","download","filename","getData","then","data","blob","Blob","buffer","type","url","URL","createObjectURL","resolvedFilename","resolveDownloadFilename","a","globalThis","createElement","href","click","revokeObjectURL","success","catch","err","error","Error","split","pop"],"sources":["usePdfViewerState.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { MAX_SCALE, MIN_SCALE, SCALE_STEP } from \"../constants.js\";\nimport type { PdfDownloadResult, SidebarMode } from \"../types.js\";\nimport { usePdfOutline } from \"./usePdfOutline.js\";\nimport type {\n UsePdfViewerCoreOptions,\n UsePdfViewerCoreResult,\n} from \"./usePdfViewerCore.js\";\nimport { usePdfViewerCore } from \"./usePdfViewerCore.js\";\nimport type { UsePdfViewerSearchResult } from \"./usePdfViewerSearch.js\";\nimport { usePdfViewerSearch } from \"./usePdfViewerSearch.js\";\n\nexport interface UsePdfViewerStateOptions extends UsePdfViewerCoreOptions {\n /** Whether the sidebar is initially open (default false) */\n initialSidebarOpen?: boolean;\n /** Which sidebar panel to show (default \"thumbnails\") */\n sidebarMode?: SidebarMode;\n /** Callback fired when a download completes or fails */\n onDownload?: (result: PdfDownloadResult) => void;\n}\n\nexport interface UsePdfViewerStateResult extends UsePdfViewerCoreResult {\n /** Zoom in by one step */\n zoomIn: () => void;\n /** Zoom out by one step */\n zoomOut: () => void;\n\n /** Current rotation in degrees (0, 90, 180, 270) */\n rotation: number;\n /** Rotate 90 degrees counter-clockwise */\n rotateLeft: () => void;\n /** Rotate 90 degrees clockwise */\n rotateRight: () => void;\n\n /** Whether the sidebar panel is open */\n sidebarOpen: boolean;\n /** Which sidebar panel is active */\n sidebarMode: SidebarMode;\n /** Change the active sidebar panel */\n setSidebarMode: (mode: SidebarMode) => void;\n /** Toggle sidebar open/closed */\n toggleSidebar: () => void;\n\n /** Search state and actions */\n search: UsePdfViewerSearchResult;\n\n /** Document outline items (from bookmarks or text extraction) */\n outlineItems: ReturnType<typeof usePdfOutline>;\n\n /** Download the PDF as a file */\n download: (filename?: string) => void;\n}\n\nexport function usePdfViewerState({\n src,\n initialPage,\n initialScale,\n initialSidebarOpen = false,\n sidebarMode: sidebarModeProp = \"thumbnails\",\n onDownload,\n}: UsePdfViewerStateOptions): UsePdfViewerStateResult {\n const core = usePdfViewerCore({ src, initialPage, initialScale });\n\n const [rotation, setRotation] = useState(0);\n const [sidebarOpen, setSidebarOpen] = useState(initialSidebarOpen);\n const [sidebarMode, setSidebarMode] = useState<SidebarMode>(sidebarModeProp);\n\n const search = usePdfViewerSearch(\n core.eventBusRef,\n core.findControllerRef,\n core.document,\n );\n\n const outlineItems = usePdfOutline(core.document);\n\n // Sync sidebarMode prop changes to state\n useEffect(function syncSidebarMode() {\n setSidebarMode(sidebarModeProp);\n }, [sidebarModeProp]);\n\n // Sync rotation → PDFViewer\n useEffect(function syncRotationToViewer() {\n const pdfViewer = core.pdfViewerRef.current;\n if (pdfViewer != null) {\n pdfViewer.pagesRotation = rotation;\n }\n }, [core.pdfViewerRef, rotation]);\n\n // Ctrl+F keyboard shortcut\n useEffect(function registerSearchShortcut() {\n const handleKeyDown = (e: KeyboardEvent) => {\n if ((e.ctrlKey || e.metaKey) && e.key === \"f\") {\n e.preventDefault();\n search.openSearch();\n }\n };\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [search.openSearch]);\n\n const zoomIn = useCallback(() => {\n core.setScale(Math.min(core.scale + SCALE_STEP, MAX_SCALE));\n }, [core.scale, core.setScale]);\n\n const zoomOut = useCallback(() => {\n core.setScale(Math.max(core.scale - SCALE_STEP, MIN_SCALE));\n }, [core.scale, core.setScale]);\n\n const rotateLeft = useCallback(() => {\n setRotation((prev) => (prev - 90 + 360) % 360);\n }, []);\n\n const rotateRight = useCallback(() => {\n setRotation((prev) => (prev + 90) % 360);\n }, []);\n\n const toggleSidebar = useCallback(() => {\n setSidebarOpen((prev) => !prev);\n }, []);\n\n const download = useCallback((filename?: string) => {\n if (core.document == null) {\n return;\n }\n void core.document.getData().then((data) => {\n const blob = new Blob([data.buffer as ArrayBuffer], {\n type: \"application/pdf\",\n });\n const url = URL.createObjectURL(blob);\n const resolvedFilename = resolveDownloadFilename(src, filename);\n const a = globalThis.document.createElement(\"a\");\n a.href = url;\n a.download = resolvedFilename;\n a.click();\n URL.revokeObjectURL(url);\n onDownload?.({ success: true, filename: resolvedFilename });\n }).catch((err: unknown) => {\n onDownload?.({\n success: false,\n error: err instanceof Error\n ? err\n : new Error(\"Failed to download PDF\"),\n });\n });\n }, [core.document, src, onDownload]);\n\n return useMemo((): UsePdfViewerStateResult => ({\n ...core,\n zoomIn,\n zoomOut,\n rotation,\n rotateLeft,\n rotateRight,\n sidebarOpen,\n sidebarMode,\n setSidebarMode,\n toggleSidebar,\n search,\n outlineItems,\n download,\n }), [\n core,\n zoomIn,\n zoomOut,\n rotation,\n rotateLeft,\n rotateRight,\n sidebarOpen,\n sidebarMode,\n setSidebarMode,\n toggleSidebar,\n search,\n outlineItems,\n download,\n ]);\n}\n\n/** Derive a download filename from an explicit name, the src URL, or a fallback. */\nfunction resolveDownloadFilename(\n src: string | ArrayBuffer,\n filename: string | undefined,\n): string {\n if (filename != null) {\n return filename;\n }\n if (typeof src === \"string\") {\n return src.split(\"/\").pop()?.split(\"?\")[0] || \"document.pdf\";\n }\n return \"document.pdf\";\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACjE,SAASC,SAAS,EAAEC,SAAS,EAAEC,UAAU,QAAQ,iBAAiB;AAElE,SAASC,aAAa,QAAQ,oBAAoB;AAKlD,SAASC,gBAAgB,QAAQ,uBAAuB;AAExD,SAASC,kBAAkB,QAAQ,yBAAyB;AA2C5D,OAAO,SAASC,iBAAiBA,CAAC;EAChCC,GAAG;EACHC,WAAW;EACXC,YAAY;EACZC,kBAAkB,GAAG,KAAK;EAC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AAI,EACJyB,MAAM,EACNK,OAAO,EACP7B,QAAQ,EACR+B,UAAU,EACVE,WAAW,EACX/B,WAAW,EACXN,WAAW,EACXQ,cAAc,EACd8B,aAAa,EACb7B,MAAM,EACNI,YAAY,EACZ0B,QAAQ,CACT,CAAC;AACJ;;AAEA;AACA,SAASa,uBAAuBA,CAC9BxD,GAAyB,EACzB4C,QAA4B,EACpB;EACR,IAAIA,QAAQ,IAAI,IAAI,EAAE;IACpB,OAAOA,QAAQ;EACjB;EACA,IAAI,OAAO5C,GAAG,KAAK,QAAQ,EAAE;IAC3B,OAAOA,GAAG,CAACoE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAAC,CAAC,EAAED,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc;EAC9D;EACA,OAAO,cAAc;AACvB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type React from \"react\";\n\n/** Which sidebar panel to display when the sidebar is open. */\nexport type SidebarMode = \"thumbnails\" | \"outline\";\n\n/** A single item in the PDF document outline (table of contents). */\nexport interface OutlineItem {\n title: string;\n depth: number;\n pageNumber: number;\n bold: boolean;\n italic: boolean;\n}\n\n/** The visual style of an annotation rendered on the PDF. */\nexport type AnnotationType =\n | \"highlight\"\n | \"underline\"\n | \"comment\"\n | \"pin\"\n | \"custom\";\n\n/** A rectangle in PDF coordinate space (origin: bottom-left of page). */\nexport interface PdfRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/** Props passed to a custom annotation renderer. */\nexport interface PdfAnnotationRenderProps {\n annotation: PdfAnnotation;\n scale: number;\n pageHeight: number;\n}\n\n/** Common fields shared by all annotation types. */\ninterface PdfAnnotationBase {\n /** Unique identifier for this annotation */\n id: string;\n /** Page number (1-indexed) */\n page: number;\n /** Coordinates in PDF points (origin: bottom-left of page) */\n rect: PdfRect;\n /** Additional rects for multi-line text highlights. When present, all rects are rendered. */\n rects?: PdfRect[];\n /** Optional label or tooltip text */\n label?: string;\n /** Optional color override (CSS color string) */\n color?: string;\n}\n\n/** A built-in annotation type (highlight, underline, comment, pin). */\ninterface PdfStandardAnnotation extends PdfAnnotationBase {\n /** The type of annotation to render */\n type: \"highlight\" | \"underline\" | \"comment\" | \"pin\";\n}\n\n/** A custom annotation with a user-provided renderer. */\nexport interface PdfCustomAnnotation extends PdfAnnotationBase {\n /** Must be \"custom\" for custom-rendered annotations */\n type: \"custom\";\n /** Render function for the custom annotation content (required for custom type) */\n render: (props: PdfAnnotationRenderProps) => React.ReactNode;\n}\n\n/** A single annotation positioned on a specific page of the PDF. */\nexport type PdfAnnotation = PdfStandardAnnotation | PdfCustomAnnotation;\n\n/** Result passed to the {@link PdfViewerProps.onDownload} callback. */\nexport type PdfDownloadResult =\n | { success: true; filename: string }\n | { success: false; error: Error };\n\n/** Possible values for a PDF form field. */\nexport type PdfFormFieldValue = string | boolean | string[];\n\n/** Data emitted when the user creates a text highlight via the highlight editor. */\nexport interface PdfTextHighlightEvent {\n /** Page number (1-indexed) */\n page: number;\n /** Bounding rects in PDF coordinate space (bottom-left origin) */\n rects: PdfRect[];\n /** The selected text content */\n selectedText: string;\n /** Highlight color as CSS color string */\n color: string;\n}\n\n/** Props for the {@link PdfViewer} component. */\nexport interface PdfViewerProps {\n /** PDF source — URL string or ArrayBuffer */\n src: string | ArrayBuffer;\n /** Annotations to overlay on the PDF */\n annotations?: PdfAnnotation[];\n /**\n * Callback fired when an annotation is clicked.\n *\n * @param annotation - The annotation that was clicked\n * @returns void\n */\n onAnnotationClick?: (annotation: PdfAnnotation) => void;\n /**\n * Callback fired when a download completes or fails.\n *\n * @param result - The download result indicating success with the filename, or failure with an error\n * @returns void\n */\n onDownload?: (result: PdfDownloadResult) => void;\n /**\n * Whether the highlight toggle button is shown in the toolbar.\n * @default false\n */\n enableHighlight?: boolean;\n /**\n * Callback fired when the user creates a text highlight.\n * Only fires when highlight mode is active.\n *\n * @param event - The highlight event with page, rects, text, and color\n * @returns void\n */\n onTextHighlight?: (event: PdfTextHighlightEvent) => void;\n /**\n * Callback fired when the user deletes a highlight via the PDF.js editor UI.\n *\n * @param event - The highlight event that was deleted\n * @returns void\n */\n onHighlightDelete?: (event: PdfTextHighlightEvent) => void;\n /** Initial page number (1-indexed, default 1) */\n initialPage?: number;\n /** Initial zoom scale (default 1.0) */\n initialScale?: number;\n /** Whether the sidebar is initially open (default false) */\n initialSidebarOpen?: boolean;\n /**\n * Whether the download button is shown in the toolbar.\n * @default false\n */\n enableDownload?: boolean;\n /**\n * Which sidebar panel to show: thumbnails or document outline.\n * @default \"thumbnails\"\n */\n sidebarMode?: SidebarMode;\n /**\n * Custom icon components for each outline depth level (0-indexed).\n * Key 0 = top-level items, 1 = first nesting level, etc.\n * If omitted, no icons are rendered.\n */\n outlineIcons?: Partial<Record<number, React.ComponentType>>;\n /**\n * Initial form field values keyed by field name. Applied when the document loads.\n * Use this to pre-populate form fields when resuming a previously edited PDF.\n */\n formData?: Record<string, PdfFormFieldValue>;\n /**\n * Callback fired when the user clicks the save button in the toolbar.\n * Receives all current form field values keyed by field name.\n *\n * @param data - All form field values keyed by field name\n * @returns void\n */\n onFormSubmit?: (data: Record<string, PdfFormFieldValue>) => void;\n /**\n * Callback fired when any form field value changes.\n *\n * @param fieldName - The name of the field that changed\n * @param value - The new value\n * @returns void\n */\n onFormChange?: (fieldName: string, value: PdfFormFieldValue) => void;\n /** Additional CSS class name for the root element */\n className?: string;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type React from \"react\";\n\n/** Which sidebar panel to display when the sidebar is open. */\nexport type SidebarMode = \"thumbnails\" | \"outline\";\n\n/** A single item in the PDF document outline (table of contents). */\nexport interface OutlineItem {\n title: string;\n depth: number;\n pageNumber: number;\n bold: boolean;\n italic: boolean;\n}\n\n/** The visual style of an annotation rendered on the PDF. */\nexport type AnnotationType =\n | \"highlight\"\n | \"underline\"\n | \"comment\"\n | \"pin\"\n | \"custom\";\n\n/** A rectangle in PDF coordinate space (origin: bottom-left of page). */\nexport interface PdfRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/** Props passed to a custom annotation renderer. */\nexport interface PdfAnnotationRenderProps {\n annotation: PdfAnnotation;\n scale: number;\n pageHeight: number;\n}\n\n/** Common fields shared by all annotation types. */\ninterface PdfAnnotationBase {\n /** Unique identifier for this annotation */\n id: string;\n /** Page number (1-indexed) */\n page: number;\n /** Coordinates in PDF points (origin: bottom-left of page) */\n rect: PdfRect;\n /** Additional rects for multi-line text highlights. When present, all rects are rendered. */\n rects?: PdfRect[];\n /** Optional label or tooltip text */\n label?: string;\n /** Optional color override (CSS color string) */\n color?: string;\n}\n\n/** A built-in annotation type (highlight, underline, comment, pin). */\ninterface PdfStandardAnnotation extends PdfAnnotationBase {\n /** The type of annotation to render */\n type: \"highlight\" | \"underline\" | \"comment\" | \"pin\";\n}\n\n/** A custom annotation with a user-provided renderer. */\nexport interface PdfCustomAnnotation extends PdfAnnotationBase {\n /** Must be \"custom\" for custom-rendered annotations */\n type: \"custom\";\n /** Render function for the custom annotation content (required for custom type) */\n render: (props: PdfAnnotationRenderProps) => React.ReactNode;\n}\n\n/** A single annotation positioned on a specific page of the PDF. */\nexport type PdfAnnotation = PdfStandardAnnotation | PdfCustomAnnotation;\n\n/** Result passed to the {@link PdfViewerProps.onDownload} callback. */\nexport type PdfDownloadResult =\n | { success: true; filename: string }\n | { success: false; error: Error };\n\n/** Possible values for a PDF form field. */\nexport type PdfFormFieldValue = string | boolean | string[];\n\n/** Data emitted when the user creates a text highlight via the highlight editor. */\nexport interface PdfTextHighlightEvent {\n /** Internal PDF.js editor ID. Use with `deleteHighlight` to programmatically remove. */\n editorId: string;\n /** Page number (1-indexed) */\n page: number;\n /** Bounding rects in PDF coordinate space (bottom-left origin) */\n rects: PdfRect[];\n /** The selected text content */\n selectedText: string;\n /** Highlight color as CSS color string */\n color: string;\n}\n\n/** Imperative handle for programmatic control of a {@link PdfViewer} or {@link BasePdfViewer}. */\nexport interface PdfViewerHandle {\n /** Scroll the viewer to the given page number (1-indexed). */\n scrollToPage: (page: number) => void;\n /** Programmatically delete a highlight by its `editorId` (from {@link PdfTextHighlightEvent}). */\n deleteHighlight: (editorId: string) => void;\n}\n\n/**\n * Options for {@link usePdfViewerInstance}.\n * Equivalent to {@link PdfViewerProps} minus the `className` rendering concern.\n */\nexport interface PdfViewerInstanceOptions {\n /** PDF source — URL string or ArrayBuffer */\n src: string | ArrayBuffer;\n /** Annotations to overlay on the PDF */\n annotations?: PdfAnnotation[];\n /** Callback fired when an annotation is clicked */\n onAnnotationClick?: (annotation: PdfAnnotation) => void;\n /** Callback fired when a download completes or fails */\n onDownload?: (result: PdfDownloadResult) => void;\n /** Whether the highlight toggle button is shown in the toolbar */\n highlightEnabled?: boolean;\n /** Callback fired when the user creates a text highlight */\n onTextHighlight?: (event: PdfTextHighlightEvent) => void;\n /** Callback fired when the user deletes a highlight */\n onHighlightDelete?: (event: PdfTextHighlightEvent) => void;\n /** Initial form field values keyed by field name */\n formData?: Record<string, PdfFormFieldValue>;\n /** Callback fired when the user clicks the save button */\n onFormSubmit?: (data: Record<string, PdfFormFieldValue>) => void;\n /** Callback fired when any form field value changes */\n onFormChange?: (fieldName: string, value: PdfFormFieldValue) => void;\n /** Initial page number (1-indexed, default 1) */\n initialPage?: number;\n /** Initial zoom scale (default 1.0) */\n initialScale?: number;\n /** Whether the sidebar is initially open (default false) */\n initialSidebarOpen?: boolean;\n /** Whether the download button is shown in the toolbar */\n enableDownload?: boolean;\n /** Which sidebar panel to show: thumbnails or document outline */\n sidebarMode?: SidebarMode;\n /** Custom icon components for each outline depth level (0-indexed) */\n outlineIcons?: Partial<Record<number, React.ComponentType>>;\n}\n\n/** Props for the {@link PdfViewer} component. */\nexport interface PdfViewerProps {\n /** PDF source — URL string or ArrayBuffer */\n src: string | ArrayBuffer;\n /** Annotations to overlay on the PDF */\n annotations?: PdfAnnotation[];\n /**\n * Callback fired when an annotation is clicked.\n *\n * @param annotation - The annotation that was clicked\n * @returns void\n */\n onAnnotationClick?: (annotation: PdfAnnotation) => void;\n /**\n * Callback fired when a download completes or fails.\n *\n * @param result - The download result indicating success with the filename, or failure with an error\n * @returns void\n */\n onDownload?: (result: PdfDownloadResult) => void;\n /**\n * Whether the highlight toggle button is shown in the toolbar.\n * @default false\n */\n enableHighlight?: boolean;\n /**\n * Callback fired when the user creates a text highlight.\n * Only fires when highlight mode is active.\n *\n * @param event - The highlight event with page, rects, text, and color\n * @returns void\n */\n onTextHighlight?: (event: PdfTextHighlightEvent) => void;\n /**\n * Callback fired when the user deletes a highlight via the PDF.js editor UI.\n *\n * @param event - The highlight event that was deleted\n * @returns void\n */\n onHighlightDelete?: (event: PdfTextHighlightEvent) => void;\n /** Initial page number (1-indexed, default 1) */\n initialPage?: number;\n /** Initial zoom scale (default 1.0) */\n initialScale?: number;\n /** Whether the sidebar is initially open (default false) */\n initialSidebarOpen?: boolean;\n /**\n * Whether the download button is shown in the toolbar.\n * @default false\n */\n enableDownload?: boolean;\n /**\n * Which sidebar panel to show: thumbnails or document outline.\n * @default \"thumbnails\"\n */\n sidebarMode?: SidebarMode;\n /**\n * Custom icon components for each outline depth level (0-indexed).\n * Key 0 = top-level items, 1 = first nesting level, etc.\n * If omitted, no icons are rendered.\n */\n outlineIcons?: Partial<Record<number, React.ComponentType>>;\n /**\n * Initial form field values keyed by field name. Applied when the document loads.\n * Use this to pre-populate form fields when resuming a previously edited PDF.\n */\n formData?: Record<string, PdfFormFieldValue>;\n /**\n * Callback fired when the user clicks the save button in the toolbar.\n * Receives all current form field values keyed by field name.\n *\n * @param data - All form field values keyed by field name\n * @returns void\n */\n onFormSubmit?: (data: Record<string, PdfFormFieldValue>) => void;\n /**\n * Callback fired when any form field value changes.\n *\n * @param fieldName - The name of the field that changed\n * @param value - The new value\n * @returns void\n */\n onFormChange?: (fieldName: string, value: PdfFormFieldValue) => void;\n /** Additional CSS class name for the root element */\n className?: string;\n}\n"],"mappings":"","ignoreList":[]}
@@ -45,6 +45,8 @@ export { usePdfOutline } from "../pdf-viewer/hooks/usePdfOutline.js";
45
45
  export { usePdfViewer } from "../pdf-viewer/hooks/usePdfViewer.js";
46
46
  export { usePdfViewerSearch } from "../pdf-viewer/hooks/usePdfViewerSearch.js";
47
47
  export { usePdfViewerSync } from "../pdf-viewer/hooks/usePdfViewerSync.js";
48
+ // PdfViewer context
49
+ export { PdfViewerProvider, usePdfViewerContext, usePdfViewerInstance } from "../pdf-viewer/PdfViewerContext.js";
48
50
  // PdfViewer hooks — composition
49
51
  export { usePdfViewerCore } from "../pdf-viewer/hooks/usePdfViewerCore.js";
50
52
  export { usePdfViewerState } from "../pdf-viewer/hooks/usePdfViewerState.js";
@@ -1 +1 @@
1
- {"version":3,"file":"experimental.js","names":["BaseFilterList","FilterList","deserializeFilterStates","serializeFilterStates","ObjectTable","BaseTable","ColumnConfigDialog","BasePdfViewer","PdfViewerAnnotationLayer","PdfViewerContent","PdfViewerOutlineSidebar","PdfViewerSearchBar","PdfViewerSidebar","PdfViewerToolbar","usePdfAnnotationPortals","usePdfAnnotationsByPage","usePdfDocument","usePdfFormFields","usePdfHighlightMode","usePdfOutline","usePdfViewer","usePdfViewerSearch","usePdfViewerSync","usePdfViewerCore","usePdfViewerState","PdfViewer","ActionForm","BaseForm"],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { BaseFilterList } from \"../filter-list/base/BaseFilterList.js\";\nexport type {\n BaseFilterListProps,\n RenderFilterInput,\n} from \"../filter-list/base/BaseFilterListApi.js\";\nexport { FilterList } from \"../filter-list/FilterList.js\";\n\nexport type {\n FilterDefinitionUnion,\n FilterListProps,\n} from \"../filter-list/FilterListApi.js\";\nexport type {\n FilterComponentType,\n FilterListItemProps,\n FilterState,\n PropertyFilterDefinition,\n} from \"../filter-list/FilterListItemApi.js\";\nexport {\n deserializeFilterStates,\n serializeFilterStates,\n} from \"../filter-list/utils/filterStateSerialization.js\";\n\n// ObjectTable that loads and displays data for a given objectSet\nexport { ObjectTable } from \"../object-table/ObjectTable.js\";\nexport type {\n ColumnDefinition,\n ColumnDefinitionLocator,\n CustomColumnLocator,\n FunctionColumnLocator,\n ObjectTableProps,\n PropertyColumnLocator,\n RdpColumnLocator,\n} from \"../object-table/ObjectTableApi.js\";\nexport type { CellEditInfo } from \"../object-table/utils/types.js\";\n\n// BaseTable that does not handle data fetching\nexport type { BaseTableProps } from \"../object-table/Table.js\";\nexport { BaseTable } from \"../object-table/Table.js\";\n\nexport { ColumnConfigDialog } from \"../object-table/ColumnConfigDialog.js\";\nexport type {\n ColumnConfigDialogProps,\n ColumnConfigOptions,\n} from \"../object-table/ColumnConfigDialog.js\";\n\n// PdfViewer\nexport { BasePdfViewer } from \"../pdf-viewer/PdfViewer.js\";\nexport type {\n AnnotationType,\n PdfAnnotation,\n PdfAnnotationRenderProps,\n PdfCustomAnnotation,\n PdfDownloadResult,\n PdfFormFieldValue,\n PdfRect,\n PdfTextHighlightEvent,\n PdfViewerProps,\n SidebarMode,\n} from \"../pdf-viewer/types.js\";\n\n// PdfViewer building blocks\nexport {\n PdfViewerAnnotationLayer,\n type PdfViewerAnnotationLayerProps,\n} from \"../pdf-viewer/components/PdfViewerAnnotationLayer.js\";\nexport {\n PdfViewerContent,\n type PdfViewerContentProps,\n} from \"../pdf-viewer/components/PdfViewerContent.js\";\nexport {\n PdfViewerOutlineSidebar,\n type PdfViewerOutlineSidebarProps,\n} from \"../pdf-viewer/components/PdfViewerOutlineSidebar.js\";\nexport {\n PdfViewerSearchBar,\n type PdfViewerSearchBarProps,\n} from \"../pdf-viewer/components/PdfViewerSearchBar.js\";\nexport {\n PdfViewerSidebar,\n type PdfViewerSidebarProps,\n} from \"../pdf-viewer/components/PdfViewerSidebar.js\";\nexport {\n PdfViewerToolbar,\n type PdfViewerToolbarProps,\n} from \"../pdf-viewer/components/PdfViewerToolbar.js\";\n\n// PdfViewer hooks — primitive\nexport {\n type AnnotationPortalTarget,\n usePdfAnnotationPortals,\n} from \"../pdf-viewer/hooks/usePdfAnnotationPortals.js\";\nexport { usePdfAnnotationsByPage } from \"../pdf-viewer/hooks/usePdfAnnotationsByPage.js\";\nexport { usePdfDocument } from \"../pdf-viewer/hooks/usePdfDocument.js\";\nexport {\n usePdfFormFields,\n type UsePdfFormFieldsOptions,\n type UsePdfFormFieldsResult,\n} from \"../pdf-viewer/hooks/usePdfFormFields.js\";\nexport {\n usePdfHighlightMode,\n type UsePdfHighlightModeOptions,\n type UsePdfHighlightModeResult,\n} from \"../pdf-viewer/hooks/usePdfHighlightMode.js\";\nexport { usePdfOutline } from \"../pdf-viewer/hooks/usePdfOutline.js\";\nexport {\n usePdfViewer,\n type UsePdfViewerResult,\n} from \"../pdf-viewer/hooks/usePdfViewer.js\";\nexport {\n usePdfViewerSearch,\n type UsePdfViewerSearchResult,\n} from \"../pdf-viewer/hooks/usePdfViewerSearch.js\";\nexport { usePdfViewerSync } from \"../pdf-viewer/hooks/usePdfViewerSync.js\";\nexport { type OutlineItem } from \"../pdf-viewer/types.js\";\n\n// PdfViewer hooks — composition\nexport {\n usePdfViewerCore,\n type UsePdfViewerCoreOptions,\n type UsePdfViewerCoreResult,\n} from \"../pdf-viewer/hooks/usePdfViewerCore.js\";\nexport {\n usePdfViewerState,\n type UsePdfViewerStateOptions,\n type UsePdfViewerStateResult,\n} from \"../pdf-viewer/hooks/usePdfViewerState.js\";\n\n// PdfViewer (Media wrapper)\nexport {\n PdfViewer,\n type PdfViewerMediaProps,\n} from \"../pdf-viewer/PdfRenderer.js\";\n\nexport { ActionForm } from \"../action-form/ActionForm.js\";\nexport type {\n ActionFormProps,\n BaseFormProps,\n FormError,\n FormState,\n} from \"../action-form/ActionFormApi.js\";\nexport { BaseForm } from \"../action-form/BaseForm.js\";\nexport type {\n ActionParameters,\n BaseFormFieldProps,\n CustomFieldProps,\n DatetimePickerFieldProps,\n DropdownFieldProps,\n FieldComponent,\n FieldValueType,\n FilePickerProps,\n FormFieldDefinition,\n FormFieldPropsByType,\n NumberInputFieldProps,\n ObjectSetFieldProps,\n Option,\n RadioButtonsFieldProps,\n RendererFieldDefinition,\n TextAreaFieldProps,\n TextInputFieldProps,\n} from \"../action-form/FormFieldApi.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,uCAAuC;AAKtE,SAASC,UAAU,QAAQ,8BAA8B;AAYzD,SACEC,uBAAuB,EACvBC,qBAAqB,QAChB,kDAAkD;;AAEzD;AACA,SAASC,WAAW,QAAQ,gCAAgC;;AAY5D;;AAEA,SAASC,SAAS,QAAQ,0BAA0B;AAEpD,SAASC,kBAAkB,QAAQ,uCAAuC;AAM1E;AACA,SAASC,aAAa,QAAQ,4BAA4B;AAc1D;AACA,SACEC,wBAAwB,QAEnB,sDAAsD;AAC7D,SACEC,gBAAgB,QAEX,8CAA8C;AACrD,SACEC,uBAAuB,QAElB,qDAAqD;AAC5D,SACEC,kBAAkB,QAEb,gDAAgD;AACvD,SACEC,gBAAgB,QAEX,8CAA8C;AACrD,SACEC,gBAAgB,QAEX,8CAA8C;;AAErD;AACA,SAEEC,uBAAuB,QAClB,gDAAgD;AACvD,SAASC,uBAAuB,QAAQ,gDAAgD;AACxF,SAASC,cAAc,QAAQ,uCAAuC;AACtE,SACEC,gBAAgB,QAGX,yCAAyC;AAChD,SACEC,mBAAmB,QAGd,4CAA4C;AACnD,SAASC,aAAa,QAAQ,sCAAsC;AACpE,SACEC,YAAY,QAEP,qCAAqC;AAC5C,SACEC,kBAAkB,QAEb,2CAA2C;AAClD,SAASC,gBAAgB,QAAQ,yCAAyC;AAG1E;AACA,SACEC,gBAAgB,QAGX,yCAAyC;AAChD,SACEC,iBAAiB,QAGZ,0CAA0C;;AAEjD;AACA,SACEC,SAAS,QAEJ,8BAA8B;AAErC,SAASC,UAAU,QAAQ,8BAA8B;AAOzD,SAASC,QAAQ,QAAQ,4BAA4B","ignoreList":[]}
1
+ {"version":3,"file":"experimental.js","names":["BaseFilterList","FilterList","deserializeFilterStates","serializeFilterStates","ObjectTable","BaseTable","ColumnConfigDialog","BasePdfViewer","PdfViewerAnnotationLayer","PdfViewerContent","PdfViewerOutlineSidebar","PdfViewerSearchBar","PdfViewerSidebar","PdfViewerToolbar","usePdfAnnotationPortals","usePdfAnnotationsByPage","usePdfDocument","usePdfFormFields","usePdfHighlightMode","usePdfOutline","usePdfViewer","usePdfViewerSearch","usePdfViewerSync","PdfViewerProvider","usePdfViewerContext","usePdfViewerInstance","usePdfViewerCore","usePdfViewerState","PdfViewer","ActionForm","BaseForm"],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { BaseFilterList } from \"../filter-list/base/BaseFilterList.js\";\nexport type {\n BaseFilterListProps,\n RenderFilterInput,\n} from \"../filter-list/base/BaseFilterListApi.js\";\nexport { FilterList } from \"../filter-list/FilterList.js\";\n\nexport type {\n FilterDefinitionUnion,\n FilterListProps,\n} from \"../filter-list/FilterListApi.js\";\nexport type {\n FilterComponentType,\n FilterListItemProps,\n FilterState,\n PropertyFilterDefinition,\n} from \"../filter-list/FilterListItemApi.js\";\nexport {\n deserializeFilterStates,\n serializeFilterStates,\n} from \"../filter-list/utils/filterStateSerialization.js\";\n\n// ObjectTable that loads and displays data for a given objectSet\nexport { ObjectTable } from \"../object-table/ObjectTable.js\";\nexport type {\n ColumnDefinition,\n ColumnDefinitionLocator,\n CustomColumnLocator,\n FunctionColumnLocator,\n ObjectTableProps,\n PropertyColumnLocator,\n RdpColumnLocator,\n} from \"../object-table/ObjectTableApi.js\";\nexport type { CellEditInfo } from \"../object-table/utils/types.js\";\n\n// BaseTable that does not handle data fetching\nexport type { BaseTableProps } from \"../object-table/Table.js\";\nexport { BaseTable } from \"../object-table/Table.js\";\n\nexport { ColumnConfigDialog } from \"../object-table/ColumnConfigDialog.js\";\nexport type {\n ColumnConfigDialogProps,\n ColumnConfigOptions,\n} from \"../object-table/ColumnConfigDialog.js\";\n\n// PdfViewer\nexport { BasePdfViewer } from \"../pdf-viewer/PdfViewer.js\";\nexport type {\n AnnotationType,\n PdfAnnotation,\n PdfAnnotationRenderProps,\n PdfCustomAnnotation,\n PdfDownloadResult,\n PdfFormFieldValue,\n PdfRect,\n PdfTextHighlightEvent,\n PdfViewerProps,\n SidebarMode,\n} from \"../pdf-viewer/types.js\";\n\n// PdfViewer building blocks\nexport {\n PdfViewerAnnotationLayer,\n type PdfViewerAnnotationLayerProps,\n} from \"../pdf-viewer/components/PdfViewerAnnotationLayer.js\";\nexport {\n PdfViewerContent,\n type PdfViewerContentProps,\n} from \"../pdf-viewer/components/PdfViewerContent.js\";\nexport {\n PdfViewerOutlineSidebar,\n type PdfViewerOutlineSidebarProps,\n} from \"../pdf-viewer/components/PdfViewerOutlineSidebar.js\";\nexport {\n PdfViewerSearchBar,\n type PdfViewerSearchBarProps,\n} from \"../pdf-viewer/components/PdfViewerSearchBar.js\";\nexport {\n PdfViewerSidebar,\n type PdfViewerSidebarProps,\n} from \"../pdf-viewer/components/PdfViewerSidebar.js\";\nexport {\n PdfViewerToolbar,\n type PdfViewerToolbarProps,\n} from \"../pdf-viewer/components/PdfViewerToolbar.js\";\n\n// PdfViewer hooks — primitive\nexport {\n type AnnotationPortalTarget,\n usePdfAnnotationPortals,\n} from \"../pdf-viewer/hooks/usePdfAnnotationPortals.js\";\nexport { usePdfAnnotationsByPage } from \"../pdf-viewer/hooks/usePdfAnnotationsByPage.js\";\nexport { usePdfDocument } from \"../pdf-viewer/hooks/usePdfDocument.js\";\nexport {\n usePdfFormFields,\n type UsePdfFormFieldsOptions,\n type UsePdfFormFieldsResult,\n} from \"../pdf-viewer/hooks/usePdfFormFields.js\";\nexport {\n usePdfHighlightMode,\n type UsePdfHighlightModeOptions,\n type UsePdfHighlightModeResult,\n} from \"../pdf-viewer/hooks/usePdfHighlightMode.js\";\nexport { usePdfOutline } from \"../pdf-viewer/hooks/usePdfOutline.js\";\nexport {\n usePdfViewer,\n type UsePdfViewerResult,\n} from \"../pdf-viewer/hooks/usePdfViewer.js\";\nexport {\n usePdfViewerSearch,\n type UsePdfViewerSearchResult,\n} from \"../pdf-viewer/hooks/usePdfViewerSearch.js\";\nexport { usePdfViewerSync } from \"../pdf-viewer/hooks/usePdfViewerSync.js\";\nexport { type OutlineItem } from \"../pdf-viewer/types.js\";\n\n// PdfViewer context\nexport {\n type PdfViewerContextValue,\n PdfViewerProvider,\n usePdfViewerContext,\n usePdfViewerInstance,\n} from \"../pdf-viewer/PdfViewerContext.js\";\nexport type {\n PdfViewerHandle,\n PdfViewerInstanceOptions,\n} from \"../pdf-viewer/types.js\";\n\n// PdfViewer hooks — composition\nexport {\n usePdfViewerCore,\n type UsePdfViewerCoreOptions,\n type UsePdfViewerCoreResult,\n} from \"../pdf-viewer/hooks/usePdfViewerCore.js\";\nexport {\n usePdfViewerState,\n type UsePdfViewerStateOptions,\n type UsePdfViewerStateResult,\n} from \"../pdf-viewer/hooks/usePdfViewerState.js\";\n\n// PdfViewer (Media wrapper)\nexport {\n PdfViewer,\n type PdfViewerMediaProps,\n} from \"../pdf-viewer/PdfRenderer.js\";\n\nexport { ActionForm } from \"../action-form/ActionForm.js\";\nexport type {\n ActionFormProps,\n BaseFormProps,\n FormError,\n FormState,\n} from \"../action-form/ActionFormApi.js\";\nexport { BaseForm } from \"../action-form/BaseForm.js\";\nexport type {\n ActionParameters,\n BaseFormFieldProps,\n CustomFieldProps,\n DatetimePickerFieldProps,\n DropdownFieldProps,\n FieldComponent,\n FieldValueType,\n FilePickerProps,\n FormFieldDefinition,\n FormFieldPropsByType,\n NumberInputFieldProps,\n ObjectSetFieldProps,\n Option,\n RadioButtonsFieldProps,\n RendererFieldDefinition,\n TextAreaFieldProps,\n TextInputFieldProps,\n} from \"../action-form/FormFieldApi.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,uCAAuC;AAKtE,SAASC,UAAU,QAAQ,8BAA8B;AAYzD,SACEC,uBAAuB,EACvBC,qBAAqB,QAChB,kDAAkD;;AAEzD;AACA,SAASC,WAAW,QAAQ,gCAAgC;;AAY5D;;AAEA,SAASC,SAAS,QAAQ,0BAA0B;AAEpD,SAASC,kBAAkB,QAAQ,uCAAuC;AAM1E;AACA,SAASC,aAAa,QAAQ,4BAA4B;AAc1D;AACA,SACEC,wBAAwB,QAEnB,sDAAsD;AAC7D,SACEC,gBAAgB,QAEX,8CAA8C;AACrD,SACEC,uBAAuB,QAElB,qDAAqD;AAC5D,SACEC,kBAAkB,QAEb,gDAAgD;AACvD,SACEC,gBAAgB,QAEX,8CAA8C;AACrD,SACEC,gBAAgB,QAEX,8CAA8C;;AAErD;AACA,SAEEC,uBAAuB,QAClB,gDAAgD;AACvD,SAASC,uBAAuB,QAAQ,gDAAgD;AACxF,SAASC,cAAc,QAAQ,uCAAuC;AACtE,SACEC,gBAAgB,QAGX,yCAAyC;AAChD,SACEC,mBAAmB,QAGd,4CAA4C;AACnD,SAASC,aAAa,QAAQ,sCAAsC;AACpE,SACEC,YAAY,QAEP,qCAAqC;AAC5C,SACEC,kBAAkB,QAEb,2CAA2C;AAClD,SAASC,gBAAgB,QAAQ,yCAAyC;AAG1E;AACA,SAEEC,iBAAiB,EACjBC,mBAAmB,EACnBC,oBAAoB,QACf,mCAAmC;AAM1C;AACA,SACEC,gBAAgB,QAGX,yCAAyC;AAChD,SACEC,iBAAiB,QAGZ,0CAA0C;;AAEjD;AACA,SACEC,SAAS,QAEJ,8BAA8B;AAErC,SAASC,UAAU,QAAQ,8BAA8B;AAOzD,SAASC,QAAQ,QAAQ,4BAA4B","ignoreList":[]}
@@ -63,9 +63,9 @@ export interface FormFieldDefinition<
63
63
  validate?: (value: FieldValueType<Q, K>) => Promise<boolean>;
64
64
  /**
65
65
  * The component props for the form field
66
- * Excludes runtime props (key, onChange) which are managed by ActionForm
66
+ * Excludes runtime props (value, onChange) which are managed by ActionForm
67
67
  */
68
- fieldComponentProps?: Omit<FormFieldPropsByType[ValidFormFieldForPropertyType<FieldDescriptorType<Q, K>>], "key" | "onChange">;
68
+ fieldComponentProps: Omit<FormFieldPropsByType[ValidFormFieldForPropertyType<FieldDescriptorType<Q, K>>], "value" | "onChange">;
69
69
  }
70
70
  type ValidationError = {
71
71
  type: ValidationRule
@@ -303,7 +303,7 @@ export type RendererFieldDefinition = { [K in FieldComponent] : {
303
303
  placeholder?: string
304
304
  helperText?: string
305
305
  helperTextPlacement?: "bottom" | "tooltip"
306
- fieldComponentProps?: Omit<FormFieldPropsByType[K], "value" | "onChange">
306
+ fieldComponentProps: Omit<FormFieldPropsByType[K], "value" | "onChange">
307
307
  } }[FieldComponent];
308
308
  /**
309
309
  * Gets valid form field types for a given property type
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cACE,kBACA,gBACA,aACA,qBACA,uBACA,WACA,4BACK,WAAY;AACnB,YAAY,WAAW,OAAQ;;;;AAK/B,iBAAiB;CACf,UAAU;CACV,UAAU,SAAS,KAAK,SAAS;EACjC;;;;CAIA,UAAU;;;;;CAMV;;;;CAKA,eAAe,eAAe,GAAG;;;;CAKjC,gBAAgB,8BAA8B,oBAAoB,GAAG;;;;CAKrE;;;;CAKA;;;;;CAMA;;;;;;CAOA,sBAAsB,WAAW;;;;CAKjC;;;;;;;CAQA,qBAAqBA,OAAO;;;;;;;CAQ5B,YAAYC,OAAO,eAAe,GAAG,OAAO;;;;;CAM5C,sBAAsB,KACpB,qBACE,8BACE,oBAAoB,GAAG,MAG3B,QAAQ;AAEX;KAEI,kBAAkB;CAAE,MAAM;CAAgB;AAAe;KAEzD,iBACD,aACA,QACA,QACA,cACA,cACA,YACA;;;;AAKJ,iBAAiB,qBAAqB;CACpC,iBAAiB;CACjB,UAAU;CACV,aAAa;CACb,cAAc;CACd,YAAY,oBAAoB;CAChC,eAAe;CACf,WAAW;CACX,YAAY;CACZ,QAAQ;AACT;;;;;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iB;IAC3D,iBAAiB,GAAG,GAAG,gBACzB,eAAe,SAAS,aAAa,KAAK,YAAY,WAAW,KAC/D,iBAAiB,GAAG,GAAG,gBAAgB,eAAe,SAAS,gBACzD,KACJ,YAAY,cAAc,KAC5B,iBAAiB,GAAG,GAAG,gBAAgB,eAAe,SAAS,aACzD,KACJ,YAAY,WAAW,KACzB,iBAAiB,GAAG,GAAG,sBAAsB,wBAC3C,sBAAsB,iBAAiB,GAAG,GAAG;;;;AAMnD,YAAY;CACV,UAAU,4BAA4B;CACtC,gBAAgB,iBAAiB,WAAW,iBAAiB;IAC3D,iBAAiB,GAAG,GAAG;;;;AAK3B,YAAY,iBACR,oBACA,aACA,gBACA,iBACA,kBACA,eACA,cACA,eACA;;;;;AAMJ,YAAY,YACR,YACA,WACA,YACA,SACA,WACA,aACA,cACA,eACA,YACA,mBACA,eACA,aACA,YACA;CAAE,MAAM;CAAU;AAAgB,IAClC;CAAE,MAAM;CAAa;AAAmB,IACxC;CAAE,MAAM;CAAa;AAAmB,IACxC;CAAE,MAAM;CAAU,QAAQ;AAAwB;;;;;;;;;AAUtD,YAAY,6BACT,KAAK,kBAAiB;CACrB;CACA,gBAAgB;CAChB,YAAY;CACZ;CACA;CACA;CACA;CACA;CACA,sBAAsB,WAAW;CACjC,sBAAsB,KAAK,qBAAqB,IAAI,UAAU;AAC/D,IACD;;;;AAKF,YAAY,8BAA8B,UAAU,uBAClD,UAAU,cAAc,eACpB,UAAU,WAAW,aACrB,UAAU,mBAAmB,eAAe,gBAC5C,UAAU,YAAY,kBAAkB,aACxC,UAAU,WAAW,eAAe,cACpC,UAAU,aAAa,cAAc,oBACrC,UACE,WACA,YACA,SACA,UACA,UACA,SACA,YAAY","names":["error: ValidationError","value: FieldValueType<Q, K>","date: Date","item: V","a: V","b: V","props: BaseFormFieldProps<V>","value: V | null"],"sources":["../../../src/action-form/FormFieldApi.ts"],"version":3,"file":"FormFieldApi.d.ts"}
1
+ {"mappings":"AAgBA,cACE,kBACA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AM;CAAU;AAAgB,IAClC;CAAE,MAAM;CAAa;AAAmB,IACxC;CAAE,MAAM;CAAa;AAAmB,IACxC;CAAE,MAAM;CAAU,QAAQ;AAAwB;;;;;;;;;AAUtD,YAAY,6BACT,KAAK,kBAAiB;CACrB;CACA,gBAAgB;CAChB,YAAY;CACZ;CACA;CACA;CACA;CACA;CACA,sBAAsB,WAAW;CACjC,qBAAqB,KAAK,qBAAqB,IAAI,UAAU;AAC9D,IACD;;;;AAKF,YAAY,8BAA8B,UAAU,uBAClD,UAAU,cAAc,eACpB,UAAU,WAAW,aACrB,UAAU,mBAAmB,eAAe,gBAC5C,UAAU,YAAY,kBAAkB,aACxC,UAAU,WAAW,eAAe,cACpC,UAAU,aAAa,cAAc,oBACrC,UACE,WACA,YACA,SACA,UACA,UACA,SACA,YAAY","names":["error: ValidationError","value: FieldValueType<Q, K>","date: Date","item: V","a: V","b: V","props: BaseFormFieldProps<V>","value: V | null"],"sources":["../../../src/action-form/FormFieldApi.ts"],"version":3,"file":"FormFieldApi.d.ts"}
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import type { CustomFieldProps } from "../FormFieldApi.js";
3
+ /**
4
+ * Renders a user-provided custom field. Delegates all rendering to the
5
+ * `customRenderer` callback, passing through the standard form field props
6
+ * (value, onChange, id) so the custom implementation can participate in
7
+ * form state management.
8
+ */
9
+ export declare const CustomField: React.FC<CustomFieldProps<unknown>>;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,OAAO,WAAqB,OAAQ;AACpC,cAAc,wBAAwB,oBAAqB;;;;;;;AAQ3D,OAAO,cAAMA,aAAa,MAAM,GAAG","names":["CustomField: React.FC<CustomFieldProps<unknown>>"],"sources":["../../../../src/action-form/fields/CustomField.tsx"],"version":3,"file":"CustomField.d.ts"}
@@ -1 +1 @@
1
- {"mappings":"AAgBA,OAAO,WAAqB,OAAQ;AAEpC,cAAsB,+BAA+B,oBAAqB;AAU1E,iBAAiB,uBAAuB;CACtC,iBAAiB;CACjB;CACA,qBAAqBA;AACtB;AAED,OAAO,cAAMC,mBAAmB,MAAM,GAAG","names":["value: unknown","FormFieldRenderer: React.FC<FormFieldRendererProps>"],"sources":["../../../../src/action-form/fields/FormFieldRenderer.tsx"],"version":3,"file":"FormFieldRenderer.d.ts"}
1
+ {"mappings":"AAgBA,OAAO,WAAqB,OAAQ;AAEpC,cAAc,+BAA+B,oBAAqB;AAQlE,iBAAiB,uBAAuB;CACtC,iBAAiB;CACjB;CACA,qBAAqBA;AACtB;AAED,OAAO,cAAMC,mBAAmB,MAAM,GAAG","names":["value: unknown","FormFieldRenderer: React.FC<FormFieldRendererProps>"],"sources":["../../../../src/action-form/fields/FormFieldRenderer.tsx"],"version":3,"file":"FormFieldRenderer.d.ts"}
@@ -1,3 +1,3 @@
1
- import { type ReactElement } from "react";
1
+ import React from "react";
2
2
  import type { RadioButtonsFieldProps } from "../FormFieldApi.js";
3
- export declare const RadioButtonsField: <V>(props: RadioButtonsFieldProps<V>) => ReactElement;
3
+ export declare const RadioButtonsField: <V>(props: RadioButtonsFieldProps<V>) => React.ReactElement;
@@ -1 +1 @@
1
- {"mappings":"AAkBA,cAAoB,oBAA0C,OAAQ;AAEtE,cAAsB,8BAA8B,oBAAqB;AAGzE,OAAO,cAAMA,oBAAoB,GAC/BC,OAAO,uBAAuB,OAC3B","names":["RadioButtonsField: <V>(\n props: RadioButtonsFieldProps<V>,\n) => ReactElement","props: RadioButtonsFieldProps<V>"],"sources":["../../../../src/action-form/fields/RadioButtonsField.tsx"],"version":3,"file":"RadioButtonsField.d.ts"}
1
+ {"mappings":"AAkBA,OAAO,WAA2C,OAAQ;AAE1D,cAAsB,8BAA8B,oBAAqB;AAGzE,OAAO,cAAMA,oBAAoB,GAC/BC,OAAO,uBAAuB,OAC3B,MAAM","names":["RadioButtonsField: <V>(\n props: RadioButtonsFieldProps<V>,\n) => React.ReactElement","props: RadioButtonsFieldProps<V>"],"sources":["../../../../src/action-form/fields/RadioButtonsField.tsx"],"version":3,"file":"RadioButtonsField.d.ts"}
@@ -1,6 +1,9 @@
1
- import type { ActionDefinition, ActionMetadata } from "@osdk/api";
2
- import type { FormFieldDefinition } from "../FormFieldApi.js";
1
+ import type { ActionMetadata } from "@osdk/api";
2
+ import type { RendererFieldDefinition } from "../FormFieldApi.js";
3
3
  /**
4
- * Derives default field definitions from fetched ActionMetadata.
4
+ * Derives default field definitions from ActionMetadata.
5
+ *
6
+ * Each parameter type maps to a concrete RendererFieldDefinition with the
7
+ * correct fieldComponent and default fieldComponentProps.
5
8
  */
6
- export declare function getDefaultFieldDefinitions<Q extends ActionDefinition<unknown>>(metadata: ActionMetadata): ReadonlyArray<FormFieldDefinition<Q>>;
9
+ export declare function getDefaultFieldDefinitions(metadata: ActionMetadata): ReadonlyArray<RendererFieldDefinition>;
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cAAc,kBAAkB,sBAAsB,WAAY;AAClE,cAIE,2BAEK,oBAAqB;;;;AAM5B,OAAO,iBAAS,2BACd,UAAU,2BACVA,UAAU,iBAAiB,cAAc,oBAAoB","names":["metadata: ActionMetadata"],"sources":["../../../../src/action-form/utils/getDefaultFieldDefinitions.ts"],"version":3,"file":"getDefaultFieldDefinitions.d.ts"}
1
+ {"mappings":"AAgBA,cAAc,sBAAsB,WAAY;AAEhD,cAAc,+BAA+B,oBAAqB;;;;;;;AAQlE,OAAO,iBAAS,2BACdA,UAAU,iBACT,cAAc","names":["metadata: ActionMetadata"],"sources":["../../../../src/action-form/utils/getDefaultFieldDefinitions.ts"],"version":3,"file":"getDefaultFieldDefinitions.d.ts"}
@@ -1,10 +1,11 @@
1
1
  import React from "react";
2
2
  export interface DialogProps {
3
3
  isOpen: boolean;
4
- onOpenChange: () => void;
4
+ onOpenChange: (open: boolean) => void;
5
5
  title: React.ReactNode;
6
6
  children: React.ReactNode;
7
7
  footer?: React.ReactNode;
8
8
  className?: string;
9
+ disablePointerDismissal?: boolean;
9
10
  }
10
- export declare function Dialog({ isOpen, onOpenChange, title, children, footer, className }: DialogProps): React.ReactElement;
11
+ export declare function Dialog({ isOpen, onOpenChange, title, children, footer, className, disablePointerDismissal }: DialogProps): React.ReactElement;
@@ -1 +1 @@
1
- {"mappings":"AAmBA,OAAO,WAAW,OAAQ;AAG1B,iBAAiB,YAAY;CAC3B;CACA;CACA,OAAO,MAAM;CACb,UAAU,MAAM;CAChB,SAAS,MAAM;CACf;AACD;AAED,OAAO,iBAAS,OAAO,EACrB,QACA,cACA,OACA,UACA,QACA,WACY,EAAX,cAAc,MAAM","names":[],"sources":["../../../../src/base-components/dialog/Dialog.tsx"],"version":3,"file":"Dialog.d.ts"}
1
+ {"mappings":"AAmBA,OAAO,WAAW,OAAQ;AAG1B,iBAAiB,YAAY;CAC3B;CACA,eAAeA;CACf,OAAO,MAAM;CACb,UAAU,MAAM;CAChB,SAAS,MAAM;CACf;CACA;AACD;AAED,OAAO,iBAAS,OAAO,EACrB,QACA,cACA,OACA,UACA,QACA,WACA,yBACY,EAAX,cAAc,MAAM","names":["open: boolean"],"sources":["../../../../src/base-components/dialog/Dialog.tsx"],"version":3,"file":"Dialog.d.ts"}
@@ -1,4 +1,5 @@
1
- import type { DerivedProperty, ObjectOrInterfaceDefinition, ObjectSet, Osdk, PrimaryKeyType, PropertyKeys, QueryDefinition, QueryMetadata, SimplePropertyDef, WhereClause } from "@osdk/api";
1
+ import type { CompileTimeMetadata, DerivedProperty, ObjectOrInterfaceDefinition, ObjectSet, Osdk, PrimaryKeyType, PropertyKeys, QueryDefinition, SimplePropertyDef, WhereClause } from "@osdk/api";
2
+ import type { QueryParameterType } from "@osdk/client/unstable-do-not-use";
2
3
  import type * as React from "react";
3
4
  import type { CellEditInfo } from "./utils/types.js";
4
5
  export type ColumnDefinition<
@@ -46,7 +47,7 @@ export type ColumnDefinition<
46
47
  */
47
48
  renderHeader?: () => React.ReactNode
48
49
  };
49
- export type ExtractQueryParameters<TQueryDef extends QueryDefinition> = TQueryDef["__DefinitionMetadata"] extends QueryMetadata ? TQueryDef["__DefinitionMetadata"]["parameters"] : never;
50
+ export type ExtractQueryParameters<Q extends QueryDefinition> = CompileTimeMetadata<Q>["parameters"] extends Record<string, never> ? undefined : QueryParameterType<CompileTimeMetadata<Q>["parameters"]>;
50
51
  export interface PropertyColumnLocator<Q extends ObjectOrInterfaceDefinition> {
51
52
  type: "property";
52
53
  id: PropertyKeys<Q>;
@@ -68,7 +69,7 @@ export interface FunctionColumnLocator<
68
69
  * @param objectSet - The current object set.
69
70
  * @returns - The function's input parameters including the object set.
70
71
  */
71
- getFunctionParams: (objectSet: ObjectSet<Q>) => ExtractQueryParameters<FunctionColumns[keyof FunctionColumns]>;
72
+ getFunctionParams: (objectSet: ObjectSet<Q, RDPs>) => ExtractQueryParameters<FunctionColumns[keyof FunctionColumns]>;
72
73
  /**
73
74
  * Function to generate keys for looking up results in the FunctionsMap.
74
75
  * @param object - The object instance
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cACE,iBACA,6BACA,WACA,MACA,gBACA,cACA,iBACA,eACA,mBACA,mBACK,WAAY;AACnB,iBAAiB,WAAW,OAAQ;AACpC,cAAc,oBAAoB,kBAAmB;AAErD,YAAY;CACV,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;IAI5D;CACF,SAAS,wBAAwB,GAAG,MAAM;;;;CAK1C;;;;CAKA,SAAS,SAAS,UAAU;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;CAQA,gBACEA,mBACG;CAEL,cACEC,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAChEC,SAAS,wBAAwB,GAAG,MAAM,qBACvC,MAAM;;;;;;;;;;CAWX;;;;;CAMA,qBAAqB,MAAM;AAC5B;AAED,YAAY,uBACV,kBAAkB,mBAChB,UAAU,gCAAgC,gBAC1C,UAAU,wBAAwB;AAGtC,iBAAiB,sBAAsB,UAAU,6BAA6B;CAC5E,MAAM;CACN,IAAI,aAAa;AACl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,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;;;;;CAY5D,iBAAiBC,OAAO,aACtB,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,sBAElD;;;;;;;;CASR,6BACEC,WAAW,MAAM;EACf,UAAU,aAAa,WAAW,aAAa;EAC/C;CACD;;;;;;;;CAUH,0BACEC,WAAW,MAAM;EACf,UAAU,aAAa,WAAW,aAAa;EAC/C,QAAQ,SAAS,UAAU;CAC5B;;;;;;;CASH,kBACEC,UAAU,aAAa,WAAW,aAAa,iBAC/CC;;;;;;CAQF,cACEX,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;;;;;;CAWlE,gBAAgB,WAAW,aAAa;;;;;CAMxC,eAAe,eAAe;;;;;CAM9B;;;;;;;;CASA,kBACEY,gBAAgB,eAAe,MAC/BC;;;;CAKF,yBACEC,KAAK,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAC7DC,uBACG,MAAM;;;;;;CAOX;CAEA;AACD;AAED,iBAAiB,iBACf,UAAU,6BACV;;;;CAIA,QAAQ,UAAU;;;;CAKlB,YAAY,UAAU;;;;CAKtB,WAAW,UAAU;AACtB","names":["value: unknown","object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>","objectSet: ObjectSet<Q>","cellData: unknown","newWhere: WhereClause<Q, RDPs>","newOrderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>","info: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >","edits: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >[]","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>","columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns","newWidth: number | null","selectedRowIds: PrimaryKeyType<Q>[]","isSelectAll?: boolean","row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","cellValue: unknown"],"sources":["../../../src/object-table/ObjectTableApi.ts"],"version":3,"file":"ObjectTableApi.d.ts"}
1
+ {"mappings":"AAgBA,cACE,qBACA,iBACA,6BACA,WACA,MACA,gBACA,cACA,iBACA,mBACA,mBACK,WAAY;AACnB,cAAc,0BAA0B,kCAAmC;AAC3E,iBAAiB,WAAW,OAAQ;AACpC,cAAc,oBAAoB,kBAAmB;AAErD,YAAY;CACV,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;IAI5D;CACF,SAAS,wBAAwB,GAAG,MAAM;;;;CAK1C;;;;CAKA,SAAS,SAAS,UAAU;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;CAQA,gBACEA,mBACG;CAEL,cACEC,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAChEC,SAAS,wBAAwB,GAAG,MAAM,qBACvC,MAAM;;;;;;;;;;CAWX;;;;;CAMA,qBAAqB,MAAM;AAC5B;AAED,YAAY,uBACV,UAAU,mBACR,oBAAoB,GAAG,sBAAsB,oCAE7C,mBAAmB,oBAAoB,GAAG;AAE9C,iBAAiB,sBAAsB,UAAU,6BAA6B;CAC5E,MAAM;CACN,IAAI,aAAa;AAClB;AAED,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;;;;;CAKA,MAAM;CACN,UAAU;CACV,iBAAiB,sBAAsB;;;;;;CAOvC,oBACEC,WAAW,UAAU,GAAG,UACrB,uBAAuB,sBAAsB;;;;;;CAOlD,SACEF,QAAQ,KAAK,SAAS,GAAG,sB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W,aAAa;EAC/C,QAAQ,SAAS,UAAU;CAC5B;;;;;;;CASH,kBACEC,UAAU,aAAa,WAAW,aAAa,iBAC/CC;;;;;;CAQF,cACEX,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;;;;;;CAWlE,gBAAgB,WAAW,aAAa;;;;;CAMxC,eAAe,eAAe;;;;;CAM9B;;;;;;;;CASA,kBACEY,gBAAgB,eAAe,MAC/BC;;;;CAKF,yBACEC,KAAK,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAC7DC,uBACG,MAAM;;;;;;CAOX;CAEA;AACD;AAED,iBAAiB,iBACf,UAAU,6BACV;;;;CAIA,QAAQ,UAAU;;;;CAKlB,YAAY,UAAU;;;;CAKtB,WAAW,UAAU;AACtB","names":["value: unknown","object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>","objectSet: ObjectSet<Q, RDPs>","cellData: unknown","newWhere: WhereClause<Q, RDPs>","newOrderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>","info: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >","edits: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >[]","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>","columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns","newWidth: number | null","selectedRowIds: PrimaryKeyType<Q>[]","isSelectAll?: boolean","row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","cellValue: unknown"],"sources":["../../../src/object-table/ObjectTableApi.ts"],"version":3,"file":"ObjectTableApi.d.ts"}
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cACE,6BACA,WACA,MACA,cACA,iBACA,yBACK,WAAY;AAGnB,cACE,wBAGK,sBAAuB;AAC9B,cACO,qBAEA,2BAA4B;AAEnC,iBAAiB,mBAAmB;qBACd;8BACU;CAC7B;AACF;AAqCD,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAK9DA,WAAW,UAAU,GAAG,mBACxBC,SACI,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,qBAE5DC,oBAAoB,MAAM,iBAAiB,GAAG,MAAM,oBACnD","names":["objectSet: ObjectSet<Q, RDPs> | undefined","objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined","columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>"],"sources":["../../../../src/object-table/hooks/useFunctionColumnsData.ts"],"version":3,"file":"useFunctionColumnsData.d.ts"}
1
+ {"mappings":"AAgBA,cACE,6BACA,WACA,MACA,cACA,iBACA,yBACK,WAAY;AAOnB,cACE,wBAEK,sBAAuB;AAC9B,cACO,qBAEA,2BAA4B;AAEnC,iBAAiB,mBAAmB;qBACd;8BACU;CAC7B;AACF;AAmBD,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAK9DA,WAAW,UAAU,GAAG,mBACxBC,SACI,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,qBAE5DC,oBAAoB,MAAM,iBAAiB,GAAG,MAAM,oBACnD","names":["objectSet: ObjectSet<Q, RDPs> | undefined","objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined","columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>"],"sources":["../../../../src/object-table/hooks/useFunctionColumnsData.ts"],"version":3,"file":"useFunctionColumnsData.d.ts"}
@@ -1,4 +1,4 @@
1
1
  import "pdfjs-dist/web/pdf_viewer.css";
2
2
  import React from "react";
3
- import type { PdfViewerProps } from "./types.js";
4
- export declare function BasePdfViewer({ src, annotations, onAnnotationClick, onDownload, enableHighlight, onTextHighlight, onHighlightDelete, formData, onFormSubmit, onFormChange, initialPage, initialScale, initialSidebarOpen, enableDownload, sidebarMode: sidebarModeProp, outlineIcons, className }: PdfViewerProps): React.ReactElement;
3
+ import type { PdfViewerHandle, PdfViewerProps } from "./types.js";
4
+ export declare const BasePdfViewer: React.ForwardRefExoticComponent<PdfViewerProps & React.RefAttributes<PdfViewerHandle>>;
@@ -1 +1 @@
1
- {"mappings":"AAkBA,OAAO,+BAAgC;AACvC,OAAO,WAAW,OAAQ;AAa1B,cAAc,sBAAsB,YAAa;AAEjD,OAAO,iBAAS,cAAc,EAC5B,KACA,aACA,mBACA,YACA,iBACA,iBACA,mBACA,UACA,cACA,cACA,aACA,cACA,oBACA,gBACA,aAAa,iBACb,cACA,WACe,EAAd,iBAAiB,MAAM","names":[],"sources":["../../../src/pdf-viewer/PdfViewer.tsx"],"version":3,"file":"PdfViewer.d.ts"}
1
+ {"mappings":"AAkBA,OAAO,+BAAgC;AACvC,OAAO,WAAgD,OAAQ;AAa/D,cAAc,iBAAiB,sBAAsB,YAAa;AAElE,OAAO,cAAMA,eAAe,MAAM,0BAChC,iBAAiB,MAAM,cAAc","names":["BasePdfViewer: React.ForwardRefExoticComponent<\n PdfViewerProps & React.RefAttributes<PdfViewerHandle>\n>"],"sources":["../../../src/pdf-viewer/PdfViewer.tsx"],"version":3,"file":"PdfViewer.d.ts"}
@@ -0,0 +1,64 @@
1
+ import type { PDFDocumentProxy } from "pdfjs-dist";
2
+ import type { EventBus, PDFFindController, PDFViewer } from "pdfjs-dist/web/pdf_viewer.mjs";
3
+ import React from "react";
4
+ import type { RefObject } from "react";
5
+ import type { AnnotationPortalTarget } from "./hooks/usePdfAnnotationPortals.js";
6
+ import type { UsePdfViewerSearchResult } from "./hooks/usePdfViewerSearch.js";
7
+ import type { OutlineItem, PdfAnnotation, PdfViewerInstanceOptions, SidebarMode } from "./types.js";
8
+ /** The shape of the value provided by {@link PdfViewerProvider}. */
9
+ export interface PdfViewerContextValue {
10
+ document: PDFDocumentProxy | undefined;
11
+ numPages: number;
12
+ loading: boolean;
13
+ error: Error | undefined;
14
+ containerRef: RefObject<HTMLDivElement>;
15
+ viewerRef: RefObject<HTMLDivElement>;
16
+ currentPage: number;
17
+ scrollToPage: (page: number) => void;
18
+ scale: number;
19
+ setScale: (scale: number) => void;
20
+ zoomIn: () => void;
21
+ zoomOut: () => void;
22
+ rotation: number;
23
+ rotateLeft: () => void;
24
+ rotateRight: () => void;
25
+ sidebarOpen: boolean;
26
+ sidebarMode: SidebarMode;
27
+ setSidebarMode: (mode: SidebarMode) => void;
28
+ toggleSidebar: () => void;
29
+ search: UsePdfViewerSearchResult;
30
+ outlineItems: OutlineItem[];
31
+ download: (filename?: string) => void;
32
+ portalTargets: AnnotationPortalTarget[];
33
+ highlightEnabled: boolean;
34
+ highlightModeActive: boolean;
35
+ toggleHighlightMode: () => void;
36
+ hasFormFields: boolean;
37
+ submitFormData: () => void;
38
+ annotations: PdfAnnotation[];
39
+ annotationsByPage: Record<number, PdfAnnotation[]>;
40
+ onAnnotationClick: ((annotation: PdfAnnotation) => void) | undefined;
41
+ enableDownload: boolean;
42
+ enableFormSave: boolean;
43
+ outlineIcons: Partial<Record<number, React.ComponentType>> | undefined;
44
+ pdfViewerRef: RefObject<PDFViewer | null>;
45
+ eventBusRef: RefObject<EventBus | null>;
46
+ findControllerRef: RefObject<PDFFindController | null>;
47
+ }
48
+ export interface PdfViewerProviderProps {
49
+ value: PdfViewerContextValue;
50
+ children: React.ReactNode;
51
+ }
52
+ /** Provides {@link PdfViewerContextValue} to descendant components. */
53
+ export declare function PdfViewerProvider({ value, children }: PdfViewerProviderProps): React.ReactElement;
54
+ /**
55
+ * Returns the nearest {@link PdfViewerContextValue} from a {@link PdfViewerProvider}.
56
+ * Throws if called outside a provider.
57
+ */
58
+ export declare function usePdfViewerContext(): PdfViewerContextValue;
59
+ /**
60
+ * Consumer-facing setup hook analogous to react-hook-form's `useForm()`.
61
+ * Accepts viewer options and returns a {@link PdfViewerContextValue} suitable
62
+ * for passing to {@link PdfViewerProvider}.
63
+ */
64
+ export declare function usePdfViewerInstance(options: PdfViewerInstanceOptions): PdfViewerContextValue;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,wBAAwB,YAAa;AACnD,cACE,UACA,mBACA,iBACK,+BAAgC;AACvC,OAAO,WAAmD,OAAQ;AAClE,cAAc,iBAAiB,OAAQ;AAEvC,cACE,8BACK,oCAAqC;AAI5C,cAAc,gCAAgC,+BAAgC;AAE9E,cACE,aACA,eACA,0BACA,mBACK,YAAa;;AAGpB,iBAAiB,sBAAsB;CAErC,UAAU;CACV;CACA;CACA,OAAO;CACP,cAAc,UAAU;CACxB,WAAW,UAAU;CACrB;CACA,eAAeA;CACf;CACA,WAAWC;CACX;CACA;CACA;CACA;CACA;CACA;CACA,aAAa;CACb,iBAAiBC,MAAM;CACvB;CACA,QAAQ;CACR,cAAc;CACd,WAAWC;CACX,eAAe;CAGf;CACA;CACA;CAGA;CACA;CAGA,aAAa;CACb,mBAAmB,eAAe;CAClC,qBAAqBC,YAAY;CAGjC;CACA;CACA,cAAc,QAAQ,eAAe,MAAM;CAG3C,cAAc,UAAU;CACxB,aAAa,UAAU;CACvB,mBAAmB,UAAU;AAC9B;AAID,iBAAiB,uBAAuB;CACtC,OAAO;CACP,UAAU,MAAM;AACjB;;AAGD,OAAO,iBAAS,kBACd,EAAE,OAAO,UAAkC,EAAtB,yBACpB,MAAM;;;;;AAYT,OAAO,iBAAS,uBAAuB;;;;;;AAevC,OAAO,iBAAS,qBACdC,SAAS,2BACR","names":["page: number","scale: number","mode: SidebarMode","filename?: string","annotation: PdfAnnotation","options: PdfViewerInstanceOptions"],"sources":["../../../src/pdf-viewer/PdfViewerContext.tsx"],"version":3,"file":"PdfViewerContext.d.ts"}
@@ -12,6 +12,7 @@ export interface UsePdfHighlightModeOptions {
12
12
  export interface UsePdfHighlightModeResult {
13
13
  highlightModeActive: boolean;
14
14
  toggleHighlightMode: () => void;
15
+ deleteHighlight: (editorId: string) => void;
15
16
  }
16
17
  /**
17
18
  * Converts an RGB array (0.0–1.0 per channel) to a CSS hex color string.
@@ -1 +1 @@
1
- {"mappings":"AAiBA,cAAc,wBAAwB,YAAa;AACnD,cAAc,iBAAiB,+BAAgC;AAC/D,cAAc,iBAAiB,OAAQ;AAEvC,cAAc,SAAS,6BAA6B,aAAc;AAElE,iBAAiB,2BAA2B;CAC1C,cAAc,UAAU;CACxB,UAAU;CACV;CACA,mBAAmBA,OAAO;CAC1B,qBAAqBA,OAAO;AAC7B;AAED,iBAAiB,0BAA0B;CACzC;CACA;AACD;;;;AAKD,OAAO,iBAAS,cAAcC;;;;;;;;;;AAkB9B,OAAO,iBAAS,kBACdC,YAAY,eACX;;;;;;AAuBH,OAAO,iBAAS,oBAAoB,EAClC,cACA,UACA,SACA,iBACA,mBAC2B,EAA1B,6BAA6B","names":["event: PdfTextHighlightEvent","color: number[]","quadPoints: Float32Array"],"sources":["../../../../src/pdf-viewer/hooks/usePdfHighlightMode.ts"],"version":3,"file":"usePdfHighlightMode.d.ts"}
1
+ {"mappings":"AAiBA,cAAc,wBAAwB,YAAa;AACnD,cAAc,iBAAiB,+BAAgC;AAC/D,cAAc,iBAAiB,OAAQ;AAEvC,cAAc,SAAS,6BAA6B,aAAc;AAElE,iBAAiB,2BAA2B;CAC1C,cAAc,UAAU;CACxB,UAAU;CACV;CACA,mBAAmBA,OAAO;CAC1B,qBAAqBA,OAAO;AAC7B;AAED,iBAAiB,0BAA0B;CACzC;CACA;CACA,kBAAkBC;AACnB;;;;AAKD,OAAO,iBAAS,cAAcC;;;;;;;;;;AAkB9B,OAAO,iBAAS,kBACdC,YAAY,eACX;;;;;;AAuBH,OAAO,iBAAS,oBAAoB,EAClC,cACA,UACA,SACA,iBACA,mBAC2B,EAA1B,6BAA6B","names":["event: PdfTextHighlightEvent","editorId: string","color: number[]","quadPoints: Float32Array"],"sources":["../../../../src/pdf-viewer/hooks/usePdfHighlightMode.ts"],"version":3,"file":"usePdfHighlightMode.d.ts"}