@algenium/blocks 1.7.0-rc.4 → 1.7.0-rc.5

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/dist/index.cjs CHANGED
@@ -8224,7 +8224,7 @@ function PdfThumbnailStrip({
8224
8224
  const canvas = canvasRef.current;
8225
8225
  if (!canvas) return;
8226
8226
  const viewport = page.getViewport({ scale: 1 });
8227
- const thumbMax = 112;
8227
+ const thumbMax = 176;
8228
8228
  const s = thumbMax / Math.max(viewport.width, viewport.height);
8229
8229
  const vp = page.getViewport({ scale: s });
8230
8230
  const ctx = canvas.getContext("2d");
@@ -8248,8 +8248,8 @@ function PdfThumbnailStrip({
8248
8248
  type: "button",
8249
8249
  onClick: () => onPick(pageNumber),
8250
8250
  className: cn(
8251
- "flex w-full flex-col items-center gap-1 rounded-md p-1 transition-colors hover:bg-muted/80",
8252
- active ? "bg-muted ring-2 ring-ring" : ""
8251
+ "flex w-full flex-col items-center gap-1 rounded-md p-2 transition-colors hover:bg-white/5",
8252
+ active ? "bg-white/10" : ""
8253
8253
  ),
8254
8254
  "aria-label": label,
8255
8255
  "aria-current": active ? "page" : void 0,
@@ -8258,11 +8258,11 @@ function PdfThumbnailStrip({
8258
8258
  "canvas",
8259
8259
  {
8260
8260
  ref: canvasRef,
8261
- className: "block max-w-full rounded-sm shadow-sm",
8261
+ className: "block max-w-full overflow-hidden rounded-sm bg-black",
8262
8262
  "aria-hidden": true
8263
8263
  }
8264
8264
  ),
8265
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-[10px] tabular-nums", children: pageNumber })
8265
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] tabular-nums text-neutral-400", children: pageNumber })
8266
8266
  ]
8267
8267
  }
8268
8268
  );
@@ -8297,6 +8297,7 @@ function PdfViewer({
8297
8297
  const errorLabelFallback = mergedLabels.error ?? "Failed to load PDF";
8298
8298
  const toolbarId = React2.useId();
8299
8299
  const pageInputId = `${toolbarId}-page`;
8300
+ const thumbnailNavId = `${toolbarId}-thumbnails`;
8300
8301
  const scrollRef = React2.useRef(null);
8301
8302
  const observerRef = React2.useRef(null);
8302
8303
  const lastReportedPage = React2.useRef(0);
@@ -8638,6 +8639,7 @@ function PdfViewer({
8638
8639
  resetZoomAct
8639
8640
  ]
8640
8641
  );
8642
+ const thumbnailsRailEligible = enableThumbnailSidebar && !busy && pagesMap !== null && pageCount > 0;
8641
8643
  if (loadError) {
8642
8644
  return /* @__PURE__ */ jsxRuntime.jsx(
8643
8645
  "div",
@@ -8667,6 +8669,20 @@ function PdfViewer({
8667
8669
  toolbarClassName
8668
8670
  ),
8669
8671
  children: [
8672
+ thumbnailsRailEligible ? /* @__PURE__ */ jsxRuntime.jsx(
8673
+ Button,
8674
+ {
8675
+ type: "button",
8676
+ variant: "outline",
8677
+ size: "icon-sm",
8678
+ className: "hidden md:inline-flex",
8679
+ onClick: () => setThumbnailSidebarOpen((v) => !v),
8680
+ "aria-label": toggleThumbLabel,
8681
+ "aria-expanded": thumbnailSidebarOpen,
8682
+ "aria-controls": thumbnailNavId,
8683
+ children: thumbnailSidebarOpen ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeftOpen, { className: "size-4", "aria-hidden": true }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelRightOpen, { className: "size-4", "aria-hidden": true })
8684
+ }
8685
+ ) : null,
8670
8686
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-xs tabular-nums sm:text-sm", children: busy || pagesMap === null ? "\u2014" : pageOfFormatter(currentVisiblePage, pageCount) }),
8671
8687
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: pageInputId, className: "sr-only", children: resolvedGoToLabel }),
8672
8688
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -8742,12 +8758,13 @@ function PdfViewer({
8742
8758
  }
8743
8759
  ),
8744
8760
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-0 flex-1 overflow-hidden", children: [
8745
- enableThumbnailSidebar && !busy && pagesMap !== null && pageCount > 0 && thumbnailSidebarOpen ? /* @__PURE__ */ jsxRuntime.jsx(
8761
+ thumbnailsRailEligible && thumbnailSidebarOpen ? /* @__PURE__ */ jsxRuntime.jsx(
8746
8762
  "nav",
8747
8763
  {
8748
- className: "bg-muted/30 flex w-[132px] shrink-0 flex-col overflow-y-auto border-r py-2 pl-2 pr-1",
8764
+ id: thumbnailNavId,
8765
+ className: "hidden w-[220px] shrink-0 flex-col overflow-y-auto border-r border-neutral-900 bg-black py-3 pl-3 pr-2 md:flex",
8749
8766
  "aria-label": thumbnailSidebarLabel,
8750
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: layouts.map((layout) => {
8767
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: layouts.map((layout) => {
8751
8768
  const pg = pagesMap.get(layout.pageNumber);
8752
8769
  return pg ? /* @__PURE__ */ jsxRuntime.jsx(
8753
8770
  PdfThumbnailStrip,
@@ -8763,45 +8780,32 @@ function PdfViewer({
8763
8780
  }) })
8764
8781
  }
8765
8782
  ) : null,
8766
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-0 min-w-0 flex-1", children: [
8767
- enableThumbnailSidebar && !busy && pagesMap !== null && pageCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
8768
- "button",
8769
- {
8770
- type: "button",
8771
- className: "text-muted-foreground hover:bg-muted/60 flex w-9 shrink-0 flex-col items-center justify-center border-r bg-transparent transition-colors",
8772
- onClick: () => setThumbnailSidebarOpen((v) => !v),
8773
- "aria-label": toggleThumbLabel,
8774
- "aria-expanded": thumbnailSidebarOpen,
8775
- children: thumbnailSidebarOpen ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "size-4", "aria-hidden": true }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "size-4", "aria-hidden": true })
8776
- }
8777
- ) : null,
8778
- /* @__PURE__ */ jsxRuntime.jsx(
8779
- "div",
8780
- {
8781
- ref: scrollRef,
8782
- tabIndex: 0,
8783
- onKeyDown: handleKeyDown,
8784
- className: "relative min-h-[240px] min-w-0 flex-1 overflow-auto outline-none focus-visible:ring-2 focus-visible:ring-ring",
8785
- "aria-busy": busy,
8786
- "aria-label": busy ? loadingLabel : "PDF pages",
8787
- children: busy || pagesMap === null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground p-6 text-sm", children: loadingLabel }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center gap-4 pb-8 pt-2", children: layouts.map((layout) => {
8788
- const pg = pagesMap.get(layout.pageNumber);
8789
- const visible = (ratios[layout.pageNumber] ?? 0) >= 1e-3;
8790
- return pg ? /* @__PURE__ */ jsxRuntime.jsx(
8791
- PdfPageCanvas,
8792
- {
8793
- page: pg,
8794
- layout,
8795
- scale,
8796
- visible,
8797
- pageClassName
8798
- },
8799
- layout.pageNumber
8800
- ) : null;
8801
- }) })
8802
- }
8803
- )
8804
- ] })
8783
+ /* @__PURE__ */ jsxRuntime.jsx(
8784
+ "div",
8785
+ {
8786
+ ref: scrollRef,
8787
+ tabIndex: 0,
8788
+ onKeyDown: handleKeyDown,
8789
+ className: "relative min-h-[240px] min-w-0 flex-1 overflow-auto outline-none focus-visible:ring-2 focus-visible:ring-ring",
8790
+ "aria-busy": busy,
8791
+ "aria-label": busy ? loadingLabel : "PDF pages",
8792
+ children: busy || pagesMap === null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground p-6 text-sm", children: loadingLabel }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center gap-4 pb-8 pt-2", children: layouts.map((layout) => {
8793
+ const pg = pagesMap.get(layout.pageNumber);
8794
+ const visible = (ratios[layout.pageNumber] ?? 0) >= 1e-3;
8795
+ return pg ? /* @__PURE__ */ jsxRuntime.jsx(
8796
+ PdfPageCanvas,
8797
+ {
8798
+ page: pg,
8799
+ layout,
8800
+ scale,
8801
+ visible,
8802
+ pageClassName
8803
+ },
8804
+ layout.pageNumber
8805
+ ) : null;
8806
+ }) })
8807
+ }
8808
+ )
8805
8809
  ] })
8806
8810
  ]
8807
8811
  }