@osdk/react-components 0.35.0 → 0.35.1-main-12e5e63aaee98d704e38748853b40679e847249e
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.
- package/CHANGELOG.md +10 -0
- package/build/browser/base-components/action-button/ActionButton.module.css +1 -1
- package/build/browser/styles.css +2 -1
- package/build/browser/tokens/component-tokens/button.css +1 -0
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/cjs/DateCalendar-62IDZDEI.cjs +24 -0
- package/build/cjs/{DateCalendar-FCZXD24P.cjs.map → DateCalendar-62IDZDEI.cjs.map} +1 -1
- package/build/cjs/{DateCalendar-VBZGPZ5P.css → DateCalendar-FZ4QRCRH.css} +2 -2
- package/build/cjs/DateCalendar-FZ4QRCRH.css.map +1 -0
- package/build/cjs/{DateRangeCalendar-2M2I5Q3Z.css → DateRangeCalendar-2C2XUXUS.css} +2 -2
- package/build/cjs/DateRangeCalendar-2C2XUXUS.css.map +1 -0
- package/build/cjs/DateRangeCalendar-67R6GXCH.cjs +12 -0
- package/build/cjs/{DateRangeCalendar-XN2ZWAFK.cjs.map → DateRangeCalendar-67R6GXCH.cjs.map} +1 -1
- package/build/cjs/{chunk-KQ4B2XDH.cjs → chunk-3NK7SJZJ.cjs} +5 -5
- package/build/cjs/{chunk-KQ4B2XDH.cjs.map → chunk-3NK7SJZJ.cjs.map} +1 -1
- package/build/cjs/{chunk-ENE2RWIL.cjs → chunk-3O4IPFOY.cjs} +17 -17
- package/build/cjs/{chunk-ENE2RWIL.cjs.map → chunk-3O4IPFOY.cjs.map} +1 -1
- package/build/cjs/{chunk-CW644WDI.cjs → chunk-46BP2MQW.cjs} +4 -4
- package/build/cjs/{chunk-CW644WDI.cjs.map → chunk-46BP2MQW.cjs.map} +1 -1
- package/build/cjs/chunk-6IQWCVAL.cjs +11 -0
- package/build/cjs/{chunk-LL5CBNDZ.cjs.map → chunk-6IQWCVAL.cjs.map} +1 -1
- package/build/cjs/chunk-ADTODU4W.cjs +11 -0
- package/build/cjs/{chunk-NZRXL4JP.cjs.map → chunk-ADTODU4W.cjs.map} +1 -1
- package/build/cjs/chunk-AU2FUE53.cjs +11 -0
- package/build/cjs/{chunk-IYHK2H55.cjs.map → chunk-AU2FUE53.cjs.map} +1 -1
- package/build/cjs/{chunk-YCWT23HH.cjs → chunk-CHJHKFYC.cjs} +4 -4
- package/build/cjs/{chunk-YCWT23HH.cjs.map → chunk-CHJHKFYC.cjs.map} +1 -1
- package/build/cjs/{chunk-UJEI6Z4C.cjs → chunk-CP3GFWGV.cjs} +4 -4
- package/build/cjs/{chunk-UJEI6Z4C.cjs.map → chunk-CP3GFWGV.cjs.map} +1 -1
- package/build/cjs/{chunk-EN6IZOML.cjs → chunk-DED346LG.cjs} +20 -20
- package/build/cjs/{chunk-EN6IZOML.cjs.map → chunk-DED346LG.cjs.map} +1 -1
- package/build/cjs/chunk-GCHUA67V.cjs +11 -0
- package/build/cjs/{chunk-PBMJNJLL.cjs.map → chunk-GCHUA67V.cjs.map} +1 -1
- package/build/cjs/{chunk-SMVWJHAQ.cjs → chunk-GHHTWPKY.cjs} +51 -51
- package/build/cjs/{chunk-SMVWJHAQ.cjs.map → chunk-GHHTWPKY.cjs.map} +1 -1
- package/build/cjs/{chunk-INFRT5OY.cjs → chunk-HVX36U5R.cjs} +20 -20
- package/build/cjs/{chunk-INFRT5OY.cjs.map → chunk-HVX36U5R.cjs.map} +1 -1
- package/build/cjs/{chunk-MUDJXY6I.cjs → chunk-LBPOK2RE.cjs} +22 -22
- package/build/cjs/{chunk-MUDJXY6I.cjs.map → chunk-LBPOK2RE.cjs.map} +1 -1
- package/build/cjs/{chunk-N3ARFCNR.cjs → chunk-QE5JP46L.cjs} +3 -3
- package/build/cjs/chunk-QE5JP46L.cjs.map +1 -0
- package/build/cjs/{chunk-MD4KDE44.cjs → chunk-QP2LHBCZ.cjs} +2 -2
- package/build/cjs/chunk-QP2LHBCZ.cjs.map +1 -0
- package/build/cjs/chunk-TJGXEFB2.cjs +11 -0
- package/build/cjs/{chunk-W6W3Q7BQ.cjs.map → chunk-TJGXEFB2.cjs.map} +1 -1
- package/build/cjs/{chunk-BFRUHBWM.cjs → chunk-X7LQ2HH4.cjs} +12 -12
- package/build/cjs/{chunk-BFRUHBWM.cjs.map → chunk-X7LQ2HH4.cjs.map} +1 -1
- package/build/cjs/{chunk-2UQ7CJCR.cjs → chunk-YYOTGD45.cjs} +9 -9
- package/build/cjs/{chunk-2UQ7CJCR.cjs.map → chunk-YYOTGD45.cjs.map} +1 -1
- package/build/cjs/{chunk-N6MCFY34.cjs → chunk-ZL4G4QPB.cjs} +4 -4
- package/build/cjs/{chunk-N6MCFY34.cjs.map → chunk-ZL4G4QPB.cjs.map} +1 -1
- package/build/cjs/public/experimental/action-form.cjs +9 -9
- package/build/cjs/public/experimental/action-form.css +1 -1
- package/build/cjs/public/experimental/action-form.css.map +1 -1
- package/build/cjs/public/experimental/aip-agent-chat.cjs +4 -4
- package/build/cjs/public/experimental/aip-agent-chat.css +1 -1
- package/build/cjs/public/experimental/aip-agent-chat.css.map +1 -1
- package/build/cjs/public/experimental/cbac-picker.cjs +12 -12
- package/build/cjs/public/experimental/cbac-picker.css +1 -1
- package/build/cjs/public/experimental/cbac-picker.css.map +1 -1
- package/build/cjs/public/experimental/document-viewer.cjs +4 -4
- package/build/cjs/public/experimental/email-viewer.cjs +3 -3
- package/build/cjs/public/experimental/excel-viewer.cjs +3 -3
- package/build/cjs/public/experimental/filter-list.cjs +19 -19
- package/build/cjs/public/experimental/filter-list.css +1 -1
- package/build/cjs/public/experimental/filter-list.css.map +1 -1
- package/build/cjs/public/experimental/image-viewer.cjs +3 -3
- package/build/cjs/public/experimental/markdown-renderer.cjs +3 -3
- package/build/cjs/public/experimental/object-table.cjs +13 -13
- package/build/cjs/public/experimental/object-table.css +1 -1
- package/build/cjs/public/experimental/object-table.css.map +1 -1
- package/build/cjs/public/experimental/pdf-viewer.cjs +7 -7
- package/build/cjs/public/experimental/tiff-renderer.cjs +3 -3
- package/build/cjs/public/experimental/video-viewer.cjs +3 -3
- package/build/cjs/public/experimental/xml-viewer.cjs +3 -3
- package/build/cjs/public/experimental.cjs +63 -63
- package/build/cjs/public/experimental.css +1 -1
- package/build/cjs/public/experimental.css.map +1 -1
- package/build/cjs/public/primitives.cjs +2 -2
- package/build/cjs/public/primitives.css +1 -1
- package/build/cjs/public/primitives.css.map +1 -1
- package/build/esm/base-components/action-button/ActionButton.module.css +1 -1
- package/build/esm/tokens/component-tokens/button.css +1 -0
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/UserAgent.js.map +1 -1
- package/docs/CSSVariables.md +8 -7
- package/package.json +7 -7
- package/build/cjs/DateCalendar-FCZXD24P.cjs +0 -24
- package/build/cjs/DateCalendar-VBZGPZ5P.css.map +0 -1
- package/build/cjs/DateRangeCalendar-2M2I5Q3Z.css.map +0 -1
- package/build/cjs/DateRangeCalendar-XN2ZWAFK.cjs +0 -12
- package/build/cjs/chunk-IYHK2H55.cjs +0 -11
- package/build/cjs/chunk-LL5CBNDZ.cjs +0 -11
- package/build/cjs/chunk-MD4KDE44.cjs.map +0 -1
- package/build/cjs/chunk-N3ARFCNR.cjs.map +0 -1
- package/build/cjs/chunk-NZRXL4JP.cjs +0 -11
- package/build/cjs/chunk-PBMJNJLL.cjs +0 -11
- package/build/cjs/chunk-W6W3Q7BQ.cjs +0 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkBE226IHU_cjs = require('./chunk-BE226IHU.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkQE5JP46L_cjs = require('./chunk-QE5JP46L.cjs');
|
|
5
5
|
var icons = require('@blueprintjs/icons');
|
|
6
6
|
var classnames = require('classnames');
|
|
7
7
|
require('pdfjs-dist/web/pdf_viewer.css');
|
|
@@ -179,12 +179,12 @@ function usePdfViewerInstance(options) {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
// src/public/experimental/pdf-viewer.ts
|
|
182
|
-
var PdfViewer2 =
|
|
182
|
+
var PdfViewer2 = chunkQE5JP46L_cjs.withOsdkMetrics(chunkBE226IHU_cjs.PdfViewer, "PdfViewer");
|
|
183
183
|
|
|
184
184
|
exports.PdfViewer = PdfViewer2;
|
|
185
185
|
exports.PdfViewerContent = PdfViewerContent;
|
|
186
186
|
exports.PdfViewerProvider = PdfViewerProvider;
|
|
187
187
|
exports.usePdfViewerContext = usePdfViewerContext;
|
|
188
188
|
exports.usePdfViewerInstance = usePdfViewerInstance;
|
|
189
|
-
//# sourceMappingURL=chunk-
|
|
190
|
-
//# sourceMappingURL=chunk-
|
|
189
|
+
//# sourceMappingURL=chunk-CHJHKFYC.cjs.map
|
|
190
|
+
//# sourceMappingURL=chunk-CHJHKFYC.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pdf-viewer/components/PdfViewerContent.tsx","../../src/pdf-viewer/PdfViewerContext.tsx","../../src/public/experimental/pdf-viewer.ts"],"names":["EMPTY_ANNOTATION_ARRAY","usePdfViewerCore","usePdfAnnotationsByPage","usePdfFormFields","useRef","useEffect","classnames","PdfViewer_default","React","Spin","ErrorIcon","PdfAnnotationOverlay","useContext","usePdfViewerState","usePdfHighlightMode","useMemo","PdfViewer","withOsdkMetrics"],"mappings":";;;;;;;;;;;;;;AA0BO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,GAAA;AAAA,EACA,WAAA,GAAcA,wCAAA;AAAA,EACd,iBAAA;AAAA,EACA,WAAA,GAAc,CAAA;AAAA,EACd,YAAA,GAAe,CAAA;AAAA,EACf,YAAA,EAAc,gBAAA;AAAA,EACd,aAAA,EAAe,iBAAA;AAAA,EACf,QAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAA,EAAG;AACD,EAAA,MAAM,SAASC,kCAAA,CAAiB;AAAA,IAC9B,GAAA;AAAA,IACA,WAA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AAA,IACA,aAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,iBAAA;AAAA,IACA,iBAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACF,CAAA,EAAI,CAAC,MAAA,EAAQ,gBAAA,EAAkB,qBAAqB,mBAAA,EAAqB,aAAA,EAAe,cAAA,EAAgB,WAAA,EAAa,iBAAA,EAAmB,iBAAA,EAAmB,cAAA,EAAgB,cAAA,EAAgB,YAAY,CAAC,CAAA;AAC1M;;;AC9DO,IAAMC,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-YCWT23HH.cjs","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 { Error as ErrorIcon, Spin } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport \"pdfjs-dist/web/pdf_viewer.css\";\nimport React, { useEffect, useRef } from \"react\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"../constants.js\";\nimport { usePdfAnnotationsByPage } from \"../hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"../hooks/usePdfFormFields.js\";\nimport { usePdfViewerCore } from \"../hooks/usePdfViewerCore.js\";\nimport { PdfAnnotationOverlay } from \"./PdfAnnotationOverlay.js\";\nimport styles from \"../PdfViewer.module.css\";\nexport function PdfViewerContent({\n src,\n annotations = EMPTY_ANNOTATION_ARRAY,\n onAnnotationClick,\n initialPage = 1,\n initialScale = 1.0,\n onPageChange: onPageChangeProp,\n onScaleChange: onScaleChangeProp,\n formData,\n onFormChange,\n className\n}) {\n const viewer = usePdfViewerCore({\n src,\n initialPage,\n initialScale\n });\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData,\n onFormChange\n });\n\n // Use refs for callbacks to avoid firing on initial mount\n const onPageChangeRef = useRef(onPageChangeProp);\n onPageChangeRef.current = onPageChangeProp;\n const onScaleChangeRef = useRef(onScaleChangeProp);\n onScaleChangeRef.current = onScaleChangeProp;\n const isInitialMountRef = useRef(true);\n useEffect(function notifyPageChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onPageChangeRef.current?.(viewer.currentPage);\n }, [viewer.currentPage]);\n useEffect(function notifyScaleChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onScaleChangeRef.current?.(viewer.scale);\n }, [viewer.scale]);\n useEffect(function clearInitialMount() {\n isInitialMountRef.current = false;\n }, []);\n const rootClassName = classnames(styles.pdfViewer, className);\n if (viewer.loading) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, /*#__PURE__*/React.createElement(Spin, {\n className: styles.spinnerIcon\n }), \"Loading\\u2026\"));\n }\n if (viewer.error != null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.errorContainer\n }, /*#__PURE__*/React.createElement(ErrorIcon, {\n className: styles.errorIcon\n }), \"Failed to load PDF: \", viewer.error.message));\n }\n if (viewer.document == null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, \"No document\"));\n }\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.scrollContainerWrapper\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.containerRef,\n className: styles.scrollContainer\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.viewerRef,\n className: \"pdfViewer\"\n }), viewer.portalTargets.map(target => {\n const pageAnnotations = annotationsByPage[target.pageNumber] ?? EMPTY_ANNOTATION_ARRAY;\n if (pageAnnotations.length === 0) {\n return null;\n }\n return /*#__PURE__*/React.createElement(PdfAnnotationOverlay, {\n key: target.pageNumber,\n target: target,\n annotations: pageAnnotations,\n onAnnotationClick: onAnnotationClick\n });\n }))));\n}","/*\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 React, { createContext, useContext, useMemo } from \"react\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"./constants.js\";\nimport { usePdfAnnotationsByPage } from \"./hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"./hooks/usePdfFormFields.js\";\nimport { usePdfHighlightMode } from \"./hooks/usePdfHighlightMode.js\";\nimport { usePdfViewerState } from \"./hooks/usePdfViewerState.js\";\n\n/** The shape of the value provided by {@link PdfViewerProvider}. */\n\nconst PdfViewerContext = /*#__PURE__*/createContext(null);\n/** Provides {@link PdfViewerContextValue} to descendant components. */\nexport function PdfViewerProvider({\n value,\n children\n}) {\n return /*#__PURE__*/React.createElement(PdfViewerContext.Provider, {\n value: value\n }, children);\n}\n\n/**\n * Returns the nearest {@link PdfViewerContextValue} from a {@link PdfViewerProvider}.\n * Throws if called outside a provider.\n */\nexport function usePdfViewerContext() {\n const ctx = useContext(PdfViewerContext);\n if (ctx == null) {\n throw new Error(\"usePdfViewerContext must be used within a PdfViewerProvider\");\n }\n return ctx;\n}\n\n/**\n * Consumer-facing setup hook analogous to react-hook-form's `useForm()`.\n * Accepts viewer options and returns a {@link PdfViewerContextValue} suitable\n * for passing to {@link PdfViewerProvider}.\n */\nexport function usePdfViewerInstance(options) {\n const viewer = usePdfViewerState({\n src: options.src,\n initialPage: options.initialPage,\n initialScale: options.initialScale,\n initialAutoSize: options.initialAutoSize,\n initialSidebarOpen: options.initialSidebarOpen,\n sidebarMode: options.sidebarMode,\n onDownload: options.onDownload\n });\n const {\n highlightModeActive,\n toggleHighlightMode\n } = usePdfHighlightMode({\n pdfViewerRef: viewer.pdfViewerRef,\n document: viewer.document,\n enabled: options.highlightEnabled ?? false,\n onTextHighlight: options.onTextHighlight,\n onHighlightDelete: options.onHighlightDelete\n });\n const {\n hasFormFields,\n submitFormData\n } = usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData: options.formData,\n onFormSubmit: options.onFormSubmit,\n onFormChange: options.onFormChange\n });\n const annotations = options.annotations ?? EMPTY_ANNOTATION_ARRAY;\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n const highlightEnabled = options.highlightEnabled ?? false;\n const enableDownload = options.enableDownload ?? false;\n const enableFormSave = options.onFormSubmit != null && hasFormFields;\n const {\n onAnnotationClick,\n outlineIcons\n } = options;\n return useMemo(() => ({\n ...viewer,\n highlightEnabled,\n highlightModeActive,\n toggleHighlightMode,\n hasFormFields,\n submitFormData,\n annotations,\n annotationsByPage,\n onAnnotationClick,\n enableDownload,\n enableFormSave,\n outlineIcons\n }), [viewer, highlightEnabled, highlightModeActive, toggleHighlightMode, hasFormFields, submitFormData, annotations, annotationsByPage, onAnnotationClick, enableDownload, enableFormSave, outlineIcons]);\n}","/*\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\n// PdfViewer\nexport { BasePdfViewer } from \"../../pdf-viewer/PdfViewer.js\";\n// PdfViewer building blocks\nexport { PdfViewerAnnotationLayer } from \"../../pdf-viewer/components/PdfViewerAnnotationLayer.js\";\nexport { PdfViewerContent } from \"../../pdf-viewer/components/PdfViewerContent.js\";\nexport { PdfViewerOutlineSidebar } from \"../../pdf-viewer/components/PdfViewerOutlineSidebar.js\";\nexport { PdfViewerSearchBar } from \"../../pdf-viewer/components/PdfViewerSearchBar.js\";\nexport { PdfViewerSidebar } from \"../../pdf-viewer/components/PdfViewerSidebar.js\";\nexport { PdfViewerToolbar } from \"../../pdf-viewer/components/PdfViewerToolbar.js\";\n\n// PdfViewer hooks — primitive\nexport { usePdfAnnotationPortals } from \"../../pdf-viewer/hooks/usePdfAnnotationPortals.js\";\nexport { usePdfAnnotationsByPage } from \"../../pdf-viewer/hooks/usePdfAnnotationsByPage.js\";\nexport { usePdfDocument } from \"../../pdf-viewer/hooks/usePdfDocument.js\";\nexport { usePdfFormFields } from \"../../pdf-viewer/hooks/usePdfFormFields.js\";\nexport { usePdfHighlightMode } from \"../../pdf-viewer/hooks/usePdfHighlightMode.js\";\nexport { usePdfOutline } from \"../../pdf-viewer/hooks/usePdfOutline.js\";\nexport { usePdfViewer } from \"../../pdf-viewer/hooks/usePdfViewer.js\";\nexport { usePdfViewerSearch } from \"../../pdf-viewer/hooks/usePdfViewerSearch.js\";\nexport { usePdfViewerSync } from \"../../pdf-viewer/hooks/usePdfViewerSync.js\";\n// PdfViewer context\nexport { PdfViewerProvider, usePdfViewerContext, usePdfViewerInstance } from \"../../pdf-viewer/PdfViewerContext.js\";\n// PdfViewer hooks — composition\nexport { usePdfViewerCore } from \"../../pdf-viewer/hooks/usePdfViewerCore.js\";\nexport { usePdfViewerState } from \"../../pdf-viewer/hooks/usePdfViewerState.js\";\n\n// PdfViewer (Media wrapper)\nimport { PdfViewer as _PdfViewer } from \"../../pdf-viewer/PdfRenderer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const PdfViewer = withOsdkMetrics(_PdfViewer, \"PdfViewer\");"]}
|
|
1
|
+
{"version":3,"sources":["../../src/pdf-viewer/components/PdfViewerContent.tsx","../../src/pdf-viewer/PdfViewerContext.tsx","../../src/public/experimental/pdf-viewer.ts"],"names":["EMPTY_ANNOTATION_ARRAY","usePdfViewerCore","usePdfAnnotationsByPage","usePdfFormFields","useRef","useEffect","classnames","PdfViewer_default","React","Spin","ErrorIcon","PdfAnnotationOverlay","useContext","usePdfViewerState","usePdfHighlightMode","useMemo","PdfViewer","withOsdkMetrics"],"mappings":";;;;;;;;;;;;;;AA0BO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,GAAA;AAAA,EACA,WAAA,GAAcA,wCAAA;AAAA,EACd,iBAAA;AAAA,EACA,WAAA,GAAc,CAAA;AAAA,EACd,YAAA,GAAe,CAAA;AAAA,EACf,YAAA,EAAc,gBAAA;AAAA,EACd,aAAA,EAAe,iBAAA;AAAA,EACf,QAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAA,EAAG;AACD,EAAA,MAAM,SAASC,kCAAA,CAAiB;AAAA,IAC9B,GAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACD,CAAA;AACD,EAAA,MAAM,iBAAA,GAAoBC,0CAAwB,WAAW,CAAA;AAC7D,EAAAC,kCAAA,CAAiB;AAAA,IACf,cAAc,MAAA,CAAO,YAAA;AAAA,IACrB,aAAa,MAAA,CAAO,WAAA;AAAA,IACpB,UAAU,MAAA,CAAO,QAAA;AAAA,IACjB,QAAA;AAAA,IACA;AAAA,GACD,CAAA;AAGD,EAAA,MAAM,eAAA,GAAkB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EAAgB,YAAY,CAAC,CAAA;AAC1M;;;AC9DO,IAAMC,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-CHJHKFYC.cjs","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 { Error as ErrorIcon, Spin } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport \"pdfjs-dist/web/pdf_viewer.css\";\nimport React, { useEffect, useRef } from \"react\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"../constants.js\";\nimport { usePdfAnnotationsByPage } from \"../hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"../hooks/usePdfFormFields.js\";\nimport { usePdfViewerCore } from \"../hooks/usePdfViewerCore.js\";\nimport { PdfAnnotationOverlay } from \"./PdfAnnotationOverlay.js\";\nimport styles from \"../PdfViewer.module.css\";\nexport function PdfViewerContent({\n src,\n annotations = EMPTY_ANNOTATION_ARRAY,\n onAnnotationClick,\n initialPage = 1,\n initialScale = 1.0,\n onPageChange: onPageChangeProp,\n onScaleChange: onScaleChangeProp,\n formData,\n onFormChange,\n className\n}) {\n const viewer = usePdfViewerCore({\n src,\n initialPage,\n initialScale\n });\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData,\n onFormChange\n });\n\n // Use refs for callbacks to avoid firing on initial mount\n const onPageChangeRef = useRef(onPageChangeProp);\n onPageChangeRef.current = onPageChangeProp;\n const onScaleChangeRef = useRef(onScaleChangeProp);\n onScaleChangeRef.current = onScaleChangeProp;\n const isInitialMountRef = useRef(true);\n useEffect(function notifyPageChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onPageChangeRef.current?.(viewer.currentPage);\n }, [viewer.currentPage]);\n useEffect(function notifyScaleChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onScaleChangeRef.current?.(viewer.scale);\n }, [viewer.scale]);\n useEffect(function clearInitialMount() {\n isInitialMountRef.current = false;\n }, []);\n const rootClassName = classnames(styles.pdfViewer, className);\n if (viewer.loading) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, /*#__PURE__*/React.createElement(Spin, {\n className: styles.spinnerIcon\n }), \"Loading\\u2026\"));\n }\n if (viewer.error != null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.errorContainer\n }, /*#__PURE__*/React.createElement(ErrorIcon, {\n className: styles.errorIcon\n }), \"Failed to load PDF: \", viewer.error.message));\n }\n if (viewer.document == null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, \"No document\"));\n }\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.scrollContainerWrapper\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.containerRef,\n className: styles.scrollContainer\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.viewerRef,\n className: \"pdfViewer\"\n }), viewer.portalTargets.map(target => {\n const pageAnnotations = annotationsByPage[target.pageNumber] ?? EMPTY_ANNOTATION_ARRAY;\n if (pageAnnotations.length === 0) {\n return null;\n }\n return /*#__PURE__*/React.createElement(PdfAnnotationOverlay, {\n key: target.pageNumber,\n target: target,\n annotations: pageAnnotations,\n onAnnotationClick: onAnnotationClick\n });\n }))));\n}","/*\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 React, { createContext, useContext, useMemo } from \"react\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"./constants.js\";\nimport { usePdfAnnotationsByPage } from \"./hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"./hooks/usePdfFormFields.js\";\nimport { usePdfHighlightMode } from \"./hooks/usePdfHighlightMode.js\";\nimport { usePdfViewerState } from \"./hooks/usePdfViewerState.js\";\n\n/** The shape of the value provided by {@link PdfViewerProvider}. */\n\nconst PdfViewerContext = /*#__PURE__*/createContext(null);\n/** Provides {@link PdfViewerContextValue} to descendant components. */\nexport function PdfViewerProvider({\n value,\n children\n}) {\n return /*#__PURE__*/React.createElement(PdfViewerContext.Provider, {\n value: value\n }, children);\n}\n\n/**\n * Returns the nearest {@link PdfViewerContextValue} from a {@link PdfViewerProvider}.\n * Throws if called outside a provider.\n */\nexport function usePdfViewerContext() {\n const ctx = useContext(PdfViewerContext);\n if (ctx == null) {\n throw new Error(\"usePdfViewerContext must be used within a PdfViewerProvider\");\n }\n return ctx;\n}\n\n/**\n * Consumer-facing setup hook analogous to react-hook-form's `useForm()`.\n * Accepts viewer options and returns a {@link PdfViewerContextValue} suitable\n * for passing to {@link PdfViewerProvider}.\n */\nexport function usePdfViewerInstance(options) {\n const viewer = usePdfViewerState({\n src: options.src,\n initialPage: options.initialPage,\n initialScale: options.initialScale,\n initialAutoSize: options.initialAutoSize,\n initialSidebarOpen: options.initialSidebarOpen,\n sidebarMode: options.sidebarMode,\n onDownload: options.onDownload\n });\n const {\n highlightModeActive,\n toggleHighlightMode\n } = usePdfHighlightMode({\n pdfViewerRef: viewer.pdfViewerRef,\n document: viewer.document,\n enabled: options.highlightEnabled ?? false,\n onTextHighlight: options.onTextHighlight,\n onHighlightDelete: options.onHighlightDelete\n });\n const {\n hasFormFields,\n submitFormData\n } = usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData: options.formData,\n onFormSubmit: options.onFormSubmit,\n onFormChange: options.onFormChange\n });\n const annotations = options.annotations ?? EMPTY_ANNOTATION_ARRAY;\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n const highlightEnabled = options.highlightEnabled ?? false;\n const enableDownload = options.enableDownload ?? false;\n const enableFormSave = options.onFormSubmit != null && hasFormFields;\n const {\n onAnnotationClick,\n outlineIcons\n } = options;\n return useMemo(() => ({\n ...viewer,\n highlightEnabled,\n highlightModeActive,\n toggleHighlightMode,\n hasFormFields,\n submitFormData,\n annotations,\n annotationsByPage,\n onAnnotationClick,\n enableDownload,\n enableFormSave,\n outlineIcons\n }), [viewer, highlightEnabled, highlightModeActive, toggleHighlightMode, hasFormFields, submitFormData, annotations, annotationsByPage, onAnnotationClick, enableDownload, enableFormSave, outlineIcons]);\n}","/*\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\n// PdfViewer\nexport { BasePdfViewer } from \"../../pdf-viewer/PdfViewer.js\";\n// PdfViewer building blocks\nexport { PdfViewerAnnotationLayer } from \"../../pdf-viewer/components/PdfViewerAnnotationLayer.js\";\nexport { PdfViewerContent } from \"../../pdf-viewer/components/PdfViewerContent.js\";\nexport { PdfViewerOutlineSidebar } from \"../../pdf-viewer/components/PdfViewerOutlineSidebar.js\";\nexport { PdfViewerSearchBar } from \"../../pdf-viewer/components/PdfViewerSearchBar.js\";\nexport { PdfViewerSidebar } from \"../../pdf-viewer/components/PdfViewerSidebar.js\";\nexport { PdfViewerToolbar } from \"../../pdf-viewer/components/PdfViewerToolbar.js\";\n\n// PdfViewer hooks — primitive\nexport { usePdfAnnotationPortals } from \"../../pdf-viewer/hooks/usePdfAnnotationPortals.js\";\nexport { usePdfAnnotationsByPage } from \"../../pdf-viewer/hooks/usePdfAnnotationsByPage.js\";\nexport { usePdfDocument } from \"../../pdf-viewer/hooks/usePdfDocument.js\";\nexport { usePdfFormFields } from \"../../pdf-viewer/hooks/usePdfFormFields.js\";\nexport { usePdfHighlightMode } from \"../../pdf-viewer/hooks/usePdfHighlightMode.js\";\nexport { usePdfOutline } from \"../../pdf-viewer/hooks/usePdfOutline.js\";\nexport { usePdfViewer } from \"../../pdf-viewer/hooks/usePdfViewer.js\";\nexport { usePdfViewerSearch } from \"../../pdf-viewer/hooks/usePdfViewerSearch.js\";\nexport { usePdfViewerSync } from \"../../pdf-viewer/hooks/usePdfViewerSync.js\";\n// PdfViewer context\nexport { PdfViewerProvider, usePdfViewerContext, usePdfViewerInstance } from \"../../pdf-viewer/PdfViewerContext.js\";\n// PdfViewer hooks — composition\nexport { usePdfViewerCore } from \"../../pdf-viewer/hooks/usePdfViewerCore.js\";\nexport { usePdfViewerState } from \"../../pdf-viewer/hooks/usePdfViewerState.js\";\n\n// PdfViewer (Media wrapper)\nimport { PdfViewer as _PdfViewer } from \"../../pdf-viewer/PdfRenderer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const PdfViewer = withOsdkMetrics(_PdfViewer, \"PdfViewer\");"]}
|
|
@@ -9,7 +9,7 @@ var chunkBE226IHU_cjs = require('./chunk-BE226IHU.cjs');
|
|
|
9
9
|
var chunkLB3IHFAB_cjs = require('./chunk-LB3IHFAB.cjs');
|
|
10
10
|
var chunkUCTQICPR_cjs = require('./chunk-UCTQICPR.cjs');
|
|
11
11
|
var chunkOISZU73V_cjs = require('./chunk-OISZU73V.cjs');
|
|
12
|
-
var
|
|
12
|
+
var chunkQE5JP46L_cjs = require('./chunk-QE5JP46L.cjs');
|
|
13
13
|
var icons = require('@blueprintjs/icons');
|
|
14
14
|
var classnames = require('classnames');
|
|
15
15
|
var React2 = require('react');
|
|
@@ -310,9 +310,9 @@ function DocumentViewer({
|
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
// src/public/experimental/document-viewer.ts
|
|
313
|
-
var DocumentViewer2 =
|
|
313
|
+
var DocumentViewer2 = chunkQE5JP46L_cjs.withOsdkMetrics(DocumentViewer, "DocumentViewer");
|
|
314
314
|
|
|
315
315
|
exports.DocumentViewer = DocumentViewer2;
|
|
316
316
|
exports.ViewerType = ViewerType;
|
|
317
|
-
//# sourceMappingURL=chunk-
|
|
318
|
-
//# sourceMappingURL=chunk-
|
|
317
|
+
//# sourceMappingURL=chunk-CP3GFWGV.cjs.map
|
|
318
|
+
//# sourceMappingURL=chunk-CP3GFWGV.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/document-viewer/DocumentViewerApi.ts","../../src/document-viewer/hooks/useTiffToPdf.ts","../../src/document-viewer/DocumentViewer.module.css","../../src/document-viewer/TiffDocumentViewer.tsx","../../src/document-viewer/DocumentViewer.tsx","../../src/public/experimental/document-viewer.ts"],"names":["ViewerType","useOsdkClient","useState","useRef","useEffect","UTIF","__EXPERIMENTAL__NOT_SUPPORTED_YET__transformAndWait","React","Spin","BasePdfViewer","TiffViewerMedia","_extends","useMemo","classnames","PdfViewer","ImageViewer","VideoViewer","MarkdownViewerMedia","ExcelViewer","EmailViewer","XmlViewer","DocumentIcon","assertUnreachable","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AAAA,IACtB,KAAK,UAAA,CAAW,KAAA;AACd,MAAA,uBAAoBJ,uBAAAA,CAAM,aAAA,CAAcY,6BAAA,EAAaR,SAAAA,CAAS;AAAA,QAC5D,KAAA;AAAA,QACA,SAAA,EAAW;AAAA,OACb,EAAG,gBAAgB,CAAC,CAAA;AAAA,IACtB,KAAK,UAAA,CAAW,GAAA;AACd,MAAA,uBAAoBJ,uBAAAA,CAAM,aAAA,CAAca,2BAAA,EAAWT,SAAAA,CAAS;AAAA,QAC1D,KAAA;AAAA,QACA,SAAA,EAAW;AAAA,OACb,EAAG,cAAc,CAAC,CAAA;AAAA,IACpB,KAAK,UAAA,CAAW,WAAA;AACd,MAAA,uBAAoBJ,uBAAAA,CAAM,aAAA,CAAc,KAAA,EAAO;AAAA,QAC7C,SAAA,EAAW;AAAA,OACb,kBAAgBA,uBAAAA,CAAM,aAAA,CAAc,KAAA,EAAO;AAAA,QACzC,WAAW,sBAAA,CAAO;AAAA,OACpB,kBAAgBA,uBAAAA,CAAM,aAAA,CAAcc,cAAA,EAAc;AAAA,QAChD,WAAW,sBAAA,CAAO;AAAA,OACnB,CAAA,EAAG,yBAAA,EAA2B,QAAQ,CAAC,CAAA;AAAA,IAC1C;AACE,MAAAC,mCAAA,CAAkB,UAAU,CAAA;AAAA;AAElC;;;ACnIO,IAAMC,eAAAA,GAAiBC,iCAAA,CAAgB,cAAA,EAAiB,gBAAgB","file":"chunk-UJEI6Z4C.cjs","sourcesContent":["/*\n * Copyright 2026 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 let ViewerType = /*#__PURE__*/function (ViewerType) {\n ViewerType[\"Pdf\"] = \"pdf\";\n ViewerType[\"Tiff\"] = \"tiff\";\n ViewerType[\"Image\"] = \"image\";\n ViewerType[\"Video\"] = \"video\";\n ViewerType[\"Markdown\"] = \"markdown\";\n ViewerType[\"Excel\"] = \"excel\";\n ViewerType[\"Email\"] = \"email\";\n ViewerType[\"Xml\"] = \"xml\";\n ViewerType[\"Unsupported\"] = \"unsupported\";\n return ViewerType;\n}({});","/*\n * Copyright 2026 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\n/* cspell:words ifds */\n\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET__transformAndWait } from \"@osdk/api/unstable\";\nimport { useOsdkClient } from \"@osdk/react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport * as UTIF from \"utif\";\nimport { ViewerType } from \"../DocumentViewerApi.js\";\nconst DISABLED_RESULT = {\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: false,\n error: undefined\n};\n\n/**\n * Detects multi-page TIFFs and converts them to PDF via the MIO transform API.\n * Single-page TIFFs are left for the TiffRenderer to handle.\n *\n * @param media - The OSDK Media object (must be a TIFF)\n * @param enabled - Whether to attempt multi-page detection and conversion\n */\nexport function useTiffToPdf(media, enabled) {\n const client = useOsdkClient();\n const [result, setResult] = useState(DISABLED_RESULT);\n const mediaRef = useRef(media);\n mediaRef.current = media;\n useEffect(() => {\n if (!enabled) {\n setResult(DISABLED_RESULT);\n return;\n }\n let cancelled = false;\n setResult({\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: true,\n error: undefined\n });\n async function detectAndTransform() {\n const currentMedia = mediaRef.current;\n\n // Step 1: Fetch TIFF bytes and count pages\n const response = await currentMedia.fetchContents();\n const buffer = await response.arrayBuffer();\n if (cancelled) return;\n const ifds = UTIF.decode(buffer);\n const pageCount = ifds.length;\n if (pageCount <= 1) {\n // Single-page TIFF — use TiffRenderer\n if (!cancelled) {\n setResult({\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: false,\n error: undefined\n });\n }\n return;\n }\n\n // Step 2: Multi-page TIFF — convert to PDF via MIO transform\n const mediaReference = currentMedia.getMediaReference();\n const pdfResponse = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__transformAndWait).transformAndWait({\n mediaReference,\n transformation: {\n $imageToDocument: {\n $operation: {\n $createPdf: {}\n }\n }\n }\n });\n if (cancelled) return;\n const pdfBuffer = await pdfResponse.arrayBuffer();\n if (!cancelled) {\n setResult({\n viewerType: ViewerType.Pdf,\n pdfData: pdfBuffer,\n loading: false,\n error: undefined\n });\n }\n }\n detectAndTransform().catch(err => {\n if (!cancelled) {\n // eslint-disable-next-line no-console\n console.warn(\"TIFF to PDF conversion failed, falling back to TIFF renderer:\", err);\n setResult({\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: false,\n error: err instanceof Error ? err : new Error(String(err))\n });\n }\n });\n return () => {\n cancelled = true;\n };\n }, [media, enabled, client]);\n return result;\n}",".container {\n display: flex;\n width: 100%;\n height: 100%;\n background-color: var(--osdk-document-viewer-bg);\n border: var(--osdk-document-viewer-border);\n border-radius: var(--osdk-surface-border-radius);\n overflow: hidden;\n}\n\n.unsupportedContainer {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--osdk-surface-spacing);\n width: 100%;\n height: 100%;\n font-family: var(--osdk-typography-family-default);\n font-size: var(--osdk-typography-size-body-medium);\n color: var(--osdk-typography-color-muted);\n}\n\n.unsupportedIcon {\n flex-shrink: 0;\n}\n\n.loadingContainer {\n composes: loadingContainer from \"../shared/LoadingError.module.css\";\n width: 100%;\n}\n\n.spinnerIcon {\n composes: spinnerIcon from \"../shared/LoadingError.module.css\";\n}\n","function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\n/*\n * Copyright 2026 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 { Spin } from \"@blueprintjs/icons\";\nimport React from \"react\";\nimport { TiffViewerMedia } from \"../images/tiff-renderer/TiffViewerMedia.js\";\nimport { BasePdfViewer } from \"../pdf-viewer/PdfViewer.js\";\nimport { ViewerType } from \"./DocumentViewerApi.js\";\nimport { useTiffToPdf } from \"./hooks/useTiffToPdf.js\";\nimport styles from \"./DocumentViewer.module.css\";\nexport function TiffDocumentViewer({\n media,\n className,\n enableTiffToPdf,\n tiffRendererProps,\n pdfViewerProps\n}) {\n const {\n viewerType,\n pdfData,\n loading\n } = useTiffToPdf(media, enableTiffToPdf);\n if (loading) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: className\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, /*#__PURE__*/React.createElement(Spin, {\n className: styles.spinnerIcon\n }), \"Converting document\\u2026\"));\n }\n if (viewerType === ViewerType.Pdf && pdfData != null) {\n return /*#__PURE__*/React.createElement(BasePdfViewer, _extends({\n src: pdfData,\n className: className\n }, pdfViewerProps));\n }\n return /*#__PURE__*/React.createElement(TiffViewerMedia, _extends({\n media: media,\n className: className\n }, tiffRendererProps));\n}","function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\n/*\n * Copyright 2026 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\n/* cspell:words openxmlformats officedocument wordprocessingml spreadsheetml */\n\nimport { Document as DocumentIcon } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport React, { useMemo } from \"react\";\nimport { EmailViewer } from \"../email-viewer/EmailViewer.js\";\nimport { ExcelViewer } from \"../excel-viewer/ExcelViewer.js\";\nimport { ImageViewer } from \"../images/image-viewer/ImageViewer.js\";\nimport { TiffViewerMedia } from \"../images/tiff-renderer/TiffViewerMedia.js\";\nimport { MarkdownViewerMedia } from \"../markdown-renderer/MarkdownViewerMedia.js\";\nimport { PdfViewer } from \"../pdf-viewer/PdfRenderer.js\";\nimport { assertUnreachable } from \"../shared/assertUnreachable.js\";\nimport { VideoViewer } from \"../video-viewer/VideoViewer.js\";\nimport { XmlViewer } from \"../xml-viewer/XmlViewer.js\";\nimport { ViewerType } from \"./DocumentViewerApi.js\";\nimport { TiffDocumentViewer } from \"./TiffDocumentViewer.js\";\nimport styles from \"./DocumentViewer.module.css\";\nconst IMAGE_MIME_TYPES = new Set([\"image/png\", \"image/jpeg\", \"image/gif\", \"image/svg+xml\", \"image/webp\", \"image/bmp\"]);\nconst MARKDOWN_MIME_TYPES = new Set([\"text/markdown\", \"text/x-markdown\"]);\nconst XML_MIME_TYPES = new Set([\"application/xml\", \"text/xml\"]);\nfunction isTiffFile(mimeType, fileName) {\n if (mimeType === \"image/tiff\") {\n return true;\n }\n const lowered = fileName?.toLowerCase();\n return lowered?.endsWith(\".tif\") === true || lowered?.endsWith(\".tiff\") === true;\n}\nfunction getViewerType(mimeType, fileName) {\n if (mimeType === \"application/pdf\") {\n return ViewerType.Pdf;\n }\n if (isTiffFile(mimeType, fileName)) {\n return ViewerType.Tiff;\n }\n if (IMAGE_MIME_TYPES.has(mimeType)) {\n return ViewerType.Image;\n }\n if (mimeType.startsWith(\"video/\")) {\n return ViewerType.Video;\n }\n if (MARKDOWN_MIME_TYPES.has(mimeType)) {\n return ViewerType.Markdown;\n }\n if (mimeType === \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\") {\n return ViewerType.Excel;\n }\n if (mimeType === \"message/rfc822\") {\n return ViewerType.Email;\n }\n if (XML_MIME_TYPES.has(mimeType)) {\n return ViewerType.Xml;\n }\n return ViewerType.Unsupported;\n}\nexport function DocumentViewer({\n media,\n className,\n mimeTypeOverride,\n pdfViewerProps,\n imageViewerProps,\n videoViewerProps,\n tiffRendererProps,\n markdownRendererProps,\n excelViewerProps,\n emailViewerProps,\n xmlViewerProps,\n fileName,\n enableTiffToPdf = false\n}) {\n const mimeType = mimeTypeOverride ?? media.getMediaReference().mimeType;\n const viewerType = useMemo(() => getViewerType(mimeType, fileName), [mimeType, fileName]);\n const rootClassName = classnames(styles.container, className);\n switch (viewerType) {\n case ViewerType.Pdf:\n return /*#__PURE__*/React.createElement(PdfViewer, _extends({\n media: media,\n className: rootClassName\n }, pdfViewerProps));\n case ViewerType.Tiff:\n if (enableTiffToPdf) {\n return /*#__PURE__*/React.createElement(TiffDocumentViewer, {\n media: media,\n className: rootClassName,\n enableTiffToPdf: enableTiffToPdf,\n tiffRendererProps: tiffRendererProps,\n pdfViewerProps: pdfViewerProps\n });\n }\n return /*#__PURE__*/React.createElement(TiffViewerMedia, _extends({\n media: media,\n className: rootClassName\n }, tiffRendererProps));\n case ViewerType.Image:\n return /*#__PURE__*/React.createElement(ImageViewer, _extends({\n media: media,\n className: rootClassName\n }, imageViewerProps));\n case ViewerType.Video:\n return /*#__PURE__*/React.createElement(VideoViewer, _extends({\n media: media,\n className: rootClassName\n }, videoViewerProps));\n case ViewerType.Markdown:\n return /*#__PURE__*/React.createElement(MarkdownViewerMedia, _extends({\n media: media,\n className: rootClassName\n }, markdownRendererProps));\n case ViewerType.Excel:\n return /*#__PURE__*/React.createElement(ExcelViewer, _extends({\n media: media,\n className: rootClassName\n }, excelViewerProps));\n case ViewerType.Email:\n return /*#__PURE__*/React.createElement(EmailViewer, _extends({\n media: media,\n className: rootClassName\n }, emailViewerProps));\n case ViewerType.Xml:\n return /*#__PURE__*/React.createElement(XmlViewer, _extends({\n media: media,\n className: rootClassName\n }, xmlViewerProps));\n case ViewerType.Unsupported:\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.unsupportedContainer\n }, /*#__PURE__*/React.createElement(DocumentIcon, {\n className: styles.unsupportedIcon\n }), \"Unsupported file type: \", mimeType));\n default:\n assertUnreachable(viewerType);\n }\n}","/*\n * Copyright 2026 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\n// DocumentViewer\nimport { DocumentViewer as _DocumentViewer } from \"../../document-viewer/DocumentViewer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const DocumentViewer = withOsdkMetrics(_DocumentViewer, \"DocumentViewer\");\nexport { ViewerType } from \"../../document-viewer/DocumentViewerApi.js\";"]}
|
|
1
|
+
{"version":3,"sources":["../../src/document-viewer/DocumentViewerApi.ts","../../src/document-viewer/hooks/useTiffToPdf.ts","../../src/document-viewer/DocumentViewer.module.css","../../src/document-viewer/TiffDocumentViewer.tsx","../../src/document-viewer/DocumentViewer.tsx","../../src/public/experimental/document-viewer.ts"],"names":["ViewerType","useOsdkClient","useState","useRef","useEffect","UTIF","__EXPERIMENTAL__NOT_SUPPORTED_YET__transformAndWait","React","Spin","BasePdfViewer","TiffViewerMedia","_extends","useMemo","classnames","PdfViewer","ImageViewer","VideoViewer","MarkdownViewerMedia","ExcelViewer","EmailViewer","XmlViewer","DocumentIcon","assertUnreachable","DocumentViewer","withOsdkMetrics"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,IAAI,UAAA,6BAAoCA,WAAAA,EAAY;AACzD,EAAAA,WAAAA,CAAW,KAAK,CAAA,GAAI,KAAA;AACpB,EAAAA,WAAAA,CAAW,MAAM,CAAA,GAAI,MAAA;AACrB,EAAAA,WAAAA,CAAW,OAAO,CAAA,GAAI,OAAA;AACtB,EAAAA,WAAAA,CAAW,OAAO,CAAA,GAAI,OAAA;AACtB,EAAAA,WAAAA,CAAW,UAAU,CAAA,GAAI,UAAA;AACzB,EAAAA,WAAAA,CAAW,OAAO,CAAA,GAAI,OAAA;AACtB,EAAAA,WAAAA,CAAW,OAAO,CAAA,GAAI,OAAA;AACtB,EAAAA,WAAAA,CAAW,KAAK,CAAA,GAAI,KAAA;AACpB,EAAAA,WAAAA,CAAW,aAAa,CAAA,GAAI,aAAA;AAC5B,EAAA,OAAOA,WAAAA;AACT,CAAA,EAAE,EAAE;ACJJ,IAAM,eAAA,GAAkB;AAAA,EACtB,YAAY,UAAA,CAAW,IAAA;AAAA,EACvB,OAAA,EAAS,MAAA;AAAA,EACT,OAAA,EAAS,KAAA;AAAA,EACT,KAAA,EAAO;AACT,CAAA;AASO,SAAS,YAAA,CAAa,OAAO,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IO,IAAMC,eAAAA,GAAiBC,iCAAA,CAAgB,cAAA,EAAiB,gBAAgB","file":"chunk-CP3GFWGV.cjs","sourcesContent":["/*\n * Copyright 2026 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 let ViewerType = /*#__PURE__*/function (ViewerType) {\n ViewerType[\"Pdf\"] = \"pdf\";\n ViewerType[\"Tiff\"] = \"tiff\";\n ViewerType[\"Image\"] = \"image\";\n ViewerType[\"Video\"] = \"video\";\n ViewerType[\"Markdown\"] = \"markdown\";\n ViewerType[\"Excel\"] = \"excel\";\n ViewerType[\"Email\"] = \"email\";\n ViewerType[\"Xml\"] = \"xml\";\n ViewerType[\"Unsupported\"] = \"unsupported\";\n return ViewerType;\n}({});","/*\n * Copyright 2026 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\n/* cspell:words ifds */\n\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET__transformAndWait } from \"@osdk/api/unstable\";\nimport { useOsdkClient } from \"@osdk/react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport * as UTIF from \"utif\";\nimport { ViewerType } from \"../DocumentViewerApi.js\";\nconst DISABLED_RESULT = {\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: false,\n error: undefined\n};\n\n/**\n * Detects multi-page TIFFs and converts them to PDF via the MIO transform API.\n * Single-page TIFFs are left for the TiffRenderer to handle.\n *\n * @param media - The OSDK Media object (must be a TIFF)\n * @param enabled - Whether to attempt multi-page detection and conversion\n */\nexport function useTiffToPdf(media, enabled) {\n const client = useOsdkClient();\n const [result, setResult] = useState(DISABLED_RESULT);\n const mediaRef = useRef(media);\n mediaRef.current = media;\n useEffect(() => {\n if (!enabled) {\n setResult(DISABLED_RESULT);\n return;\n }\n let cancelled = false;\n setResult({\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: true,\n error: undefined\n });\n async function detectAndTransform() {\n const currentMedia = mediaRef.current;\n\n // Step 1: Fetch TIFF bytes and count pages\n const response = await currentMedia.fetchContents();\n const buffer = await response.arrayBuffer();\n if (cancelled) return;\n const ifds = UTIF.decode(buffer);\n const pageCount = ifds.length;\n if (pageCount <= 1) {\n // Single-page TIFF — use TiffRenderer\n if (!cancelled) {\n setResult({\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: false,\n error: undefined\n });\n }\n return;\n }\n\n // Step 2: Multi-page TIFF — convert to PDF via MIO transform\n const mediaReference = currentMedia.getMediaReference();\n const pdfResponse = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__transformAndWait).transformAndWait({\n mediaReference,\n transformation: {\n $imageToDocument: {\n $operation: {\n $createPdf: {}\n }\n }\n }\n });\n if (cancelled) return;\n const pdfBuffer = await pdfResponse.arrayBuffer();\n if (!cancelled) {\n setResult({\n viewerType: ViewerType.Pdf,\n pdfData: pdfBuffer,\n loading: false,\n error: undefined\n });\n }\n }\n detectAndTransform().catch(err => {\n if (!cancelled) {\n // eslint-disable-next-line no-console\n console.warn(\"TIFF to PDF conversion failed, falling back to TIFF renderer:\", err);\n setResult({\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: false,\n error: err instanceof Error ? err : new Error(String(err))\n });\n }\n });\n return () => {\n cancelled = true;\n };\n }, [media, enabled, client]);\n return result;\n}",".container {\n display: flex;\n width: 100%;\n height: 100%;\n background-color: var(--osdk-document-viewer-bg);\n border: var(--osdk-document-viewer-border);\n border-radius: var(--osdk-surface-border-radius);\n overflow: hidden;\n}\n\n.unsupportedContainer {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--osdk-surface-spacing);\n width: 100%;\n height: 100%;\n font-family: var(--osdk-typography-family-default);\n font-size: var(--osdk-typography-size-body-medium);\n color: var(--osdk-typography-color-muted);\n}\n\n.unsupportedIcon {\n flex-shrink: 0;\n}\n\n.loadingContainer {\n composes: loadingContainer from \"../shared/LoadingError.module.css\";\n width: 100%;\n}\n\n.spinnerIcon {\n composes: spinnerIcon from \"../shared/LoadingError.module.css\";\n}\n","function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\n/*\n * Copyright 2026 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 { Spin } from \"@blueprintjs/icons\";\nimport React from \"react\";\nimport { TiffViewerMedia } from \"../images/tiff-renderer/TiffViewerMedia.js\";\nimport { BasePdfViewer } from \"../pdf-viewer/PdfViewer.js\";\nimport { ViewerType } from \"./DocumentViewerApi.js\";\nimport { useTiffToPdf } from \"./hooks/useTiffToPdf.js\";\nimport styles from \"./DocumentViewer.module.css\";\nexport function TiffDocumentViewer({\n media,\n className,\n enableTiffToPdf,\n tiffRendererProps,\n pdfViewerProps\n}) {\n const {\n viewerType,\n pdfData,\n loading\n } = useTiffToPdf(media, enableTiffToPdf);\n if (loading) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: className\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, /*#__PURE__*/React.createElement(Spin, {\n className: styles.spinnerIcon\n }), \"Converting document\\u2026\"));\n }\n if (viewerType === ViewerType.Pdf && pdfData != null) {\n return /*#__PURE__*/React.createElement(BasePdfViewer, _extends({\n src: pdfData,\n className: className\n }, pdfViewerProps));\n }\n return /*#__PURE__*/React.createElement(TiffViewerMedia, _extends({\n media: media,\n className: className\n }, tiffRendererProps));\n}","function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\n/*\n * Copyright 2026 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\n/* cspell:words openxmlformats officedocument wordprocessingml spreadsheetml */\n\nimport { Document as DocumentIcon } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport React, { useMemo } from \"react\";\nimport { EmailViewer } from \"../email-viewer/EmailViewer.js\";\nimport { ExcelViewer } from \"../excel-viewer/ExcelViewer.js\";\nimport { ImageViewer } from \"../images/image-viewer/ImageViewer.js\";\nimport { TiffViewerMedia } from \"../images/tiff-renderer/TiffViewerMedia.js\";\nimport { MarkdownViewerMedia } from \"../markdown-renderer/MarkdownViewerMedia.js\";\nimport { PdfViewer } from \"../pdf-viewer/PdfRenderer.js\";\nimport { assertUnreachable } from \"../shared/assertUnreachable.js\";\nimport { VideoViewer } from \"../video-viewer/VideoViewer.js\";\nimport { XmlViewer } from \"../xml-viewer/XmlViewer.js\";\nimport { ViewerType } from \"./DocumentViewerApi.js\";\nimport { TiffDocumentViewer } from \"./TiffDocumentViewer.js\";\nimport styles from \"./DocumentViewer.module.css\";\nconst IMAGE_MIME_TYPES = new Set([\"image/png\", \"image/jpeg\", \"image/gif\", \"image/svg+xml\", \"image/webp\", \"image/bmp\"]);\nconst MARKDOWN_MIME_TYPES = new Set([\"text/markdown\", \"text/x-markdown\"]);\nconst XML_MIME_TYPES = new Set([\"application/xml\", \"text/xml\"]);\nfunction isTiffFile(mimeType, fileName) {\n if (mimeType === \"image/tiff\") {\n return true;\n }\n const lowered = fileName?.toLowerCase();\n return lowered?.endsWith(\".tif\") === true || lowered?.endsWith(\".tiff\") === true;\n}\nfunction getViewerType(mimeType, fileName) {\n if (mimeType === \"application/pdf\") {\n return ViewerType.Pdf;\n }\n if (isTiffFile(mimeType, fileName)) {\n return ViewerType.Tiff;\n }\n if (IMAGE_MIME_TYPES.has(mimeType)) {\n return ViewerType.Image;\n }\n if (mimeType.startsWith(\"video/\")) {\n return ViewerType.Video;\n }\n if (MARKDOWN_MIME_TYPES.has(mimeType)) {\n return ViewerType.Markdown;\n }\n if (mimeType === \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\") {\n return ViewerType.Excel;\n }\n if (mimeType === \"message/rfc822\") {\n return ViewerType.Email;\n }\n if (XML_MIME_TYPES.has(mimeType)) {\n return ViewerType.Xml;\n }\n return ViewerType.Unsupported;\n}\nexport function DocumentViewer({\n media,\n className,\n mimeTypeOverride,\n pdfViewerProps,\n imageViewerProps,\n videoViewerProps,\n tiffRendererProps,\n markdownRendererProps,\n excelViewerProps,\n emailViewerProps,\n xmlViewerProps,\n fileName,\n enableTiffToPdf = false\n}) {\n const mimeType = mimeTypeOverride ?? media.getMediaReference().mimeType;\n const viewerType = useMemo(() => getViewerType(mimeType, fileName), [mimeType, fileName]);\n const rootClassName = classnames(styles.container, className);\n switch (viewerType) {\n case ViewerType.Pdf:\n return /*#__PURE__*/React.createElement(PdfViewer, _extends({\n media: media,\n className: rootClassName\n }, pdfViewerProps));\n case ViewerType.Tiff:\n if (enableTiffToPdf) {\n return /*#__PURE__*/React.createElement(TiffDocumentViewer, {\n media: media,\n className: rootClassName,\n enableTiffToPdf: enableTiffToPdf,\n tiffRendererProps: tiffRendererProps,\n pdfViewerProps: pdfViewerProps\n });\n }\n return /*#__PURE__*/React.createElement(TiffViewerMedia, _extends({\n media: media,\n className: rootClassName\n }, tiffRendererProps));\n case ViewerType.Image:\n return /*#__PURE__*/React.createElement(ImageViewer, _extends({\n media: media,\n className: rootClassName\n }, imageViewerProps));\n case ViewerType.Video:\n return /*#__PURE__*/React.createElement(VideoViewer, _extends({\n media: media,\n className: rootClassName\n }, videoViewerProps));\n case ViewerType.Markdown:\n return /*#__PURE__*/React.createElement(MarkdownViewerMedia, _extends({\n media: media,\n className: rootClassName\n }, markdownRendererProps));\n case ViewerType.Excel:\n return /*#__PURE__*/React.createElement(ExcelViewer, _extends({\n media: media,\n className: rootClassName\n }, excelViewerProps));\n case ViewerType.Email:\n return /*#__PURE__*/React.createElement(EmailViewer, _extends({\n media: media,\n className: rootClassName\n }, emailViewerProps));\n case ViewerType.Xml:\n return /*#__PURE__*/React.createElement(XmlViewer, _extends({\n media: media,\n className: rootClassName\n }, xmlViewerProps));\n case ViewerType.Unsupported:\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.unsupportedContainer\n }, /*#__PURE__*/React.createElement(DocumentIcon, {\n className: styles.unsupportedIcon\n }), \"Unsupported file type: \", mimeType));\n default:\n assertUnreachable(viewerType);\n }\n}","/*\n * Copyright 2026 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\n// DocumentViewer\nimport { DocumentViewer as _DocumentViewer } from \"../../document-viewer/DocumentViewer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const DocumentViewer = withOsdkMetrics(_DocumentViewer, \"DocumentViewer\");\nexport { ViewerType } from \"../../document-viewer/DocumentViewerApi.js\";"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkJKNARBQW_cjs = require('./chunk-JKNARBQW.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkLBPOK2RE_cjs = require('./chunk-LBPOK2RE.cjs');
|
|
5
|
+
var chunk3O4IPFOY_cjs = require('./chunk-3O4IPFOY.cjs');
|
|
6
6
|
var chunkHNBSGCSZ_cjs = require('./chunk-HNBSGCSZ.cjs');
|
|
7
7
|
var chunk7LXS66DW_cjs = require('./chunk-7LXS66DW.cjs');
|
|
8
|
-
var
|
|
8
|
+
var chunkQP2LHBCZ_cjs = require('./chunk-QP2LHBCZ.cjs');
|
|
9
9
|
var chunkUCTQICPR_cjs = require('./chunk-UCTQICPR.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkQE5JP46L_cjs = require('./chunk-QE5JP46L.cjs');
|
|
11
11
|
var react = require('@osdk/react');
|
|
12
12
|
var React17 = require('react');
|
|
13
13
|
var icons = require('@blueprintjs/icons');
|
|
@@ -386,7 +386,7 @@ var FilePickerField = /* @__PURE__ */ React17.memo(function FilePickerFieldFn({
|
|
|
386
386
|
onClick: handleClear,
|
|
387
387
|
"aria-label": "Clear selection",
|
|
388
388
|
disabled
|
|
389
|
-
}, /* @__PURE__ */ React17__default.default.createElement(icons.Cross, null)), /* @__PURE__ */ React17__default.default.createElement(
|
|
389
|
+
}, /* @__PURE__ */ React17__default.default.createElement(icons.Cross, null)), /* @__PURE__ */ React17__default.default.createElement(chunkQP2LHBCZ_cjs.ActionButton, {
|
|
390
390
|
type: "button",
|
|
391
391
|
tabIndex: -1,
|
|
392
392
|
className: FilePickerField_default.osdkFilePickerBrowse,
|
|
@@ -539,7 +539,7 @@ function useInfiniteScroll({
|
|
|
539
539
|
}) {
|
|
540
540
|
const observer = React17.useRef();
|
|
541
541
|
const targetRef = React17.useRef();
|
|
542
|
-
const eventCallback =
|
|
542
|
+
const eventCallback = chunkLBPOK2RE_cjs.useEventCallback(callback);
|
|
543
543
|
const throttledCallback = React17.useCallback(lodashEs.throttle(eventCallback), []);
|
|
544
544
|
const handleObserverUpdate = React17.useCallback(
|
|
545
545
|
(entries) => {
|
|
@@ -590,7 +590,7 @@ function _extends() {
|
|
|
590
590
|
return n;
|
|
591
591
|
}, _extends.apply(null, arguments);
|
|
592
592
|
}
|
|
593
|
-
var AsyncDropdownField =
|
|
593
|
+
var AsyncDropdownField = chunkLBPOK2RE_cjs.typedReactMemo(function AsyncDropdownFieldFn({
|
|
594
594
|
isLoading,
|
|
595
595
|
hasMore,
|
|
596
596
|
isSearching,
|
|
@@ -622,7 +622,7 @@ var AsyncDropdownField = chunkMUDJXY6I_cjs.typedReactMemo(function AsyncDropdown
|
|
|
622
622
|
callback: onFetchMore,
|
|
623
623
|
loadedCount: itemCount
|
|
624
624
|
});
|
|
625
|
-
return /* @__PURE__ */ React17__default.default.createElement(
|
|
625
|
+
return /* @__PURE__ */ React17__default.default.createElement(chunkLBPOK2RE_cjs.DropdownField, _extends({}, dropdownProps, {
|
|
626
626
|
isSearchable: true,
|
|
627
627
|
popupStatus,
|
|
628
628
|
trailingItem: hasMore ? /* @__PURE__ */ React17__default.default.createElement(InfiniteScrollSentinel, {
|
|
@@ -801,7 +801,7 @@ var DEFAULT_OBJECT_ICON = {
|
|
|
801
801
|
};
|
|
802
802
|
var ICON_SIZE = icons.IconSize.STANDARD;
|
|
803
803
|
var DEFAULT_EMPTY_MESSAGE = "Object set is not defined";
|
|
804
|
-
var ObjectSetField =
|
|
804
|
+
var ObjectSetField = chunkLBPOK2RE_cjs.typedReactMemo(function ObjectSetFieldFn({
|
|
805
805
|
value,
|
|
806
806
|
emptyMessage = DEFAULT_EMPTY_MESSAGE,
|
|
807
807
|
disabled
|
|
@@ -891,7 +891,7 @@ function toComponentIcon(apiIcon) {
|
|
|
891
891
|
var RadioButtonsField_default = {};
|
|
892
892
|
|
|
893
893
|
// src/action-form/fields/RadioButtonsField.tsx
|
|
894
|
-
var RadioButtonsField =
|
|
894
|
+
var RadioButtonsField = chunkLBPOK2RE_cjs.typedReactMemo(function RadioButtonsFieldFn({
|
|
895
895
|
id,
|
|
896
896
|
value,
|
|
897
897
|
onChange,
|
|
@@ -1067,7 +1067,7 @@ function renderFieldComponent(fieldDefinition, value, onChange, error, portalCon
|
|
|
1067
1067
|
const disabled = fieldDefinition.disabled === true;
|
|
1068
1068
|
switch (fieldDefinition.fieldComponent) {
|
|
1069
1069
|
case "DATE_RANGE_INPUT":
|
|
1070
|
-
return /* @__PURE__ */ React17__default.default.createElement(
|
|
1070
|
+
return /* @__PURE__ */ React17__default.default.createElement(chunk3O4IPFOY_cjs.DateRangePicker, _extends4({
|
|
1071
1071
|
id: fieldDefinition.fieldKey,
|
|
1072
1072
|
value: coerceToDateRange(value),
|
|
1073
1073
|
onChange,
|
|
@@ -1104,7 +1104,7 @@ function renderFieldComponent(fieldDefinition, value, onChange, error, portalCon
|
|
|
1104
1104
|
disabled
|
|
1105
1105
|
}));
|
|
1106
1106
|
case "DROPDOWN": {
|
|
1107
|
-
return /* @__PURE__ */ React17__default.default.createElement(
|
|
1107
|
+
return /* @__PURE__ */ React17__default.default.createElement(chunkLBPOK2RE_cjs.DropdownField, _extends4({
|
|
1108
1108
|
id: fieldDefinition.fieldKey,
|
|
1109
1109
|
value,
|
|
1110
1110
|
onChange,
|
|
@@ -1117,7 +1117,7 @@ function renderFieldComponent(fieldDefinition, value, onChange, error, portalCon
|
|
|
1117
1117
|
}));
|
|
1118
1118
|
}
|
|
1119
1119
|
case "DATETIME_PICKER":
|
|
1120
|
-
return /* @__PURE__ */ React17__default.default.createElement(
|
|
1120
|
+
return /* @__PURE__ */ React17__default.default.createElement(chunk3O4IPFOY_cjs.DatePicker, _extends4({
|
|
1121
1121
|
id: fieldDefinition.fieldKey,
|
|
1122
1122
|
placeholder: fieldDefinition.placeholder,
|
|
1123
1123
|
value: value instanceof Date ? value : null,
|
|
@@ -1199,10 +1199,10 @@ function resolvePortalContainer(fieldComponentProps, formPortalContainer) {
|
|
|
1199
1199
|
return Object.hasOwn(fieldComponentProps, "portalContainer") ? fieldComponentProps.portalContainer : formPortalContainer;
|
|
1200
1200
|
}
|
|
1201
1201
|
function coerceToDateRange(value) {
|
|
1202
|
-
if (!Array.isArray(value) || value.length !== 2) return
|
|
1202
|
+
if (!Array.isArray(value) || value.length !== 2) return chunk3O4IPFOY_cjs.EMPTY_RANGE;
|
|
1203
1203
|
const start = value[0] instanceof Date ? value[0] : null;
|
|
1204
1204
|
const end = value[1] instanceof Date ? value[1] : null;
|
|
1205
|
-
if (start == null && end == null) return
|
|
1205
|
+
if (start == null && end == null) return chunk3O4IPFOY_cjs.EMPTY_RANGE;
|
|
1206
1206
|
return [start, end];
|
|
1207
1207
|
}
|
|
1208
1208
|
function isFileArray(value) {
|
|
@@ -1533,7 +1533,7 @@ var SubmitButton = /* @__PURE__ */ React17.memo(function SubmitButtonFn({
|
|
|
1533
1533
|
onClick
|
|
1534
1534
|
}) {
|
|
1535
1535
|
const buttonLabel = isPending ? "Submitting\u2026" : buttonText;
|
|
1536
|
-
const button = /* @__PURE__ */ React17__default.default.createElement(
|
|
1536
|
+
const button = /* @__PURE__ */ React17__default.default.createElement(chunkQP2LHBCZ_cjs.ActionButton, {
|
|
1537
1537
|
type: "button",
|
|
1538
1538
|
variant: buttonVariant,
|
|
1539
1539
|
disabled: isSubmitDisabled || isPending,
|
|
@@ -1747,7 +1747,7 @@ function _extends5() {
|
|
|
1747
1747
|
}
|
|
1748
1748
|
var EMPTY_FIELD_DEFINITIONS = [];
|
|
1749
1749
|
var EMPTY_FORM_CONTENT = [];
|
|
1750
|
-
var ActionForm =
|
|
1750
|
+
var ActionForm = chunkLBPOK2RE_cjs.typedReactMemo(function ActionFormFn({
|
|
1751
1751
|
actionDefinition,
|
|
1752
1752
|
formTitle,
|
|
1753
1753
|
showFormTitle = false,
|
|
@@ -1852,9 +1852,9 @@ var ActionForm = chunkMUDJXY6I_cjs.typedReactMemo(function ActionFormFn({
|
|
|
1852
1852
|
});
|
|
1853
1853
|
|
|
1854
1854
|
// src/public/experimental/action-form.ts
|
|
1855
|
-
var ActionForm2 =
|
|
1855
|
+
var ActionForm2 = chunkQE5JP46L_cjs.withOsdkMetrics(ActionForm, "ActionForm");
|
|
1856
1856
|
|
|
1857
1857
|
exports.ActionForm = ActionForm2;
|
|
1858
1858
|
exports.BaseForm = BaseForm;
|
|
1859
|
-
//# sourceMappingURL=chunk-
|
|
1860
|
-
//# sourceMappingURL=chunk-
|
|
1859
|
+
//# sourceMappingURL=chunk-DED346LG.cjs.map
|
|
1860
|
+
//# sourceMappingURL=chunk-DED346LG.cjs.map
|