pdf-tsx 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +19 -20
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -149,10 +149,9 @@ A collapsible icon sidebar. Each panel has an icon button — clicking it toggle
149
149
 
150
150
  ```tsx
151
151
  import { PDFSidebar } from 'pdf-tsx'
152
- import { FiImage, FiList, FiChevronsLeft } from 'react-icons/fi'
152
+ import { FiImage, FiList } from 'react-icons/fi'
153
153
 
154
154
  <PDFSidebar
155
- collapseIcon={<FiChevronsLeft size={16} />}
156
155
  panels={[
157
156
  { icon: <FiImage size={18} />, label: 'Thumbnails', content: <PDFThumbnails /> },
158
157
  { icon: <FiList size={18} />, label: 'Outline', content: <PDFOutline /> },
@@ -160,10 +159,9 @@ import { FiImage, FiList, FiChevronsLeft } from 'react-icons/fi'
160
159
  />
161
160
  ```
162
161
 
163
- | Prop | Type | Description |
164
- |----------------|------------------|------------------------------------------------------------------|
165
- | `panels` | `SidebarPanel[]` | Array of panels to display |
166
- | `collapseIcon` | `ReactNode` | If provided, renders a toggle button at the top of the icon bar to hide the sidebar |
162
+ | Prop | Type | Description |
163
+ |----------|------------------|------------------------------|
164
+ | `panels` | `SidebarPanel[]` | Array of panels to display |
167
165
 
168
166
  **SidebarPanel**
169
167
 
@@ -178,24 +176,21 @@ import { FiImage, FiList, FiChevronsLeft } from 'react-icons/fi'
178
176
  Use `PDFSidebarToggle` in the toolbar alongside `PDFSidebar`. When the sidebar is open, the collapse button lives inside the sidebar. When collapsed, the expand button appears in the toolbar.
179
177
 
180
178
  ```tsx
181
- import { PDFSidebar, PDFSidebarToggle } from 'pdf-tsx'
182
- import { FiChevronsLeft, FiChevronsRight } from 'react-icons/fi'
179
+ import { PDFSidebar, PDFSidebarToggle, PDFToolbar } from 'pdf-tsx'
180
+ import { FiChevronsLeft, FiChevronsRight, FiMoreHorizontal } from 'react-icons/fi'
183
181
 
184
182
  <PDFViewer
185
183
  sidebar={
186
- <PDFSidebar
187
- collapseIcon={<FiChevronsLeft size={16} />}
188
- panels={[...]}
189
- />
184
+ <PDFSidebar panels={[...]} />
190
185
  }
191
186
  toolbar={
192
- <>
187
+ <PDFToolbar overflowIcon={<FiMoreHorizontal size={16} />}>
193
188
  <PDFSidebarToggle
194
189
  collapseIcon={<FiChevronsLeft size={16} />}
195
190
  expandIcon={<FiChevronsRight size={16} />}
196
191
  />
197
192
  {/* other toolbar items */}
198
- </>
193
+ </PDFToolbar>
199
194
  }
200
195
  />
201
196
  ```
@@ -312,7 +307,7 @@ The badge uses `var(--pdf-accent)` and respects `themeOverrides`.
312
307
  ```tsx
313
308
  import { useState, Suspense, lazy } from 'react'
314
309
  import {
315
- PDFSidebar, PDFSidebarToggle, PDFToolbar,
310
+ PDFSidebar, PDFSidebarToggle, PDFToolbar, PDFToolbarItem,
316
311
  PDFThumbnails, PDFOutline, PDFSearch,
317
312
  PDFZoomControls, PDFPageFit, PDFRotationControl,
318
313
  PDFNavigation, PDFDownloadButton, PDFChangeFile,
@@ -350,10 +345,10 @@ function App() {
350
345
  <PDFViewer
351
346
  file={file}
352
347
  workerSrc={workerUrl}
348
+ defaultFit="width"
353
349
  onChangeFile={setFile}
354
350
  sidebar={
355
351
  <PDFSidebar
356
- collapseIcon={<FiChevronsLeft size={16} />}
357
352
  panels={[
358
353
  { icon: <FiImage size={18} />, label: 'Thumbnails', content: <PDFThumbnails /> },
359
354
  { icon: <FiList size={18} />, label: 'Outline', content: <PDFOutline /> },
@@ -376,13 +371,17 @@ function App() {
376
371
  clearIcon={<FiX size={14} />}
377
372
  />
378
373
  <PDFZoomControls zoomOutIcon={<FiZoomOut size={16} />} zoomInIcon={<FiZoomIn size={16} />} />
379
- <PDFPageFit fitWidthIcon={<FiAlignJustify size={16} />} fitPageIcon={<FiMaximize2 size={16} />} />
380
374
  <PDFRotationControl icon={<FiRotateCw size={16} />} />
381
- <PDFNavigation prevIcon={<FiChevronLeft size={16} />} nextIcon={<FiChevronRight size={16} />} />
382
- <PDFChangeFile icon={<FiFolderPlus size={16} />} />
383
- <PDFDownloadButton icon={<FiDownload size={15} />} />
375
+ <PDFPageFit fitWidthIcon={<FiAlignJustify size={16} />} fitPageIcon={<FiMaximize2 size={16} />} />
384
376
  <PDFThemeToggle lightIcon={<FiSun size={16} />} darkIcon={<FiMoon size={16} />} />
385
377
  <PDFPrintButton icon={<FiPrinter size={16} />} />
378
+ <PDFChangeFile icon={<FiFolderPlus size={16} />} />
379
+ <PDFDownloadButton icon={<FiDownload size={15} />} />
380
+ <PDFNavigation prevIcon={<FiChevronLeft size={16} />} nextIcon={<FiChevronRight size={16} />} />
381
+ {/* custom button with overflow label */}
382
+ <PDFToolbarItem label="Share">
383
+ <button onClick={() => {}}>Share</button>
384
+ </PDFToolbarItem>
386
385
  </PDFToolbar>
387
386
  }
388
387
  />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdf-tsx",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "A fully-featured, composable PDF viewer component for React",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.cjs",
@@ -53,6 +53,7 @@
53
53
  "eslint-plugin-react-refresh": "^0.5.2",
54
54
  "globals": "^16.5.0",
55
55
  "react-icons": "^5.6.0",
56
+ "react-scan": "^0.5.6",
56
57
  "typescript": "~5.9.3",
57
58
  "typescript-eslint": "^8.58.1",
58
59
  "vite": "^8.0.8",