Skip to content

armgit / ui

Public Imported from GitHub
0
TypeScript

Simplify PDF block resizables and document splitter DnD

Andrew Luo57d77608c269
diff --git a/.playwright-cli/console-2026-05-14T22-33-45-490Z.log b/.playwright-cli/console-2026-05-14T22-33-45-490Z.log
new file mode 100644
index 0000000..30e3601
--- /dev/null
+++ b/.playwright-cli/console-2026-05-14T22-33-45-490Z.log
@@ -0,0 +1,77 @@
+[ 285586ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 285633ms] [LOG] [Fast Refresh] done in 148ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 380341ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 380801ms] [LOG] [Fast Refresh] done in 447ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 394243ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 394466ms] [LOG] [Fast Refresh] done in 301ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 409817ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 409836ms] [LOG] [Fast Refresh] done in 119ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 487578ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 488294ms] [LOG] [Fast Refresh] done in 683ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 495517ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 495699ms] [LOG] [Fast Refresh] done in 244ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 1317909ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 1921612ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 1921652ms] [LOG] [Fast Refresh] done in 140ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2124524ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2124803ms] [LOG] [Fast Refresh] done in 357ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2132399ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2132597ms] [LOG] [Fast Refresh] done in 273ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2144836ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2145008ms] [LOG] [Fast Refresh] done in 245ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2790258ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2790294ms] [LOG] [Fast Refresh] done in 140ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2892850ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2893195ms] [LOG] [Fast Refresh] done in 303ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2893593ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2893766ms] [LOG] [Fast Refresh] done in 275ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2894143ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2894208ms] [LOG] [Fast Refresh] done in 167ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2895145ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2895157ms] [LOG] [Fast Refresh] done in 112ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2895675ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2895694ms] [LOG] [Fast Refresh] done in 120ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2909276ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2909484ms] [LOG] [Fast Refresh] done in 277ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2909604ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2909695ms] [LOG] [Fast Refresh] done in 192ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2909869ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2909972ms] [LOG] [Fast Refresh] done in 205ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2911086ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2911089ms] [LOG] [Fast Refresh] done in 105ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2911226ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2911246ms] [LOG] [Fast Refresh] done in 121ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2911348ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2911386ms] [LOG] [Fast Refresh] done in 140ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2911543ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2911553ms] [LOG] [Fast Refresh] done in 111ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2911657ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2911810ms] [LOG] [Fast Refresh] done in 254ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2912009ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2912469ms] [LOG] [Fast Refresh] done in 561ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2926118ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2926282ms] [LOG] [Fast Refresh] done in 256ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2926599ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2926662ms] [LOG] [Fast Refresh] done in 164ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2927227ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2927275ms] [LOG] [Fast Refresh] done in 149ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2927588ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2927591ms] [LOG] [Fast Refresh] done in 104ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2927916ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2927921ms] [LOG] [Fast Refresh] done in 107ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2936056ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2936237ms] [LOG] [Fast Refresh] done in 242ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2936346ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2936384ms] [LOG] [Fast Refresh] done in 139ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2937381ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2937433ms] [LOG] [Fast Refresh] done in 154ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2958117ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2958316ms] [LOG] [Fast Refresh] done in 280ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2978527ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2978679ms] [LOG] [Fast Refresh] done in 225ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2989592ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 2989749ms] [LOG] [Fast Refresh] done in 236ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 3065796ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 3066067ms] [LOG] [Fast Refresh] done in 339ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 3117581ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 3117968ms] [LOG] [Fast Refresh] done in 469ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
diff --git a/.playwright-cli/console-2026-05-14T22-38-30-447Z.log b/.playwright-cli/console-2026-05-14T22-38-30-447Z.log
new file mode 100644
index 0000000..7da80a8
--- /dev/null
+++ b/.playwright-cli/console-2026-05-14T22-38-30-447Z.log
@@ -0,0 +1,56 @@
+[ 441ms] [INFO] %cDownload the React DevTools for a better development experience: https://react.dev/link/react-devtools font-weight:bold @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 526ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 619ms] [ERROR] Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. Consider using template tag instead (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template). @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:3318
+[ 745ms] Error: Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
+
+- A server/client branch `if (typeof window !== 'undefined')`.
+- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
+- Date formatting in a user's locale which doesn't match the server.
+- External changing data without sending a snapshot of it along with the HTML.
+- Invalid HTML tag nesting.
+
+It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
+
+https://react.dev/link/hydration-mismatch
+
+ ...
+ <InnerLayoutRouter url="/blocks" tree={[...]} params={{}} cacheNode={{rsc:{...}, ...}} segmentPath={[...]} ...>
+ <SegmentViewNode type="page" pagePath="(app)/bloc...">
+ <SegmentTrieNode>
+ <BlocksPage>
+ <PdfViewerBlocks>
+ <section className="space-y-12">
+ <PdfViewerBlockPreview block={{id:"pdf-dr...", ...}}>
+ <article id="pdf-dropzone" className="space-y-3">
+ <div>
+ <div className="overflow-h...">
+ <div>
+ <div className="bg-background">
+ <PdfDropzoneBlock>
+ <div className="grid h-[72...">
+ <FileUpload accept="applicatio..." acceptedFileTypes={[...]} browseLabel="Browse PDF" ...>
+ <div className="space-y-3 ...">
+ <style>
++ {"... rgba(0, 0, 0, 0.08) 57%,\n rgba(0, 0, 0, 0.2) 60%,\n rgba(0, 0..."}
+- {"... rgba(255, 255, 255, 0.1) 57%,\n rgba(255, 255, 255, 0.3) 60%,\n ..."}
+ ...
+ ...
+ ...
+
+ at throwOnHydrationMismatch (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3318:56)
+ at prepareToHydrateHostInstance (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3372:23)
+ at completeWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6922:60)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at completeUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9622:23)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9557:28)
+ at workLoopConcurrentByScheduler (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9551:58)
+ at renderRootConcurrent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9534:71)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9061:150)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 95383ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 95883ms] [LOG] [Fast Refresh] done in 445ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 109287ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 109492ms] [LOG] [Fast Refresh] done in 295ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 124860ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 124879ms] [LOG] [Fast Refresh] done in 119ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
diff --git a/.playwright-cli/console-2026-05-14T22-41-00-756Z.log b/.playwright-cli/console-2026-05-14T22-41-00-756Z.log
new file mode 100644
index 0000000..6fa46d7
--- /dev/null
+++ b/.playwright-cli/console-2026-05-14T22-41-00-756Z.log
@@ -0,0 +1,63 @@
+[ 277ms] [INFO] %cDownload the React DevTools for a better development experience: https://react.dev/link/react-devtools font-weight:bold @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 361ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 456ms] [ERROR] Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. Consider using template tag instead (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template). @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:3318
+[ 574ms] Error: Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
+
+- A server/client branch `if (typeof window !== 'undefined')`.
+- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
+- Date formatting in a user's locale which doesn't match the server.
+- External changing data without sending a snapshot of it along with the HTML.
+- Invalid HTML tag nesting.
+
+It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
+
+https://react.dev/link/hydration-mismatch
+
+ ...
+ <InnerLayoutRouter url="/blocks" tree={[...]} params={{}} cacheNode={{rsc:{...}, ...}} segmentPath={[...]} ...>
+ <SegmentViewNode type="page" pagePath="(app)/bloc...">
+ <SegmentTrieNode>
+ <BlocksPage>
+ <PdfViewerBlocks>
+ <section className="space-y-12">
+ <PdfViewerBlockPreview block={{id:"pdf-dr...", ...}}>
+ <article id="pdf-dropzone" className="space-y-3">
+ <div>
+ <div className="overflow-h...">
+ <div>
+ <div className="bg-background">
+ <PdfDropzoneBlock>
+ <div className="grid h-[72...">
+ <FileUpload accept="applicatio..." acceptedFileTypes={[...]} browseLabel="Browse PDF" ...>
+ <div className="space-y-3 ...">
+ <style>
++ {"... rgba(0, 0, 0, 0.08) 57%,\n rgba(0, 0, 0, 0.2) 60%,\n rgba(0, 0..."}
+- {"... rgba(255, 255, 255, 0.1) 57%,\n rgba(255, 255, 255, 0.3) 60%,\n ..."}
+ ...
+ ...
+ ...
+
+ at throwOnHydrationMismatch (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3318:56)
+ at prepareToHydrateHostInstance (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3372:23)
+ at completeWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6922:60)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at completeUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9622:23)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9557:28)
+ at workLoopConcurrentByScheduler (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9551:58)
+ at renderRootConcurrent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9534:71)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9061:150)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 52312ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 53032ms] [LOG] [Fast Refresh] done in 818ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 60252ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 60434ms] [LOG] [Fast Refresh] done in 245ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 882625ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 1486347ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 1486386ms] [LOG] [Fast Refresh] done in 140ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 1689258ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 1689796ms] [LOG] [Fast Refresh] done in 638ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 1697132ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 1697343ms] [LOG] [Fast Refresh] done in 266ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 1709570ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 1709760ms] [LOG] [Fast Refresh] done in 238ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
diff --git a/.playwright-cli/console-2026-05-14T23-09-50-842Z.log b/.playwright-cli/console-2026-05-14T23-09-50-842Z.log
new file mode 100644
index 0000000..2babb25
--- /dev/null
+++ b/.playwright-cli/console-2026-05-14T23-09-50-842Z.log
@@ -0,0 +1,346 @@
+[ 288ms] [INFO] %cDownload the React DevTools for a better development experience: https://react.dev/link/react-devtools font-weight:bold @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 369ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 670ms] [ERROR] Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. Consider using template tag instead (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template). @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:3318
+[ 738ms] Error: Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
+
+- A server/client branch `if (typeof window !== 'undefined')`.
+- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
+- Date formatting in a user's locale which doesn't match the server.
+- External changing data without sending a snapshot of it along with the HTML.
+- Invalid HTML tag nesting.
+
+It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
+
+https://react.dev/link/hydration-mismatch
+
+ ...
+ <InnerLayoutRouter url="/blocks" tree={[...]} params={{}} cacheNode={{rsc:{...}, ...}} segmentPath={[...]} ...>
+ <SegmentViewNode type="page" pagePath="(app)/bloc...">
+ <SegmentTrieNode>
+ <BlocksPage>
+ <PdfViewerBlocks>
+ <section className="space-y-12">
+ <PdfViewerBlockPreview block={{id:"pdf-dr...", ...}}>
+ <article id="pdf-dropzone" className="space-y-3">
+ <div>
+ <div className="overflow-h...">
+ <div>
+ <div className="bg-background">
+ <PdfDropzoneBlock>
+ <div className="grid h-[72...">
+ <FileUpload accept="applicatio..." acceptedFileTypes={[...]} browseLabel="Browse PDF" ...>
+ <div className="space-y-3 ...">
+ <style>
++ {"... rgba(0, 0, 0, 0.08) 57%,\n rgba(0, 0, 0, 0.2) 60%,\n rgba(0, 0..."}
+- {"... rgba(255, 255, 255, 0.1) 57%,\n rgba(255, 255, 255, 0.3) 60%,\n ..."}
+ ...
+ ...
+ ...
+
+ at throwOnHydrationMismatch (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3318:56)
+ at prepareToHydrateHostInstance (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3372:23)
+ at completeWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6922:60)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at completeUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9622:23)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9557:28)
+ at workLoopConcurrentByScheduler (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9551:58)
+ at renderRootConcurrent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9534:71)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9061:150)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 624906ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 624943ms] [LOG] [Fast Refresh] done in 140ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 727495ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 728072ms] ReferenceError: verticalListSortingStrategy is not defined
+ at SplitterGroupsPane (http://localhost:4000/_next/static/chunks/apps_v4_102_iax._.js?id=%255Bproject%255D%252Fapps%252Fv4%252Fcomponents%252Fdocument-splitter-docs.tsx+%255Bapp-client%255D+%2528ecmascript%2529:1026:35)
+ at Object.react_stack_bottom_frame (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:15037:24)
+ at renderWithHooks (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:4620:24)
+ at updateFunctionComponent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6081:21)
+ at beginWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6691:24)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9555:97)
+ at workLoopSync (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9449:40)
+ at renderRootSync (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9433:13)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9098:47)
+ at performSyncWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10263:9)
+ at flushSyncWorkAcrossRoots_impl (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10179:316)
+ at flushSyncWork$1 (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9230:86)
+ at Object.scheduleRefresh (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:299:13)
+ at http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:391:33
+ at Set.forEach (<anonymous>)
+ at Object.performReactRefresh (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:384:38)
+ at applyUpdate (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:878:31)
+ at http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:886:13
+[ 727990ms] [LOG] [Fast Refresh] done in 457ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 728103ms] [WARNING] [Fast Refresh] performing full reload because your application had an unrecoverable error @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 728240ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 728415ms] [LOG] [Fast Refresh] done in 275ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 728791ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 728856ms] [LOG] [Fast Refresh] done in 167ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 729168ms] [INFO] %cDownload the React DevTools for a better development experience: https://react.dev/link/react-devtools font-weight:bold @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 729260ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 729389ms] [ERROR] Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. Consider using template tag instead (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template). @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:3318
+[ 729568ms] Error: Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
+
+- A server/client branch `if (typeof window !== 'undefined')`.
+- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
+- Date formatting in a user's locale which doesn't match the server.
+- External changing data without sending a snapshot of it along with the HTML.
+- Invalid HTML tag nesting.
+
+It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
+
+https://react.dev/link/hydration-mismatch
+
+ ...
+ <InnerLayoutRouter url="/blocks" tree={[...]} params={{}} cacheNode={{rsc:{...}, ...}} segmentPath={[...]} ...>
+ <SegmentViewNode type="page" pagePath="(app)/bloc...">
+ <SegmentTrieNode>
+ <BlocksPage>
+ <PdfViewerBlocks>
+ <section className="space-y-12">
+ <PdfViewerBlockPreview block={{id:"pdf-dr...", ...}}>
+ <article id="pdf-dropzone" className="space-y-3">
+ <div>
+ <div className="overflow-h...">
+ <div>
+ <div className="bg-background">
+ <PdfDropzoneBlock>
+ <div className="grid h-[72...">
+ <FileUpload accept="applicatio..." acceptedFileTypes={[...]} browseLabel="Browse PDF" ...>
+ <div className="space-y-3 ...">
+ <style>
++ {"... rgba(0, 0, 0, 0.08) 57%,\n rgba(0, 0, 0, 0.2) 60%,\n rgba(0, 0..."}
+- {"... rgba(255, 255, 255, 0.1) 57%,\n rgba(255, 255, 255, 0.3) 60%,\n ..."}
+ ...
+ ...
+ ...
+
+ at throwOnHydrationMismatch (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3318:56)
+ at prepareToHydrateHostInstance (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3372:23)
+ at completeWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6922:60)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at completeUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9622:23)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9557:28)
+ at workLoopConcurrentByScheduler (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9551:58)
+ at renderRootConcurrent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9534:71)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9061:150)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 730262ms] ReferenceError: verticalListSortingStrategy is not defined
+ at SplitterGroupsPane (http://localhost:4000/_next/static/chunks/apps_v4_102_iax._.js:4787:35)
+ at Object.react_stack_bottom_frame (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:15037:24)
+ at renderWithHooks (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:4620:24)
+ at updateFunctionComponent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6081:21)
+ at beginWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6691:24)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9555:97)
+ at workLoopSync (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9449:40)
+ at renderRootSync (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9433:13)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9098:47)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 743924ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 744122ms] [WARNING] [Fast Refresh] performing full reload because your application had an unrecoverable error @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 744132ms] [LOG] [Fast Refresh] done in 298ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 744253ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 744343ms] [LOG] [Fast Refresh] done in 192ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 744517ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 744620ms] [LOG] [Fast Refresh] done in 205ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 745262ms] [INFO] %cDownload the React DevTools for a better development experience: https://react.dev/link/react-devtools font-weight:bold @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 745327ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 745667ms] [ERROR] Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. Consider using template tag instead (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template). @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:3318
+[ 745823ms] Error: Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
+
+- A server/client branch `if (typeof window !== 'undefined')`.
+- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
+- Date formatting in a user's locale which doesn't match the server.
+- External changing data without sending a snapshot of it along with the HTML.
+- Invalid HTML tag nesting.
+
+It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
+
+https://react.dev/link/hydration-mismatch
+
+ ...
+ <InnerLayoutRouter url="/blocks" tree={[...]} params={{}} cacheNode={{rsc:{...}, ...}} segmentPath={[...]} ...>
+ <SegmentViewNode type="page" pagePath="(app)/bloc...">
+ <SegmentTrieNode>
+ <BlocksPage>
+ <PdfViewerBlocks>
+ <section className="space-y-12">
+ <PdfViewerBlockPreview block={{id:"pdf-dr...", ...}}>
+ <article id="pdf-dropzone" className="space-y-3">
+ <div>
+ <div className="overflow-h...">
+ <div>
+ <div className="bg-background">
+ <PdfDropzoneBlock>
+ <div className="grid h-[72...">
+ <FileUpload accept="applicatio..." acceptedFileTypes={[...]} browseLabel="Browse PDF" ...>
+ <div className="space-y-3 ...">
+ <style>
++ {"... rgba(0, 0, 0, 0.08) 57%,\n rgba(0, 0, 0, 0.2) 60%,\n rgba(0, 0..."}
+- {"... rgba(255, 255, 255, 0.1) 57%,\n rgba(255, 255, 255, 0.3) 60%,\n ..."}
+ ...
+ ...
+ ...
+
+ at throwOnHydrationMismatch (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3318:56)
+ at prepareToHydrateHostInstance (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3372:23)
+ at completeWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6922:60)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at completeUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9622:23)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9557:28)
+ at workLoopConcurrentByScheduler (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9551:58)
+ at renderRootConcurrent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9534:71)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9061:150)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 746354ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 746480ms] [LOG] [Fast Refresh] done in 275ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 746864ms] ReferenceError: verticalListSortingStrategy is not defined
+ at SplitterGroupsPane (http://localhost:4000/_next/static/chunks/apps_v4_102_iax._.js:4777:35)
+ at Object.react_stack_bottom_frame (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:15037:24)
+ at renderWithHooks (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:4620:24)
+ at updateFunctionComponent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6081:21)
+ at beginWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6691:24)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9555:97)
+ at workLoopSync (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9449:40)
+ at renderRootSync (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9433:13)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9098:47)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 746884ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 747117ms] [LOG] [Fast Refresh] done in 508ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 760765ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 760938ms] [WARNING] [Fast Refresh] performing full reload because your application had an unrecoverable error @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 760943ms] [LOG] [Fast Refresh] done in 272ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 761246ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 761310ms] [LOG] [Fast Refresh] done in 164ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 761581ms] [INFO] %cDownload the React DevTools for a better development experience: https://react.dev/link/react-devtools font-weight:bold @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 761671ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 761780ms] [ERROR] Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. Consider using template tag instead (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template). @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:3318
+[ 761969ms] Error: Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
+
+- A server/client branch `if (typeof window !== 'undefined')`.
+- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
+- Date formatting in a user's locale which doesn't match the server.
+- External changing data without sending a snapshot of it along with the HTML.
+- Invalid HTML tag nesting.
+
+It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
+
+https://react.dev/link/hydration-mismatch
+
+ ...
+ <InnerLayoutRouter url="/blocks" tree={[...]} params={{}} cacheNode={{rsc:{...}, ...}} segmentPath={[...]} ...>
+ <SegmentViewNode type="page" pagePath="(app)/bloc...">
+ <SegmentTrieNode>
+ <BlocksPage>
+ <PdfViewerBlocks>
+ <section className="space-y-12">
+ <PdfViewerBlockPreview block={{id:"pdf-dr...", ...}}>
+ <article id="pdf-dropzone" className="space-y-3">
+ <div>
+ <div className="overflow-h...">
+ <div>
+ <div className="bg-background">
+ <PdfDropzoneBlock>
+ <div className="grid h-[72...">
+ <FileUpload accept="applicatio..." acceptedFileTypes={[...]} browseLabel="Browse PDF" ...>
+ <div className="space-y-3 ...">
+ <style>
++ {"... rgba(0, 0, 0, 0.08) 57%,\n rgba(0, 0, 0, 0.2) 60%,\n rgba(0, 0..."}
+- {"... rgba(255, 255, 255, 0.1) 57%,\n rgba(255, 255, 255, 0.3) 60%,\n ..."}
+ ...
+ ...
+ ...
+
+ at throwOnHydrationMismatch (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3318:56)
+ at prepareToHydrateHostInstance (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3372:23)
+ at completeWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6922:60)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at completeUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9622:23)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9557:28)
+ at workLoopConcurrentByScheduler (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9551:58)
+ at renderRootConcurrent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9534:71)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9061:150)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 763286ms] ReferenceError: verticalListSortingStrategy is not defined
+ at SplitterGroupsPane (http://localhost:4000/_next/static/chunks/apps_v4_102_iax._.js:4764:35)
+ at Object.react_stack_bottom_frame (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:15037:24)
+ at renderWithHooks (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:4620:24)
+ at updateFunctionComponent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6081:21)
+ at beginWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6691:24)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9555:97)
+ at workLoopSync (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9449:40)
+ at renderRootSync (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9433:13)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9098:47)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 770704ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 770841ms] [WARNING] [Fast Refresh] performing full reload because your application had an unrecoverable error @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 770876ms] [WARNING] [Fast Refresh] performing full reload because your application had an unrecoverable error @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 770886ms] [LOG] [Fast Refresh] done in 274ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 770994ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 771032ms] [LOG] [Fast Refresh] done in 139ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 771477ms] [INFO] %cDownload the React DevTools for a better development experience: https://react.dev/link/react-devtools font-weight:bold @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 771530ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 771702ms] [ERROR] Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. Consider using template tag instead (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template). @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:3318
+[ 771888ms] Error: Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
+
+- A server/client branch `if (typeof window !== 'undefined')`.
+- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
+- Date formatting in a user's locale which doesn't match the server.
+- External changing data without sending a snapshot of it along with the HTML.
+- Invalid HTML tag nesting.
+
+It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
+
+https://react.dev/link/hydration-mismatch
+
+ ...
+ <InnerLayoutRouter url="/blocks" tree={[...]} params={{}} cacheNode={{rsc:{...}, ...}} segmentPath={[...]} ...>
+ <SegmentViewNode type="page" pagePath="(app)/bloc...">
+ <SegmentTrieNode>
+ <BlocksPage>
+ <PdfViewerBlocks>
+ <section className="space-y-12">
+ <PdfViewerBlockPreview block={{id:"pdf-dr...", ...}}>
+ <article id="pdf-dropzone" className="space-y-3">
+ <div>
+ <div className="overflow-h...">
+ <div>
+ <div className="bg-background">
+ <PdfDropzoneBlock>
+ <div className="grid h-[72...">
+ <FileUpload accept="applicatio..." acceptedFileTypes={[...]} browseLabel="Browse PDF" ...>
+ <div className="space-y-3 ...">
+ <style>
++ {"... rgba(0, 0, 0, 0.08) 57%,\n rgba(0, 0, 0, 0.2) 60%,\n rgba(0, 0..."}
+- {"... rgba(255, 255, 255, 0.1) 57%,\n rgba(255, 255, 255, 0.3) 60%,\n ..."}
+ ...
+ ...
+ ...
+
+ at throwOnHydrationMismatch (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3318:56)
+ at prepareToHydrateHostInstance (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3372:23)
+ at completeWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6922:60)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at completeUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9622:23)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9557:28)
+ at workLoopConcurrentByScheduler (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9551:58)
+ at renderRootConcurrent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9534:71)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9061:150)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 792764ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 793034ms] [LOG] [Fast Refresh] done in 320ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 813175ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 813491ms] [LOG] [Fast Refresh] done in 235ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 824240ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 824439ms] [LOG] [Fast Refresh] done in 248ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
diff --git a/.playwright-cli/console-2026-05-14T23-23-53-642Z.log b/.playwright-cli/console-2026-05-14T23-23-53-642Z.log
new file mode 100644
index 0000000..fe591a9
--- /dev/null
+++ b/.playwright-cli/console-2026-05-14T23-23-53-642Z.log
@@ -0,0 +1,54 @@
+[ 475ms] [INFO] %cDownload the React DevTools for a better development experience: https://react.dev/link/react-devtools font-weight:bold @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 607ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 679ms] [ERROR] Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. Consider using template tag instead (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template). @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:3318
+[ 782ms] Error: Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
+
+- A server/client branch `if (typeof window !== 'undefined')`.
+- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
+- Date formatting in a user's locale which doesn't match the server.
+- External changing data without sending a snapshot of it along with the HTML.
+- Invalid HTML tag nesting.
+
+It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
+
+https://react.dev/link/hydration-mismatch
+
+ ...
+ <InnerLayoutRouter url="/blocks" tree={[...]} params={{}} cacheNode={{rsc:{...}, ...}} segmentPath={[...]} ...>
+ <SegmentViewNode type="page" pagePath="(app)/bloc...">
+ <SegmentTrieNode>
+ <BlocksPage>
+ <PdfViewerBlocks>
+ <section className="space-y-12">
+ <PdfViewerBlockPreview block={{id:"pdf-dr...", ...}}>
+ <article id="pdf-dropzone" className="space-y-3">
+ <div>
+ <div className="overflow-h...">
+ <div>
+ <div className="bg-background">
+ <PdfDropzoneBlock>
+ <div className="grid h-[72...">
+ <FileUpload accept="applicatio..." acceptedFileTypes={[...]} browseLabel="Browse PDF" ...>
+ <div className="space-y-3 ...">
+ <style>
++ {"... rgba(0, 0, 0, 0.08) 57%,\n rgba(0, 0, 0, 0.2) 60%,\n rgba(0, 0..."}
+- {"... rgba(255, 255, 255, 0.1) 57%,\n rgba(255, 255, 255, 0.3) 60%,\n ..."}
+ ...
+ ...
+ ...
+
+ at throwOnHydrationMismatch (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3318:56)
+ at prepareToHydrateHostInstance (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3372:23)
+ at completeWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6922:60)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at completeUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9622:23)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9557:28)
+ at workLoopConcurrentByScheduler (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9551:58)
+ at renderRootConcurrent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9534:71)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9061:150)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 57644ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 57999ms] [LOG] [Fast Refresh] done in 453ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 109429ms] [LOG] [Fast Refresh] rebuilding @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 109816ms] [LOG] [Fast Refresh] done in 473ms @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
diff --git a/.playwright-cli/console-2026-05-14T23-26-17-028Z.log b/.playwright-cli/console-2026-05-14T23-26-17-028Z.log
new file mode 100644
index 0000000..3e672da
--- /dev/null
+++ b/.playwright-cli/console-2026-05-14T23-26-17-028Z.log
@@ -0,0 +1,200 @@
+[ 283ms] [INFO] %cDownload the React DevTools for a better development experience: https://react.dev/link/react-devtools font-weight:bold @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 367ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 449ms] [ERROR] Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. Consider using template tag instead (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template). @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:3318
+[ 552ms] Error: Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
+
+- A server/client branch `if (typeof window !== 'undefined')`.
+- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
+- Date formatting in a user's locale which doesn't match the server.
+- External changing data without sending a snapshot of it along with the HTML.
+- Invalid HTML tag nesting.
+
+It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
+
+https://react.dev/link/hydration-mismatch
+
+ ...
+ <InnerLayoutRouter url="/blocks" tree={[...]} params={{}} cacheNode={{rsc:{...}, ...}} segmentPath={[...]} ...>
+ <SegmentViewNode type="page" pagePath="(app)/bloc...">
+ <SegmentTrieNode>
+ <BlocksPage>
+ <PdfViewerBlocks>
+ <section className="space-y-12">
+ <PdfViewerBlockPreview block={{id:"pdf-dr...", ...}}>
+ <article id="pdf-dropzone" className="space-y-3">
+ <div>
+ <div className="overflow-h...">
+ <div>
+ <div className="bg-background">
+ <PdfDropzoneBlock>
+ <div className="grid h-[72...">
+ <FileUpload accept="applicatio..." acceptedFileTypes={[...]} browseLabel="Browse PDF" ...>
+ <div className="space-y-3 ...">
+ <style>
++ {"... rgba(0, 0, 0, 0.08) 57%,\n rgba(0, 0, 0, 0.2) 60%,\n rgba(0, 0..."}
+- {"... rgba(255, 255, 255, 0.1) 57%,\n rgba(255, 255, 255, 0.3) 60%,\n ..."}
+ ...
+ ...
+ ...
+
+ at throwOnHydrationMismatch (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3318:56)
+ at prepareToHydrateHostInstance (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3372:23)
+ at completeWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6922:60)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at completeUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9622:23)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9557:28)
+ at workLoopConcurrentByScheduler (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9551:58)
+ at renderRootConcurrent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9534:71)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9061:150)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 26781ms] [INFO] %cDownload the React DevTools for a better development experience: https://react.dev/link/react-devtools font-weight:bold @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 26831ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 26862ms] [ERROR] Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. Consider using template tag instead (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template). @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:3318
+[ 26959ms] Error: Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
+
+- A server/client branch `if (typeof window !== 'undefined')`.
+- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
+- Date formatting in a user's locale which doesn't match the server.
+- External changing data without sending a snapshot of it along with the HTML.
+- Invalid HTML tag nesting.
+
+It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
+
+https://react.dev/link/hydration-mismatch
+
+ ...
+ <InnerLayoutRouter url="/blocks" tree={[...]} params={{}} cacheNode={{rsc:{...}, ...}} segmentPath={[...]} ...>
+ <SegmentViewNode type="page" pagePath="(app)/bloc...">
+ <SegmentTrieNode>
+ <BlocksPage>
+ <PdfViewerBlocks>
+ <section className="space-y-12">
+ <PdfViewerBlockPreview block={{id:"pdf-dr...", ...}}>
+ <article id="pdf-dropzone" className="space-y-3">
+ <div>
+ <div className="overflow-h...">
+ <div>
+ <div className="bg-background">
+ <PdfDropzoneBlock>
+ <div className="grid h-[72...">
+ <FileUpload accept="applicatio..." acceptedFileTypes={[...]} browseLabel="Browse PDF" ...>
+ <div className="space-y-3 ...">
+ <style>
++ {"... rgba(0, 0, 0, 0.08) 57%,\n rgba(0, 0, 0, 0.2) 60%,\n rgba(0, 0..."}
+- {"... rgba(255, 255, 255, 0.1) 57%,\n rgba(255, 255, 255, 0.3) 60%,\n ..."}
+ ...
+ ...
+ ...
+
+ at throwOnHydrationMismatch (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3318:56)
+ at prepareToHydrateHostInstance (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3372:23)
+ at completeWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6922:60)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at completeUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9622:23)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9557:28)
+ at workLoopConcurrentByScheduler (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9551:58)
+ at renderRootConcurrent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9534:71)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9061:150)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 53725ms] [INFO] %cDownload the React DevTools for a better development experience: https://react.dev/link/react-devtools font-weight:bold @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 53779ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 53813ms] [ERROR] Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. Consider using template tag instead (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template). @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:3318
+[ 53920ms] Error: Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
+
+- A server/client branch `if (typeof window !== 'undefined')`.
+- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
+- Date formatting in a user's locale which doesn't match the server.
+- External changing data without sending a snapshot of it along with the HTML.
+- Invalid HTML tag nesting.
+
+It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
+
+https://react.dev/link/hydration-mismatch
+
+ ...
+ <InnerLayoutRouter url="/blocks" tree={[...]} params={{}} cacheNode={{rsc:{...}, ...}} segmentPath={[...]} ...>
+ <SegmentViewNode type="page" pagePath="(app)/bloc...">
+ <SegmentTrieNode>
+ <BlocksPage>
+ <PdfViewerBlocks>
+ <section className="space-y-12">
+ <PdfViewerBlockPreview block={{id:"pdf-dr...", ...}}>
+ <article id="pdf-dropzone" className="space-y-3">
+ <div>
+ <div className="overflow-h...">
+ <div>
+ <div className="bg-background">
+ <PdfDropzoneBlock>
+ <div className="grid h-[72...">
+ <FileUpload accept="applicatio..." acceptedFileTypes={[...]} browseLabel="Browse PDF" ...>
+ <div className="space-y-3 ...">
+ <style>
++ {"... rgba(0, 0, 0, 0.08) 57%,\n rgba(0, 0, 0, 0.2) 60%,\n rgba(0, 0..."}
+- {"... rgba(255, 255, 255, 0.1) 57%,\n rgba(255, 255, 255, 0.3) 60%,\n ..."}
+ ...
+ ...
+ ...
+
+ at throwOnHydrationMismatch (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3318:56)
+ at prepareToHydrateHostInstance (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3372:23)
+ at completeWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6922:60)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at completeUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9622:23)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9557:28)
+ at workLoopConcurrentByScheduler (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9551:58)
+ at renderRootConcurrent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9534:71)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9061:150)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
+[ 67285ms] [INFO] %cDownload the React DevTools for a better development experience: https://react.dev/link/react-devtools font-weight:bold @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 67327ms] [LOG] [HMR] connected @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:2477
+[ 67362ms] [ERROR] Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. Consider using template tag instead (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template). @ http://localhost:4000/_next/static/chunks/0d1g_next_dist_01ztmm1._.js:3318
+[ 67462ms] Error: Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
+
+- A server/client branch `if (typeof window !== 'undefined')`.
+- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
+- Date formatting in a user's locale which doesn't match the server.
+- External changing data without sending a snapshot of it along with the HTML.
+- Invalid HTML tag nesting.
+
+It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
+
+https://react.dev/link/hydration-mismatch
+
+ ...
+ <InnerLayoutRouter url="/blocks" tree={[...]} params={{}} cacheNode={{rsc:{...}, ...}} segmentPath={[...]} ...>
+ <SegmentViewNode type="page" pagePath="(app)/bloc...">
+ <SegmentTrieNode>
+ <BlocksPage>
+ <PdfViewerBlocks>
+ <section className="space-y-12">
+ <PdfViewerBlockPreview block={{id:"pdf-dr...", ...}}>
+ <article id="pdf-dropzone" className="space-y-3">
+ <div>
+ <div className="overflow-h...">
+ <div>
+ <div className="bg-background">
+ <PdfDropzoneBlock>
+ <div className="grid h-[72...">
+ <FileUpload accept="applicatio..." acceptedFileTypes={[...]} browseLabel="Browse PDF" ...>
+ <div className="space-y-3 ...">
+ <style>
++ {"... rgba(0, 0, 0, 0.08) 57%,\n rgba(0, 0, 0, 0.2) 60%,\n rgba(0, 0..."}
+- {"... rgba(255, 255, 255, 0.1) 57%,\n rgba(255, 255, 255, 0.3) 60%,\n ..."}
+ ...
+ ...
+ ...
+
+ at throwOnHydrationMismatch (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3318:56)
+ at prepareToHydrateHostInstance (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:3372:23)
+ at completeWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:6922:60)
+ at runWithFiberInDEV (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:965:74)
+ at completeUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9622:23)
+ at performUnitOfWork (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9557:28)
+ at workLoopConcurrentByScheduler (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9551:58)
+ at renderRootConcurrent (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9534:71)
+ at performWorkOnRoot (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:9061:150)
+ at performWorkOnRootViaSchedulerTask (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_react-dom_02pv8tp._.js:10255:9)
+ at MessagePort.performWorkUntilDeadline (http://localhost:4000/_next/static/chunks/0d1g_next_dist_compiled_0jcobmk._.js:2647:64)
diff --git a/.playwright-cli/page-2026-05-14T22-38-31-050Z.yml b/.playwright-cli/page-2026-05-14T22-38-31-050Z.yml
new file mode 100644
index 0000000..bdb6394
--- /dev/null
+++ b/.playwright-cli/page-2026-05-14T22-38-31-050Z.yml
@@ -0,0 +1,621 @@
+- generic [active] [ref=e1]:
+ - generic [ref=e2]:
+ - banner [ref=e3]:
+ - generic [ref=e5]:
+ - link "Extend UI" [ref=e6] [cursor=pointer]:
+ - /url: /
+ - generic [ref=e8]: Extend UI
+ - navigation [ref=e9]:
+ - link "Docs" [ref=e10] [cursor=pointer]:
+ - /url: /docs
+ - link "Components" [ref=e11] [cursor=pointer]:
+ - /url: /docs/components
+ - link "Blocks" [ref=e12] [cursor=pointer]:
+ - /url: /blocks
+ - generic [ref=e13]:
+ - button "Search documentation..." [ref=e15] [cursor=pointer]:
+ - generic [ref=e16]: Search documentation...
+ - separator [ref=e17]
+ - link "GitHub" [ref=e18] [cursor=pointer]:
+ - /url: https://github.com/extend-hq/ui
+ - img
+ - generic [ref=e19]: GitHub
+ - separator [ref=e20]
+ - button "Toggle theme" [ref=e21] [cursor=pointer]:
+ - img
+ - generic [ref=e22]: Toggle theme
+ - main [ref=e23]:
+ - generic [ref=e26]:
+ - heading "Document Blocks" [level=1] [ref=e27]
+ - paragraph [ref=e28]: Composed PDF viewer workflows built from citations, OCR blocks, signing fields, and document splits.
+ - generic [ref=e29]:
+ - link "Browse Blocks" [ref=e30] [cursor=pointer]:
+ - /url: "#blocks"
+ - link "View Components" [ref=e31] [cursor=pointer]:
+ - /url: /docs/components
+ - generic [ref=e34]:
+ - article [ref=e35]:
+ - generic [ref=e36]:
+ - generic [ref=e37]:
+ - heading "PDF Dropzone" [level=3] [ref=e38]
+ - paragraph [ref=e39]: A PDF-only upload dropzone that opens the dropped file in the shared viewer.
+ - generic [ref=e40]:
+ - link "Open in New Tab" [ref=e41] [cursor=pointer]:
+ - /url: /docs/components/file-upload
+ - text: Open in New Tab
+ - img
+ - button "Refresh PDF Dropzone preview" [ref=e42] [cursor=pointer]:
+ - img
+ - generic [ref=e43]:
+ - generic [ref=e44]:
+ - code [ref=e45]: npx shadcn@latest add pdf-viewer file-upload
+ - generic [ref=e46]: Preview
+ - generic [ref=e51] [cursor=pointer]:
+ - img [ref=e54]
+ - generic [ref=e57]:
+ - generic [ref=e58]: Drop a PDF to preview
+ - generic [ref=e59]: PDF files only
+ - generic [ref=e60]:
+ - img [ref=e61]
+ - generic [ref=e64]: Browse PDF
+ - button "Drop a PDF to preview PDF files only Browse PDF" [ref=e65]
+ - article [ref=e66]:
+ - generic [ref=e67]:
+ - generic [ref=e68]:
+ - heading "Citations" [level=3] [ref=e69]
+ - paragraph [ref=e70]: Evidence cards that scroll the PDF viewer to source bounding boxes.
+ - generic [ref=e71]:
+ - link "Open in New Tab" [ref=e72] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/citations
+ - text: Open in New Tab
+ - img
+ - button "Refresh Citations preview" [ref=e73] [cursor=pointer]:
+ - img
+ - generic [ref=e74]:
+ - generic [ref=e75]:
+ - code [ref=e76]: npx shadcn@latest add citations
+ - generic [ref=e77]: Preview
+ - generic [ref=e79]:
+ - generic:
+ - generic:
+ - generic [ref=e80]:
+ - generic [ref=e81]:
+ - generic [ref=e82]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e83]: Page 1 of -
+ - generic [ref=e84]:
+ - generic [ref=e85]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e86]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e87]
+ - generic [ref=e88]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e89]: "0.75"
+ - generic [ref=e90]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e91]
+ - generic [ref=e92]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e93]
+ - generic "Upload PDF" [ref=e95] [cursor=pointer]:
+ - button "Upload PDF" [ref=e96]
+ - img
+ - img [ref=e97]
+ - separator [ref=e106]:
+ - img [ref=e108]
+ - generic:
+ - complementary:
+ - generic [ref=e116]:
+ - button "Title p. 1 Attention Is All You Need Attention Is All You Need" [ref=e117]:
+ - generic [ref=e118]:
+ - generic [ref=e119]: Title
+ - generic [ref=e120]: p. 1
+ - generic [ref=e121]: Attention Is All You Need
+ - generic [ref=e122]: Attention Is All You Need
+ - button "Authors p. 1 Vaswani, Shazeer, Parmar, Uszkoreit, Jones, Gomez, Kaiser, Polosukhin Ashish Vaswani ... Illia Polosukhin" [ref=e123]:
+ - generic [ref=e124]:
+ - generic [ref=e125]: Authors
+ - generic [ref=e126]: p. 1
+ - generic [ref=e127]: Vaswani, Shazeer, Parmar, Uszkoreit, Jones, Gomez, Kaiser, Polosukhin
+ - generic [ref=e128]: Ashish Vaswani ... Illia Polosukhin
+ - button "Abstract claim p. 1 The Transformer relies entirely on attention mechanisms and avoids recurrence and convolutions. The Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely." [ref=e129]:
+ - generic [ref=e130]:
+ - generic [ref=e131]: Abstract claim
+ - generic [ref=e132]: p. 1
+ - generic [ref=e133]: The Transformer relies entirely on attention mechanisms and avoids recurrence and convolutions.
+ - generic [ref=e134]: The Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely.
+ - button "Translation quality p. 1 28.4 BLEU on WMT 2014 English-to-German our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task" [ref=e135]:
+ - generic [ref=e136]:
+ - generic [ref=e137]: Translation quality
+ - generic [ref=e138]: p. 1
+ - generic [ref=e139]: 28.4 BLEU on WMT 2014 English-to-German
+ - generic [ref=e140]: our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task
+ - button "Background p. 2 Self-attention connects positions in a sequence through constant-time operations. Self-attention connects all positions with a constant number of sequentially executed operations." [ref=e141]:
+ - generic [ref=e142]:
+ - generic [ref=e143]: Background
+ - generic [ref=e144]: p. 2
+ - generic [ref=e145]: Self-attention connects positions in a sequence through constant-time operations.
+ - generic [ref=e146]: Self-attention connects all positions with a constant number of sequentially executed operations.
+ - article [ref=e147]:
+ - generic [ref=e149]:
+ - link "Open in New Tab" [ref=e150] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/ocr-blocks
+ - text: Open in New Tab
+ - img
+ - button "Refresh OCR Blocks preview" [ref=e151] [cursor=pointer]:
+ - img
+ - generic [ref=e152]:
+ - generic [ref=e153]:
+ - code [ref=e154]: npx shadcn@latest add ocr-blocks
+ - generic [ref=e155]: Preview
+ - generic [ref=e157]:
+ - generic:
+ - generic:
+ - generic [ref=e158]:
+ - generic [ref=e159]:
+ - generic [ref=e160]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e161]: Page 1 of -
+ - generic [ref=e162]:
+ - generic [ref=e163]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e164]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e165]
+ - generic [ref=e166]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e167]: "0.75"
+ - generic [ref=e168]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e169]
+ - generic [ref=e170]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e171]
+ - generic "Upload PDF" [ref=e173] [cursor=pointer]:
+ - button "Upload PDF" [ref=e174]
+ - img
+ - img [ref=e175]
+ - separator [ref=e184]:
+ - img [ref=e186]
+ - generic:
+ - complementary:
+ - generic [ref=e194]:
+ - button "Paper title p. 1 Heading · 99% Attention Is All You Need" [ref=e195]:
+ - generic [ref=e196]:
+ - img [ref=e198]
+ - generic [ref=e200]:
+ - generic [ref=e201]:
+ - generic [ref=e202]: Paper title
+ - generic [ref=e203]: p. 1
+ - generic [ref=e204]: Heading · 99%
+ - generic [ref=e205]: Attention Is All You Need
+ - button "Authors p. 1 Paragraph · 96% Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit..." [ref=e206]:
+ - generic [ref=e207]:
+ - img [ref=e209]
+ - generic [ref=e211]:
+ - generic [ref=e212]:
+ - generic [ref=e213]: Authors
+ - generic [ref=e214]: p. 1
+ - generic [ref=e215]: Paragraph · 96%
+ - generic [ref=e216]: Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit...
+ - button "Section heading p. 1 Heading · 98% Abstract" [ref=e217]:
+ - generic [ref=e218]:
+ - img [ref=e220]
+ - generic [ref=e222]:
+ - generic [ref=e223]:
+ - generic [ref=e224]: Section heading
+ - generic [ref=e225]: p. 1
+ - generic [ref=e226]: Heading · 98%
+ - generic [ref=e227]: Abstract
+ - button "Abstract body p. 1 Paragraph · 94% The dominant sequence transduction models are based on complex recurrent or convolutional neural networks..." [ref=e228]:
+ - generic [ref=e229]:
+ - img [ref=e231]
+ - generic [ref=e233]:
+ - generic [ref=e234]:
+ - generic [ref=e235]: Abstract body
+ - generic [ref=e236]: p. 1
+ - generic [ref=e237]: Paragraph · 94%
+ - generic [ref=e238]: The dominant sequence transduction models are based on complex recurrent or convolutional neural networks...
+ - button "Background text p. 2 Paragraph · 92% Recurrent neural networks, long short-term memory and gated recurrent neural networks..." [ref=e239]:
+ - generic [ref=e240]:
+ - img [ref=e242]
+ - generic [ref=e244]:
+ - generic [ref=e245]:
+ - generic [ref=e246]: Background text
+ - generic [ref=e247]: p. 2
+ - generic [ref=e248]: Paragraph · 92%
+ - generic [ref=e249]: Recurrent neural networks, long short-term memory and gated recurrent neural networks...
+ - button "Architecture figure p. 2 Image · 89% Transformer architecture diagram" [ref=e250]:
+ - generic [ref=e251]:
+ - img [ref=e253]
+ - generic [ref=e257]:
+ - generic [ref=e258]:
+ - generic [ref=e259]: Architecture figure
+ - generic [ref=e260]: p. 2
+ - generic [ref=e261]: Image · 89%
+ - generic [ref=e262]: Transformer architecture diagram
+ - button "Complexity table p. 6 Table · 91% Layer type, complexity per layer, sequential operations, maximum path length" [ref=e263]:
+ - generic [ref=e264]:
+ - img [ref=e266]
+ - generic [ref=e268]:
+ - generic [ref=e269]:
+ - generic [ref=e270]: Complexity table
+ - generic [ref=e271]: p. 6
+ - generic [ref=e272]: Table · 91%
+ - generic [ref=e273]: Layer type, complexity per layer, sequential operations, maximum path length
+ - button "Comparison criteria p. 6 List · 88% Total computational complexity, parallelizable computation, and maximum path length" [ref=e274]:
+ - generic [ref=e275]:
+ - img [ref=e277]
+ - generic [ref=e281]:
+ - generic [ref=e282]:
+ - generic [ref=e283]: Comparison criteria
+ - generic [ref=e284]: p. 6
+ - generic [ref=e285]: List · 88%
+ - generic [ref=e286]: Total computational complexity, parallelizable computation, and maximum path length
+ - article [ref=e287]:
+ - generic [ref=e289]:
+ - link "Open in New Tab" [ref=e290] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/e-signature
+ - text: Open in New Tab
+ - img
+ - button "Refresh E-Signature preview" [ref=e291] [cursor=pointer]:
+ - img
+ - generic [ref=e292]:
+ - generic [ref=e293]:
+ - code [ref=e294]: npx shadcn@latest add e-signature
+ - generic [ref=e295]: Preview
+ - generic [ref=e297]:
+ - generic:
+ - generic:
+ - generic [ref=e298]:
+ - generic [ref=e299]:
+ - generic [ref=e300]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e301]: Page 1 of -
+ - generic [ref=e302]:
+ - generic [ref=e303]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e304]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e305]
+ - generic [ref=e306]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e307]: "0.75"
+ - generic [ref=e308]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e309]
+ - generic [ref=e310]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e311]
+ - button "Draw" [ref=e312] [cursor=pointer]:
+ - img
+ - text: Draw
+ - button "Download" [disabled]:
+ - img
+ - text: Download
+ - separator [ref=e313]
+ - generic "Upload PDF" [ref=e315] [cursor=pointer]:
+ - button "Upload PDF" [ref=e316]
+ - img
+ - img [ref=e317]
+ - separator [ref=e326]:
+ - img [ref=e328]
+ - generic:
+ - complementary:
+ - generic [ref=e337]:
+ - img [ref=e339]
+ - generic [ref=e342]:
+ - generic [ref=e343]:
+ - generic [ref=e344]: Signature1
+ - generic [ref=e345]: Unsigned
+ - generic [ref=e346]: 250 x 58 on page 1
+ - button "Sign" [ref=e347] [cursor=pointer]:
+ - img
+ - text: Sign
+ - article [ref=e348]:
+ - generic [ref=e349]:
+ - generic [ref=e350]:
+ - heading "Human Review" [level=3] [ref=e351]
+ - paragraph [ref=e352]: Extraction review cards connected to source evidence in the PDF viewer.
+ - generic [ref=e353]:
+ - link "Open in New Tab" [ref=e354] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/human-review
+ - text: Open in New Tab
+ - img
+ - button "Refresh Human Review preview" [ref=e355] [cursor=pointer]:
+ - img
+ - generic [ref=e356]:
+ - generic [ref=e357]:
+ - code [ref=e358]: npx shadcn@latest add human-review pdf-viewer
+ - generic [ref=e359]: Preview
+ - generic [ref=e361]:
+ - generic:
+ - generic:
+ - generic [ref=e362]:
+ - generic [ref=e363]:
+ - generic [ref=e364]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e365]: Page 1 of -
+ - generic [ref=e366]:
+ - generic [ref=e367]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e368]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e369]
+ - generic [ref=e370]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e371]: "0.75"
+ - generic [ref=e372]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e373]
+ - generic [ref=e374]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e375]
+ - generic "Upload PDF" [ref=e377] [cursor=pointer]:
+ - button "Upload PDF" [ref=e378]
+ - img
+ - img [ref=e379]
+ - separator [ref=e388]:
+ - img [ref=e390]
+ - generic:
+ - generic:
+ - generic [ref=e397]:
+ - tablist [ref=e398]:
+ - tab "Form" [selected] [ref=e399] [cursor=pointer]:
+ - img
+ - text: Form
+ - tab "JSON" [ref=e400] [cursor=pointer]:
+ - img
+ - text: JSON
+ - generic [ref=e401]:
+ - img [ref=e402]
+ - text: 4 fields
+ - tabpanel:
+ - generic [ref=e405]:
+ - generic [ref=e406]:
+ - generic [ref=e407]:
+ - generic [ref=e408]:
+ - generic [ref=e411]: Vendor name
+ - generic [ref=e413]: vendor_name
+ - generic [ref=e414]:
+ - button "Set vendor_name to null" [ref=e415] [cursor=pointer]:
+ - img
+ - generic [ref=e416]:
+ - img [ref=e417]
+ - text: string
+ - generic [ref=e422]:
+ - generic [ref=e423]:
+ - paragraph [ref=e424]: Supplier shown on the invoice header.
+ - generic [ref=e425]: Actual
+ - generic [ref=e426]: Acme Supplies LLC
+ - generic [ref=e427]:
+ - generic [ref=e428]: Expected
+ - textbox [ref=e430]: Acme Supply LLC
+ - generic [ref=e431]:
+ - generic [ref=e432]:
+ - generic [ref=e433]:
+ - generic [ref=e436]: Total amount
+ - generic [ref=e438]: total_amount
+ - generic [ref=e439]:
+ - button "Set total_amount to null" [ref=e440] [cursor=pointer]:
+ - img
+ - generic [ref=e441]:
+ - img [ref=e442]
+ - text: number
+ - generic [ref=e446]:
+ - generic [ref=e447]:
+ - paragraph [ref=e448]: Final amount due including tax.
+ - generic [ref=e449]: Actual
+ - generic [ref=e450]: "12480"
+ - generic [ref=e451]:
+ - generic [ref=e452]: Expected
+ - spinbutton [ref=e454]: "12480.75"
+ - generic [ref=e455]:
+ - generic [ref=e456]:
+ - generic [ref=e457]:
+ - generic [ref=e460]: Payment terms
+ - generic [ref=e462]: payment_terms
+ - generic [ref=e463]:
+ - button "Set payment_terms to null" [ref=e464] [cursor=pointer]:
+ - img
+ - generic [ref=e465]:
+ - img [ref=e466]
+ - text: string
+ - generic [ref=e471]:
+ - generic [ref=e472]:
+ - generic [ref=e473]: Actual
+ - generic [ref=e474]: Net 15
+ - generic [ref=e475]:
+ - generic [ref=e476]: Expected
+ - combobox [ref=e478]:
+ - option "Due on receipt"
+ - option "Net 15"
+ - option "Net 30" [selected]
+ - generic [ref=e479]:
+ - generic [ref=e480]:
+ - generic [ref=e481]:
+ - generic [ref=e484]: Requires review
+ - generic [ref=e486]: requires_review
+ - generic [ref=e487]:
+ - button "Set requires_review to null" [ref=e488] [cursor=pointer]:
+ - img
+ - generic [ref=e489]:
+ - img [ref=e490]
+ - text: boolean
+ - generic [ref=e492]:
+ - generic [ref=e493]:
+ - paragraph [ref=e494]: Whether a human should verify this document before export.
+ - generic [ref=e495]: Actual
+ - generic [ref=e496]: "false"
+ - generic [ref=e497]:
+ - generic [ref=e498]: Expected
+ - generic [ref=e499]:
+ - button "True" [ref=e500] [cursor=pointer]
+ - button "False" [ref=e501] [cursor=pointer]
+ - article [ref=e502]:
+ - generic [ref=e503]:
+ - generic [ref=e504]:
+ - heading "Document Splits" [level=3] [ref=e505]
+ - paragraph [ref=e506]: Lazy page thumbnails, draggable split groups, and PDF navigation.
+ - generic [ref=e507]:
+ - link "Open in New Tab" [ref=e508] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/document-splits
+ - text: Open in New Tab
+ - img
+ - button "Refresh Document Splits preview" [ref=e509] [cursor=pointer]:
+ - img
+ - generic [ref=e510]:
+ - generic [ref=e511]:
+ - code [ref=e512]: npx shadcn@latest add document-splits
+ - generic [ref=e513]: Preview
+ - generic [ref=e515]:
+ - generic:
+ - generic:
+ - generic [ref=e516]:
+ - generic [ref=e517]:
+ - generic [ref=e518]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e519]: Page 1 of -
+ - generic [ref=e520]:
+ - generic [ref=e521]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e522]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e523]
+ - generic [ref=e524]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e525]: "0.75"
+ - generic [ref=e526]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e527]
+ - generic [ref=e528]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e529]
+ - generic "Upload PDF" [ref=e531] [cursor=pointer]:
+ - button "Upload PDF" [ref=e532]
+ - img
+ - img [ref=e533]
+ - separator [ref=e542]:
+ - img [ref=e544]
+ - generic:
+ - complementary:
+ - button "Add split" [ref=e552] [cursor=pointer]:
+ - img
+ - text: Add split
+ - generic [ref=e553]:
+ - generic [ref=e554]:
+ - generic [ref=e555]:
+ - generic [ref=e556]:
+ - button "Reorder Abstract and intro" [disabled] [ref=e557]:
+ - img [ref=e558]
+ - generic [ref=e565]:
+ - generic [ref=e566]: Abstract and intro
+ - generic [ref=e567]: Pages 1-3
+ - generic [ref=e568]:
+ - generic [ref=e569]: "3"
+ - button "Remove Abstract and intro" [ref=e570] [cursor=pointer]:
+ - img
+ - generic [ref=e573]:
+ - generic [ref=e579]: "1"
+ - generic [ref=e585]: "2"
+ - generic [ref=e591]: "3"
+ - generic [ref=e592]:
+ - generic [ref=e593]:
+ - generic [ref=e594]:
+ - button "Reorder Model architecture" [disabled] [ref=e595]:
+ - img [ref=e596]
+ - generic [ref=e603]:
+ - generic [ref=e604]: Model architecture
+ - generic [ref=e605]: Pages 4-8
+ - generic [ref=e606]:
+ - generic [ref=e607]: "5"
+ - button "Remove Model architecture" [ref=e608] [cursor=pointer]:
+ - img
+ - generic [ref=e611]:
+ - generic [ref=e617]: "4"
+ - generic [ref=e623]: "5"
+ - generic [ref=e629]: "6"
+ - generic [ref=e635]: "7"
+ - generic [ref=e641]: "8"
+ - generic [ref=e642]:
+ - generic [ref=e643]:
+ - generic [ref=e644]:
+ - button "Reorder Training and results" [disabled] [ref=e645]:
+ - img [ref=e646]
+ - generic [ref=e653]:
+ - generic [ref=e654]: Training and results
+ - generic [ref=e655]: Pages 9-15
+ - generic [ref=e656]:
+ - generic [ref=e657]: "7"
+ - button "Remove Training and results" [ref=e658] [cursor=pointer]:
+ - img
+ - generic [ref=e661]:
+ - generic [ref=e667]: "9"
+ - generic [ref=e673]: "10"
+ - generic [ref=e679]: "11"
+ - generic [ref=e685]: "12"
+ - generic [ref=e691]: "13"
+ - generic [ref=e697]: "14"
+ - generic [ref=e703]: "15"
+ - contentinfo [ref=e704]:
+ - generic [ref=e707]:
+ - text: Created by
+ - link "Extend" [ref=e708] [cursor=pointer]:
+ - /url: https://www.extend.ai
+ - text: . The source code is available on
+ - link "GitHub" [ref=e709] [cursor=pointer]:
+ - /url: https://github.com/extend-hq/ui
+ - text: .
+ - region "Notifications alt+T"
+ - generic [ref=e711]: xl
\ No newline at end of file
diff --git a/.playwright-cli/page-2026-05-14T22-41-01-193Z.yml b/.playwright-cli/page-2026-05-14T22-41-01-193Z.yml
new file mode 100644
index 0000000..bdb6394
--- /dev/null
+++ b/.playwright-cli/page-2026-05-14T22-41-01-193Z.yml
@@ -0,0 +1,621 @@
+- generic [active] [ref=e1]:
+ - generic [ref=e2]:
+ - banner [ref=e3]:
+ - generic [ref=e5]:
+ - link "Extend UI" [ref=e6] [cursor=pointer]:
+ - /url: /
+ - generic [ref=e8]: Extend UI
+ - navigation [ref=e9]:
+ - link "Docs" [ref=e10] [cursor=pointer]:
+ - /url: /docs
+ - link "Components" [ref=e11] [cursor=pointer]:
+ - /url: /docs/components
+ - link "Blocks" [ref=e12] [cursor=pointer]:
+ - /url: /blocks
+ - generic [ref=e13]:
+ - button "Search documentation..." [ref=e15] [cursor=pointer]:
+ - generic [ref=e16]: Search documentation...
+ - separator [ref=e17]
+ - link "GitHub" [ref=e18] [cursor=pointer]:
+ - /url: https://github.com/extend-hq/ui
+ - img
+ - generic [ref=e19]: GitHub
+ - separator [ref=e20]
+ - button "Toggle theme" [ref=e21] [cursor=pointer]:
+ - img
+ - generic [ref=e22]: Toggle theme
+ - main [ref=e23]:
+ - generic [ref=e26]:
+ - heading "Document Blocks" [level=1] [ref=e27]
+ - paragraph [ref=e28]: Composed PDF viewer workflows built from citations, OCR blocks, signing fields, and document splits.
+ - generic [ref=e29]:
+ - link "Browse Blocks" [ref=e30] [cursor=pointer]:
+ - /url: "#blocks"
+ - link "View Components" [ref=e31] [cursor=pointer]:
+ - /url: /docs/components
+ - generic [ref=e34]:
+ - article [ref=e35]:
+ - generic [ref=e36]:
+ - generic [ref=e37]:
+ - heading "PDF Dropzone" [level=3] [ref=e38]
+ - paragraph [ref=e39]: A PDF-only upload dropzone that opens the dropped file in the shared viewer.
+ - generic [ref=e40]:
+ - link "Open in New Tab" [ref=e41] [cursor=pointer]:
+ - /url: /docs/components/file-upload
+ - text: Open in New Tab
+ - img
+ - button "Refresh PDF Dropzone preview" [ref=e42] [cursor=pointer]:
+ - img
+ - generic [ref=e43]:
+ - generic [ref=e44]:
+ - code [ref=e45]: npx shadcn@latest add pdf-viewer file-upload
+ - generic [ref=e46]: Preview
+ - generic [ref=e51] [cursor=pointer]:
+ - img [ref=e54]
+ - generic [ref=e57]:
+ - generic [ref=e58]: Drop a PDF to preview
+ - generic [ref=e59]: PDF files only
+ - generic [ref=e60]:
+ - img [ref=e61]
+ - generic [ref=e64]: Browse PDF
+ - button "Drop a PDF to preview PDF files only Browse PDF" [ref=e65]
+ - article [ref=e66]:
+ - generic [ref=e67]:
+ - generic [ref=e68]:
+ - heading "Citations" [level=3] [ref=e69]
+ - paragraph [ref=e70]: Evidence cards that scroll the PDF viewer to source bounding boxes.
+ - generic [ref=e71]:
+ - link "Open in New Tab" [ref=e72] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/citations
+ - text: Open in New Tab
+ - img
+ - button "Refresh Citations preview" [ref=e73] [cursor=pointer]:
+ - img
+ - generic [ref=e74]:
+ - generic [ref=e75]:
+ - code [ref=e76]: npx shadcn@latest add citations
+ - generic [ref=e77]: Preview
+ - generic [ref=e79]:
+ - generic:
+ - generic:
+ - generic [ref=e80]:
+ - generic [ref=e81]:
+ - generic [ref=e82]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e83]: Page 1 of -
+ - generic [ref=e84]:
+ - generic [ref=e85]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e86]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e87]
+ - generic [ref=e88]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e89]: "0.75"
+ - generic [ref=e90]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e91]
+ - generic [ref=e92]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e93]
+ - generic "Upload PDF" [ref=e95] [cursor=pointer]:
+ - button "Upload PDF" [ref=e96]
+ - img
+ - img [ref=e97]
+ - separator [ref=e106]:
+ - img [ref=e108]
+ - generic:
+ - complementary:
+ - generic [ref=e116]:
+ - button "Title p. 1 Attention Is All You Need Attention Is All You Need" [ref=e117]:
+ - generic [ref=e118]:
+ - generic [ref=e119]: Title
+ - generic [ref=e120]: p. 1
+ - generic [ref=e121]: Attention Is All You Need
+ - generic [ref=e122]: Attention Is All You Need
+ - button "Authors p. 1 Vaswani, Shazeer, Parmar, Uszkoreit, Jones, Gomez, Kaiser, Polosukhin Ashish Vaswani ... Illia Polosukhin" [ref=e123]:
+ - generic [ref=e124]:
+ - generic [ref=e125]: Authors
+ - generic [ref=e126]: p. 1
+ - generic [ref=e127]: Vaswani, Shazeer, Parmar, Uszkoreit, Jones, Gomez, Kaiser, Polosukhin
+ - generic [ref=e128]: Ashish Vaswani ... Illia Polosukhin
+ - button "Abstract claim p. 1 The Transformer relies entirely on attention mechanisms and avoids recurrence and convolutions. The Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely." [ref=e129]:
+ - generic [ref=e130]:
+ - generic [ref=e131]: Abstract claim
+ - generic [ref=e132]: p. 1
+ - generic [ref=e133]: The Transformer relies entirely on attention mechanisms and avoids recurrence and convolutions.
+ - generic [ref=e134]: The Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely.
+ - button "Translation quality p. 1 28.4 BLEU on WMT 2014 English-to-German our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task" [ref=e135]:
+ - generic [ref=e136]:
+ - generic [ref=e137]: Translation quality
+ - generic [ref=e138]: p. 1
+ - generic [ref=e139]: 28.4 BLEU on WMT 2014 English-to-German
+ - generic [ref=e140]: our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task
+ - button "Background p. 2 Self-attention connects positions in a sequence through constant-time operations. Self-attention connects all positions with a constant number of sequentially executed operations." [ref=e141]:
+ - generic [ref=e142]:
+ - generic [ref=e143]: Background
+ - generic [ref=e144]: p. 2
+ - generic [ref=e145]: Self-attention connects positions in a sequence through constant-time operations.
+ - generic [ref=e146]: Self-attention connects all positions with a constant number of sequentially executed operations.
+ - article [ref=e147]:
+ - generic [ref=e149]:
+ - link "Open in New Tab" [ref=e150] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/ocr-blocks
+ - text: Open in New Tab
+ - img
+ - button "Refresh OCR Blocks preview" [ref=e151] [cursor=pointer]:
+ - img
+ - generic [ref=e152]:
+ - generic [ref=e153]:
+ - code [ref=e154]: npx shadcn@latest add ocr-blocks
+ - generic [ref=e155]: Preview
+ - generic [ref=e157]:
+ - generic:
+ - generic:
+ - generic [ref=e158]:
+ - generic [ref=e159]:
+ - generic [ref=e160]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e161]: Page 1 of -
+ - generic [ref=e162]:
+ - generic [ref=e163]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e164]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e165]
+ - generic [ref=e166]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e167]: "0.75"
+ - generic [ref=e168]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e169]
+ - generic [ref=e170]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e171]
+ - generic "Upload PDF" [ref=e173] [cursor=pointer]:
+ - button "Upload PDF" [ref=e174]
+ - img
+ - img [ref=e175]
+ - separator [ref=e184]:
+ - img [ref=e186]
+ - generic:
+ - complementary:
+ - generic [ref=e194]:
+ - button "Paper title p. 1 Heading · 99% Attention Is All You Need" [ref=e195]:
+ - generic [ref=e196]:
+ - img [ref=e198]
+ - generic [ref=e200]:
+ - generic [ref=e201]:
+ - generic [ref=e202]: Paper title
+ - generic [ref=e203]: p. 1
+ - generic [ref=e204]: Heading · 99%
+ - generic [ref=e205]: Attention Is All You Need
+ - button "Authors p. 1 Paragraph · 96% Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit..." [ref=e206]:
+ - generic [ref=e207]:
+ - img [ref=e209]
+ - generic [ref=e211]:
+ - generic [ref=e212]:
+ - generic [ref=e213]: Authors
+ - generic [ref=e214]: p. 1
+ - generic [ref=e215]: Paragraph · 96%
+ - generic [ref=e216]: Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit...
+ - button "Section heading p. 1 Heading · 98% Abstract" [ref=e217]:
+ - generic [ref=e218]:
+ - img [ref=e220]
+ - generic [ref=e222]:
+ - generic [ref=e223]:
+ - generic [ref=e224]: Section heading
+ - generic [ref=e225]: p. 1
+ - generic [ref=e226]: Heading · 98%
+ - generic [ref=e227]: Abstract
+ - button "Abstract body p. 1 Paragraph · 94% The dominant sequence transduction models are based on complex recurrent or convolutional neural networks..." [ref=e228]:
+ - generic [ref=e229]:
+ - img [ref=e231]
+ - generic [ref=e233]:
+ - generic [ref=e234]:
+ - generic [ref=e235]: Abstract body
+ - generic [ref=e236]: p. 1
+ - generic [ref=e237]: Paragraph · 94%
+ - generic [ref=e238]: The dominant sequence transduction models are based on complex recurrent or convolutional neural networks...
+ - button "Background text p. 2 Paragraph · 92% Recurrent neural networks, long short-term memory and gated recurrent neural networks..." [ref=e239]:
+ - generic [ref=e240]:
+ - img [ref=e242]
+ - generic [ref=e244]:
+ - generic [ref=e245]:
+ - generic [ref=e246]: Background text
+ - generic [ref=e247]: p. 2
+ - generic [ref=e248]: Paragraph · 92%
+ - generic [ref=e249]: Recurrent neural networks, long short-term memory and gated recurrent neural networks...
+ - button "Architecture figure p. 2 Image · 89% Transformer architecture diagram" [ref=e250]:
+ - generic [ref=e251]:
+ - img [ref=e253]
+ - generic [ref=e257]:
+ - generic [ref=e258]:
+ - generic [ref=e259]: Architecture figure
+ - generic [ref=e260]: p. 2
+ - generic [ref=e261]: Image · 89%
+ - generic [ref=e262]: Transformer architecture diagram
+ - button "Complexity table p. 6 Table · 91% Layer type, complexity per layer, sequential operations, maximum path length" [ref=e263]:
+ - generic [ref=e264]:
+ - img [ref=e266]
+ - generic [ref=e268]:
+ - generic [ref=e269]:
+ - generic [ref=e270]: Complexity table
+ - generic [ref=e271]: p. 6
+ - generic [ref=e272]: Table · 91%
+ - generic [ref=e273]: Layer type, complexity per layer, sequential operations, maximum path length
+ - button "Comparison criteria p. 6 List · 88% Total computational complexity, parallelizable computation, and maximum path length" [ref=e274]:
+ - generic [ref=e275]:
+ - img [ref=e277]
+ - generic [ref=e281]:
+ - generic [ref=e282]:
+ - generic [ref=e283]: Comparison criteria
+ - generic [ref=e284]: p. 6
+ - generic [ref=e285]: List · 88%
+ - generic [ref=e286]: Total computational complexity, parallelizable computation, and maximum path length
+ - article [ref=e287]:
+ - generic [ref=e289]:
+ - link "Open in New Tab" [ref=e290] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/e-signature
+ - text: Open in New Tab
+ - img
+ - button "Refresh E-Signature preview" [ref=e291] [cursor=pointer]:
+ - img
+ - generic [ref=e292]:
+ - generic [ref=e293]:
+ - code [ref=e294]: npx shadcn@latest add e-signature
+ - generic [ref=e295]: Preview
+ - generic [ref=e297]:
+ - generic:
+ - generic:
+ - generic [ref=e298]:
+ - generic [ref=e299]:
+ - generic [ref=e300]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e301]: Page 1 of -
+ - generic [ref=e302]:
+ - generic [ref=e303]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e304]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e305]
+ - generic [ref=e306]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e307]: "0.75"
+ - generic [ref=e308]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e309]
+ - generic [ref=e310]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e311]
+ - button "Draw" [ref=e312] [cursor=pointer]:
+ - img
+ - text: Draw
+ - button "Download" [disabled]:
+ - img
+ - text: Download
+ - separator [ref=e313]
+ - generic "Upload PDF" [ref=e315] [cursor=pointer]:
+ - button "Upload PDF" [ref=e316]
+ - img
+ - img [ref=e317]
+ - separator [ref=e326]:
+ - img [ref=e328]
+ - generic:
+ - complementary:
+ - generic [ref=e337]:
+ - img [ref=e339]
+ - generic [ref=e342]:
+ - generic [ref=e343]:
+ - generic [ref=e344]: Signature1
+ - generic [ref=e345]: Unsigned
+ - generic [ref=e346]: 250 x 58 on page 1
+ - button "Sign" [ref=e347] [cursor=pointer]:
+ - img
+ - text: Sign
+ - article [ref=e348]:
+ - generic [ref=e349]:
+ - generic [ref=e350]:
+ - heading "Human Review" [level=3] [ref=e351]
+ - paragraph [ref=e352]: Extraction review cards connected to source evidence in the PDF viewer.
+ - generic [ref=e353]:
+ - link "Open in New Tab" [ref=e354] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/human-review
+ - text: Open in New Tab
+ - img
+ - button "Refresh Human Review preview" [ref=e355] [cursor=pointer]:
+ - img
+ - generic [ref=e356]:
+ - generic [ref=e357]:
+ - code [ref=e358]: npx shadcn@latest add human-review pdf-viewer
+ - generic [ref=e359]: Preview
+ - generic [ref=e361]:
+ - generic:
+ - generic:
+ - generic [ref=e362]:
+ - generic [ref=e363]:
+ - generic [ref=e364]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e365]: Page 1 of -
+ - generic [ref=e366]:
+ - generic [ref=e367]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e368]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e369]
+ - generic [ref=e370]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e371]: "0.75"
+ - generic [ref=e372]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e373]
+ - generic [ref=e374]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e375]
+ - generic "Upload PDF" [ref=e377] [cursor=pointer]:
+ - button "Upload PDF" [ref=e378]
+ - img
+ - img [ref=e379]
+ - separator [ref=e388]:
+ - img [ref=e390]
+ - generic:
+ - generic:
+ - generic [ref=e397]:
+ - tablist [ref=e398]:
+ - tab "Form" [selected] [ref=e399] [cursor=pointer]:
+ - img
+ - text: Form
+ - tab "JSON" [ref=e400] [cursor=pointer]:
+ - img
+ - text: JSON
+ - generic [ref=e401]:
+ - img [ref=e402]
+ - text: 4 fields
+ - tabpanel:
+ - generic [ref=e405]:
+ - generic [ref=e406]:
+ - generic [ref=e407]:
+ - generic [ref=e408]:
+ - generic [ref=e411]: Vendor name
+ - generic [ref=e413]: vendor_name
+ - generic [ref=e414]:
+ - button "Set vendor_name to null" [ref=e415] [cursor=pointer]:
+ - img
+ - generic [ref=e416]:
+ - img [ref=e417]
+ - text: string
+ - generic [ref=e422]:
+ - generic [ref=e423]:
+ - paragraph [ref=e424]: Supplier shown on the invoice header.
+ - generic [ref=e425]: Actual
+ - generic [ref=e426]: Acme Supplies LLC
+ - generic [ref=e427]:
+ - generic [ref=e428]: Expected
+ - textbox [ref=e430]: Acme Supply LLC
+ - generic [ref=e431]:
+ - generic [ref=e432]:
+ - generic [ref=e433]:
+ - generic [ref=e436]: Total amount
+ - generic [ref=e438]: total_amount
+ - generic [ref=e439]:
+ - button "Set total_amount to null" [ref=e440] [cursor=pointer]:
+ - img
+ - generic [ref=e441]:
+ - img [ref=e442]
+ - text: number
+ - generic [ref=e446]:
+ - generic [ref=e447]:
+ - paragraph [ref=e448]: Final amount due including tax.
+ - generic [ref=e449]: Actual
+ - generic [ref=e450]: "12480"
+ - generic [ref=e451]:
+ - generic [ref=e452]: Expected
+ - spinbutton [ref=e454]: "12480.75"
+ - generic [ref=e455]:
+ - generic [ref=e456]:
+ - generic [ref=e457]:
+ - generic [ref=e460]: Payment terms
+ - generic [ref=e462]: payment_terms
+ - generic [ref=e463]:
+ - button "Set payment_terms to null" [ref=e464] [cursor=pointer]:
+ - img
+ - generic [ref=e465]:
+ - img [ref=e466]
+ - text: string
+ - generic [ref=e471]:
+ - generic [ref=e472]:
+ - generic [ref=e473]: Actual
+ - generic [ref=e474]: Net 15
+ - generic [ref=e475]:
+ - generic [ref=e476]: Expected
+ - combobox [ref=e478]:
+ - option "Due on receipt"
+ - option "Net 15"
+ - option "Net 30" [selected]
+ - generic [ref=e479]:
+ - generic [ref=e480]:
+ - generic [ref=e481]:
+ - generic [ref=e484]: Requires review
+ - generic [ref=e486]: requires_review
+ - generic [ref=e487]:
+ - button "Set requires_review to null" [ref=e488] [cursor=pointer]:
+ - img
+ - generic [ref=e489]:
+ - img [ref=e490]
+ - text: boolean
+ - generic [ref=e492]:
+ - generic [ref=e493]:
+ - paragraph [ref=e494]: Whether a human should verify this document before export.
+ - generic [ref=e495]: Actual
+ - generic [ref=e496]: "false"
+ - generic [ref=e497]:
+ - generic [ref=e498]: Expected
+ - generic [ref=e499]:
+ - button "True" [ref=e500] [cursor=pointer]
+ - button "False" [ref=e501] [cursor=pointer]
+ - article [ref=e502]:
+ - generic [ref=e503]:
+ - generic [ref=e504]:
+ - heading "Document Splits" [level=3] [ref=e505]
+ - paragraph [ref=e506]: Lazy page thumbnails, draggable split groups, and PDF navigation.
+ - generic [ref=e507]:
+ - link "Open in New Tab" [ref=e508] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/document-splits
+ - text: Open in New Tab
+ - img
+ - button "Refresh Document Splits preview" [ref=e509] [cursor=pointer]:
+ - img
+ - generic [ref=e510]:
+ - generic [ref=e511]:
+ - code [ref=e512]: npx shadcn@latest add document-splits
+ - generic [ref=e513]: Preview
+ - generic [ref=e515]:
+ - generic:
+ - generic:
+ - generic [ref=e516]:
+ - generic [ref=e517]:
+ - generic [ref=e518]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e519]: Page 1 of -
+ - generic [ref=e520]:
+ - generic [ref=e521]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e522]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e523]
+ - generic [ref=e524]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e525]: "0.75"
+ - generic [ref=e526]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e527]
+ - generic [ref=e528]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e529]
+ - generic "Upload PDF" [ref=e531] [cursor=pointer]:
+ - button "Upload PDF" [ref=e532]
+ - img
+ - img [ref=e533]
+ - separator [ref=e542]:
+ - img [ref=e544]
+ - generic:
+ - complementary:
+ - button "Add split" [ref=e552] [cursor=pointer]:
+ - img
+ - text: Add split
+ - generic [ref=e553]:
+ - generic [ref=e554]:
+ - generic [ref=e555]:
+ - generic [ref=e556]:
+ - button "Reorder Abstract and intro" [disabled] [ref=e557]:
+ - img [ref=e558]
+ - generic [ref=e565]:
+ - generic [ref=e566]: Abstract and intro
+ - generic [ref=e567]: Pages 1-3
+ - generic [ref=e568]:
+ - generic [ref=e569]: "3"
+ - button "Remove Abstract and intro" [ref=e570] [cursor=pointer]:
+ - img
+ - generic [ref=e573]:
+ - generic [ref=e579]: "1"
+ - generic [ref=e585]: "2"
+ - generic [ref=e591]: "3"
+ - generic [ref=e592]:
+ - generic [ref=e593]:
+ - generic [ref=e594]:
+ - button "Reorder Model architecture" [disabled] [ref=e595]:
+ - img [ref=e596]
+ - generic [ref=e603]:
+ - generic [ref=e604]: Model architecture
+ - generic [ref=e605]: Pages 4-8
+ - generic [ref=e606]:
+ - generic [ref=e607]: "5"
+ - button "Remove Model architecture" [ref=e608] [cursor=pointer]:
+ - img
+ - generic [ref=e611]:
+ - generic [ref=e617]: "4"
+ - generic [ref=e623]: "5"
+ - generic [ref=e629]: "6"
+ - generic [ref=e635]: "7"
+ - generic [ref=e641]: "8"
+ - generic [ref=e642]:
+ - generic [ref=e643]:
+ - generic [ref=e644]:
+ - button "Reorder Training and results" [disabled] [ref=e645]:
+ - img [ref=e646]
+ - generic [ref=e653]:
+ - generic [ref=e654]: Training and results
+ - generic [ref=e655]: Pages 9-15
+ - generic [ref=e656]:
+ - generic [ref=e657]: "7"
+ - button "Remove Training and results" [ref=e658] [cursor=pointer]:
+ - img
+ - generic [ref=e661]:
+ - generic [ref=e667]: "9"
+ - generic [ref=e673]: "10"
+ - generic [ref=e679]: "11"
+ - generic [ref=e685]: "12"
+ - generic [ref=e691]: "13"
+ - generic [ref=e697]: "14"
+ - generic [ref=e703]: "15"
+ - contentinfo [ref=e704]:
+ - generic [ref=e707]:
+ - text: Created by
+ - link "Extend" [ref=e708] [cursor=pointer]:
+ - /url: https://www.extend.ai
+ - text: . The source code is available on
+ - link "GitHub" [ref=e709] [cursor=pointer]:
+ - /url: https://github.com/extend-hq/ui
+ - text: .
+ - region "Notifications alt+T"
+ - generic [ref=e711]: xl
\ No newline at end of file
diff --git a/.playwright-cli/page-2026-05-14T23-09-51-926Z.yml b/.playwright-cli/page-2026-05-14T23-09-51-926Z.yml
new file mode 100644
index 0000000..3b55ee8
--- /dev/null
+++ b/.playwright-cli/page-2026-05-14T23-09-51-926Z.yml
@@ -0,0 +1,623 @@
+- generic [active] [ref=e1]:
+ - generic [ref=e7] [cursor=pointer]:
+ - button "Open issues overlay" [ref=e8]:
+ - img [ref=e10]
+ - generic [ref=e12]:
+ - generic [ref=e13]: "1"
+ - generic [ref=e14]: "2"
+ - generic [ref=e15]:
+ - text: Issue
+ - generic [ref=e16]: s
+ - button "Collapse issues badge" [ref=e17]:
+ - img [ref=e18]
+ - generic [ref=e20]:
+ - banner [ref=e21]:
+ - generic [ref=e23]:
+ - link "Extend UI" [ref=e24] [cursor=pointer]:
+ - /url: /
+ - generic [ref=e26]: Extend UI
+ - navigation [ref=e27]:
+ - link "Docs" [ref=e28] [cursor=pointer]:
+ - /url: /docs
+ - link "Components" [ref=e29] [cursor=pointer]:
+ - /url: /docs/components
+ - link "Blocks" [ref=e30] [cursor=pointer]:
+ - /url: /blocks
+ - generic [ref=e31]:
+ - button "Search documentation..." [ref=e33] [cursor=pointer]:
+ - generic [ref=e34]: Search documentation...
+ - separator [ref=e35]
+ - link "GitHub" [ref=e36] [cursor=pointer]:
+ - /url: https://github.com/extend-hq/ui
+ - img
+ - generic [ref=e37]: GitHub
+ - separator [ref=e38]
+ - button "Toggle theme" [ref=e39] [cursor=pointer]:
+ - img
+ - generic [ref=e40]: Toggle theme
+ - main [ref=e41]:
+ - generic [ref=e44]:
+ - heading "Document Blocks" [level=1] [ref=e45]
+ - paragraph [ref=e46]: Composed PDF viewer workflows built from citations, OCR blocks, signing fields, and document splits.
+ - generic [ref=e47]:
+ - link "Browse Blocks" [ref=e48] [cursor=pointer]:
+ - /url: "#blocks"
+ - link "View Components" [ref=e49] [cursor=pointer]:
+ - /url: /docs/components
+ - generic [ref=e52]:
+ - article [ref=e53]:
+ - generic [ref=e54]:
+ - generic [ref=e55]:
+ - heading "PDF Dropzone" [level=3] [ref=e56]
+ - paragraph [ref=e57]: A PDF-only upload dropzone that opens the dropped file in the shared viewer.
+ - generic [ref=e58]:
+ - link "Open in New Tab" [ref=e59] [cursor=pointer]:
+ - /url: /docs/components/file-upload
+ - text: Open in New Tab
+ - img
+ - button "Refresh PDF Dropzone preview" [ref=e60] [cursor=pointer]:
+ - img
+ - generic [ref=e61]:
+ - generic [ref=e62]:
+ - code [ref=e63]: npx shadcn@latest add pdf-viewer file-upload
+ - generic [ref=e64]: Preview
+ - generic [ref=e69] [cursor=pointer]:
+ - img [ref=e72]
+ - generic [ref=e75]:
+ - generic [ref=e76]: Drop a PDF to preview
+ - generic [ref=e77]: PDF files only
+ - generic [ref=e78]:
+ - img [ref=e79]
+ - generic [ref=e82]: Browse PDF
+ - button "Drop a PDF to preview PDF files only Browse PDF" [ref=e83]
+ - article [ref=e84]:
+ - generic [ref=e85]:
+ - generic [ref=e86]:
+ - heading "Citations" [level=3] [ref=e87]
+ - paragraph [ref=e88]: Evidence cards that scroll the PDF viewer to source bounding boxes.
+ - generic [ref=e89]:
+ - link "Open in New Tab" [ref=e90] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/citations
+ - text: Open in New Tab
+ - img
+ - button "Refresh Citations preview" [ref=e91] [cursor=pointer]:
+ - img
+ - generic [ref=e92]:
+ - generic [ref=e93]:
+ - code [ref=e94]: npx shadcn@latest add citations
+ - generic [ref=e95]: Preview
+ - generic [ref=e97]:
+ - generic [ref=e99]:
+ - generic [ref=e100]:
+ - generic [ref=e101]:
+ - generic [ref=e102]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e103]: Page 1 of -
+ - generic [ref=e104]:
+ - generic [ref=e105]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e106]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e107]
+ - generic [ref=e108]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e109]: "0.75"
+ - generic [ref=e110]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e111]
+ - generic [ref=e112]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e113]
+ - generic "Upload PDF" [ref=e115] [cursor=pointer]:
+ - button "Upload PDF" [ref=e116]
+ - img
+ - img [ref=e119]
+ - separator [ref=e128]:
+ - img [ref=e130]
+ - complementary [ref=e138]:
+ - generic [ref=e141]:
+ - button "Title p. 1 Attention Is All You Need Attention Is All You Need" [ref=e142]:
+ - generic [ref=e143]:
+ - generic [ref=e144]: Title
+ - generic [ref=e145]: p. 1
+ - generic [ref=e146]: Attention Is All You Need
+ - generic [ref=e147]: Attention Is All You Need
+ - button "Authors p. 1 Vaswani, Shazeer, Parmar, Uszkoreit, Jones, Gomez, Kaiser, Polosukhin Ashish Vaswani ... Illia Polosukhin" [ref=e148]:
+ - generic [ref=e149]:
+ - generic [ref=e150]: Authors
+ - generic [ref=e151]: p. 1
+ - generic [ref=e152]: Vaswani, Shazeer, Parmar, Uszkoreit, Jones, Gomez, Kaiser, Polosukhin
+ - generic [ref=e153]: Ashish Vaswani ... Illia Polosukhin
+ - button "Abstract claim p. 1 The Transformer relies entirely on attention mechanisms and avoids recurrence and convolutions. The Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely." [ref=e154]:
+ - generic [ref=e155]:
+ - generic [ref=e156]: Abstract claim
+ - generic [ref=e157]: p. 1
+ - generic [ref=e158]: The Transformer relies entirely on attention mechanisms and avoids recurrence and convolutions.
+ - generic [ref=e159]: The Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely.
+ - button "Translation quality p. 1 28.4 BLEU on WMT 2014 English-to-German our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task" [ref=e160]:
+ - generic [ref=e161]:
+ - generic [ref=e162]: Translation quality
+ - generic [ref=e163]: p. 1
+ - generic [ref=e164]: 28.4 BLEU on WMT 2014 English-to-German
+ - generic [ref=e165]: our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task
+ - button "Background p. 2 Self-attention connects positions in a sequence through constant-time operations. Self-attention connects all positions with a constant number of sequentially executed operations." [ref=e166]:
+ - generic [ref=e167]:
+ - generic [ref=e168]: Background
+ - generic [ref=e169]: p. 2
+ - generic [ref=e170]: Self-attention connects positions in a sequence through constant-time operations.
+ - generic [ref=e171]: Self-attention connects all positions with a constant number of sequentially executed operations.
+ - article [ref=e174]:
+ - generic [ref=e176]:
+ - link "Open in New Tab" [ref=e177] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/ocr-blocks
+ - text: Open in New Tab
+ - img
+ - button "Refresh OCR Blocks preview" [ref=e178] [cursor=pointer]:
+ - img
+ - generic [ref=e179]:
+ - generic [ref=e180]:
+ - code [ref=e181]: npx shadcn@latest add ocr-blocks
+ - generic [ref=e182]: Preview
+ - generic [ref=e184]:
+ - generic [ref=e186]:
+ - generic [ref=e187]:
+ - generic [ref=e188]:
+ - generic [ref=e189]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e190]: Page 1 of -
+ - generic [ref=e191]:
+ - generic [ref=e192]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e193]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e194]
+ - generic [ref=e195]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e196]: "0.75"
+ - generic [ref=e197]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e198]
+ - generic [ref=e199]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e200]
+ - generic "Upload PDF" [ref=e202] [cursor=pointer]:
+ - button "Upload PDF" [ref=e203]
+ - img
+ - img [ref=e206]
+ - separator [ref=e215]:
+ - img [ref=e217]
+ - complementary [ref=e225]:
+ - generic [ref=e228]:
+ - button "Paper title p. 1 Heading · 99% Attention Is All You Need" [ref=e229]:
+ - generic [ref=e230]:
+ - img [ref=e232]
+ - generic [ref=e234]:
+ - generic [ref=e235]:
+ - generic [ref=e236]: Paper title
+ - generic [ref=e237]: p. 1
+ - generic [ref=e238]: Heading · 99%
+ - generic [ref=e239]: Attention Is All You Need
+ - button "Authors p. 1 Paragraph · 96% Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit..." [ref=e240]:
+ - generic [ref=e241]:
+ - img [ref=e243]
+ - generic [ref=e245]:
+ - generic [ref=e246]:
+ - generic [ref=e247]: Authors
+ - generic [ref=e248]: p. 1
+ - generic [ref=e249]: Paragraph · 96%
+ - generic [ref=e250]: Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit...
+ - button "Section heading p. 1 Heading · 98% Abstract" [ref=e251]:
+ - generic [ref=e252]:
+ - img [ref=e254]
+ - generic [ref=e256]:
+ - generic [ref=e257]:
+ - generic [ref=e258]: Section heading
+ - generic [ref=e259]: p. 1
+ - generic [ref=e260]: Heading · 98%
+ - generic [ref=e261]: Abstract
+ - button "Abstract body p. 1 Paragraph · 94% The dominant sequence transduction models are based on complex recurrent or convolutional neural networks..." [ref=e262]:
+ - generic [ref=e263]:
+ - img [ref=e265]
+ - generic [ref=e267]:
+ - generic [ref=e268]:
+ - generic [ref=e269]: Abstract body
+ - generic [ref=e270]: p. 1
+ - generic [ref=e271]: Paragraph · 94%
+ - generic [ref=e272]: The dominant sequence transduction models are based on complex recurrent or convolutional neural networks...
+ - button "Background text p. 2 Paragraph · 92% Recurrent neural networks, long short-term memory and gated recurrent neural networks..." [ref=e273]:
+ - generic [ref=e274]:
+ - img [ref=e276]
+ - generic [ref=e278]:
+ - generic [ref=e279]:
+ - generic [ref=e280]: Background text
+ - generic [ref=e281]: p. 2
+ - generic [ref=e282]: Paragraph · 92%
+ - generic [ref=e283]: Recurrent neural networks, long short-term memory and gated recurrent neural networks...
+ - button "Architecture figure p. 2 Image · 89% Transformer architecture diagram" [ref=e284]:
+ - generic [ref=e285]:
+ - img [ref=e287]
+ - generic [ref=e291]:
+ - generic [ref=e292]:
+ - generic [ref=e293]: Architecture figure
+ - generic [ref=e294]: p. 2
+ - generic [ref=e295]: Image · 89%
+ - generic [ref=e296]: Transformer architecture diagram
+ - button "Complexity table p. 6 Table · 91% Layer type, complexity per layer, sequential operations, maximum path length" [ref=e297]:
+ - generic [ref=e298]:
+ - img [ref=e300]
+ - generic [ref=e302]:
+ - generic [ref=e303]:
+ - generic [ref=e304]: Complexity table
+ - generic [ref=e305]: p. 6
+ - generic [ref=e306]: Table · 91%
+ - generic [ref=e307]: Layer type, complexity per layer, sequential operations, maximum path length
+ - button "Comparison criteria p. 6 List · 88% Total computational complexity, parallelizable computation, and maximum path length" [ref=e308]:
+ - generic [ref=e309]:
+ - img [ref=e311]
+ - generic [ref=e315]:
+ - generic [ref=e316]:
+ - generic [ref=e317]: Comparison criteria
+ - generic [ref=e318]: p. 6
+ - generic [ref=e319]: List · 88%
+ - generic [ref=e320]: Total computational complexity, parallelizable computation, and maximum path length
+ - article [ref=e323]:
+ - generic [ref=e325]:
+ - link "Open in New Tab" [ref=e326] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/e-signature
+ - text: Open in New Tab
+ - img
+ - button "Refresh E-Signature preview" [ref=e327] [cursor=pointer]:
+ - img
+ - generic [ref=e328]:
+ - generic [ref=e329]:
+ - code [ref=e330]: npx shadcn@latest add e-signature
+ - generic [ref=e331]: Preview
+ - generic [ref=e333]:
+ - generic [ref=e335]:
+ - generic [ref=e336]:
+ - generic [ref=e337]:
+ - generic [ref=e338]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e339]: Page 1 of -
+ - generic [ref=e340]:
+ - generic [ref=e341]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e342]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e343]
+ - generic [ref=e344]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e345]: "0.75"
+ - generic [ref=e346]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e347]
+ - generic [ref=e348]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e349]
+ - button "Draw" [ref=e350] [cursor=pointer]:
+ - img
+ - text: Draw
+ - button "Download" [disabled]:
+ - img
+ - text: Download
+ - separator [ref=e351]
+ - generic "Upload PDF" [ref=e353] [cursor=pointer]:
+ - button "Upload PDF" [ref=e354]
+ - img
+ - img [ref=e357]
+ - separator [ref=e366]:
+ - img [ref=e368]
+ - complementary [ref=e376]:
+ - generic [ref=e380]:
+ - img [ref=e382]
+ - generic [ref=e385]:
+ - generic [ref=e386]:
+ - generic [ref=e387]: Signature1
+ - generic [ref=e388]: Unsigned
+ - generic [ref=e389]: 250 x 58 on page 1
+ - button "Sign" [ref=e390] [cursor=pointer]:
+ - img
+ - text: Sign
+ - article [ref=e391]:
+ - generic [ref=e392]:
+ - generic [ref=e393]:
+ - heading "Human Review" [level=3] [ref=e394]
+ - paragraph [ref=e395]: Extraction review cards connected to source evidence in the PDF viewer.
+ - generic [ref=e396]:
+ - link "Open in New Tab" [ref=e397] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/human-review
+ - text: Open in New Tab
+ - img
+ - button "Refresh Human Review preview" [ref=e398] [cursor=pointer]:
+ - img
+ - generic [ref=e399]:
+ - generic [ref=e400]:
+ - code [ref=e401]: npx shadcn@latest add human-review pdf-viewer
+ - generic [ref=e402]: Preview
+ - generic [ref=e404]:
+ - generic [ref=e406]:
+ - generic [ref=e407]:
+ - generic [ref=e408]:
+ - generic [ref=e409]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e410]: Page 1 of -
+ - generic [ref=e411]:
+ - generic [ref=e412]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e413]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e414]
+ - generic [ref=e415]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e416]: "0.75"
+ - generic [ref=e417]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e418]
+ - generic [ref=e419]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e420]
+ - generic "Upload PDF" [ref=e422] [cursor=pointer]:
+ - button "Upload PDF" [ref=e423]
+ - img
+ - img [ref=e426]
+ - separator [ref=e435]:
+ - img [ref=e437]
+ - generic [ref=e445]:
+ - generic [ref=e446]:
+ - tablist [ref=e447]:
+ - tab "Form" [selected] [ref=e448] [cursor=pointer]:
+ - img
+ - text: Form
+ - tab "JSON" [ref=e449] [cursor=pointer]:
+ - img
+ - text: JSON
+ - generic [ref=e450]:
+ - img [ref=e451]
+ - text: 4 fields
+ - tabpanel "Form" [ref=e454]:
+ - generic [ref=e456]:
+ - generic [ref=e457]:
+ - generic [ref=e458]:
+ - generic [ref=e459]:
+ - generic [ref=e462]: Vendor name
+ - generic [ref=e464]: vendor_name
+ - generic [ref=e465]:
+ - button "Set vendor_name to null" [ref=e466] [cursor=pointer]:
+ - img
+ - generic [ref=e467]:
+ - img [ref=e468]
+ - text: string
+ - generic [ref=e473]:
+ - generic [ref=e474]:
+ - paragraph [ref=e475]: Supplier shown on the invoice header.
+ - generic [ref=e476]: Actual
+ - generic [ref=e477]: Acme Supplies LLC
+ - generic [ref=e478]:
+ - generic [ref=e479]: Expected
+ - textbox [ref=e481]: Acme Supply LLC
+ - generic [ref=e482]:
+ - generic [ref=e483]:
+ - generic [ref=e484]:
+ - generic [ref=e487]: Total amount
+ - generic [ref=e489]: total_amount
+ - generic [ref=e490]:
+ - button "Set total_amount to null" [ref=e491] [cursor=pointer]:
+ - img
+ - generic [ref=e492]:
+ - img [ref=e493]
+ - text: number
+ - generic [ref=e497]:
+ - generic [ref=e498]:
+ - paragraph [ref=e499]: Final amount due including tax.
+ - generic [ref=e500]: Actual
+ - generic [ref=e501]: "12480"
+ - generic [ref=e502]:
+ - generic [ref=e503]: Expected
+ - spinbutton [ref=e505]: "12480.75"
+ - generic [ref=e506]:
+ - generic [ref=e507]:
+ - generic [ref=e508]:
+ - generic [ref=e511]: Payment terms
+ - generic [ref=e513]: payment_terms
+ - generic [ref=e514]:
+ - button "Set payment_terms to null" [ref=e515] [cursor=pointer]:
+ - img
+ - generic [ref=e516]:
+ - img [ref=e517]
+ - text: string
+ - generic [ref=e522]:
+ - generic [ref=e523]:
+ - generic [ref=e524]: Actual
+ - generic [ref=e525]: Net 15
+ - generic [ref=e526]:
+ - generic [ref=e527]: Expected
+ - combobox [ref=e529]:
+ - option "Due on receipt"
+ - option "Net 15"
+ - option "Net 30" [selected]
+ - generic [ref=e530]:
+ - generic [ref=e531]:
+ - generic [ref=e532]:
+ - generic [ref=e535]: Requires review
+ - generic [ref=e537]: requires_review
+ - generic [ref=e538]:
+ - button "Set requires_review to null" [ref=e539] [cursor=pointer]:
+ - img
+ - generic [ref=e540]:
+ - img [ref=e541]
+ - text: boolean
+ - generic [ref=e543]:
+ - generic [ref=e544]:
+ - paragraph [ref=e545]: Whether a human should verify this document before export.
+ - generic [ref=e546]: Actual
+ - generic [ref=e547]: "false"
+ - generic [ref=e548]:
+ - generic [ref=e549]: Expected
+ - generic [ref=e550]:
+ - button "True" [ref=e551] [cursor=pointer]
+ - button "False" [ref=e552] [cursor=pointer]
+ - article [ref=e555]:
+ - generic [ref=e556]:
+ - generic [ref=e557]:
+ - heading "Document Splits" [level=3] [ref=e558]
+ - paragraph [ref=e559]: Lazy page thumbnails, draggable split groups, and PDF navigation.
+ - generic [ref=e560]:
+ - link "Open in New Tab" [ref=e561] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/document-splits
+ - text: Open in New Tab
+ - img
+ - button "Refresh Document Splits preview" [ref=e562] [cursor=pointer]:
+ - img
+ - generic [ref=e563]:
+ - generic [ref=e564]:
+ - code [ref=e565]: npx shadcn@latest add document-splits
+ - generic [ref=e566]: Preview
+ - generic [ref=e570]:
+ - generic [ref=e572]:
+ - generic [ref=e573]:
+ - generic [ref=e574]:
+ - generic [ref=e575]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e576]: Page 1 of -
+ - generic [ref=e577]:
+ - generic [ref=e578]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e579]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e580]
+ - generic [ref=e581]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e582]: "0.75"
+ - generic [ref=e583]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e584]
+ - generic [ref=e585]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e586]
+ - generic "Upload PDF" [ref=e588] [cursor=pointer]:
+ - button "Upload PDF" [ref=e589]
+ - img
+ - img [ref=e592]
+ - separator [ref=e597]:
+ - img [ref=e599]
+ - complementary [ref=e607]:
+ - button "Add split" [ref=e609] [cursor=pointer]:
+ - img
+ - text: Add split
+ - generic [ref=e611]:
+ - generic [ref=e612]:
+ - generic [ref=e613]:
+ - generic [ref=e614]:
+ - button "Reorder Abstract and intro" [disabled] [ref=e615]:
+ - img [ref=e616]
+ - generic [ref=e623]:
+ - generic [ref=e624]: Abstract and intro
+ - generic [ref=e625]: Pages 1-3
+ - generic [ref=e626]:
+ - generic [ref=e627]: "3"
+ - button "Remove Abstract and intro" [ref=e628] [cursor=pointer]:
+ - img
+ - generic [ref=e631]:
+ - generic [ref=e637]: "1"
+ - generic [ref=e643]: "2"
+ - generic [ref=e649]: "3"
+ - generic [ref=e650]:
+ - generic [ref=e651]:
+ - generic [ref=e652]:
+ - button "Reorder Model architecture" [disabled] [ref=e653]:
+ - img [ref=e654]
+ - generic [ref=e661]:
+ - generic [ref=e662]: Model architecture
+ - generic [ref=e663]: Pages 4-8
+ - generic [ref=e664]:
+ - generic [ref=e665]: "5"
+ - button "Remove Model architecture" [ref=e666] [cursor=pointer]:
+ - img
+ - generic [ref=e669]:
+ - generic [ref=e675]: "4"
+ - generic [ref=e681]: "5"
+ - generic [ref=e687]: "6"
+ - generic [ref=e693]: "7"
+ - generic [ref=e699]: "8"
+ - generic [ref=e700]:
+ - generic [ref=e701]:
+ - generic [ref=e702]:
+ - button "Reorder Training and results" [disabled] [ref=e703]:
+ - img [ref=e704]
+ - generic [ref=e711]:
+ - generic [ref=e712]: Training and results
+ - generic [ref=e713]: Pages 9-15
+ - generic [ref=e714]:
+ - generic [ref=e715]: "7"
+ - button "Remove Training and results" [ref=e716] [cursor=pointer]:
+ - img
+ - generic [ref=e719]:
+ - generic [ref=e725]: "9"
+ - generic [ref=e731]: "10"
+ - generic [ref=e737]: "11"
+ - generic [ref=e743]: "12"
+ - generic [ref=e749]: "13"
+ - generic [ref=e755]: "14"
+ - generic [ref=e761]: "15"
+ - contentinfo [ref=e762]:
+ - generic [ref=e765]:
+ - text: Created by
+ - link "Extend" [ref=e766] [cursor=pointer]:
+ - /url: https://www.extend.ai
+ - text: . The source code is available on
+ - link "GitHub" [ref=e767] [cursor=pointer]:
+ - /url: https://github.com/extend-hq/ui
+ - text: .
+ - region "Notifications alt+T"
+ - generic [ref=e769]: xl
+ - alert [ref=e770]
\ No newline at end of file
diff --git a/.playwright-cli/page-2026-05-14T23-23-54-686Z.yml b/.playwright-cli/page-2026-05-14T23-23-54-686Z.yml
new file mode 100644
index 0000000..b77e002
--- /dev/null
+++ b/.playwright-cli/page-2026-05-14T23-23-54-686Z.yml
@@ -0,0 +1,612 @@
+- generic [active] [ref=e1]:
+ - generic [ref=e2]:
+ - banner [ref=e3]:
+ - generic [ref=e5]:
+ - link "Extend UI" [ref=e6] [cursor=pointer]:
+ - /url: /
+ - generic [ref=e8]: Extend UI
+ - navigation [ref=e9]:
+ - link "Docs" [ref=e10] [cursor=pointer]:
+ - /url: /docs
+ - link "Components" [ref=e11] [cursor=pointer]:
+ - /url: /docs/components
+ - link "Blocks" [ref=e12] [cursor=pointer]:
+ - /url: /blocks
+ - generic [ref=e13]:
+ - button "Search documentation..." [ref=e15] [cursor=pointer]:
+ - generic [ref=e16]: Search documentation...
+ - separator [ref=e17]
+ - link "GitHub" [ref=e18] [cursor=pointer]:
+ - /url: https://github.com/extend-hq/ui
+ - img
+ - generic [ref=e19]: GitHub
+ - separator [ref=e20]
+ - button "Toggle theme" [ref=e21] [cursor=pointer]:
+ - img
+ - generic [ref=e22]: Toggle theme
+ - main [ref=e23]:
+ - generic [ref=e26]:
+ - heading "Document Blocks" [level=1] [ref=e27]
+ - paragraph [ref=e28]: Composed PDF viewer workflows built from citations, OCR blocks, signing fields, and document splits.
+ - generic [ref=e29]:
+ - link "Browse Blocks" [ref=e30] [cursor=pointer]:
+ - /url: "#blocks"
+ - link "View Components" [ref=e31] [cursor=pointer]:
+ - /url: /docs/components
+ - generic [ref=e34]:
+ - article [ref=e35]:
+ - generic [ref=e36]:
+ - generic [ref=e37]:
+ - heading "PDF Dropzone" [level=3] [ref=e38]
+ - paragraph [ref=e39]: A PDF-only upload dropzone that opens the dropped file in the shared viewer.
+ - generic [ref=e40]:
+ - link "Open in New Tab" [ref=e41] [cursor=pointer]:
+ - /url: /docs/components/file-upload
+ - text: Open in New Tab
+ - img
+ - button "Refresh PDF Dropzone preview" [ref=e42] [cursor=pointer]:
+ - img
+ - generic [ref=e43]:
+ - generic [ref=e44]:
+ - code [ref=e45]: npx shadcn@latest add pdf-viewer file-upload
+ - generic [ref=e46]: Preview
+ - generic [ref=e51] [cursor=pointer]:
+ - img [ref=e54]
+ - generic [ref=e57]:
+ - generic [ref=e58]: Drop a PDF to preview
+ - generic [ref=e59]: PDF files only
+ - generic [ref=e60]:
+ - img [ref=e61]
+ - generic [ref=e64]: Browse PDF
+ - button "Drop a PDF to preview PDF files only Browse PDF" [ref=e65]
+ - article [ref=e66]:
+ - generic [ref=e67]:
+ - generic [ref=e68]:
+ - heading "Citations" [level=3] [ref=e69]
+ - paragraph [ref=e70]: Evidence cards that scroll the PDF viewer to source bounding boxes.
+ - generic [ref=e71]:
+ - link "Open in New Tab" [ref=e72] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/citations
+ - text: Open in New Tab
+ - img
+ - button "Refresh Citations preview" [ref=e73] [cursor=pointer]:
+ - img
+ - generic [ref=e74]:
+ - generic [ref=e75]:
+ - code [ref=e76]: npx shadcn@latest add citations
+ - generic [ref=e77]: Preview
+ - generic [ref=e79]:
+ - generic [ref=e81]:
+ - generic [ref=e82]:
+ - generic [ref=e83]:
+ - generic [ref=e84]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e85]: Page 1 of -
+ - generic [ref=e86]:
+ - generic [ref=e87]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e88]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e89]
+ - generic [ref=e90]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e91]: "0.75"
+ - generic [ref=e92]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e93]
+ - generic [ref=e94]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e95]
+ - generic "Upload PDF" [ref=e97] [cursor=pointer]:
+ - button "Upload PDF" [ref=e98]
+ - img
+ - img [ref=e101]
+ - separator [ref=e106]:
+ - img [ref=e108]
+ - complementary [ref=e116]:
+ - generic [ref=e119]:
+ - button "Title p. 1 Attention Is All You Need Attention Is All You Need" [ref=e120]:
+ - generic [ref=e121]:
+ - generic [ref=e122]: Title
+ - generic [ref=e123]: p. 1
+ - generic [ref=e124]: Attention Is All You Need
+ - generic [ref=e125]: Attention Is All You Need
+ - button "Authors p. 1 Vaswani, Shazeer, Parmar, Uszkoreit, Jones, Gomez, Kaiser, Polosukhin Ashish Vaswani ... Illia Polosukhin" [ref=e126]:
+ - generic [ref=e127]:
+ - generic [ref=e128]: Authors
+ - generic [ref=e129]: p. 1
+ - generic [ref=e130]: Vaswani, Shazeer, Parmar, Uszkoreit, Jones, Gomez, Kaiser, Polosukhin
+ - generic [ref=e131]: Ashish Vaswani ... Illia Polosukhin
+ - button "Abstract claim p. 1 The Transformer relies entirely on attention mechanisms and avoids recurrence and convolutions. The Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely." [ref=e132]:
+ - generic [ref=e133]:
+ - generic [ref=e134]: Abstract claim
+ - generic [ref=e135]: p. 1
+ - generic [ref=e136]: The Transformer relies entirely on attention mechanisms and avoids recurrence and convolutions.
+ - generic [ref=e137]: The Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely.
+ - button "Translation quality p. 1 28.4 BLEU on WMT 2014 English-to-German our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task" [ref=e138]:
+ - generic [ref=e139]:
+ - generic [ref=e140]: Translation quality
+ - generic [ref=e141]: p. 1
+ - generic [ref=e142]: 28.4 BLEU on WMT 2014 English-to-German
+ - generic [ref=e143]: our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task
+ - button "Background p. 2 Self-attention connects positions in a sequence through constant-time operations. Self-attention connects all positions with a constant number of sequentially executed operations." [ref=e144]:
+ - generic [ref=e145]:
+ - generic [ref=e146]: Background
+ - generic [ref=e147]: p. 2
+ - generic [ref=e148]: Self-attention connects positions in a sequence through constant-time operations.
+ - generic [ref=e149]: Self-attention connects all positions with a constant number of sequentially executed operations.
+ - article [ref=e150]:
+ - generic [ref=e152]:
+ - link "Open in New Tab" [ref=e153] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/ocr-blocks
+ - text: Open in New Tab
+ - img
+ - button "Refresh OCR Blocks preview" [ref=e154] [cursor=pointer]:
+ - img
+ - generic [ref=e155]:
+ - generic [ref=e156]:
+ - code [ref=e157]: npx shadcn@latest add ocr-blocks
+ - generic [ref=e158]: Preview
+ - generic [ref=e160]:
+ - generic [ref=e162]:
+ - generic [ref=e163]:
+ - generic [ref=e164]:
+ - generic [ref=e165]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e166]: Page 1 of -
+ - generic [ref=e167]:
+ - generic [ref=e168]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e169]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e170]
+ - generic [ref=e171]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e172]: "0.75"
+ - generic [ref=e173]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e174]
+ - generic [ref=e175]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e176]
+ - generic "Upload PDF" [ref=e178] [cursor=pointer]:
+ - button "Upload PDF" [ref=e179]
+ - img
+ - img [ref=e182]
+ - separator [ref=e187]:
+ - img [ref=e189]
+ - complementary [ref=e197]:
+ - generic [ref=e200]:
+ - button "Paper title p. 1 Heading · 99% Attention Is All You Need" [ref=e201]:
+ - generic [ref=e202]:
+ - img [ref=e204]
+ - generic [ref=e206]:
+ - generic [ref=e207]:
+ - generic [ref=e208]: Paper title
+ - generic [ref=e209]: p. 1
+ - generic [ref=e210]: Heading · 99%
+ - generic [ref=e211]: Attention Is All You Need
+ - button "Authors p. 1 Paragraph · 96% Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit..." [ref=e212]:
+ - generic [ref=e213]:
+ - img [ref=e215]
+ - generic [ref=e217]:
+ - generic [ref=e218]:
+ - generic [ref=e219]: Authors
+ - generic [ref=e220]: p. 1
+ - generic [ref=e221]: Paragraph · 96%
+ - generic [ref=e222]: Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit...
+ - button "Section heading p. 1 Heading · 98% Abstract" [ref=e223]:
+ - generic [ref=e224]:
+ - img [ref=e226]
+ - generic [ref=e228]:
+ - generic [ref=e229]:
+ - generic [ref=e230]: Section heading
+ - generic [ref=e231]: p. 1
+ - generic [ref=e232]: Heading · 98%
+ - generic [ref=e233]: Abstract
+ - button "Abstract body p. 1 Paragraph · 94% The dominant sequence transduction models are based on complex recurrent or convolutional neural networks..." [ref=e234]:
+ - generic [ref=e235]:
+ - img [ref=e237]
+ - generic [ref=e239]:
+ - generic [ref=e240]:
+ - generic [ref=e241]: Abstract body
+ - generic [ref=e242]: p. 1
+ - generic [ref=e243]: Paragraph · 94%
+ - generic [ref=e244]: The dominant sequence transduction models are based on complex recurrent or convolutional neural networks...
+ - button "Background text p. 2 Paragraph · 92% Recurrent neural networks, long short-term memory and gated recurrent neural networks..." [ref=e245]:
+ - generic [ref=e246]:
+ - img [ref=e248]
+ - generic [ref=e250]:
+ - generic [ref=e251]:
+ - generic [ref=e252]: Background text
+ - generic [ref=e253]: p. 2
+ - generic [ref=e254]: Paragraph · 92%
+ - generic [ref=e255]: Recurrent neural networks, long short-term memory and gated recurrent neural networks...
+ - button "Architecture figure p. 2 Image · 89% Transformer architecture diagram" [ref=e256]:
+ - generic [ref=e257]:
+ - img [ref=e259]
+ - generic [ref=e263]:
+ - generic [ref=e264]:
+ - generic [ref=e265]: Architecture figure
+ - generic [ref=e266]: p. 2
+ - generic [ref=e267]: Image · 89%
+ - generic [ref=e268]: Transformer architecture diagram
+ - button "Complexity table p. 6 Table · 91% Layer type, complexity per layer, sequential operations, maximum path length" [ref=e269]:
+ - generic [ref=e270]:
+ - img [ref=e272]
+ - generic [ref=e274]:
+ - generic [ref=e275]:
+ - generic [ref=e276]: Complexity table
+ - generic [ref=e277]: p. 6
+ - generic [ref=e278]: Table · 91%
+ - generic [ref=e279]: Layer type, complexity per layer, sequential operations, maximum path length
+ - button "Comparison criteria p. 6 List · 88% Total computational complexity, parallelizable computation, and maximum path length" [ref=e280]:
+ - generic [ref=e281]:
+ - img [ref=e283]
+ - generic [ref=e287]:
+ - generic [ref=e288]:
+ - generic [ref=e289]: Comparison criteria
+ - generic [ref=e290]: p. 6
+ - generic [ref=e291]: List · 88%
+ - generic [ref=e292]: Total computational complexity, parallelizable computation, and maximum path length
+ - article [ref=e293]:
+ - generic [ref=e295]:
+ - link "Open in New Tab" [ref=e296] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/e-signature
+ - text: Open in New Tab
+ - img
+ - button "Refresh E-Signature preview" [ref=e297] [cursor=pointer]:
+ - img
+ - generic [ref=e298]:
+ - generic [ref=e299]:
+ - code [ref=e300]: npx shadcn@latest add e-signature
+ - generic [ref=e301]: Preview
+ - generic [ref=e303]:
+ - generic [ref=e305]:
+ - generic [ref=e306]:
+ - generic [ref=e307]:
+ - generic [ref=e308]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e309]: Page 1 of -
+ - generic [ref=e310]:
+ - generic [ref=e311]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e312]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e313]
+ - generic [ref=e314]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e315]: "0.75"
+ - generic [ref=e316]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e317]
+ - generic [ref=e318]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e319]
+ - button "Draw" [ref=e320] [cursor=pointer]:
+ - img
+ - text: Draw
+ - button "Download" [disabled]:
+ - img
+ - text: Download
+ - separator [ref=e321]
+ - generic "Upload PDF" [ref=e323] [cursor=pointer]:
+ - button "Upload PDF" [ref=e324]
+ - img
+ - img [ref=e327]
+ - separator [ref=e332]:
+ - img [ref=e334]
+ - complementary [ref=e342]:
+ - generic [ref=e346]:
+ - img [ref=e348]
+ - generic [ref=e351]:
+ - generic [ref=e352]:
+ - generic [ref=e353]: Signature1
+ - generic [ref=e354]: Unsigned
+ - generic [ref=e355]: 250 x 58 on page 1
+ - button "Sign" [ref=e356] [cursor=pointer]:
+ - img
+ - text: Sign
+ - article [ref=e357]:
+ - generic [ref=e358]:
+ - generic [ref=e359]:
+ - heading "Human Review" [level=3] [ref=e360]
+ - paragraph [ref=e361]: Extraction review cards connected to source evidence in the PDF viewer.
+ - generic [ref=e362]:
+ - link "Open in New Tab" [ref=e363] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/human-review
+ - text: Open in New Tab
+ - img
+ - button "Refresh Human Review preview" [ref=e364] [cursor=pointer]:
+ - img
+ - generic [ref=e365]:
+ - generic [ref=e366]:
+ - code [ref=e367]: npx shadcn@latest add human-review pdf-viewer
+ - generic [ref=e368]: Preview
+ - generic [ref=e370]:
+ - generic [ref=e372]:
+ - generic [ref=e373]:
+ - generic [ref=e374]:
+ - generic [ref=e375]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e376]: Page 1 of -
+ - generic [ref=e377]:
+ - generic [ref=e378]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e379]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e380]
+ - generic [ref=e381]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e382]: "0.75"
+ - generic [ref=e383]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e384]
+ - generic [ref=e385]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e386]
+ - generic "Upload PDF" [ref=e388] [cursor=pointer]:
+ - button "Upload PDF" [ref=e389]
+ - img
+ - img [ref=e392]
+ - separator [ref=e397]:
+ - img [ref=e399]
+ - generic [ref=e407]:
+ - generic [ref=e408]:
+ - tablist [ref=e409]:
+ - tab "Form" [selected] [ref=e410] [cursor=pointer]:
+ - img
+ - text: Form
+ - tab "JSON" [ref=e411] [cursor=pointer]:
+ - img
+ - text: JSON
+ - generic [ref=e412]:
+ - img [ref=e413]
+ - text: 4 fields
+ - tabpanel "Form" [ref=e416]:
+ - generic [ref=e418]:
+ - generic [ref=e419]:
+ - generic [ref=e420]:
+ - generic [ref=e421]:
+ - generic [ref=e424]: Vendor name
+ - generic [ref=e426]: vendor_name
+ - generic [ref=e427]:
+ - button "Set vendor_name to null" [ref=e428] [cursor=pointer]:
+ - img
+ - generic [ref=e429]:
+ - img [ref=e430]
+ - text: string
+ - generic [ref=e435]:
+ - generic [ref=e436]:
+ - paragraph [ref=e437]: Supplier shown on the invoice header.
+ - generic [ref=e438]: Actual
+ - generic [ref=e439]: Acme Supplies LLC
+ - generic [ref=e440]:
+ - generic [ref=e441]: Expected
+ - textbox [ref=e443]: Acme Supply LLC
+ - generic [ref=e444]:
+ - generic [ref=e445]:
+ - generic [ref=e446]:
+ - generic [ref=e449]: Total amount
+ - generic [ref=e451]: total_amount
+ - generic [ref=e452]:
+ - button "Set total_amount to null" [ref=e453] [cursor=pointer]:
+ - img
+ - generic [ref=e454]:
+ - img [ref=e455]
+ - text: number
+ - generic [ref=e459]:
+ - generic [ref=e460]:
+ - paragraph [ref=e461]: Final amount due including tax.
+ - generic [ref=e462]: Actual
+ - generic [ref=e463]: "12480"
+ - generic [ref=e464]:
+ - generic [ref=e465]: Expected
+ - spinbutton [ref=e467]: "12480.75"
+ - generic [ref=e468]:
+ - generic [ref=e469]:
+ - generic [ref=e470]:
+ - generic [ref=e473]: Payment terms
+ - generic [ref=e475]: payment_terms
+ - generic [ref=e476]:
+ - button "Set payment_terms to null" [ref=e477] [cursor=pointer]:
+ - img
+ - generic [ref=e478]:
+ - img [ref=e479]
+ - text: string
+ - generic [ref=e484]:
+ - generic [ref=e485]:
+ - generic [ref=e486]: Actual
+ - generic [ref=e487]: Net 15
+ - generic [ref=e488]:
+ - generic [ref=e489]: Expected
+ - combobox [ref=e491]:
+ - option "Due on receipt"
+ - option "Net 15"
+ - option "Net 30" [selected]
+ - generic [ref=e492]:
+ - generic [ref=e493]:
+ - generic [ref=e494]:
+ - generic [ref=e497]: Requires review
+ - generic [ref=e499]: requires_review
+ - generic [ref=e500]:
+ - button "Set requires_review to null" [ref=e501] [cursor=pointer]:
+ - img
+ - generic [ref=e502]:
+ - img [ref=e503]
+ - text: boolean
+ - generic [ref=e505]:
+ - generic [ref=e506]:
+ - paragraph [ref=e507]: Whether a human should verify this document before export.
+ - generic [ref=e508]: Actual
+ - generic [ref=e509]: "false"
+ - generic [ref=e510]:
+ - generic [ref=e511]: Expected
+ - generic [ref=e512]:
+ - button "True" [ref=e513] [cursor=pointer]
+ - button "False" [ref=e514] [cursor=pointer]
+ - article [ref=e515]:
+ - generic [ref=e516]:
+ - generic [ref=e517]:
+ - heading "Document Splits" [level=3] [ref=e518]
+ - paragraph [ref=e519]: Lazy page thumbnails, draggable split groups, and PDF navigation.
+ - generic [ref=e520]:
+ - link "Open in New Tab" [ref=e521] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/document-splits
+ - text: Open in New Tab
+ - img
+ - button "Refresh Document Splits preview" [ref=e522] [cursor=pointer]:
+ - img
+ - generic [ref=e523]:
+ - generic [ref=e524]:
+ - code [ref=e525]: npx shadcn@latest add document-splits
+ - generic [ref=e526]: Preview
+ - generic [ref=e528]:
+ - generic [ref=e530]:
+ - generic [ref=e531]:
+ - generic [ref=e532]:
+ - generic [ref=e533]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e534]: Page 1 of -
+ - generic [ref=e535]:
+ - generic [ref=e536]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e537]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e538]
+ - generic [ref=e539]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e540]: "0.75"
+ - generic [ref=e541]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e542]
+ - generic [ref=e543]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e544]
+ - generic "Upload PDF" [ref=e546] [cursor=pointer]:
+ - button "Upload PDF" [ref=e547]
+ - img
+ - img [ref=e550]
+ - separator [ref=e555]:
+ - img [ref=e557]
+ - complementary [ref=e565]:
+ - button "Add split" [ref=e567] [cursor=pointer]:
+ - img
+ - text: Add split
+ - generic [ref=e569]:
+ - generic [ref=e570]:
+ - generic [ref=e571]:
+ - generic [ref=e572]:
+ - button "Reorder Abstract and intro" [disabled] [ref=e573]:
+ - img [ref=e574]
+ - generic [ref=e581]:
+ - generic [ref=e582]: Abstract and intro
+ - generic [ref=e583]: Pages 1-3
+ - generic [ref=e584]:
+ - generic [ref=e585]: "3"
+ - button "Remove Abstract and intro" [ref=e586] [cursor=pointer]:
+ - img
+ - generic [ref=e589]:
+ - generic [ref=e595]: "1"
+ - generic [ref=e601]: "2"
+ - generic [ref=e607]: "3"
+ - generic [ref=e608]:
+ - generic [ref=e609]:
+ - generic [ref=e610]:
+ - button "Reorder Model architecture" [disabled] [ref=e611]:
+ - img [ref=e612]
+ - generic [ref=e619]:
+ - generic [ref=e620]: Model architecture
+ - generic [ref=e621]: Pages 4-8
+ - generic [ref=e622]:
+ - generic [ref=e623]: "5"
+ - button "Remove Model architecture" [ref=e624] [cursor=pointer]:
+ - img
+ - generic [ref=e627]:
+ - generic [ref=e633]: "4"
+ - generic [ref=e639]: "5"
+ - generic [ref=e645]: "6"
+ - generic [ref=e651]: "7"
+ - generic [ref=e657]: "8"
+ - generic [ref=e658]:
+ - generic [ref=e659]:
+ - generic [ref=e660]:
+ - button "Reorder Training and results" [disabled] [ref=e661]:
+ - img [ref=e662]
+ - generic [ref=e669]:
+ - generic [ref=e670]: Training and results
+ - generic [ref=e671]: Pages 9-15
+ - generic [ref=e672]:
+ - generic [ref=e673]: "7"
+ - button "Remove Training and results" [ref=e674] [cursor=pointer]:
+ - img
+ - generic [ref=e677]:
+ - generic [ref=e683]: "9"
+ - generic [ref=e689]: "10"
+ - generic [ref=e695]: "11"
+ - generic [ref=e701]: "12"
+ - generic [ref=e707]: "13"
+ - generic [ref=e713]: "14"
+ - generic [ref=e719]: "15"
+ - contentinfo [ref=e720]:
+ - generic [ref=e723]:
+ - text: Created by
+ - link "Extend" [ref=e724] [cursor=pointer]:
+ - /url: https://www.extend.ai
+ - text: . The source code is available on
+ - link "GitHub" [ref=e725] [cursor=pointer]:
+ - /url: https://github.com/extend-hq/ui
+ - text: .
+ - region "Notifications alt+T"
+ - generic [ref=e727]: xl
+ - alert [ref=e728]
\ No newline at end of file
diff --git a/.playwright-cli/page-2026-05-14T23-26-17-455Z.yml b/.playwright-cli/page-2026-05-14T23-26-17-455Z.yml
new file mode 100644
index 0000000..8b51334
--- /dev/null
+++ b/.playwright-cli/page-2026-05-14T23-26-17-455Z.yml
@@ -0,0 +1,611 @@
+- generic [active] [ref=e1]:
+ - generic [ref=e2]:
+ - banner [ref=e3]:
+ - generic [ref=e5]:
+ - link "Extend UI" [ref=e6] [cursor=pointer]:
+ - /url: /
+ - generic [ref=e8]: Extend UI
+ - navigation [ref=e9]:
+ - link "Docs" [ref=e10] [cursor=pointer]:
+ - /url: /docs
+ - link "Components" [ref=e11] [cursor=pointer]:
+ - /url: /docs/components
+ - link "Blocks" [ref=e12] [cursor=pointer]:
+ - /url: /blocks
+ - generic [ref=e13]:
+ - button "Search documentation..." [ref=e15] [cursor=pointer]:
+ - generic [ref=e16]: Search documentation...
+ - separator [ref=e17]
+ - link "GitHub" [ref=e18] [cursor=pointer]:
+ - /url: https://github.com/extend-hq/ui
+ - img
+ - generic [ref=e19]: GitHub
+ - separator [ref=e20]
+ - button "Toggle theme" [ref=e21] [cursor=pointer]:
+ - img
+ - generic [ref=e22]: Toggle theme
+ - main [ref=e23]:
+ - generic [ref=e26]:
+ - heading "Document Blocks" [level=1] [ref=e27]
+ - paragraph [ref=e28]: Composed PDF viewer workflows built from citations, OCR blocks, signing fields, and document splits.
+ - generic [ref=e29]:
+ - link "Browse Blocks" [ref=e30] [cursor=pointer]:
+ - /url: "#blocks"
+ - link "View Components" [ref=e31] [cursor=pointer]:
+ - /url: /docs/components
+ - generic [ref=e34]:
+ - article [ref=e35]:
+ - generic [ref=e36]:
+ - generic [ref=e37]:
+ - heading "PDF Dropzone" [level=3] [ref=e38]
+ - paragraph [ref=e39]: A PDF-only upload dropzone that opens the dropped file in the shared viewer.
+ - generic [ref=e40]:
+ - link "Open in New Tab" [ref=e41] [cursor=pointer]:
+ - /url: /docs/components/file-upload
+ - text: Open in New Tab
+ - img
+ - button "Refresh PDF Dropzone preview" [ref=e42] [cursor=pointer]:
+ - img
+ - generic [ref=e43]:
+ - generic [ref=e44]:
+ - code [ref=e45]: npx shadcn@latest add pdf-viewer file-upload
+ - generic [ref=e46]: Preview
+ - generic [ref=e51] [cursor=pointer]:
+ - img [ref=e54]
+ - generic [ref=e57]:
+ - generic [ref=e58]: Drop a PDF to preview
+ - generic [ref=e59]: PDF files only
+ - generic [ref=e60]:
+ - img [ref=e61]
+ - generic [ref=e64]: Browse PDF
+ - button "Drop a PDF to preview PDF files only Browse PDF" [ref=e65]
+ - article [ref=e66]:
+ - generic [ref=e67]:
+ - generic [ref=e68]:
+ - heading "Citations" [level=3] [ref=e69]
+ - paragraph [ref=e70]: Evidence cards that scroll the PDF viewer to source bounding boxes.
+ - generic [ref=e71]:
+ - link "Open in New Tab" [ref=e72] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/citations
+ - text: Open in New Tab
+ - img
+ - button "Refresh Citations preview" [ref=e73] [cursor=pointer]:
+ - img
+ - generic [ref=e74]:
+ - generic [ref=e75]:
+ - code [ref=e76]: npx shadcn@latest add citations
+ - generic [ref=e77]: Preview
+ - generic [ref=e79]:
+ - generic [ref=e81]:
+ - generic [ref=e82]:
+ - generic [ref=e83]:
+ - generic [ref=e84]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e85]: Page 1 of -
+ - generic [ref=e86]:
+ - generic [ref=e87]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e88]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e89]
+ - generic [ref=e90]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e91]: "0.75"
+ - generic [ref=e92]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e93]
+ - generic [ref=e94]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e95]
+ - generic "Upload PDF" [ref=e97] [cursor=pointer]:
+ - button "Upload PDF" [ref=e98]
+ - img
+ - img [ref=e101]
+ - separator [ref=e110]:
+ - img [ref=e112]
+ - complementary [ref=e120]:
+ - generic [ref=e123]:
+ - button "Title p. 1 Attention Is All You Need Attention Is All You Need" [ref=e124]:
+ - generic [ref=e125]:
+ - generic [ref=e126]: Title
+ - generic [ref=e127]: p. 1
+ - generic [ref=e128]: Attention Is All You Need
+ - generic [ref=e129]: Attention Is All You Need
+ - button "Authors p. 1 Vaswani, Shazeer, Parmar, Uszkoreit, Jones, Gomez, Kaiser, Polosukhin Ashish Vaswani ... Illia Polosukhin" [ref=e130]:
+ - generic [ref=e131]:
+ - generic [ref=e132]: Authors
+ - generic [ref=e133]: p. 1
+ - generic [ref=e134]: Vaswani, Shazeer, Parmar, Uszkoreit, Jones, Gomez, Kaiser, Polosukhin
+ - generic [ref=e135]: Ashish Vaswani ... Illia Polosukhin
+ - button "Abstract claim p. 1 The Transformer relies entirely on attention mechanisms and avoids recurrence and convolutions. The Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely." [ref=e136]:
+ - generic [ref=e137]:
+ - generic [ref=e138]: Abstract claim
+ - generic [ref=e139]: p. 1
+ - generic [ref=e140]: The Transformer relies entirely on attention mechanisms and avoids recurrence and convolutions.
+ - generic [ref=e141]: The Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely.
+ - button "Translation quality p. 1 28.4 BLEU on WMT 2014 English-to-German our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task" [ref=e142]:
+ - generic [ref=e143]:
+ - generic [ref=e144]: Translation quality
+ - generic [ref=e145]: p. 1
+ - generic [ref=e146]: 28.4 BLEU on WMT 2014 English-to-German
+ - generic [ref=e147]: our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task
+ - button "Background p. 2 Self-attention connects positions in a sequence through constant-time operations. Self-attention connects all positions with a constant number of sequentially executed operations." [ref=e148]:
+ - generic [ref=e149]:
+ - generic [ref=e150]: Background
+ - generic [ref=e151]: p. 2
+ - generic [ref=e152]: Self-attention connects positions in a sequence through constant-time operations.
+ - generic [ref=e153]: Self-attention connects all positions with a constant number of sequentially executed operations.
+ - article [ref=e154]:
+ - generic [ref=e156]:
+ - link "Open in New Tab" [ref=e157] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/ocr-blocks
+ - text: Open in New Tab
+ - img
+ - button "Refresh OCR Blocks preview" [ref=e158] [cursor=pointer]:
+ - img
+ - generic [ref=e159]:
+ - generic [ref=e160]:
+ - code [ref=e161]: npx shadcn@latest add ocr-blocks
+ - generic [ref=e162]: Preview
+ - generic [ref=e164]:
+ - generic [ref=e166]:
+ - generic [ref=e167]:
+ - generic [ref=e168]:
+ - generic [ref=e169]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e170]: Page 1 of -
+ - generic [ref=e171]:
+ - generic [ref=e172]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e173]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e174]
+ - generic [ref=e175]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e176]: "0.75"
+ - generic [ref=e177]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e178]
+ - generic [ref=e179]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e180]
+ - generic "Upload PDF" [ref=e182] [cursor=pointer]:
+ - button "Upload PDF" [ref=e183]
+ - img
+ - img [ref=e186]
+ - separator [ref=e195]:
+ - img [ref=e197]
+ - complementary [ref=e205]:
+ - generic [ref=e208]:
+ - button "Paper title p. 1 Heading · 99% Attention Is All You Need" [ref=e209]:
+ - generic [ref=e210]:
+ - img [ref=e212]
+ - generic [ref=e214]:
+ - generic [ref=e215]:
+ - generic [ref=e216]: Paper title
+ - generic [ref=e217]: p. 1
+ - generic [ref=e218]: Heading · 99%
+ - generic [ref=e219]: Attention Is All You Need
+ - button "Authors p. 1 Paragraph · 96% Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit..." [ref=e220]:
+ - generic [ref=e221]:
+ - img [ref=e223]
+ - generic [ref=e225]:
+ - generic [ref=e226]:
+ - generic [ref=e227]: Authors
+ - generic [ref=e228]: p. 1
+ - generic [ref=e229]: Paragraph · 96%
+ - generic [ref=e230]: Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit...
+ - button "Section heading p. 1 Heading · 98% Abstract" [ref=e231]:
+ - generic [ref=e232]:
+ - img [ref=e234]
+ - generic [ref=e236]:
+ - generic [ref=e237]:
+ - generic [ref=e238]: Section heading
+ - generic [ref=e239]: p. 1
+ - generic [ref=e240]: Heading · 98%
+ - generic [ref=e241]: Abstract
+ - button "Abstract body p. 1 Paragraph · 94% The dominant sequence transduction models are based on complex recurrent or convolutional neural networks..." [ref=e242]:
+ - generic [ref=e243]:
+ - img [ref=e245]
+ - generic [ref=e247]:
+ - generic [ref=e248]:
+ - generic [ref=e249]: Abstract body
+ - generic [ref=e250]: p. 1
+ - generic [ref=e251]: Paragraph · 94%
+ - generic [ref=e252]: The dominant sequence transduction models are based on complex recurrent or convolutional neural networks...
+ - button "Background text p. 2 Paragraph · 92% Recurrent neural networks, long short-term memory and gated recurrent neural networks..." [ref=e253]:
+ - generic [ref=e254]:
+ - img [ref=e256]
+ - generic [ref=e258]:
+ - generic [ref=e259]:
+ - generic [ref=e260]: Background text
+ - generic [ref=e261]: p. 2
+ - generic [ref=e262]: Paragraph · 92%
+ - generic [ref=e263]: Recurrent neural networks, long short-term memory and gated recurrent neural networks...
+ - button "Architecture figure p. 2 Image · 89% Transformer architecture diagram" [ref=e264]:
+ - generic [ref=e265]:
+ - img [ref=e267]
+ - generic [ref=e271]:
+ - generic [ref=e272]:
+ - generic [ref=e273]: Architecture figure
+ - generic [ref=e274]: p. 2
+ - generic [ref=e275]: Image · 89%
+ - generic [ref=e276]: Transformer architecture diagram
+ - button "Complexity table p. 6 Table · 91% Layer type, complexity per layer, sequential operations, maximum path length" [ref=e277]:
+ - generic [ref=e278]:
+ - img [ref=e280]
+ - generic [ref=e282]:
+ - generic [ref=e283]:
+ - generic [ref=e284]: Complexity table
+ - generic [ref=e285]: p. 6
+ - generic [ref=e286]: Table · 91%
+ - generic [ref=e287]: Layer type, complexity per layer, sequential operations, maximum path length
+ - button "Comparison criteria p. 6 List · 88% Total computational complexity, parallelizable computation, and maximum path length" [ref=e288]:
+ - generic [ref=e289]:
+ - img [ref=e291]
+ - generic [ref=e295]:
+ - generic [ref=e296]:
+ - generic [ref=e297]: Comparison criteria
+ - generic [ref=e298]: p. 6
+ - generic [ref=e299]: List · 88%
+ - generic [ref=e300]: Total computational complexity, parallelizable computation, and maximum path length
+ - article [ref=e301]:
+ - generic [ref=e303]:
+ - link "Open in New Tab" [ref=e304] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/e-signature
+ - text: Open in New Tab
+ - img
+ - button "Refresh E-Signature preview" [ref=e305] [cursor=pointer]:
+ - img
+ - generic [ref=e306]:
+ - generic [ref=e307]:
+ - code [ref=e308]: npx shadcn@latest add e-signature
+ - generic [ref=e309]: Preview
+ - generic [ref=e311]:
+ - generic [ref=e313]:
+ - generic [ref=e314]:
+ - generic [ref=e315]:
+ - generic [ref=e316]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e317]: Page 1 of -
+ - generic [ref=e318]:
+ - generic [ref=e319]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e320]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e321]
+ - generic [ref=e322]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e323]: "0.75"
+ - generic [ref=e324]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e325]
+ - generic [ref=e326]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e327]
+ - button "Draw" [ref=e328] [cursor=pointer]:
+ - img
+ - text: Draw
+ - button "Download" [disabled]:
+ - img
+ - text: Download
+ - separator [ref=e329]
+ - generic "Upload PDF" [ref=e331] [cursor=pointer]:
+ - button "Upload PDF" [ref=e332]
+ - img
+ - img [ref=e335]
+ - separator [ref=e344]:
+ - img [ref=e346]
+ - complementary [ref=e354]:
+ - generic [ref=e358]:
+ - img [ref=e360]
+ - generic [ref=e363]:
+ - generic [ref=e364]:
+ - generic [ref=e365]: Signature1
+ - generic [ref=e366]: Unsigned
+ - generic [ref=e367]: 250 x 58 on page 1
+ - button "Sign" [ref=e368] [cursor=pointer]:
+ - img
+ - text: Sign
+ - article [ref=e369]:
+ - generic [ref=e370]:
+ - generic [ref=e371]:
+ - heading "Human Review" [level=3] [ref=e372]
+ - paragraph [ref=e373]: Extraction review cards connected to source evidence in the PDF viewer.
+ - generic [ref=e374]:
+ - link "Open in New Tab" [ref=e375] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/human-review
+ - text: Open in New Tab
+ - img
+ - button "Refresh Human Review preview" [ref=e376] [cursor=pointer]:
+ - img
+ - generic [ref=e377]:
+ - generic [ref=e378]:
+ - code [ref=e379]: npx shadcn@latest add human-review pdf-viewer
+ - generic [ref=e380]: Preview
+ - generic [ref=e382]:
+ - generic [ref=e384]:
+ - generic [ref=e385]:
+ - generic [ref=e386]:
+ - generic [ref=e387]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e388]: Page 1 of -
+ - generic [ref=e389]:
+ - generic [ref=e390]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e391]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e392]
+ - generic [ref=e393]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e394]: "0.75"
+ - generic [ref=e395]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e396]
+ - generic [ref=e397]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e398]
+ - generic "Upload PDF" [ref=e400] [cursor=pointer]:
+ - button "Upload PDF" [ref=e401]
+ - img
+ - img [ref=e404]
+ - separator [ref=e413]:
+ - img [ref=e415]
+ - generic [ref=e423]:
+ - generic [ref=e424]:
+ - tablist [ref=e425]:
+ - tab "Form" [selected] [ref=e426] [cursor=pointer]:
+ - img
+ - text: Form
+ - tab "JSON" [ref=e427] [cursor=pointer]:
+ - img
+ - text: JSON
+ - generic [ref=e428]:
+ - img [ref=e429]
+ - text: 4 fields
+ - tabpanel [ref=e432]:
+ - generic [ref=e434]:
+ - generic [ref=e435]:
+ - generic [ref=e436]:
+ - generic [ref=e437]:
+ - generic [ref=e440]: Vendor name
+ - generic [ref=e442]: vendor_name
+ - generic [ref=e443]:
+ - button "Set vendor_name to null" [ref=e444] [cursor=pointer]:
+ - img
+ - generic [ref=e445]:
+ - img [ref=e446]
+ - text: string
+ - generic [ref=e451]:
+ - generic [ref=e452]:
+ - paragraph [ref=e453]: Supplier shown on the invoice header.
+ - generic [ref=e454]: Actual
+ - generic [ref=e455]: Acme Supplies LLC
+ - generic [ref=e456]:
+ - generic [ref=e457]: Expected
+ - textbox [ref=e459]: Acme Supply LLC
+ - generic [ref=e460]:
+ - generic [ref=e461]:
+ - generic [ref=e462]:
+ - generic [ref=e465]: Total amount
+ - generic [ref=e467]: total_amount
+ - generic [ref=e468]:
+ - button "Set total_amount to null" [ref=e469] [cursor=pointer]:
+ - img
+ - generic [ref=e470]:
+ - img [ref=e471]
+ - text: number
+ - generic [ref=e475]:
+ - generic [ref=e476]:
+ - paragraph [ref=e477]: Final amount due including tax.
+ - generic [ref=e478]: Actual
+ - generic [ref=e479]: "12480"
+ - generic [ref=e480]:
+ - generic [ref=e481]: Expected
+ - spinbutton [ref=e483]: "12480.75"
+ - generic [ref=e484]:
+ - generic [ref=e485]:
+ - generic [ref=e486]:
+ - generic [ref=e489]: Payment terms
+ - generic [ref=e491]: payment_terms
+ - generic [ref=e492]:
+ - button "Set payment_terms to null" [ref=e493] [cursor=pointer]:
+ - img
+ - generic [ref=e494]:
+ - img [ref=e495]
+ - text: string
+ - generic [ref=e500]:
+ - generic [ref=e501]:
+ - generic [ref=e502]: Actual
+ - generic [ref=e503]: Net 15
+ - generic [ref=e504]:
+ - generic [ref=e505]: Expected
+ - combobox [ref=e507]:
+ - option "Due on receipt"
+ - option "Net 15"
+ - option "Net 30" [selected]
+ - generic [ref=e508]:
+ - generic [ref=e509]:
+ - generic [ref=e510]:
+ - generic [ref=e513]: Requires review
+ - generic [ref=e515]: requires_review
+ - generic [ref=e516]:
+ - button "Set requires_review to null" [ref=e517] [cursor=pointer]:
+ - img
+ - generic [ref=e518]:
+ - img [ref=e519]
+ - text: boolean
+ - generic [ref=e521]:
+ - generic [ref=e522]:
+ - paragraph [ref=e523]: Whether a human should verify this document before export.
+ - generic [ref=e524]: Actual
+ - generic [ref=e525]: "false"
+ - generic [ref=e526]:
+ - generic [ref=e527]: Expected
+ - generic [ref=e528]:
+ - button "True" [ref=e529] [cursor=pointer]
+ - button "False" [ref=e530] [cursor=pointer]
+ - article [ref=e531]:
+ - generic [ref=e532]:
+ - generic [ref=e533]:
+ - heading "Document Splits" [level=3] [ref=e534]
+ - paragraph [ref=e535]: Lazy page thumbnails, draggable split groups, and PDF navigation.
+ - generic [ref=e536]:
+ - link "Open in New Tab" [ref=e537] [cursor=pointer]:
+ - /url: /docs/components/pdf-viewer/document-splits
+ - text: Open in New Tab
+ - img
+ - button "Refresh Document Splits preview" [ref=e538] [cursor=pointer]:
+ - img
+ - generic [ref=e539]:
+ - generic [ref=e540]:
+ - code [ref=e541]: npx shadcn@latest add document-splits
+ - generic [ref=e542]: Preview
+ - generic [ref=e544]:
+ - generic [ref=e546]:
+ - generic [ref=e547]:
+ - generic [ref=e548]:
+ - generic [ref=e549]:
+ - button "Toggle thumbnails" [disabled]:
+ - img
+ - generic [ref=e550]: Page 1 of -
+ - generic [ref=e551]:
+ - generic [ref=e552]:
+ - button "Rotate counterclockwise" [disabled]:
+ - img
+ - generic [ref=e553]:
+ - button "Rotate clockwise" [disabled]:
+ - img
+ - separator [ref=e554]
+ - generic [ref=e555]:
+ - button "Zoom out" [disabled]:
+ - img
+ - combobox [disabled]:
+ - generic: 75%
+ - generic:
+ - img
+ - textbox [disabled] [ref=e556]: "0.75"
+ - generic [ref=e557]:
+ - button "Zoom in" [disabled]:
+ - img
+ - separator [ref=e558]
+ - generic [ref=e559]:
+ - button "Search text" [disabled]:
+ - img
+ - separator [ref=e560]
+ - generic "Upload PDF" [ref=e562] [cursor=pointer]:
+ - button "Upload PDF" [ref=e563]
+ - img
+ - img [ref=e566]
+ - separator [ref=e575]:
+ - img [ref=e577]
+ - complementary [ref=e585]:
+ - button "Add split" [ref=e587] [cursor=pointer]:
+ - img
+ - text: Add split
+ - generic [ref=e589]:
+ - generic [ref=e590]:
+ - generic [ref=e591]:
+ - generic [ref=e592]:
+ - button "Reorder Abstract and intro" [disabled] [ref=e593]:
+ - img [ref=e594]
+ - generic [ref=e601]:
+ - generic [ref=e602]: Abstract and intro
+ - generic [ref=e603]: Pages 1-3
+ - generic [ref=e604]:
+ - generic [ref=e605]: "3"
+ - button "Remove Abstract and intro" [ref=e606] [cursor=pointer]:
+ - img
+ - generic [ref=e609]:
+ - generic [ref=e615]: "1"
+ - generic [ref=e621]: "2"
+ - generic [ref=e627]: "3"
+ - generic [ref=e628]:
+ - generic [ref=e629]:
+ - generic [ref=e630]:
+ - button "Reorder Model architecture" [disabled] [ref=e631]:
+ - img [ref=e632]
+ - generic [ref=e639]:
+ - generic [ref=e640]: Model architecture
+ - generic [ref=e641]: Pages 4-8
+ - generic [ref=e642]:
+ - generic [ref=e643]: "5"
+ - button "Remove Model architecture" [ref=e644] [cursor=pointer]:
+ - img
+ - generic [ref=e647]:
+ - generic [ref=e653]: "4"
+ - generic [ref=e659]: "5"
+ - generic [ref=e665]: "6"
+ - generic [ref=e671]: "7"
+ - generic [ref=e677]: "8"
+ - generic [ref=e678]:
+ - generic [ref=e679]:
+ - generic [ref=e680]:
+ - button "Reorder Training and results" [disabled] [ref=e681]:
+ - img [ref=e682]
+ - generic [ref=e689]:
+ - generic [ref=e690]: Training and results
+ - generic [ref=e691]: Pages 9-15
+ - generic [ref=e692]:
+ - generic [ref=e693]: "7"
+ - button "Remove Training and results" [ref=e694] [cursor=pointer]:
+ - img
+ - generic [ref=e697]:
+ - generic [ref=e703]: "9"
+ - generic [ref=e709]: "10"
+ - generic [ref=e715]: "11"
+ - generic [ref=e721]: "12"
+ - generic [ref=e727]: "13"
+ - generic [ref=e733]: "14"
+ - generic [ref=e739]: "15"
+ - contentinfo [ref=e740]:
+ - generic [ref=e743]:
+ - text: Created by
+ - link "Extend" [ref=e744] [cursor=pointer]:
+ - /url: https://www.extend.ai
+ - text: . The source code is available on
+ - link "GitHub" [ref=e745] [cursor=pointer]:
+ - /url: https://github.com/extend-hq/ui
+ - text: .
+ - region "Notifications alt+T"
+ - generic [ref=e747]: xl
\ No newline at end of file
diff --git a/apps/v4/app/(app)/(root)/page.tsx b/apps/v4/app/(app)/(root)/page.tsx
index e2c6255..0b880ef 100644
--- a/apps/v4/app/(app)/(root)/page.tsx
+++ b/apps/v4/app/(app)/(root)/page.tsx
@@ -1,7 +1,5 @@
import { type Metadata } from "next"
import Link from "next/link"
-import { ArrowRightIcon } from "@hugeicons/core-free-icons"
-import { HugeiconsIcon } from "@hugeicons/react"
import { Button } from "@/components/ui/button"
import {
@@ -10,39 +8,14 @@ import {
PageHeaderDescription,
PageHeaderHeading,
} from "@/components/page-header"
-import { Badge } from "@/registry/new-york-v4/ui/badge"
import {
- Card,
- CardContent,
- CardDescription,
- CardFooter,
- CardHeader,
- CardTitle,
-} from "@/registry/new-york-v4/ui/card"
+ MobileRootPreview,
+ RootComponentsCollage,
+} from "@/components/root-components-collage"
const title = "Document components for modern apps"
const description =
- "Extend UI gives teams open source viewers, navigation, review, OCR, and metadata components for document processing products."
-
-const featuredComponents = [
- ["PDF Viewer", "Page rendering, zoom, search, thumbnails, and text layers."],
- [
- "DOCX Viewer",
- "Word document rendering with sections, headings, and comments.",
- ],
- [
- "Excel Viewer",
- "Workbook previews with sheets, frozen panes, and large-grid ergonomics.",
- ],
- [
- "File Upload",
- "Drag-and-drop intake with validation, progress, queues, and retry states.",
- ],
- [
- "Annotation Layer",
- "Highlights, pins, rectangles, notes, and anchored review comments.",
- ],
-]
+ "Open source viewers, uploads, thumbnails, citations, OCR blocks, and e-signing primitives for document processing products."
export const dynamic = "force-static"
export const revalidate = false
@@ -74,7 +47,7 @@ export const metadata: Metadata = {
export default function IndexPage() {
return (
<div className="flex flex-1 flex-col">
- <PageHeader>
+ <PageHeader className="[&_.container]:pt-20 md:[&_.container]:pt-28 lg:[&_.container]:pt-32">
<PageHeaderHeading className="max-w-4xl">{title}</PageHeaderHeading>
<PageHeaderDescription>{description}</PageHeaderDescription>
<PageActions>
@@ -89,55 +62,20 @@ export default function IndexPage() {
size="sm"
variant="ghost"
className="rounded-lg"
- render={<Link href="/blocks" />}
+ render={<Link href="/docs/components/pdf-viewer" />}
>
- View Blocks
+ View PDF Viewer
</Button>
</PageActions>
</PageHeader>
- <div className="container-wrapper flex-1 pb-10">
- <div className="container grid gap-8 lg:grid-cols-[minmax(0,1fr)_22rem]">
- <section className="grid gap-4 md:grid-cols-2 xl:grid-cols-3">
- {featuredComponents.map(([name, detail]) => (
- <Card key={name} className="rounded-lg shadow-none">
- <CardHeader>
- <div className="mb-3">
- <Badge variant="secondary">Extend UI</Badge>
- </div>
- <CardTitle>{name}</CardTitle>
- <CardDescription>{detail}</CardDescription>
- </CardHeader>
- </Card>
- ))}
+ <div className="container-wrapper flex-1 pb-6">
+ <div className="container overflow-hidden">
+ <section className="-mx-4 w-[158vw] overflow-hidden rounded-lg md:hidden">
+ <MobileRootPreview />
+ </section>
+ <section className="hidden md:block">
+ <RootComponentsCollage />
</section>
- <aside className="lg:sticky lg:top-[calc(var(--header-height)+2rem)] lg:self-start">
- <Card className="rounded-lg shadow-none">
- <CardHeader>
- <CardTitle>Deploy your document processing on Extend</CardTitle>
- </CardHeader>
- <CardContent>
- <CardDescription>
- Trusted by Brex, Flatiron, Square, and more. Extend provides
- production ready tools to handle your toughest documents.
- </CardDescription>
- </CardContent>
- <CardFooter>
- <Button
- size="sm"
- className="rounded-lg"
- render={
- <a
- href="https://www.extend.ai?utm_source=extend-ui"
- target="_blank"
- rel="noreferrer"
- />
- }
- >
- Deploy now <HugeiconsIcon icon={ArrowRightIcon} />
- </Button>
- </CardFooter>
- </Card>
- </aside>
</div>
</div>
</div>
diff --git a/apps/v4/app/(app)/blocks/layout.tsx b/apps/v4/app/(app)/blocks/layout.tsx
index d2f7461..7e5a116 100644
--- a/apps/v4/app/(app)/blocks/layout.tsx
+++ b/apps/v4/app/(app)/blocks/layout.tsx
@@ -2,18 +2,16 @@ import { type Metadata } from "next"
import Link from "next/link"
import { Button } from "@/components/ui/button"
-import { BlocksNav } from "@/components/blocks-nav"
import {
PageActions,
PageHeader,
PageHeaderDescription,
PageHeaderHeading,
} from "@/components/page-header"
-import { PageNav } from "@/components/page-nav"
const title = "Document Blocks"
const description =
- "Composed document workflows built from the viewer, navigation, review, comparison, OCR, and metadata components."
+ "Composed PDF viewer workflows built from citations, OCR blocks, signing fields, and document splits."
export const metadata: Metadata = {
title,
@@ -62,18 +60,10 @@ export default function BlocksLayout({
</Button>
</PageActions>
</PageHeader>
- <PageNav id="blocks">
- <BlocksNav />
- <Button
- variant="secondary"
- size="sm"
- className="mr-7 hidden shadow-none lg:flex"
- render={<Link href="/docs/components" />}
- >
- Browse components
- </Button>
- </PageNav>
- <div className="container-wrapper flex-1 section-soft md:py-12">
+ <div
+ id="blocks"
+ className="container-wrapper flex-1 section-soft md:py-12"
+ >
<div className="container">{children}</div>
</div>
</>
diff --git a/apps/v4/app/(app)/blocks/page.tsx b/apps/v4/app/(app)/blocks/page.tsx
index 5a6c0d1..f3f989d 100644
--- a/apps/v4/app/(app)/blocks/page.tsx
+++ b/apps/v4/app/(app)/blocks/page.tsx
@@ -1,51 +1,8 @@
-import {
- Card,
- CardDescription,
- CardHeader,
- CardTitle,
-} from "@/registry/new-york-v4/ui/card"
+import { PdfViewerBlocks } from "@/components/pdf-viewer-blocks"
export const dynamic = "force-static"
export const revalidate = false
-const blocks = [
- {
- id: "viewers",
- title: "Viewer Workspace",
- description:
- "A file preview layout with sidebar navigation, toolbar actions, and a responsive document canvas.",
- },
- {
- id: "review",
- title: "Review Queue",
- description:
- "A document approval screen with annotations, comment threads, redline status, and metadata.",
- },
- {
- id: "comparison",
- title: "Comparison Review",
- description:
- "A side-by-side comparison workspace with synchronized scrolling and diff navigation.",
- },
- {
- id: "metadata",
- title: "Extraction Console",
- description:
- "A processing view for OCR confidence, extracted properties, parse warnings, and retry states.",
- },
-]
-
export default async function BlocksPage() {
- return (
- <div className="grid gap-4 md:grid-cols-2">
- {blocks.map((block) => (
- <Card id={block.id} key={block.id} className="rounded-lg shadow-none">
- <CardHeader>
- <CardTitle>{block.title}</CardTitle>
- <CardDescription>{block.description}</CardDescription>
- </CardHeader>
- </Card>
- ))}
- </div>
- )
+ return <PdfViewerBlocks />
}
diff --git a/apps/v4/app/globals.css b/apps/v4/app/globals.css
index f347995..e885713 100644
--- a/apps/v4/app/globals.css
+++ b/apps/v4/app/globals.css
@@ -85,8 +85,8 @@
--color-info: var(--info);
--animate-skeleton: skeleton 2s -1s infinite linear;
@keyframes skeleton {
- to {
- background-position: -200% 0;
+ to {
+ background-position: -200% 0;
}
}
}
@@ -261,6 +261,18 @@
}
}
+@utility scrollbar-overflow-only {
+ &:not(:has([data-slot="scroll-area-viewport"][data-has-overflow-x]))
+ [data-slot="scroll-area-scrollbar"][data-orientation="horizontal"] {
+ display: none;
+ }
+
+ &:not(:has([data-slot="scroll-area-viewport"][data-has-overflow-y]))
+ [data-slot="scroll-area-scrollbar"][data-orientation="vertical"] {
+ display: none;
+ }
+}
+
@utility border-ghost {
@apply relative after:absolute after:inset-0 after:border after:border-border after:mix-blend-darken dark:after:mix-blend-lighten;
}
diff --git a/apps/v4/components/blocks-nav.tsx b/apps/v4/components/blocks-nav.tsx
deleted file mode 100644
index e97b8ff..0000000
--- a/apps/v4/components/blocks-nav.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-"use client"
-
-import Link from "next/link"
-import { usePathname } from "next/navigation"
-
-import { ScrollArea, ScrollBar } from "@/registry/new-york-v4/ui/scroll-area"
-
-const blockCategories = [
- { name: "Featured", slug: "" },
- { name: "Viewers", slug: "viewers" },
- { name: "Review", slug: "review" },
- { name: "Comparison", slug: "comparison" },
-]
-
-export function BlocksNav() {
- const pathname = usePathname()
-
- return (
- <div className="relative overflow-hidden">
- <ScrollArea className="max-w-none">
- <div className="flex items-center">
- <BlocksNavLink
- category={{ name: "Featured", slug: "" }}
- isActive={pathname === "/blocks"}
- />
- {blockCategories.slice(1).map((category) => (
- <BlocksNavLink
- key={category.slug}
- category={category}
- isActive={false}
- />
- ))}
- </div>
- <ScrollBar orientation="horizontal" className="invisible" />
- </ScrollArea>
- </div>
- )
-}
-
-function BlocksNavLink({
- category,
- isActive,
-}: {
- category: (typeof blockCategories)[number]
- isActive: boolean
-}) {
- return (
- <Link
- href={category.slug ? `/blocks#${category.slug}` : "/blocks"}
- key={category.slug}
- className="flex h-7 items-center justify-center px-4 text-center text-base font-medium text-muted-foreground transition-colors hover:text-primary data-[active=true]:text-primary"
- data-active={isActive}
- >
- {category.name}
- </Link>
- )
-}
diff --git a/apps/v4/components/citations-docs.tsx b/apps/v4/components/citations-docs.tsx
index bda6600..b5249ab 100644
--- a/apps/v4/components/citations-docs.tsx
+++ b/apps/v4/components/citations-docs.tsx
@@ -1,13 +1,13 @@
"use client"
import * as React from "react"
-import { Loading03Icon } from "@hugeicons/core-free-icons"
-import { HugeiconsIcon } from "@hugeicons/react"
-import type * as ReactPdf from "react-pdf"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
+import { PDFViewer, type PDFViewerHandle } from "@/components/ui/pdf-viewer"
+import { ScrollArea } from "@/components/ui/scroll-area"
import { HighlightedCodeBlock } from "@/components/highlighted-code-block"
+import { PdfBlockResizableShell } from "@/components/pdf-block-resizable-shell"
type Point = {
x: number
@@ -30,21 +30,10 @@ type HighlightArea = {
height: number
}
-type ReactPdfModule = typeof ReactPdf
-
const PDF_URL = "/samples/attention.pdf"
-const PDF_WORKER_URL = new URL(
- "pdfjs-dist/legacy/build/pdf.worker.min.mjs",
- import.meta.url
-).toString()
-const PAGE_WIDTH = 792
-const PAGE_HEIGHT = 612
-const RENDERED_PAGE_WIDTH = 430
-const RENDERED_PAGE_HEIGHT = Math.round(
- RENDERED_PAGE_WIDTH * (PAGE_HEIGHT / PAGE_WIDTH)
-)
-const DEVICE_PIXEL_RATIO_LIMIT = 2
-const PAGE_RENDER_BUFFER = 2
+const ANNOTATION_PAGE_WIDTH = 792
+const ANNOTATION_PAGE_HEIGHT = 612
+const DEFAULT_ZOOM = 0.75
const CITATION_STYLE = {
active:
"border-blue-500/60 bg-blue-500/5 shadow-[0_0_0_1px_rgb(59_130_246_/_8%)]",
@@ -135,10 +124,10 @@ function convertPolygonToHighlightArea(polygon: Point[]): HighlightArea {
const bottom = Math.max(...yValues)
return {
- left: (left / PAGE_WIDTH) * 100,
- top: (top / PAGE_HEIGHT) * 100,
- width: ((right - left) / PAGE_WIDTH) * 100,
- height: ((bottom - top) / PAGE_HEIGHT) * 100,
+ left: (left / ANNOTATION_PAGE_WIDTH) * 100,
+ top: (top / ANNOTATION_PAGE_HEIGHT) * 100,
+ width: ((right - left) / ANNOTATION_PAGE_WIDTH) * 100,
+ height: ((bottom - top) / ANNOTATION_PAGE_HEIGHT) * 100,
}
}
@@ -161,278 +150,37 @@ function CitationHighlight({ citation }: { citation: Citation }) {
)
}
-function CitationPage({
- pageNumber,
- activeCitation,
- reactPdf,
- shouldRenderPage,
- onFirstPageRender,
+function CitationsPanel({
+ activeCitationId,
+ className,
+ onCitationFocus,
}: {
- pageNumber: number
- activeCitation: Citation | null
- reactPdf: ReactPdfModule
- shouldRenderPage: boolean
- onFirstPageRender?: () => void
+ activeCitationId?: string
+ className?: string
+ onCitationFocus?: (citation: Citation) => void
}) {
- const devicePixelRatio =
- typeof window === "undefined"
- ? 1
- : Math.min(DEVICE_PIXEL_RATIO_LIMIT, window.devicePixelRatio || 1)
-
- return (
- <div
- data-citation-page={pageNumber}
- className="relative"
- style={{ width: RENDERED_PAGE_WIDTH, height: RENDERED_PAGE_HEIGHT }}
- >
- {shouldRenderPage ? (
- <reactPdf.Page
- pageNumber={pageNumber}
- width={RENDERED_PAGE_WIDTH}
- className="overflow-hidden border bg-background shadow-xs"
- renderAnnotationLayer={false}
- renderTextLayer={false}
- devicePixelRatio={devicePixelRatio}
- loading={
- <div
- className="grid place-items-center"
- style={{
- width: RENDERED_PAGE_WIDTH,
- height: RENDERED_PAGE_HEIGHT,
- }}
- >
- <HugeiconsIcon
- icon={Loading03Icon}
- className="size-4 animate-spin"
- />
- </div>
- }
- onRenderSuccess={pageNumber === 1 ? onFirstPageRender : undefined}
- onRenderError={pageNumber === 1 ? onFirstPageRender : undefined}
- />
- ) : (
- <div className="size-full border bg-muted/30 shadow-xs" />
- )}
- {activeCitation?.page === pageNumber ? (
- <CitationHighlight citation={activeCitation} />
- ) : null}
- </div>
- )
-}
-
-export function Citations() {
- const [activeCitationId, setActiveCitationId] = React.useState(
- CITATIONS[0].id
+ const [localActiveCitationId, setLocalActiveCitationId] = React.useState(
+ activeCitationId ?? CITATIONS[0].id
)
- const [reactPdf, setReactPdf] = React.useState<ReactPdfModule | null>(null)
- const [loadError, setLoadError] = React.useState(false)
- const [isDocumentLoading, setIsDocumentLoading] = React.useState(true)
- const [isPageRendering, setIsPageRendering] = React.useState(true)
- const [numPages, setNumPages] = React.useState<number | null>(null)
- const [currentPage, setCurrentPage] = React.useState(1)
- const viewportRef = React.useRef<HTMLDivElement>(null)
const activeCitation =
- CITATIONS.find((citation) => citation.id === activeCitationId) ??
- CITATIONS[0]
- const pageNumbers = React.useMemo(() => {
- return Array.from({ length: numPages ?? 0 }, (_, index) => index + 1)
- }, [numPages])
- const isViewerLoading = !reactPdf || isDocumentLoading || isPageRendering
-
- React.useEffect(() => {
- let mounted = true
-
- void import("react-pdf")
- .then((module) => {
- module.pdfjs.GlobalWorkerOptions.workerSrc = PDF_WORKER_URL
-
- if (mounted) {
- setReactPdf(module)
- }
- })
- .catch(() => {
- if (mounted) {
- setLoadError(true)
- setIsDocumentLoading(false)
- setIsPageRendering(false)
- }
- })
-
- return () => {
- mounted = false
- }
- }, [])
-
- const handleFirstPageRender = React.useCallback(() => {
- setIsPageRendering(false)
- }, [])
-
- const handleDocumentLoadStart = React.useCallback(() => {
- setIsDocumentLoading(true)
- setIsPageRendering(true)
- setLoadError(false)
- setNumPages(null)
- setCurrentPage(1)
- viewportRef.current?.scrollTo({ top: 0, left: 0 })
- }, [])
-
- const handleDocumentLoadSuccess = React.useCallback(
- ({ numPages }: { numPages: number }) => {
- setNumPages(numPages)
- setCurrentPage(1)
- setIsDocumentLoading(false)
- setIsPageRendering(true)
- setLoadError(false)
- viewportRef.current?.scrollTo({ top: 0, left: 0 })
+ CITATIONS.find(
+ (citation) => citation.id === (activeCitationId ?? localActiveCitationId)
+ ) ?? CITATIONS[0]
+
+ const focusCitation = React.useCallback(
+ (citation: Citation) => {
+ setLocalActiveCitationId(citation.id)
+ onCitationFocus?.(citation)
},
- []
+ [onCitationFocus]
)
- const handleDocumentLoadError = React.useCallback(() => {
- setIsDocumentLoading(false)
- setIsPageRendering(false)
- setLoadError(true)
- setNumPages(null)
- }, [])
-
- const updateCurrentPageFromViewport = React.useCallback(() => {
- const viewport = viewportRef.current
- if (!viewport || !numPages) {
- return
- }
-
- const viewportRect = viewport.getBoundingClientRect()
- const viewportCenter = viewportRect.top + viewportRect.height / 2
- let closestPage = 1
- let closestDistance = Number.POSITIVE_INFINITY
-
- viewport
- .querySelectorAll<HTMLElement>("[data-citation-page]")
- .forEach((page) => {
- const pageRect = page.getBoundingClientRect()
- const pageCenter = pageRect.top + pageRect.height / 2
- const distance = Math.abs(pageCenter - viewportCenter)
-
- if (distance < closestDistance) {
- closestDistance = distance
- closestPage = Number(page.dataset.citationPage || "1")
- }
- })
-
- setCurrentPage((page) => (page === closestPage ? page : closestPage))
- }, [numPages])
-
- React.useEffect(() => {
- const viewport = viewportRef.current
- if (!viewport || !numPages) {
- return
- }
-
- let frameId = 0
- const handleScroll = () => {
- window.cancelAnimationFrame(frameId)
- frameId = window.requestAnimationFrame(updateCurrentPageFromViewport)
- }
-
- frameId = window.requestAnimationFrame(updateCurrentPageFromViewport)
- viewport.addEventListener("scroll", handleScroll, { passive: true })
-
- return () => {
- window.cancelAnimationFrame(frameId)
- viewport.removeEventListener("scroll", handleScroll)
- }
- }, [numPages, updateCurrentPageFromViewport])
-
- const scrollToCitation = React.useCallback((citation: Citation) => {
- setActiveCitationId(citation.id)
- setCurrentPage(citation.page)
-
- window.requestAnimationFrame(() => {
- const viewport = viewportRef.current
- const page = viewport?.querySelector<HTMLElement>(
- `[data-citation-page="${citation.page}"]`
- )
-
- if (!viewport || !page) return
-
- const highlight = convertPolygonToHighlightArea(citation.polygon)
- const pageTop =
- page.getBoundingClientRect().top -
- viewport.getBoundingClientRect().top +
- viewport.scrollTop
- const targetTop =
- pageTop + (highlight.top / 100) * RENDERED_PAGE_HEIGHT - 96
-
- viewport.scrollTo({
- top: Math.max(0, targetTop),
- behavior: "smooth",
- })
- })
- }, [])
-
return (
- <div className="grid h-[620px] overflow-hidden bg-background lg:grid-cols-[minmax(0,1fr)_20rem]">
- <div className="flex min-h-0 min-w-0 flex-col border-b lg:border-r lg:border-b-0">
- <div className="flex min-h-12 items-center justify-between gap-3 border-b px-3">
- <div className="text-sm whitespace-nowrap text-primary">
- Page {currentPage} of {numPages ?? "-"}
- </div>
- </div>
- <div className="relative flex h-full min-h-0 w-full flex-1 bg-muted/30">
- {isViewerLoading && !loadError ? (
- <div className="absolute inset-0 z-10 grid place-items-center bg-background">
- <HugeiconsIcon
- icon={Loading03Icon}
- className="size-4 animate-spin"
- />
- </div>
- ) : null}
- {loadError ? (
- <div className="absolute inset-0 z-10 grid place-items-center bg-background p-6 text-sm text-muted-foreground">
- Unable to load the PDF preview.
- </div>
- ) : null}
- {reactPdf ? (
- <reactPdf.Document
- file={PDF_URL}
- className={cn(
- "flex h-full min-h-0 w-full flex-1",
- (isViewerLoading || loadError) && "invisible"
- )}
- loading={null}
- error={null}
- onLoadStart={handleDocumentLoadStart}
- onLoadSuccess={handleDocumentLoadSuccess}
- onLoadError={handleDocumentLoadError}
- >
- <div
- ref={viewportRef}
- className={cn(
- "min-h-0 min-w-0 flex-1 overflow-auto",
- isPageRendering && !loadError && "invisible"
- )}
- >
- <div className="flex min-h-full w-max min-w-full flex-col items-center justify-start gap-6 p-6">
- {pageNumbers.map((pageNumber) => (
- <CitationPage
- key={pageNumber}
- pageNumber={pageNumber}
- activeCitation={activeCitation}
- reactPdf={reactPdf}
- shouldRenderPage={
- Math.abs(pageNumber - currentPage) <= PAGE_RENDER_BUFFER
- }
- onFirstPageRender={handleFirstPageRender}
- />
- ))}
- </div>
- </div>
- </reactPdf.Document>
- ) : null}
- </div>
- </div>
- <aside className="flex min-h-0 flex-col">
- <div className="min-h-0 flex-1 overflow-y-auto p-3">
+ <aside
+ className={cn("flex h-[420px] min-h-0 flex-col bg-background", className)}
+ >
+ <ScrollArea className="min-h-0 flex-1" scrollFade>
+ <div className="p-3">
<div className="space-y-2">
{CITATIONS.map((citation) => {
const isActive = citation.id === activeCitation.id
@@ -441,9 +189,9 @@ export function Citations() {
<button
key={citation.id}
type="button"
- onClick={() => scrollToCitation(citation)}
- onFocus={() => scrollToCitation(citation)}
- onMouseEnter={() => scrollToCitation(citation)}
+ onClick={() => focusCitation(citation)}
+ onFocus={() => focusCitation(citation)}
+ onMouseEnter={() => focusCitation(citation)}
className={cn(
"w-full rounded-lg border bg-background p-3 text-left transition-[border-color,background-color,box-shadow] hover:border-blue-500/50 hover:bg-blue-500/5 focus-visible:border-blue-500/60 focus-visible:ring-2 focus-visible:ring-blue-500/20 focus-visible:outline-none",
isActive && CITATION_STYLE.active
@@ -466,7 +214,121 @@ export function Citations() {
})}
</div>
</div>
- </aside>
+ </ScrollArea>
+ </aside>
+ )
+}
+
+export function Citations() {
+ return <CitationsPanel />
+}
+
+export function CitationsBlock() {
+ const [activeCitationId, setActiveCitationId] = React.useState(
+ CITATIONS[0].id
+ )
+ const viewerRef = React.useRef<PDFViewerHandle>(null)
+ const activeCitation =
+ CITATIONS.find((citation) => citation.id === activeCitationId) ??
+ CITATIONS[0]
+
+ const scrollToCitation = React.useCallback((citation: Citation) => {
+ setActiveCitationId(citation.id)
+ viewerRef.current?.scrollToPageArea(
+ citation.page,
+ convertPolygonToHighlightArea(citation.polygon)
+ )
+ }, [])
+
+ return (
+ <PdfBlockResizableShell
+ autoSaveId="pdf-block-citations"
+ left={
+ <PDFViewer
+ ref={viewerRef}
+ file={PDF_URL}
+ defaultZoom={DEFAULT_ZOOM}
+ renderPageOverlay={({ pageNumber }) =>
+ activeCitation.page === pageNumber ? (
+ <CitationHighlight citation={activeCitation} />
+ ) : null
+ }
+ />
+ }
+ right={
+ <CitationsPanel
+ activeCitationId={activeCitation.id}
+ className="h-full"
+ onCitationFocus={scrollToCitation}
+ />
+ }
+ />
+ )
+}
+
+function CitationExampleCard({
+ active,
+ accentClassName,
+ label,
+ pageLabel,
+ snippet,
+ value,
+}: {
+ active?: boolean
+ accentClassName?: string
+ label: string
+ pageLabel: string
+ snippet: string
+ value: string
+}) {
+ return (
+ <button
+ type="button"
+ className={cn(
+ "w-full rounded-lg border bg-background p-3 text-left transition-[border-color,background-color,box-shadow] hover:border-blue-500/50 hover:bg-blue-500/5 focus-visible:ring-2 focus-visible:ring-blue-500/20 focus-visible:outline-none",
+ active &&
+ (accentClassName ??
+ "border-blue-500/60 bg-blue-500/5 shadow-[0_0_0_1px_rgb(59_130_246_/_8%)]")
+ )}
+ >
+ <div className="flex items-center justify-between gap-3">
+ <div className="text-sm font-medium">{label}</div>
+ <div className="shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground">
+ {pageLabel}
+ </div>
+ </div>
+ <div className="mt-1 text-sm text-foreground/90">{value}</div>
+ <div className="mt-2 line-clamp-2 text-xs text-muted-foreground">
+ {snippet}
+ </div>
+ </button>
+ )
+}
+
+function CitationsExample() {
+ return (
+ <div className="flex h-[420px] flex-col gap-2 bg-background p-3">
+ <CitationExampleCard
+ active
+ label="Invoice total"
+ pageLabel="p. 1"
+ value="$12,480.00"
+ snippet="Total amount due, including tax and service fees."
+ />
+ <CitationExampleCard
+ label="Payment terms"
+ pageLabel="p. 2"
+ value="Net 30"
+ snippet="Payment is due within thirty days of receipt."
+ accentClassName="border-emerald-500/60 bg-emerald-500/5"
+ />
+ <CitationExampleCard
+ label="Purchase order"
+ pageLabel="p. 3"
+ value="PO-1048"
+ snippet="Customer purchase order identifier."
+ accentClassName="border-amber-500/60 bg-amber-500/5"
+ />
</div>
)
}
@@ -479,7 +341,7 @@ export function CitationsDemo() {
data-slot="component-preview"
className="group relative mt-4 mb-12 flex flex-col overflow-hidden rounded-xl border"
>
- <Citations />
+ <CitationsExample />
<div
data-slot="code"
data-mobile-code-visible={isCodeVisible}
@@ -526,351 +388,89 @@ export function CitationsDemo() {
const citationsUsageCode = `"use client";
-import * as React from "react";
-import { Loading03Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import type * as ReactPdf from "react-pdf";
+import { CitationCard } from "@/components/ui/citation-card";
-import { cn } from "@/lib/utils";
+export function CitationsExample() {
+ return (
+ <div className="flex h-[420px] flex-col gap-2 bg-background p-3">
+ <CitationCard
+ active
+ label="Invoice total"
+ pageLabel="p. 1"
+ value="$12,480.00"
+ snippet="Total amount due, including tax and service fees."
+ />
+ <CitationCard
+ label="Payment terms"
+ pageLabel="p. 2"
+ value="Net 30"
+ snippet="Payment is due within thirty days of receipt."
+ accentClassName="border-emerald-500/60 bg-emerald-500/5"
+ />
+ <CitationCard
+ label="Purchase order"
+ pageLabel="p. 3"
+ value="PO-1048"
+ snippet="Customer purchase order identifier."
+ accentClassName="border-amber-500/60 bg-amber-500/5"
+ />
+ </div>
+ );
+}`
-type ReactPdfModule = typeof ReactPdf;
+const citationsSourceCode = `"use client";
-type Point = { x: number; y: number };
+import * as React from "react";
-type Citation = {
- id: string;
+import { cn } from "@/lib/utils";
+
+type CitationCardProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
label: string;
value: string;
- page: number;
- referenceText: string;
- polygon: Point[];
-};
-
-const PAGE_WIDTH = 792;
-const PAGE_HEIGHT = 612;
-const RENDERED_PAGE_WIDTH = 430;
-const RENDERED_PAGE_HEIGHT = Math.round(RENDERED_PAGE_WIDTH * (PAGE_HEIGHT / PAGE_WIDTH));
-const PAGE_RENDER_BUFFER = 2;
-const CITATION_STYLE = {
- active:
- "border-blue-500/60 bg-blue-500/5 shadow-[0_0_0_1px_rgb(59_130_246_/_8%)]",
- overlay:
- "border-blue-500/70 bg-blue-500/12 shadow-[0_4px_16px_rgb(59_130_246_/_12%)]",
+ snippet?: string;
+ pageLabel?: string;
+ active?: boolean;
+ accentClassName?: string;
};
-const PDF_URL = "/samples/attention.pdf";
-const PDF_WORKER_URL = new URL(
- "pdfjs-dist/legacy/build/pdf.worker.min.mjs",
- import.meta.url,
-).toString();
-
-const CITATIONS: Citation[] = [
- {
- id: "title",
- label: "Title",
- value: "Attention Is All You Need",
- page: 1,
- referenceText: "Attention Is All You Need",
- polygon: [
- { x: 246, y: 188 },
- { x: 566, y: 188 },
- { x: 566, y: 222 },
- { x: 246, y: 222 },
- ],
- },
- {
- id: "architecture",
- label: "Background",
- value: "Self-attention connects positions in a sequence through constant-time operations.",
- page: 2,
- referenceText:
- "Self-attention connects all positions with a constant number of sequentially executed operations.",
- polygon: [
- { x: 76, y: 74 },
- { x: 718, y: 74 },
- { x: 718, y: 184 },
- { x: 76, y: 184 },
- ],
- },
-];
-
-function convertPolygonToHighlightArea(polygon: Point[]) {
- const xValues = polygon.map((point) => point.x);
- const yValues = polygon.map((point) => point.y);
- const left = Math.min(...xValues);
- const right = Math.max(...xValues);
- const top = Math.min(...yValues);
- const bottom = Math.max(...yValues);
-
- return {
- left: (left / PAGE_WIDTH) * 100,
- top: (top / PAGE_HEIGHT) * 100,
- width: ((right - left) / PAGE_WIDTH) * 100,
- height: ((bottom - top) / PAGE_HEIGHT) * 100,
- };
-}
-
-function CitationHighlight({ citation }: { citation: Citation }) {
- const highlight = convertPolygonToHighlightArea(citation.polygon);
+export function CitationCard({
+ label,
+ value,
+ snippet,
+ pageLabel,
+ active = false,
+ accentClassName = "border-blue-500/60 bg-blue-500/5",
+ className,
+ ...props
+}: CitationCardProps) {
return (
- <div
+ <button
+ type="button"
className={cn(
- "pointer-events-none absolute z-10 rounded-[3px] border",
- CITATION_STYLE.overlay,
+ "w-full rounded-lg border bg-background p-3 text-left transition-[border-color,background-color,box-shadow] hover:border-blue-500/50 hover:bg-blue-500/5 focus-visible:ring-2 focus-visible:ring-blue-500/20 focus-visible:outline-none",
+ active && accentClassName,
+ className,
)}
- style={{
- left: highlight.left + "%",
- top: highlight.top + "%",
- width: highlight.width + "%",
- height: highlight.height + "%",
- }}
- />
- );
-}
-
-export function Citations() {
- const [activeCitationId, setActiveCitationId] = React.useState(CITATIONS[0].id);
- const [reactPdf, setReactPdf] = React.useState<ReactPdfModule | null>(null);
- const [loadError, setLoadError] = React.useState(false);
- const [isDocumentLoading, setIsDocumentLoading] = React.useState(true);
- const [isPageRendering, setIsPageRendering] = React.useState(true);
- const [numPages, setNumPages] = React.useState<number | null>(null);
- const [currentPage, setCurrentPage] = React.useState(1);
- const viewportRef = React.useRef<HTMLDivElement>(null);
- const activeCitation =
- CITATIONS.find((citation) => citation.id === activeCitationId) ?? CITATIONS[0];
- const pageNumbers = React.useMemo(
- () => Array.from({ length: numPages ?? 0 }, (_, index) => index + 1),
- [numPages],
- );
- const isViewerLoading = !reactPdf || isDocumentLoading || isPageRendering;
-
- React.useEffect(() => {
- let mounted = true;
-
- void import("react-pdf")
- .then((module) => {
- module.pdfjs.GlobalWorkerOptions.workerSrc = PDF_WORKER_URL;
-
- if (mounted) setReactPdf(module);
- })
- .catch(() => {
- if (mounted) {
- setLoadError(true);
- setIsDocumentLoading(false);
- setIsPageRendering(false);
- }
- });
-
- return () => {
- mounted = false;
- };
- }, []);
-
- const handleFirstPageRender = React.useCallback(() => {
- setIsPageRendering(false);
- }, []);
-
- const handleDocumentLoadStart = React.useCallback(() => {
- setIsDocumentLoading(true);
- setIsPageRendering(true);
- setLoadError(false);
- setNumPages(null);
- setCurrentPage(1);
- viewportRef.current?.scrollTo({ top: 0, left: 0 });
- }, []);
-
- const handleDocumentLoadSuccess = React.useCallback(({ numPages }: { numPages: number }) => {
- setNumPages(numPages);
- setCurrentPage(1);
- setIsDocumentLoading(false);
- setIsPageRendering(true);
- setLoadError(false);
- viewportRef.current?.scrollTo({ top: 0, left: 0 });
- }, []);
-
- const handleDocumentLoadError = React.useCallback(() => {
- setIsDocumentLoading(false);
- setIsPageRendering(false);
- setLoadError(true);
- setNumPages(null);
- }, []);
-
- const updateCurrentPageFromViewport = React.useCallback(() => {
- const viewport = viewportRef.current;
- if (!viewport || !numPages) return;
-
- const viewportRect = viewport.getBoundingClientRect();
- const viewportCenter = viewportRect.top + viewportRect.height / 2;
- let closestPage = 1;
- let closestDistance = Number.POSITIVE_INFINITY;
-
- viewport.querySelectorAll<HTMLElement>("[data-citation-page]").forEach((page) => {
- const pageRect = page.getBoundingClientRect();
- const pageCenter = pageRect.top + pageRect.height / 2;
- const distance = Math.abs(pageCenter - viewportCenter);
-
- if (distance < closestDistance) {
- closestDistance = distance;
- closestPage = Number(page.dataset.citationPage || "1");
- }
- });
-
- setCurrentPage((page) => (page === closestPage ? page : closestPage));
- }, [numPages]);
-
- React.useEffect(() => {
- const viewport = viewportRef.current;
- if (!viewport || !numPages) return;
-
- let frameId = window.requestAnimationFrame(updateCurrentPageFromViewport);
- const handleScroll = () => {
- window.cancelAnimationFrame(frameId);
- frameId = window.requestAnimationFrame(updateCurrentPageFromViewport);
- };
-
- viewport.addEventListener("scroll", handleScroll, { passive: true });
- return () => {
- window.cancelAnimationFrame(frameId);
- viewport.removeEventListener("scroll", handleScroll);
- };
- }, [numPages, updateCurrentPageFromViewport]);
-
- function scrollToCitation(citation: Citation) {
- setActiveCitationId(citation.id);
- setCurrentPage(citation.page);
-
- window.requestAnimationFrame(() => {
- const viewport = viewportRef.current;
- const page = viewport?.querySelector<HTMLElement>(
- \`[data-citation-page="\${citation.page}"]\`,
- );
-
- if (!viewport || !page) return;
-
- const highlight = convertPolygonToHighlightArea(citation.polygon);
- const pageTop =
- page.getBoundingClientRect().top -
- viewport.getBoundingClientRect().top +
- viewport.scrollTop;
-
- viewport.scrollTo({
- top: Math.max(0, pageTop + (highlight.top / 100) * RENDERED_PAGE_HEIGHT - 96),
- behavior: "smooth",
- });
- });
- }
-
- return (
- <div className="grid h-[620px] overflow-hidden bg-background lg:grid-cols-[minmax(0,1fr)_20rem]">
- <div className="flex min-h-0 min-w-0 flex-col border-b lg:border-r lg:border-b-0">
- <div className="flex min-h-12 items-center justify-between gap-3 border-b px-3">
- <div className="text-sm whitespace-nowrap text-primary">
- Page {currentPage} of {numPages ?? "-"}
- </div>
- </div>
- <div className="relative flex h-full min-h-0 w-full flex-1 bg-muted/30">
- {isViewerLoading && !loadError ? (
- <div className="absolute inset-0 z-10 grid place-items-center bg-background">
- <HugeiconsIcon icon={Loading03Icon} className="size-4 animate-spin" />
- </div>
- ) : null}
- {loadError ? (
- <div className="absolute inset-0 z-10 grid place-items-center bg-background p-6 text-sm text-muted-foreground">
- Unable to load the PDF preview.
+ {...props}
+ >
+ <div className="flex items-center justify-between gap-3">
+ <div className="text-sm font-medium">{label}</div>
+ {pageLabel ? (
+ <div className="shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground">
+ {pageLabel}
</div>
- ) : null}
- {reactPdf ? (
- <reactPdf.Document
- file={PDF_URL}
- className={cn(
- "flex h-full min-h-0 w-full flex-1",
- (isViewerLoading || loadError) && "invisible",
- )}
- loading={null}
- error={null}
- onLoadStart={handleDocumentLoadStart}
- onLoadSuccess={handleDocumentLoadSuccess}
- onLoadError={handleDocumentLoadError}
- >
- <div
- ref={viewportRef}
- className={cn(
- "min-h-0 min-w-0 flex-1 overflow-auto",
- isPageRendering && !loadError && "invisible",
- )}
- >
- <div className="flex min-h-full w-max min-w-full flex-col items-center justify-start gap-6 p-6">
- {pageNumbers.map((pageNumber) => {
- const shouldRenderPage =
- Math.abs(pageNumber - currentPage) <= PAGE_RENDER_BUFFER;
-
- return (
- <div
- key={pageNumber}
- data-citation-page={pageNumber}
- className="relative"
- style={{ width: RENDERED_PAGE_WIDTH, height: RENDERED_PAGE_HEIGHT }}
- >
- {shouldRenderPage ? (
- <reactPdf.Page
- pageNumber={pageNumber}
- width={RENDERED_PAGE_WIDTH}
- className="overflow-hidden border bg-background shadow-xs"
- renderAnnotationLayer={false}
- renderTextLayer={false}
- loading={
- <div
- className="grid place-items-center"
- style={{
- width: RENDERED_PAGE_WIDTH,
- height: RENDERED_PAGE_HEIGHT,
- }}
- >
- <HugeiconsIcon icon={Loading03Icon} className="size-4 animate-spin" />
- </div>
- }
- onRenderSuccess={pageNumber === 1 ? handleFirstPageRender : undefined}
- onRenderError={pageNumber === 1 ? handleFirstPageRender : undefined}
- />
- ) : (
- <div className="size-full border bg-muted/30 shadow-xs" />
- )}
- {activeCitation.page === pageNumber ? (
- <CitationHighlight citation={activeCitation} />
- ) : null}
- </div>
- );
- })}
- </div>
- </div>
- </reactPdf.Document>
- ) : null}
- </div>
+ ) : null}
</div>
- <aside className="min-h-0 overflow-y-auto p-3">
- {CITATIONS.map((citation) => (
- <button
- key={citation.id}
- type="button"
- onClick={() => scrollToCitation(citation)}
- onMouseEnter={() => scrollToCitation(citation)}
- onFocus={() => scrollToCitation(citation)}
- className={cn(
- "mb-2 w-full rounded-lg border bg-background p-3 text-left text-sm",
- citation.id === activeCitation.id && CITATION_STYLE.active,
- )}
- >
- <div className="font-medium">{citation.label}</div>
- <div className="mt-1">{citation.value}</div>
- <div className="mt-2 text-xs text-muted-foreground">{citation.referenceText}</div>
- </button>
- ))}
- </aside>
- </div>
+ <div className="mt-1 text-sm text-foreground/90">{value}</div>
+ {snippet ? (
+ <div className="mt-2 line-clamp-2 text-xs text-muted-foreground">
+ {snippet}
+ </div>
+ ) : null}
+ </button>
);
}`
export function CitationsSource() {
- return <HighlightedCodeBlock code={citationsUsageCode} />
+ return <HighlightedCodeBlock code={citationsSourceCode} />
}
diff --git a/apps/v4/components/csv-viewer-docs.tsx b/apps/v4/components/csv-viewer-docs.tsx
index bffec34..56842ae 100644
--- a/apps/v4/components/csv-viewer-docs.tsx
+++ b/apps/v4/components/csv-viewer-docs.tsx
@@ -170,7 +170,7 @@ function ToolbarTooltip({
)
}
-function CsvViewerPreviewClient() {
+export function CsvViewerPreviewClient() {
const inputRef = React.useRef<HTMLInputElement | null>(null)
const isDark = useIsDarkTheme()
const [glide, setGlide] = React.useState<GlideDataGridModule | null>(null)
diff --git a/apps/v4/components/docs-sidebar.tsx b/apps/v4/components/docs-sidebar.tsx
index deafdf9..83e8700 100644
--- a/apps/v4/components/docs-sidebar.tsx
+++ b/apps/v4/components/docs-sidebar.tsx
@@ -37,6 +37,11 @@ const PDF_VIEWER_SUBPAGES = [
{ name: "Citations", url: "/docs/components/pdf-viewer/citations" },
{ name: "OCR Blocks", url: "/docs/components/pdf-viewer/ocr-blocks" },
{ name: "E-Signature", url: "/docs/components/pdf-viewer/e-signature" },
+ { name: "Human Review", url: "/docs/components/pdf-viewer/human-review" },
+ {
+ name: "Document Splits",
+ url: "/docs/components/pdf-viewer/document-splits",
+ },
]
export function DocsSidebar({
diff --git a/apps/v4/components/document-splitter-docs.tsx b/apps/v4/components/document-splitter-docs.tsx
new file mode 100644
index 0000000..1da897b
--- /dev/null
+++ b/apps/v4/components/document-splitter-docs.tsx
@@ -0,0 +1,1614 @@
+"use client"
+
+import * as React from "react"
+import {
+ closestCenter,
+ DndContext,
+ DragOverlay,
+ PointerSensor,
+ useDroppable,
+ useSensor,
+ useSensors,
+ type CollisionDetection,
+ type DragEndEvent,
+ type DragOverEvent,
+ type DragStartEvent,
+} from "@dnd-kit/core"
+import {
+ arrayMove,
+ horizontalListSortingStrategy,
+ SortableContext,
+ useSortable,
+} from "@dnd-kit/sortable"
+import { CSS } from "@dnd-kit/utilities"
+import {
+ Add01Icon,
+ Delete02Icon,
+ DragDropVerticalIcon,
+} from "@hugeicons/core-free-icons"
+import { HugeiconsIcon } from "@hugeicons/react"
+import type * as ReactPdf from "react-pdf"
+
+import { cn } from "@/lib/utils"
+import { Button } from "@/components/ui/button"
+import { PDFViewer, type PDFViewerHandle } from "@/components/ui/pdf-viewer"
+import { ScrollArea } from "@/components/ui/scroll-area"
+import { FileThumbnailLoadingOverlay } from "@/components/file-thumbnail-docs"
+import { HighlightedCodeBlock } from "@/components/highlighted-code-block"
+import { PdfBlockResizableShell } from "@/components/pdf-block-resizable-shell"
+import { Badge } from "@/registry/new-york-v4/ui/badge"
+import { Card } from "@/registry/new-york-v4/ui/card"
+
+type ReactPdfModule = typeof ReactPdf
+type PageId = `page-${number}`
+
+type SplitGroup = {
+ id: string
+ title: string
+ pages: PageId[]
+}
+
+const PDF_URL = "/samples/attention.pdf"
+const PDF_WORKER_URL = new URL(
+ "pdfjs-dist/legacy/build/pdf.worker.min.mjs",
+ import.meta.url
+).toString()
+const THUMBNAIL_WIDTH = 72
+const THUMBNAIL_HEIGHT = 92
+const THUMBNAIL_ROOT_MARGIN = "360px"
+const DEFAULT_ZOOM = 0.75
+const DEFAULT_PREVIEW_PAGE_COUNT = 15
+const DRAG_OVERLAY_DROP_ANIMATION = null
+
+const splitterCollisionDetection: CollisionDetection = (args) => {
+ const dragType = args.active.data.current?.type
+
+ if (dragType === "page") {
+ return closestCenter({
+ ...args,
+ droppableContainers: args.droppableContainers.filter(
+ (container) =>
+ container.data.current?.type === "page" ||
+ (container.data.current?.type === "page-dropzone" &&
+ container.data.current?.isEmpty)
+ ),
+ })
+ }
+
+ return closestCenter(args)
+}
+
+function toPageId(pageNumber: number): PageId {
+ return `page-${pageNumber}`
+}
+
+function getPageNumber(pageId: PageId): number {
+ return Number(pageId.replace("page-", ""))
+}
+
+function createInitialGroups(pageCount: number): SplitGroup[] {
+ const pages = Array.from({ length: pageCount }, (_, index) =>
+ toPageId(index + 1)
+ )
+
+ return [
+ {
+ id: "split-1",
+ title: "Abstract and intro",
+ pages: pages.slice(0, Math.min(3, pageCount)),
+ },
+ {
+ id: "split-2",
+ title: "Model architecture",
+ pages: pages.slice(3, Math.min(8, pageCount)),
+ },
+ {
+ id: "split-3",
+ title: "Training and results",
+ pages: pages.slice(8),
+ },
+ ].filter((group) => group.pages.length > 0)
+}
+
+function formatPageRanges(pageIds: PageId[]) {
+ if (pageIds.length === 0) return "No pages"
+
+ const pages = pageIds.map(getPageNumber)
+ const ranges: string[] = []
+ let rangeStart = pages[0]
+ let previous = pages[0]
+
+ for (let index = 1; index <= pages.length; index += 1) {
+ const current = pages[index]
+
+ if (current !== previous + 1) {
+ ranges.push(
+ rangeStart === previous ? `${rangeStart}` : `${rangeStart}-${previous}`
+ )
+ rangeStart = current
+ }
+
+ previous = current
+ }
+
+ return `Pages ${ranges.join(", ")}`
+}
+
+function createPageRangeLabels(groups: SplitGroup[]) {
+ return Object.fromEntries(
+ groups.map((group) => [group.id, formatPageRanges(group.pages)])
+ )
+}
+
+function useLazyThumbnail() {
+ const [node, setNode] = React.useState<HTMLDivElement | null>(null)
+ const [shouldRender, setShouldRender] = React.useState(false)
+
+ React.useEffect(() => {
+ if (!node || shouldRender) return
+
+ const observer = new IntersectionObserver(
+ ([entry]) => {
+ if (entry?.isIntersecting) {
+ setShouldRender(true)
+ observer.disconnect()
+ }
+ },
+ { rootMargin: THUMBNAIL_ROOT_MARGIN }
+ )
+
+ observer.observe(node)
+
+ return () => observer.disconnect()
+ }, [node, shouldRender])
+
+ return { setNode, shouldRender }
+}
+
+function PageThumbnailLoading() {
+ return (
+ <div className="absolute inset-0 overflow-hidden bg-muted">
+ <FileThumbnailLoadingOverlay />
+ </div>
+ )
+}
+
+function SplitGroupDropzone({
+ id,
+ isEmpty,
+ children,
+}: {
+ id: string
+ isEmpty: boolean
+ children: React.ReactNode
+}) {
+ const { isOver, setNodeRef } = useDroppable({
+ id,
+ data: {
+ groupId: id,
+ isEmpty,
+ type: "page-dropzone",
+ },
+ })
+ return (
+ <div
+ ref={setNodeRef}
+ className={cn(
+ "min-h-[116px] rounded-lg p-2 transition-[background-color,box-shadow]",
+ isOver && "bg-accent/30 shadow-[inset_0_0_0_1px_var(--border)]"
+ )}
+ >
+ {children}
+ </div>
+ )
+}
+
+const PageThumbnailPreview = React.memo(function PageThumbnailPreview({
+ pageId,
+ pageNumber,
+ reactPdf,
+ isActive,
+ imageUrl,
+ onSelect,
+ onThumbnailReady,
+}: {
+ pageId: PageId
+ pageNumber: number
+ reactPdf: ReactPdfModule | null
+ isActive: boolean
+ imageUrl?: string
+ onSelect: (pageNumber: number) => void
+ onThumbnailReady?: (pageId: PageId, imageUrl: string) => void
+}) {
+ const [isThumbnailLoading, setIsThumbnailLoading] = React.useState(true)
+ const { setNode, shouldRender } = useLazyThumbnail()
+ const rootRef = React.useRef<HTMLButtonElement>(null)
+
+ React.useEffect(() => {
+ if (reactPdf && shouldRender) {
+ setIsThumbnailLoading(true)
+ }
+ }, [pageNumber, reactPdf, shouldRender])
+
+ return (
+ <div
+ ref={setNode}
+ className="relative"
+ style={{ width: THUMBNAIL_WIDTH, height: THUMBNAIL_HEIGHT }}
+ >
+ <button
+ ref={rootRef}
+ type="button"
+ className={cn(
+ "relative cursor-grab overflow-hidden rounded-md border bg-muted text-left shadow-xs transition-[border-color,box-shadow,opacity] active:cursor-grabbing",
+ isActive
+ ? "border-blue-500 shadow-[0_0_0_2px_rgb(59_130_246_/_14%)]"
+ : "border-border hover:border-foreground/30"
+ )}
+ style={{ width: THUMBNAIL_WIDTH, height: THUMBNAIL_HEIGHT }}
+ onClick={() => onSelect(pageNumber)}
+ >
+ {imageUrl ? (
+ <img
+ src={imageUrl}
+ alt=""
+ className="absolute inset-0 size-full object-cover"
+ draggable={false}
+ />
+ ) : reactPdf && shouldRender ? (
+ <>
+ <reactPdf.Thumbnail
+ pageNumber={pageNumber}
+ width={THUMBNAIL_WIDTH}
+ className={cn(
+ "absolute inset-0 block size-full [&_.react-pdf__Thumbnail__page]:!m-0 [&_.react-pdf__Thumbnail__page]:!size-full [&_.react-pdf__Thumbnail__page]:overflow-hidden [&_canvas]:!size-full [&_canvas]:object-cover [&_canvas]:align-top [&_canvas]:transition-[opacity,filter,transform] [&_canvas]:duration-[160ms] [&_canvas]:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:[&_canvas]:transition-none",
+ isThumbnailLoading
+ ? "[&_canvas]:scale-[1.01] [&_canvas]:opacity-0 [&_canvas]:blur-sm"
+ : "[&_canvas]:blur-0 [&_canvas]:scale-100 [&_canvas]:opacity-100"
+ )}
+ onItemClick={({ pageNumber: clickedPageNumber }) => {
+ onSelect(clickedPageNumber)
+ }}
+ onRenderSuccess={() => {
+ setIsThumbnailLoading(false)
+
+ if (!onThumbnailReady) return
+
+ window.requestAnimationFrame(() => {
+ const canvas = rootRef.current?.querySelector("canvas")
+
+ if (!canvas) return
+
+ try {
+ canvas.toBlob((blob) => {
+ if (!blob) return
+
+ onThumbnailReady(pageId, URL.createObjectURL(blob))
+ }, "image/png")
+ } catch {
+ // Canvas export can fail if the browser marks it tainted.
+ }
+ })
+ }}
+ onRenderError={() => setIsThumbnailLoading(false)}
+ loading={null}
+ />
+ {isThumbnailLoading ? <PageThumbnailLoading /> : null}
+ </>
+ ) : (
+ <PageThumbnailLoading />
+ )}
+ <span className="absolute right-1 bottom-1 rounded bg-background/90 px-1.5 py-0.5 text-[10px] font-medium shadow-xs">
+ {pageNumber}
+ </span>
+ </button>
+ </div>
+ )
+})
+
+function SortablePageThumbnail({
+ groupId,
+ pageId,
+ pageNumber,
+ reactPdf,
+ isActive,
+ imageUrl,
+ onSelect,
+ onThumbnailReady,
+}: {
+ groupId: string
+ pageId: PageId
+ pageNumber: number
+ reactPdf: ReactPdfModule | null
+ isActive: boolean
+ imageUrl?: string
+ onSelect: (pageNumber: number) => void
+ onThumbnailReady?: (pageId: PageId, imageUrl: string) => void
+}) {
+ const {
+ attributes,
+ isDragging,
+ listeners,
+ setNodeRef,
+ transform,
+ transition,
+ } = useSortable({
+ id: pageId,
+ data: {
+ groupId,
+ pageId,
+ type: "page",
+ },
+ })
+
+ return (
+ <div
+ ref={setNodeRef}
+ style={{
+ transform: CSS.Transform.toString(transform),
+ transition,
+ }}
+ className={cn("group relative shrink-0", isDragging && "z-20 opacity-0")}
+ {...attributes}
+ {...listeners}
+ >
+ <PageThumbnailPreview
+ pageId={pageId}
+ pageNumber={pageNumber}
+ reactPdf={reactPdf}
+ isActive={isActive}
+ imageUrl={imageUrl}
+ onSelect={onSelect}
+ onThumbnailReady={onThumbnailReady}
+ />
+ </div>
+ )
+}
+
+function SplitGroupCard({
+ group,
+ pageRangeLabel,
+ reactPdf,
+ activePage,
+ isPageDragging = false,
+ thumbnailImages,
+ canRemove,
+ onRemove,
+ onSelectPage,
+ onThumbnailReady,
+}: {
+ group: SplitGroup
+ pageRangeLabel: string
+ reactPdf: ReactPdfModule | null
+ activePage: number
+ isPageDragging?: boolean
+ thumbnailImages?: Record<PageId, string>
+ canRemove: boolean
+ onRemove: () => void
+ onSelectPage: (pageNumber: number) => void
+ onThumbnailReady?: (pageId: PageId, imageUrl: string) => void
+}) {
+ if (!reactPdf) {
+ return (
+ <Card className="rounded-xl">
+ <div className="flex items-start justify-between gap-3 border-b p-3">
+ <div className="flex min-w-0 items-start gap-2">
+ <button
+ type="button"
+ aria-label={`Reorder ${group.title}`}
+ className="mt-0.5 inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-md text-muted-foreground"
+ disabled
+ >
+ <HugeiconsIcon icon={DragDropVerticalIcon} className="size-4" />
+ </button>
+ <div className="min-w-0">
+ <div className="truncate text-sm font-medium">{group.title}</div>
+ <div className="mt-1 text-xs text-muted-foreground">
+ {pageRangeLabel}
+ </div>
+ </div>
+ </div>
+ <div className="flex shrink-0 items-center gap-2">
+ <Badge variant="secondary" className="rounded-full">
+ {group.pages.length}
+ </Badge>
+ {canRemove ? (
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label={`Remove ${group.title}`}
+ onClick={onRemove}
+ >
+ <HugeiconsIcon icon={Delete02Icon} className="size-4" />
+ </Button>
+ ) : null}
+ </div>
+ </div>
+ <div className="min-h-[116px] rounded-lg p-2">
+ <ScrollArea
+ className="h-[110px] w-full overflow-hidden"
+ orientation="horizontal"
+ scrollbarGutter
+ scrollbarOverflowOnly
+ viewportClassName="overflow-y-hidden"
+ >
+ <div className="flex w-max gap-2 overflow-y-hidden py-1 pr-6">
+ {group.pages.map((pageId) => {
+ const pageNumber = getPageNumber(pageId)
+
+ return (
+ <div
+ key={pageId}
+ className={cn(
+ "relative shrink-0 overflow-hidden rounded-md border bg-muted shadow-xs",
+ activePage === pageNumber
+ ? "border-blue-500 shadow-[0_0_0_2px_rgb(59_130_246_/_14%)]"
+ : "border-border"
+ )}
+ style={{ width: THUMBNAIL_WIDTH, height: THUMBNAIL_HEIGHT }}
+ >
+ <PageThumbnailLoading />
+ <span className="absolute right-1 bottom-1 rounded bg-background/90 px-1.5 py-0.5 text-[10px] font-medium shadow-xs">
+ {pageNumber}
+ </span>
+ </div>
+ )
+ })}
+ </div>
+ </ScrollArea>
+ </div>
+ </Card>
+ )
+ }
+
+ return (
+ <Card className="rounded-xl">
+ <div className="flex items-start justify-between gap-3 border-b p-3">
+ <div className="flex min-w-0 items-start gap-2">
+ <button
+ type="button"
+ aria-label={`Reorder ${group.title}`}
+ className="mt-0.5 inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-md text-muted-foreground"
+ disabled
+ >
+ <HugeiconsIcon icon={DragDropVerticalIcon} className="size-4" />
+ </button>
+ <div className="min-w-0">
+ <div className="truncate text-sm font-medium">{group.title}</div>
+ <div className="mt-1 text-xs text-muted-foreground">
+ {pageRangeLabel}
+ </div>
+ </div>
+ </div>
+ <div className="flex shrink-0 items-center gap-2">
+ <Badge variant="secondary" className="rounded-full">
+ {group.pages.length}
+ </Badge>
+ {canRemove ? (
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label={`Remove ${group.title}`}
+ onClick={onRemove}
+ >
+ <HugeiconsIcon icon={Delete02Icon} className="size-4" />
+ </Button>
+ ) : null}
+ </div>
+ </div>
+ <SplitGroupDropzone id={group.id} isEmpty={group.pages.length === 0}>
+ {group.pages.length > 0 ? (
+ <SortableContext
+ items={group.pages}
+ strategy={horizontalListSortingStrategy}
+ >
+ <ScrollArea
+ className={cn(
+ "h-[110px] w-full overflow-hidden",
+ isPageDragging &&
+ "[&_[data-orientation=horizontal][data-slot=scroll-area-scrollbar]]:hidden"
+ )}
+ orientation="horizontal"
+ scrollbarGutter
+ scrollbarOverflowOnly
+ viewportClassName="overflow-y-hidden"
+ >
+ <div className="flex w-max gap-2 overflow-y-hidden py-1 pr-6">
+ {group.pages.map((pageId) => {
+ const pageNumber = getPageNumber(pageId)
+
+ return (
+ <SortablePageThumbnail
+ key={pageId}
+ groupId={group.id}
+ pageId={pageId}
+ pageNumber={pageNumber}
+ reactPdf={reactPdf}
+ isActive={activePage === pageNumber}
+ imageUrl={thumbnailImages?.[pageId]}
+ onSelect={onSelectPage}
+ onThumbnailReady={onThumbnailReady}
+ />
+ )
+ })}
+ </div>
+ </ScrollArea>
+ </SortableContext>
+ ) : (
+ <div className="grid h-[104px] place-items-center rounded-lg bg-muted/35 text-xs text-muted-foreground">
+ Drop pages here
+ </div>
+ )}
+ </SplitGroupDropzone>
+ </Card>
+ )
+}
+
+function PageDragOverlay({
+ pageId,
+ imageUrl,
+}: {
+ pageId: PageId
+ imageUrl?: string
+}) {
+ const pageNumber = getPageNumber(pageId)
+
+ return (
+ <div
+ className="relative overflow-hidden rounded-md border border-blue-500 bg-background shadow-lg shadow-black/10"
+ style={{ width: THUMBNAIL_WIDTH, height: THUMBNAIL_HEIGHT }}
+ >
+ {imageUrl ? (
+ <img
+ src={imageUrl}
+ alt=""
+ className="size-full object-cover"
+ draggable={false}
+ />
+ ) : (
+ <PageThumbnailLoading />
+ )}
+ <span className="absolute right-1 bottom-1 rounded bg-background/90 px-1.5 py-0.5 text-[10px] font-medium shadow-xs">
+ {pageNumber}
+ </span>
+ </div>
+ )
+}
+
+function findGroupId(groups: SplitGroup[], id: string) {
+ if (groups.some((group) => group.id === id)) return id
+
+ return groups.find((group) => group.pages.includes(id as PageId))?.id ?? null
+}
+
+function getGroupPages(groups: SplitGroup[], groupId: string | null) {
+ return groups.find((group) => group.id === groupId)?.pages ?? []
+}
+
+function movePageToGroup({
+ activePageId,
+ groups,
+ insertIndex,
+ targetGroupId,
+}: {
+ activePageId: PageId
+ groups: SplitGroup[]
+ insertIndex: number
+ targetGroupId: string
+}) {
+ return groups.map((group) => {
+ const pagesWithoutActive = group.pages.filter(
+ (pageId) => pageId !== activePageId
+ )
+
+ if (group.id !== targetGroupId) {
+ return { ...group, pages: pagesWithoutActive }
+ }
+
+ const nextPages = [...pagesWithoutActive]
+ nextPages.splice(insertIndex, 0, activePageId)
+ return { ...group, pages: nextPages }
+ })
+}
+
+function reorderPageInGroup({
+ activePageId,
+ groups,
+ overPageId,
+}: {
+ activePageId: PageId
+ groups: SplitGroup[]
+ overPageId: PageId
+}) {
+ const groupId = findGroupId(groups, activePageId)
+ const pages = getGroupPages(groups, groupId)
+ const activeIndex = pages.indexOf(activePageId)
+ const overIndex = pages.indexOf(overPageId)
+
+ if (!groupId || activeIndex === -1 || overIndex === -1) return groups
+
+ return groups.map((group) =>
+ group.id === groupId
+ ? { ...group, pages: arrayMove(group.pages, activeIndex, overIndex) }
+ : group
+ )
+}
+
+function SplitterGroupsPane({
+ activePage,
+ className,
+ documentKey,
+ pageCount,
+ reactPdf,
+ withFrameDivider = true,
+ onSelectPage,
+}: {
+ activePage: number
+ className?: string
+ documentKey: string
+ pageCount: number
+ reactPdf: ReactPdfModule | null
+ withFrameDivider?: boolean
+ onSelectPage: (pageNumber: number) => void
+}) {
+ const [groups, setGroups] = React.useState<SplitGroup[]>(() =>
+ createInitialGroups(DEFAULT_PREVIEW_PAGE_COUNT)
+ )
+ const [activePageId, setActivePageId] = React.useState<PageId | null>(null)
+ const [thumbnailImages, setThumbnailImages] = React.useState<
+ Record<PageId, string>
+ >({})
+ const thumbnailObjectUrlsRef = React.useRef(new Set<string>())
+ const dragStartGroupIdRef = React.useRef<string | null>(null)
+ const dragStartGroupsRef = React.useRef<SplitGroup[] | null>(null)
+ const sensors = useSensors(
+ useSensor(PointerSensor, {
+ activationConstraint: { distance: 6 },
+ })
+ )
+
+ const clearCachedThumbnails = React.useCallback(() => {
+ thumbnailObjectUrlsRef.current.forEach((imageUrl) => {
+ URL.revokeObjectURL(imageUrl)
+ })
+ thumbnailObjectUrlsRef.current.clear()
+ setThumbnailImages({})
+ }, [])
+
+ React.useEffect(() => {
+ const nextGroups = createInitialGroups(
+ pageCount || DEFAULT_PREVIEW_PAGE_COUNT
+ )
+
+ setGroups(nextGroups)
+ clearCachedThumbnails()
+ setActivePageId(null)
+ }, [clearCachedThumbnails, documentKey, pageCount])
+
+ React.useEffect(() => {
+ const objectUrls = thumbnailObjectUrlsRef.current
+
+ return () => {
+ objectUrls.forEach((imageUrl) => {
+ URL.revokeObjectURL(imageUrl)
+ })
+ objectUrls.clear()
+ }
+ }, [])
+
+ const pageRangeLabels = React.useMemo(
+ () => createPageRangeLabels(groups),
+ [groups]
+ )
+
+ const addSplit = React.useCallback(() => {
+ setGroups((previousGroups) => [
+ ...previousGroups,
+ {
+ id: `split-${Date.now()}-${previousGroups.length}`,
+ title: `Split ${previousGroups.length + 1}`,
+ pages: [],
+ },
+ ])
+ }, [])
+
+ const removeSplit = React.useCallback((groupId: string) => {
+ setGroups((previousGroups) => {
+ const groupToRemove = previousGroups.find((group) => group.id === groupId)
+ const remainingGroups = previousGroups.filter(
+ (group) => group.id !== groupId
+ )
+
+ if (!groupToRemove || remainingGroups.length === 0) return previousGroups
+
+ return remainingGroups.map((group, index) =>
+ index === 0
+ ? { ...group, pages: [...group.pages, ...groupToRemove.pages] }
+ : group
+ )
+ })
+ }, [])
+
+ const handleThumbnailReady = React.useCallback(
+ (pageId: PageId, imageUrl: string) => {
+ setThumbnailImages((currentImages) => {
+ if (currentImages[pageId]) {
+ URL.revokeObjectURL(imageUrl)
+ return currentImages
+ }
+
+ thumbnailObjectUrlsRef.current.add(imageUrl)
+ return { ...currentImages, [pageId]: imageUrl }
+ })
+ },
+ []
+ )
+
+ const handleDragStart = React.useCallback(
+ (event: DragStartEvent) => {
+ const dragType = event.active.data.current?.type
+
+ if (dragType === "page") {
+ const pageId = String(event.active.id) as PageId
+ dragStartGroupIdRef.current = findGroupId(groups, pageId)
+ dragStartGroupsRef.current = groups
+ setActivePageId(pageId)
+ return
+ }
+
+ dragStartGroupIdRef.current = null
+ dragStartGroupsRef.current = null
+ setActivePageId(null)
+ },
+ [groups]
+ )
+
+ const handleDragOver = React.useCallback((event: DragOverEvent) => {
+ const dragType = event.active.data.current?.type
+ const overId = event.over?.id
+
+ if (dragType !== "page" || !overId) return
+
+ const pageId = String(event.active.id) as PageId
+
+ setGroups((previousGroups) => {
+ const sourceGroupId = findGroupId(previousGroups, pageId)
+ const targetGroupId = findGroupId(previousGroups, String(overId))
+
+ if (!sourceGroupId || !targetGroupId || sourceGroupId === targetGroupId) {
+ return previousGroups
+ }
+
+ const targetPages = getGroupPages(previousGroups, targetGroupId)
+ const overPageIndex = targetPages.indexOf(String(overId) as PageId)
+ const overRect = event.over?.rect
+ const activeRect = event.active.rect.current.translated
+ const isAfterOverPage =
+ overPageIndex !== -1 &&
+ activeRect &&
+ overRect &&
+ activeRect.left > overRect.left + overRect.width / 2
+ const insertIndex =
+ overPageIndex === -1
+ ? targetPages.length
+ : overPageIndex + (isAfterOverPage ? 1 : 0)
+
+ return movePageToGroup({
+ groups: previousGroups,
+ activePageId: pageId,
+ targetGroupId,
+ insertIndex,
+ })
+ })
+ }, [])
+
+ const handleDragEnd = React.useCallback((event: DragEndEvent) => {
+ const dragType = event.active.data.current?.type
+ const overId = event.over?.id
+
+ if (dragType === "page" && overId) {
+ const activePageId = String(event.active.id) as PageId
+ const overPageId = String(overId) as PageId
+
+ setGroups((previousGroups) => {
+ const overGroupId = findGroupId(previousGroups, String(overId))
+
+ if (dragStartGroupIdRef.current !== overGroupId) {
+ return previousGroups
+ }
+
+ return reorderPageInGroup({
+ groups: previousGroups,
+ activePageId,
+ overPageId,
+ })
+ })
+ }
+
+ dragStartGroupIdRef.current = null
+ dragStartGroupsRef.current = null
+ setActivePageId(null)
+ }, [])
+
+ const handleDragCancel = React.useCallback(() => {
+ if (dragStartGroupsRef.current) {
+ setGroups(dragStartGroupsRef.current)
+ }
+
+ dragStartGroupIdRef.current = null
+ dragStartGroupsRef.current = null
+ setActivePageId(null)
+ }, [])
+
+ const visibleActivePage = activePageId
+ ? getPageNumber(activePageId)
+ : activePage
+ const isPageDragging = activePageId !== null
+
+ return (
+ <aside
+ className={cn(
+ "flex h-full min-h-0 flex-col bg-muted/20",
+ withFrameDivider && "border-t md:border-t-0 md:border-l",
+ className
+ )}
+ >
+ <div className="flex min-h-12 items-center justify-end gap-3 border-b bg-background px-3">
+ <Button type="button" variant="outline" size="sm" onClick={addSplit}>
+ <HugeiconsIcon icon={Add01Icon} className="size-4" />
+ Add split
+ </Button>
+ </div>
+ {reactPdf ? (
+ <DndContext
+ sensors={sensors}
+ collisionDetection={splitterCollisionDetection}
+ onDragStart={handleDragStart}
+ onDragOver={handleDragOver}
+ onDragEnd={handleDragEnd}
+ onDragCancel={handleDragCancel}
+ >
+ <ScrollArea className="min-h-0 flex-1" scrollFade>
+ <div className="space-y-3 p-3">
+ {groups.map((group) => (
+ <SplitGroupCard
+ key={group.id}
+ group={group}
+ pageRangeLabel={pageRangeLabels[group.id] ?? "No pages"}
+ reactPdf={reactPdf}
+ activePage={visibleActivePage}
+ isPageDragging={isPageDragging}
+ thumbnailImages={thumbnailImages}
+ canRemove={groups.length > 1}
+ onRemove={() => removeSplit(group.id)}
+ onSelectPage={onSelectPage}
+ onThumbnailReady={handleThumbnailReady}
+ />
+ ))}
+ </div>
+ </ScrollArea>
+ <DragOverlay dropAnimation={DRAG_OVERLAY_DROP_ANIMATION}>
+ {activePageId ? (
+ <PageDragOverlay
+ pageId={activePageId}
+ imageUrl={thumbnailImages[activePageId]}
+ />
+ ) : null}
+ </DragOverlay>
+ </DndContext>
+ ) : (
+ <ScrollArea className="min-h-0 flex-1" scrollFade>
+ <div className="space-y-3 p-3">
+ {groups.map((group) => (
+ <SplitGroupCard
+ key={group.id}
+ group={group}
+ pageRangeLabel={pageRangeLabels[group.id] ?? "No pages"}
+ reactPdf={null}
+ activePage={visibleActivePage}
+ canRemove={groups.length > 1}
+ onRemove={() => removeSplit(group.id)}
+ onSelectPage={onSelectPage}
+ />
+ ))}
+ </div>
+ </ScrollArea>
+ )}
+ </aside>
+ )
+}
+
+export function DocumentSplits({
+ file = PDF_URL,
+ className,
+}: {
+ file?: string
+ className?: string
+} = {}) {
+ const [reactPdf, setReactPdf] = React.useState<ReactPdfModule | null>(null)
+ const [numPages, setNumPages] = React.useState(0)
+
+ React.useEffect(() => {
+ let isMounted = true
+
+ import("react-pdf").then((module) => {
+ module.pdfjs.GlobalWorkerOptions.workerSrc = PDF_WORKER_URL
+
+ if (isMounted) {
+ setReactPdf(module)
+ }
+ })
+
+ return () => {
+ isMounted = false
+ }
+ }, [])
+
+ const renderPanel = (pdfModule: ReactPdfModule | null) => (
+ <div className={cn("h-[620px] overflow-hidden bg-background", className)}>
+ <SplitterGroupsPane
+ activePage={1}
+ documentKey={file}
+ pageCount={numPages}
+ reactPdf={pdfModule}
+ onSelectPage={() => {}}
+ />
+ </div>
+ )
+
+ if (!reactPdf) {
+ return renderPanel(null)
+ }
+
+ return (
+ <reactPdf.Document
+ file={file}
+ onLoadSuccess={({ numPages: pageCount }) => {
+ setNumPages(pageCount)
+ }}
+ loading={renderPanel(null)}
+ error={
+ <div className="grid h-[620px] place-items-center bg-background text-sm text-muted-foreground">
+ Unable to load PDF.
+ </div>
+ }
+ >
+ {renderPanel(reactPdf)}
+ </reactPdf.Document>
+ )
+}
+
+export function DocumentSplitsBlock() {
+ const [reactPdf, setReactPdf] = React.useState<ReactPdfModule | null>(null)
+ const [pdfUrl, setPdfUrl] = React.useState(PDF_URL)
+ const [numPages, setNumPages] = React.useState(0)
+ const [activePage, setActivePage] = React.useState(1)
+ const viewerRef = React.useRef<PDFViewerHandle>(null)
+ const uploadedPdfUrlRef = React.useRef<string | null>(null)
+
+ React.useEffect(() => {
+ let isMounted = true
+
+ import("react-pdf").then((module) => {
+ module.pdfjs.GlobalWorkerOptions.workerSrc = PDF_WORKER_URL
+
+ if (isMounted) {
+ setReactPdf(module)
+ }
+ })
+
+ return () => {
+ isMounted = false
+ }
+ }, [])
+
+ React.useEffect(() => {
+ return () => {
+ if (uploadedPdfUrlRef.current) {
+ URL.revokeObjectURL(uploadedPdfUrlRef.current)
+ }
+ }
+ }, [])
+
+ const handleLoadSuccess = React.useCallback(
+ ({ numPages: pageCount }: { numPages: number }) => {
+ setNumPages(pageCount)
+ },
+ []
+ )
+
+ const handleActivePageChange = React.useCallback((pageNumber: number) => {
+ window.queueMicrotask(() => {
+ setActivePage((currentPage) =>
+ currentPage === pageNumber ? currentPage : pageNumber
+ )
+ })
+ }, [])
+
+ const handlePdfUpload = React.useCallback((file: File) => {
+ const nextUrl = URL.createObjectURL(file)
+
+ if (uploadedPdfUrlRef.current) {
+ URL.revokeObjectURL(uploadedPdfUrlRef.current)
+ }
+
+ uploadedPdfUrlRef.current = nextUrl
+ setPdfUrl(nextUrl)
+ setNumPages(0)
+ setActivePage(1)
+ }, [])
+
+ const scrollToPage = React.useCallback((pageNumber: number) => {
+ setActivePage(pageNumber)
+
+ viewerRef.current?.scrollToPage(pageNumber, {
+ block: "start",
+ behavior: "auto",
+ })
+ }, [])
+
+ const updatePageCountFromViewer = React.useCallback((pageCount: number) => {
+ window.queueMicrotask(() => {
+ setNumPages(pageCount)
+ })
+ }, [])
+
+ const renderShell = (pdfModule: ReactPdfModule | null) => (
+ <PdfBlockResizableShell
+ autoSaveId="pdf-block-document-splits"
+ heightClassName="h-[720px]"
+ rightDefaultSize={50}
+ rightMaxSize={66}
+ rightMinSize={30}
+ left={
+ <PDFViewer
+ ref={viewerRef}
+ file={pdfUrl}
+ defaultZoom={DEFAULT_ZOOM}
+ onActivePageChange={handleActivePageChange}
+ onPdfUpload={handlePdfUpload}
+ onDocumentLoadSuccess={updatePageCountFromViewer}
+ />
+ }
+ right={
+ <SplitterGroupsPane
+ activePage={activePage}
+ documentKey={pdfUrl}
+ pageCount={numPages}
+ reactPdf={pdfModule}
+ withFrameDivider={false}
+ onSelectPage={scrollToPage}
+ />
+ }
+ />
+ )
+
+ if (!reactPdf) {
+ return renderShell(null)
+ }
+
+ return (
+ <reactPdf.Document
+ file={pdfUrl}
+ onLoadSuccess={handleLoadSuccess}
+ loading={renderShell(null)}
+ error={
+ <div className="grid h-[720px] place-items-center bg-background text-sm text-muted-foreground">
+ Unable to load PDF.
+ </div>
+ }
+ >
+ {renderShell(reactPdf)}
+ </reactPdf.Document>
+ )
+}
+
+function DocumentSplitExampleCard({
+ title,
+ pages,
+ activePage,
+ className,
+}: {
+ title: string
+ pages: number[]
+ activePage?: number
+ className?: string
+}) {
+ return (
+ <section className={cn("rounded-lg border bg-background p-3", className)}>
+ <div className="mb-3 flex items-center justify-between gap-3">
+ <div className="flex min-w-0 items-center gap-2">
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ className="size-7 cursor-grab text-muted-foreground"
+ aria-label={`Reorder ${title}`}
+ >
+ <HugeiconsIcon icon={DragDropVerticalIcon} className="size-4" />
+ </Button>
+ <div className="truncate text-sm font-medium">{title}</div>
+ </div>
+ <Badge variant="secondary" className="rounded-full">
+ {pages.length} pages
+ </Badge>
+ </div>
+ <ScrollArea
+ className="h-[108px] w-full overflow-hidden"
+ orientation="horizontal"
+ scrollbarGutter
+ scrollbarOverflowOnly
+ viewportClassName="overflow-y-hidden"
+ >
+ <div className="flex w-max gap-2 overflow-y-hidden py-1 pr-4">
+ {pages.map((page) => (
+ <button
+ key={page}
+ type="button"
+ className={cn(
+ "relative h-[92px] w-[72px] shrink-0 overflow-hidden rounded-md border bg-muted text-xs text-muted-foreground transition-colors hover:border-primary/50",
+ activePage === page &&
+ "border-primary bg-primary/5 text-primary"
+ )}
+ >
+ <div className="absolute inset-2 rounded-sm bg-background/70 shadow-sm" />
+ <span className="absolute right-1.5 bottom-1.5 rounded bg-background/90 px-1 text-[10px]">
+ {page}
+ </span>
+ </button>
+ ))}
+ </div>
+ </ScrollArea>
+ </section>
+ )
+}
+
+function DocumentSplitsExample() {
+ return (
+ <div className="flex h-[520px] flex-col gap-3 bg-background p-3">
+ <DocumentSplitExampleCard
+ title="Abstract and intro"
+ pages={[1, 2, 3]}
+ activePage={2}
+ />
+ <DocumentSplitExampleCard
+ title="Model architecture"
+ pages={[4, 5, 6, 7, 8]}
+ className="border-blue-500/50 bg-blue-500/5"
+ />
+ <DocumentSplitExampleCard
+ title="Training and results"
+ pages={[9, 10, 11, 12, 13, 14, 15]}
+ />
+ </div>
+ )
+}
+
+export function DocumentSplitsDemo() {
+ const [isCodeVisible, setIsCodeVisible] = React.useState(false)
+
+ return (
+ <div
+ data-slot="component-preview"
+ className="group relative mt-4 mb-12 flex flex-col overflow-hidden rounded-xl border"
+ >
+ <DocumentSplits file="/samples/attention.pdf" />
+ <div
+ data-slot="code"
+ data-mobile-code-visible={isCodeVisible}
+ className="relative overflow-hidden **:data-[slot=copy-button]:right-4 **:data-[slot=copy-button]:hidden data-[mobile-code-visible=true]:**:data-[slot=copy-button]:flex [&_[data-rehype-pretty-code-figure]]:m-0! [&_[data-rehype-pretty-code-figure]]:rounded-t-none [&_[data-rehype-pretty-code-figure]]:border-t [&_pre]:max-h-72"
+ >
+ {isCodeVisible ? (
+ <HighlightedCodeBlock
+ code={documentSplitterUsageCode}
+ className="rounded-none border-x-0 border-b-0"
+ />
+ ) : (
+ <div className="relative">
+ <HighlightedCodeBlock
+ code={documentSplitterUsageCode}
+ className="rounded-none border-x-0 border-b-0"
+ maxHeightClassName="max-h-56"
+ previewLines={10}
+ showCopy={false}
+ />
+ <div className="absolute inset-0 flex items-center justify-center pb-4">
+ <div
+ className="absolute inset-0"
+ style={{
+ background:
+ "linear-gradient(to top, var(--color-code), color-mix(in oklab, var(--color-code) 60%, transparent), transparent)",
+ }}
+ />
+ <Button
+ type="button"
+ size="sm"
+ variant="outline"
+ className="relative z-10 rounded-lg bg-background text-foreground shadow-none hover:bg-muted dark:bg-background dark:text-foreground dark:hover:bg-muted"
+ onClick={() => setIsCodeVisible(true)}
+ >
+ View Code
+ </Button>
+ </div>
+ </div>
+ )}
+ </div>
+ </div>
+ )
+}
+
+const documentSplitterUsageCode = `"use client";
+
+import { DocumentSplits } from "@/components/ui/document-splits";
+
+export function DocumentSplitsExample() {
+ return <DocumentSplits file="/samples/attention.pdf" className="h-[620px]" />;
+}`
+
+const documentSplitterSourceCode = `"use client";
+
+import * as React from "react";
+import {
+ closestCenter,
+ DndContext,
+ DragOverlay,
+ PointerSensor,
+ useDroppable,
+ useSensor,
+ useSensors,
+ type DragEndEvent,
+ type DragOverEvent,
+ type DragStartEvent,
+} from "@dnd-kit/core";
+import {
+ SortableContext,
+ arrayMove,
+ horizontalListSortingStrategy,
+ useSortable,
+} from "@dnd-kit/sortable";
+import { CSS } from "@dnd-kit/utilities";
+import { Add01Icon } from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
+import type * as ReactPdf from "react-pdf";
+
+import { Button } from "@/components/ui/button";
+import { ScrollArea } from "@/components/ui/scroll-area";
+import { cn } from "@/lib/utils";
+
+type ReactPdfModule = typeof ReactPdf;
+type PageId = string;
+type SplitGroup = {
+ id: string;
+ title: string;
+ pages: PageId[];
+};
+
+const DEFAULT_PAGE_COUNT = 15;
+const THUMBNAIL_WIDTH = 72;
+const THUMBNAIL_HEIGHT = 92;
+
+function toPageId(pageNumber: number) {
+ return "page-" + pageNumber;
+}
+
+function getPageNumber(pageId: PageId) {
+ return Number(pageId.replace("page-", ""));
+}
+
+function createInitialGroups(pageCount: number): SplitGroup[] {
+ const pages = Array.from({ length: pageCount }, (_, index) => toPageId(index + 1));
+
+ return [
+ { id: "split-1", title: "Abstract and intro", pages: pages.slice(0, Math.min(3, pageCount)) },
+ { id: "split-2", title: "Model architecture", pages: pages.slice(3, Math.min(8, pageCount)) },
+ { id: "split-3", title: "Training and results", pages: pages.slice(8) },
+ ].filter((group) => group.pages.length > 0);
+}
+
+function findGroupId(groups: SplitGroup[], id: string) {
+ if (groups.some((group) => group.id === id)) return id;
+ return groups.find((group) => group.pages.includes(id))?.id ?? null;
+}
+
+function getGroupPages(groups: SplitGroup[], groupId: string | null) {
+ return groups.find((group) => group.id === groupId)?.pages ?? [];
+}
+
+function movePageToGroup({
+ activePageId,
+ groups,
+ insertIndex,
+ targetGroupId,
+}: {
+ activePageId: PageId;
+ groups: SplitGroup[];
+ insertIndex: number;
+ targetGroupId: string;
+}) {
+ return groups.map((group) => {
+ const pagesWithoutActive = group.pages.filter((pageId) => pageId !== activePageId);
+
+ if (group.id !== targetGroupId) {
+ return { ...group, pages: pagesWithoutActive };
+ }
+
+ const nextPages = [...pagesWithoutActive];
+ nextPages.splice(insertIndex, 0, activePageId);
+ return { ...group, pages: nextPages };
+ });
+}
+
+function reorderPageInGroup({
+ activePageId,
+ groups,
+ overPageId,
+}: {
+ activePageId: PageId;
+ groups: SplitGroup[];
+ overPageId: PageId;
+}) {
+ const groupId = findGroupId(groups, activePageId);
+ const pages = getGroupPages(groups, groupId);
+ const activeIndex = pages.indexOf(activePageId);
+ const overIndex = pages.indexOf(overPageId);
+
+ if (!groupId || activeIndex === -1 || overIndex === -1) return groups;
+
+ return groups.map((group) =>
+ group.id === groupId ? { ...group, pages: arrayMove(group.pages, activeIndex, overIndex) } : group,
+ );
+}
+
+function SplitDropzone({
+ children,
+ group,
+}: {
+ children: React.ReactNode;
+ group: SplitGroup;
+}) {
+ const { isOver, setNodeRef } = useDroppable({
+ id: group.id,
+ data: { type: "page-dropzone", isEmpty: group.pages.length === 0 },
+ });
+
+ return (
+ <div
+ ref={setNodeRef}
+ className={cn("min-h-[116px] rounded-lg p-2", isOver && "bg-accent/30 ring-1 ring-border")}
+ >
+ {children}
+ </div>
+ );
+}
+
+function PageThumbnail({
+ pageId,
+ reactPdf,
+}: {
+ pageId: PageId;
+ reactPdf: ReactPdfModule;
+}) {
+ const pageNumber = getPageNumber(pageId);
+ const { attributes, isDragging, listeners, setNodeRef, transform, transition } = useSortable({
+ id: pageId,
+ data: { type: "page" },
+ });
+
+ return (
+ <button
+ ref={setNodeRef}
+ type="button"
+ className={cn(
+ "relative shrink-0 cursor-grab overflow-hidden rounded-md border bg-muted shadow-xs active:cursor-grabbing",
+ isDragging && "opacity-0",
+ )}
+ style={{
+ width: THUMBNAIL_WIDTH,
+ height: THUMBNAIL_HEIGHT,
+ transform: CSS.Transform.toString(transform),
+ transition,
+ }}
+ {...attributes}
+ {...listeners}
+ >
+ <reactPdf.Thumbnail
+ pageNumber={pageNumber}
+ width={THUMBNAIL_WIDTH}
+ renderTextLayer={false}
+ className="absolute inset-0 block size-full [&_.react-pdf__Thumbnail__page]:!m-0 [&_.react-pdf__Thumbnail__page]:!size-full [&_.react-pdf__Thumbnail__page]:overflow-hidden [&_canvas]:!size-full [&_canvas]:object-cover"
+ loading={<div className="absolute inset-0 animate-pulse bg-muted" />}
+ />
+ <span className="absolute right-1 bottom-1 rounded bg-background/90 px-1.5 py-0.5 text-[10px] font-medium shadow-xs">
+ {pageNumber}
+ </span>
+ </button>
+ );
+}
+
+function SplitGroupCard({
+ group,
+ reactPdf,
+}: {
+ group: SplitGroup;
+ reactPdf: ReactPdfModule;
+}) {
+ return (
+ <section className="rounded-lg border bg-background">
+ <div className="flex items-center justify-between gap-3 border-b p-3">
+ <div className="truncate text-sm font-medium">{group.title}</div>
+ <div className="shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground">
+ {group.pages.length} pages
+ </div>
+ </div>
+ <SplitDropzone group={group}>
+ <SortableContext items={group.pages} strategy={horizontalListSortingStrategy}>
+ <ScrollArea
+ className="h-[110px] w-full overflow-hidden"
+ orientation="horizontal"
+ scrollbarGutter
+ scrollbarOverflowOnly
+ viewportClassName="overflow-y-hidden"
+ >
+ <div className="flex w-max gap-2 overflow-y-hidden py-1 pr-6">
+ {group.pages.map((pageId) => (
+ <PageThumbnail key={pageId} pageId={pageId} reactPdf={reactPdf} />
+ ))}
+ </div>
+ </ScrollArea>
+ </SortableContext>
+ </SplitDropzone>
+ </section>
+ );
+}
+
+export function DocumentSplits({
+ file,
+ workerUrl = new URL("pdfjs-dist/legacy/build/pdf.worker.min.mjs", import.meta.url).toString(),
+ className,
+}: {
+ file: string | File;
+ workerUrl?: string;
+ className?: string;
+}) {
+ const [reactPdf, setReactPdf] = React.useState<ReactPdfModule | null>(null);
+ const [pageCount, setPageCount] = React.useState(0);
+ const [groups, setGroups] = React.useState(() => createInitialGroups(DEFAULT_PAGE_COUNT));
+ const [activePageId, setActivePageId] = React.useState<PageId | null>(null);
+ const dragStartGroupIdRef = React.useRef<string | null>(null);
+ const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }));
+
+ React.useEffect(() => {
+ let mounted = true;
+
+ void import("react-pdf").then((module) => {
+ module.pdfjs.GlobalWorkerOptions.workerSrc = workerUrl;
+ if (mounted) setReactPdf(module);
+ });
+
+ return () => {
+ mounted = false;
+ };
+ }, [workerUrl]);
+
+ React.useEffect(() => {
+ setGroups(createInitialGroups(pageCount || DEFAULT_PAGE_COUNT));
+ }, [pageCount, file]);
+
+ const handleDragStart = React.useCallback((event: DragStartEvent) => {
+ if (event.active.data.current?.type === "page") {
+ const pageId = String(event.active.id);
+ dragStartGroupIdRef.current = findGroupId(groups, pageId);
+ setActivePageId(pageId);
+ }
+ }, [groups]);
+
+ const handleDragOver = React.useCallback((event: DragOverEvent) => {
+ if (event.active.data.current?.type !== "page" || !event.over) return;
+
+ const pageId = String(event.active.id);
+ const overId = String(event.over.id);
+
+ setGroups((current) => {
+ const sourceGroupId = findGroupId(current, pageId);
+ const targetGroupId = findGroupId(current, overId);
+
+ if (!sourceGroupId || !targetGroupId || sourceGroupId === targetGroupId) {
+ return current;
+ }
+
+ const targetPages = getGroupPages(current, targetGroupId);
+ const overIndex = targetPages.indexOf(overId);
+ const insertIndex = overIndex === -1 ? targetPages.length : overIndex;
+
+ return movePageToGroup({
+ activePageId: pageId,
+ groups: current,
+ insertIndex,
+ targetGroupId,
+ });
+ });
+ }, []);
+
+ const handleDragEnd = React.useCallback((event: DragEndEvent) => {
+ if (event.active.data.current?.type !== "page" || !event.over) {
+ dragStartGroupIdRef.current = null;
+ setActivePageId(null);
+ return;
+ }
+
+ const pageId = String(event.active.id);
+ const overId = String(event.over.id);
+
+ setGroups((current) => {
+ const overGroupId = findGroupId(current, overId);
+ if (dragStartGroupIdRef.current !== overGroupId) return current;
+
+ return reorderPageInGroup({
+ activePageId: pageId,
+ groups: current,
+ overPageId: overId,
+ });
+ });
+
+ dragStartGroupIdRef.current = null;
+ setActivePageId(null);
+ }, []);
+
+ const shell = (pdfModule: ReactPdfModule | null) => (
+ <div className={cn("h-[620px] overflow-hidden bg-background", className)}>
+ {pdfModule ? (
+ <DndContext
+ sensors={sensors}
+ collisionDetection={closestCenter}
+ onDragStart={handleDragStart}
+ onDragOver={handleDragOver}
+ onDragEnd={handleDragEnd}
+ onDragCancel={() => {
+ dragStartGroupIdRef.current = null;
+ setActivePageId(null);
+ }}
+ >
+ <ScrollArea className="h-full" scrollFade>
+ <div className="space-y-3 p-3">
+ {groups.map((group) => (
+ <SplitGroupCard key={group.id} group={group} reactPdf={pdfModule} />
+ ))}
+ </div>
+ </ScrollArea>
+ <DragOverlay>
+ {activePageId ? (
+ <div
+ className="relative overflow-hidden rounded-md border bg-background shadow-lg"
+ style={{ width: THUMBNAIL_WIDTH, height: THUMBNAIL_HEIGHT }}
+ >
+ <pdfModule.Thumbnail pageNumber={getPageNumber(activePageId)} width={THUMBNAIL_WIDTH} />
+ </div>
+ ) : null}
+ </DragOverlay>
+ </DndContext>
+ ) : (
+ <div className="grid h-full place-items-center text-sm text-muted-foreground">Loading pages...</div>
+ )}
+ </div>
+ );
+
+ if (!reactPdf) {
+ return shell(null);
+ }
+
+ return (
+ <reactPdf.Document
+ file={file}
+ onLoadSuccess={({ numPages }) => setPageCount(numPages)}
+ loading={shell(null)}
+ >
+ {shell(reactPdf)}
+ </reactPdf.Document>
+ );
+}`
+
+export function DocumentSplitsSource() {
+ return <HighlightedCodeBlock code={documentSplitterSourceCode} />
+}
diff --git a/apps/v4/components/e-signature-docs.tsx b/apps/v4/components/e-signature-docs.tsx
index 6d053a6..c0bf416 100644
--- a/apps/v4/components/e-signature-docs.tsx
+++ b/apps/v4/components/e-signature-docs.tsx
@@ -5,16 +5,17 @@ import {
BorderFullIcon,
Download01Icon,
FilePenIcon,
- Loading03Icon,
Pen01Icon,
} from "@hugeicons/core-free-icons"
import { HugeiconsIcon } from "@hugeicons/react"
-import type * as ReactPdf from "react-pdf"
import type SignaturePad from "signature_pad"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
+import { PDFViewer } from "@/components/ui/pdf-viewer"
+import { ScrollArea } from "@/components/ui/scroll-area"
import { HighlightedCodeBlock } from "@/components/highlighted-code-block"
+import { PdfBlockResizableShell } from "@/components/pdf-block-resizable-shell"
import {
Dialog,
DialogContent,
@@ -40,20 +41,10 @@ type SignatureField = {
imageDataUrl?: string
}
-type ReactPdfModule = typeof ReactPdf
-
const PDF_URL = "/samples/attention.pdf"
-const PDF_WORKER_URL = new URL(
- "pdfjs-dist/legacy/build/pdf.worker.min.mjs",
- import.meta.url
-).toString()
const PAGE_WIDTH = 612
const PAGE_HEIGHT = 792
-const RENDERED_PAGE_WIDTH = 430
-const RENDERED_PAGE_HEIGHT = Math.round(
- RENDERED_PAGE_WIDTH * (PAGE_HEIGHT / PAGE_WIDTH)
-)
-const DEVICE_PIXEL_RATIO_LIMIT = 2
+const DEFAULT_ZOOM = 0.75
const MIN_FIELD_WIDTH = 96
const MIN_FIELD_HEIGHT = 34
const SIGNATURE_PAD_PADDING = 8
@@ -507,97 +498,6 @@ function SignatureFieldOverlay({
)
}
-function ESignaturePage({
- reactPdf,
- field,
- isDrawing,
- draftBox,
- onPointerDown,
- onPointerMove,
- onPointerUp,
- onDragStart,
-}: {
- reactPdf: ReactPdfModule
- field: SignatureField
- isDrawing: boolean
- draftBox: BoundingBox | null
- onPointerDown: (event: React.PointerEvent<HTMLDivElement>) => void
- onPointerMove: (event: React.PointerEvent<HTMLDivElement>) => void
- onPointerUp: (event: React.PointerEvent<HTMLDivElement>) => void
- onDragStart: (event: React.PointerEvent<HTMLDivElement>) => void
-}) {
- const devicePixelRatio =
- typeof window === "undefined"
- ? 1
- : Math.min(DEVICE_PIXEL_RATIO_LIMIT, window.devicePixelRatio || 1)
-
- return (
- <div
- data-signature-page={field.page}
- className={cn(
- "relative touch-none select-none",
- isDrawing && "cursor-crosshair"
- )}
- style={{ width: RENDERED_PAGE_WIDTH, height: RENDERED_PAGE_HEIGHT }}
- onPointerMove={onPointerMove}
- onPointerUp={onPointerUp}
- onPointerCancel={onPointerUp}
- >
- <reactPdf.Page
- pageNumber={field.page}
- width={RENDERED_PAGE_WIDTH}
- className="overflow-hidden border bg-background shadow-xs"
- renderAnnotationLayer={false}
- renderTextLayer={false}
- devicePixelRatio={devicePixelRatio}
- loading={
- <div
- className="grid place-items-center"
- style={{ width: RENDERED_PAGE_WIDTH, height: RENDERED_PAGE_HEIGHT }}
- >
- <HugeiconsIcon
- icon={Loading03Icon}
- className="size-4 animate-spin"
- />
- </div>
- }
- />
- <SignatureFieldOverlay
- field={field}
- isDrawing={isDrawing}
- onDragStart={onDragStart}
- />
- {isDrawing ? (
- <div
- className="absolute inset-0 z-40 cursor-crosshair touch-none"
- onPointerDown={(event) => {
- event.stopPropagation()
- onPointerDown(event)
- }}
- onPointerMove={(event) => {
- event.stopPropagation()
- onPointerMove(event)
- }}
- onPointerUp={(event) => {
- event.stopPropagation()
- onPointerUp(event)
- }}
- onPointerCancel={(event) => {
- event.stopPropagation()
- onPointerUp(event)
- }}
- />
- ) : null}
- {draftBox ? (
- <div
- className="pointer-events-none absolute z-50 rounded-[3px] border border-dashed border-blue-500/70 bg-blue-500/10"
- style={bboxToStyle(draftBox)}
- />
- ) : null}
- </div>
- )
-}
-
async function downloadSignedPdf(field: SignatureField) {
const { PDFDocument } = await import("pdf-lib")
const existingPdfBytes = await fetch(PDF_URL).then((response) =>
@@ -644,10 +544,81 @@ async function downloadSignedPdf(field: SignatureField) {
URL.revokeObjectURL(url)
}
+function SignatureFieldsPanel({
+ field,
+ className,
+ onFieldChange,
+}: {
+ field: SignatureField
+ className?: string
+ onFieldChange: (field: SignatureField) => void
+}) {
+ const [dialogOpen, setDialogOpen] = React.useState(false)
+
+ return (
+ <aside
+ className={cn("flex h-[420px] min-h-0 flex-col bg-background", className)}
+ >
+ <ScrollArea className="min-h-0 flex-1" scrollFade>
+ <div className="p-3">
+ <div className="rounded-lg border bg-background p-3">
+ <div className="flex items-start gap-3">
+ <div className="flex size-8 shrink-0 items-center justify-center rounded-md bg-blue-500/10 text-blue-600 dark:text-blue-300">
+ <HugeiconsIcon icon={FilePenIcon} className="size-4" />
+ </div>
+ <div className="min-w-0 flex-1">
+ <div className="flex items-center justify-between gap-2">
+ <div className="text-sm font-medium">{field.label}</div>
+ <div
+ className={cn(
+ "rounded-full px-2 py-0.5 text-xs",
+ field.imageDataUrl
+ ? "bg-emerald-500/10 text-emerald-600 dark:text-emerald-300"
+ : "bg-muted text-muted-foreground"
+ )}
+ >
+ {field.imageDataUrl ? "Signed" : "Unsigned"}
+ </div>
+ </div>
+ <div className="mt-2 text-xs text-muted-foreground">
+ {Math.round(field.bbox.width)} x{" "}
+ {Math.round(field.bbox.height)} on page {field.page}
+ </div>
+ <Button
+ type="button"
+ size="sm"
+ variant={field.imageDataUrl ? "outline" : "default"}
+ className="mt-3 w-full"
+ onClick={() => setDialogOpen(true)}
+ >
+ <HugeiconsIcon icon={Pen01Icon} className="size-4" />
+ {field.imageDataUrl ? "Edit signature" : "Sign"}
+ </Button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </ScrollArea>
+ <SignatureDialog
+ open={dialogOpen}
+ fieldBbox={field.bbox}
+ onOpenChange={setDialogOpen}
+ onConfirm={(imageDataUrl) => {
+ onFieldChange({ ...field, imageDataUrl })
+ }}
+ />
+ </aside>
+ )
+}
+
export function ESignature() {
const [field, setField] = React.useState<SignatureField>(INITIAL_FIELD)
- const [reactPdf, setReactPdf] = React.useState<ReactPdfModule | null>(null)
- const [loadError, setLoadError] = React.useState(false)
+
+ return <SignatureFieldsPanel field={field} onFieldChange={setField} />
+}
+
+export function ESignatureBlock() {
+ const [field, setField] = React.useState<SignatureField>(INITIAL_FIELD)
const [isDrawing, setIsDrawing] = React.useState(false)
const [drawStart, setDrawStart] = React.useState<{
x: number
@@ -658,31 +629,8 @@ export function ESignature() {
x: number
y: number
} | null>(null)
- const [dialogOpen, setDialogOpen] = React.useState(false)
const [isDownloading, setIsDownloading] = React.useState(false)
- React.useEffect(() => {
- let mounted = true
-
- void import("react-pdf")
- .then((module) => {
- module.pdfjs.GlobalWorkerOptions.workerSrc = PDF_WORKER_URL
-
- if (mounted) {
- setReactPdf(module)
- }
- })
- .catch(() => {
- if (mounted) {
- setLoadError(true)
- }
- })
-
- return () => {
- mounted = false
- }
- }, [])
-
const handlePagePointerDown = React.useCallback(
(event: React.PointerEvent<HTMLDivElement>) => {
if (!isDrawing) return
@@ -741,7 +689,9 @@ export function ESignature() {
}
if (drawStart || dragOffset) {
- event.currentTarget.releasePointerCapture(event.pointerId)
+ if (event.currentTarget.hasPointerCapture(event.pointerId)) {
+ event.currentTarget.releasePointerCapture(event.pointerId)
+ }
}
setDrawStart(null)
@@ -758,7 +708,7 @@ export function ESignature() {
event.stopPropagation()
const page = event.currentTarget.closest<HTMLElement>(
- "[data-signature-page]"
+ "[data-pdf-viewer-page]"
)
if (!page) return
@@ -782,126 +732,201 @@ export function ESignature() {
}, [field])
return (
- <div className="grid h-[620px] overflow-hidden bg-background lg:grid-cols-[minmax(0,1fr)_20rem]">
- <div className="flex min-h-0 min-w-0 flex-col border-b lg:border-r lg:border-b-0">
- <div className="flex h-12 shrink-0 items-center gap-2 border-b px-3">
- <div className="mr-auto text-sm font-medium">PDF Viewer</div>
- <Button
- type="button"
- size="sm"
- variant={isDrawing ? "default" : "outline"}
- onClick={() => setIsDrawing((value) => !value)}
- >
- <HugeiconsIcon icon={BorderFullIcon} className="size-4" />
- Draw
- </Button>
+ <PdfBlockResizableShell
+ autoSaveId="pdf-block-e-signature"
+ left={
+ <PDFViewer
+ file={PDF_URL}
+ defaultZoom={DEFAULT_ZOOM}
+ pageWidth={PAGE_WIDTH}
+ pageHeight={PAGE_HEIGHT}
+ pageClassName={() =>
+ cn("touch-none select-none", isDrawing && "cursor-crosshair")
+ }
+ toolbarActions={
+ <>
+ <Button
+ type="button"
+ size="sm"
+ variant={isDrawing ? "default" : "outline"}
+ onClick={() => setIsDrawing((value) => !value)}
+ >
+ <HugeiconsIcon icon={BorderFullIcon} className="size-4" />
+ Draw
+ </Button>
+ <Button
+ type="button"
+ size="sm"
+ variant="outline"
+ disabled={!field.imageDataUrl || isDownloading}
+ onClick={handleDownload}
+ >
+ <HugeiconsIcon icon={Download01Icon} className="size-4" />
+ Download
+ </Button>
+ </>
+ }
+ onPagePointerMove={handlePagePointerMove}
+ onPagePointerUp={handlePagePointerUp}
+ onPagePointerCancel={handlePagePointerUp}
+ renderPageOverlay={({ pageNumber }) =>
+ pageNumber === field.page ? (
+ <>
+ <SignatureFieldOverlay
+ field={field}
+ isDrawing={isDrawing}
+ onDragStart={handleDragStart}
+ />
+ {isDrawing ? (
+ <div
+ className="absolute inset-0 z-40 cursor-crosshair touch-none"
+ onPointerDown={(event) => {
+ event.stopPropagation()
+ handlePagePointerDown(event)
+ }}
+ onPointerMove={(event) => {
+ event.stopPropagation()
+ handlePagePointerMove(event)
+ }}
+ onPointerUp={(event) => {
+ event.stopPropagation()
+ handlePagePointerUp(event)
+ }}
+ onPointerCancel={(event) => {
+ event.stopPropagation()
+ handlePagePointerUp(event)
+ }}
+ />
+ ) : null}
+ {draftBox ? (
+ <div
+ className="pointer-events-none absolute z-50 rounded-[3px] border border-dashed border-blue-500/70 bg-blue-500/10"
+ style={bboxToStyle(draftBox)}
+ />
+ ) : null}
+ </>
+ ) : null
+ }
+ />
+ }
+ right={
+ <SignatureFieldsPanel
+ field={field}
+ className="h-full"
+ onFieldChange={setField}
+ />
+ }
+ />
+ )
+}
+
+function SignatureFieldExampleCard({
+ label,
+ status = "unsigned",
+ pageLabel,
+ description,
+ iconClassName,
+ actionLabel,
+ onAction,
+}: {
+ label: string
+ status?: "unsigned" | "signed" | "optional"
+ pageLabel?: string
+ description?: string
+ iconClassName?: string
+ actionLabel?: string
+ onAction?: () => void
+}) {
+ const statusLabel =
+ status === "signed"
+ ? "Signed"
+ : status === "optional"
+ ? "Optional"
+ : "Needs signature"
+
+ return (
+ <div className="rounded-lg border bg-background p-3">
+ <div className="flex items-start gap-3">
+ <div
+ className={cn(
+ "mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md bg-blue-500/10 text-blue-600 dark:text-blue-300",
+ iconClassName
+ )}
+ >
+ <HugeiconsIcon icon={FilePenIcon} className="size-4" />
+ </div>
+ <div className="min-w-0 flex-1">
+ <div className="flex items-center justify-between gap-3">
+ <div className="truncate text-sm font-medium">{label}</div>
+ {pageLabel ? (
+ <div className="shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground">
+ {pageLabel}
+ </div>
+ ) : null}
+ </div>
+ <div className="mt-1 text-xs text-muted-foreground">
+ {statusLabel}
+ {description ? ` · ${description}` : null}
+ </div>
<Button
type="button"
size="sm"
- variant="outline"
- disabled={!field.imageDataUrl || isDownloading}
- onClick={handleDownload}
+ variant={status === "signed" ? "outline" : "default"}
+ className="mt-3 w-full"
+ onClick={onAction}
>
- <HugeiconsIcon icon={Download01Icon} className="size-4" />
- Download
+ <HugeiconsIcon icon={Pen01Icon} className="size-4" />
+ {actionLabel ?? (status === "signed" ? "Edit signature" : "Sign")}
</Button>
</div>
- <div className="min-h-0 flex-1 overflow-auto bg-muted/30">
- {loadError ? (
- <div className="grid h-full place-items-center p-6 text-sm text-muted-foreground">
- Unable to load the PDF preview.
- </div>
- ) : reactPdf ? (
- <reactPdf.Document
- file={PDF_URL}
- className="flex min-h-full w-max min-w-full flex-col items-center p-6"
- loading={
- <div className="grid h-full min-h-80 place-items-center">
- <HugeiconsIcon
- icon={Loading03Icon}
- className="size-4 animate-spin"
- />
- </div>
- }
- error={null}
- onLoadError={() => setLoadError(true)}
- >
- <ESignaturePage
- reactPdf={reactPdf}
- field={field}
- isDrawing={isDrawing}
- draftBox={draftBox}
- onPointerDown={handlePagePointerDown}
- onPointerMove={handlePagePointerMove}
- onPointerUp={handlePagePointerUp}
- onDragStart={handleDragStart}
- />
- </reactPdf.Document>
- ) : (
- <div className="grid h-full min-h-80 place-items-center">
- <HugeiconsIcon
- icon={Loading03Icon}
- className="size-4 animate-spin"
- />
- </div>
- )}
- </div>
</div>
- <aside className="flex min-h-0 flex-col">
- <div className="border-b px-4 py-3">
- <div className="text-sm font-medium">Fields</div>
- <div className="text-xs text-muted-foreground">
- Draw, drag, sign, then download.
- </div>
- </div>
- <div className="min-h-0 flex-1 overflow-y-auto p-3">
- <div className="rounded-lg border bg-background p-3">
- <div className="flex items-start gap-3">
- <div className="flex size-8 shrink-0 items-center justify-center rounded-md bg-blue-500/10 text-blue-600 dark:text-blue-300">
- <HugeiconsIcon icon={FilePenIcon} className="size-4" />
- </div>
- <div className="min-w-0 flex-1">
- <div className="flex items-center justify-between gap-2">
- <div className="text-sm font-medium">{field.label}</div>
- <div
- className={cn(
- "rounded-full px-2 py-0.5 text-xs",
- field.imageDataUrl
- ? "bg-emerald-500/10 text-emerald-600 dark:text-emerald-300"
- : "bg-muted text-muted-foreground"
- )}
- >
- {field.imageDataUrl ? "Signed" : "Unsigned"}
- </div>
- </div>
- <div className="mt-2 text-xs text-muted-foreground">
- {Math.round(field.bbox.width)} x{" "}
- {Math.round(field.bbox.height)} on page {field.page}
- </div>
- <Button
- type="button"
- size="sm"
- variant={field.imageDataUrl ? "outline" : "default"}
- className="mt-3 w-full"
- onClick={() => setDialogOpen(true)}
- >
- <HugeiconsIcon icon={Pen01Icon} className="size-4" />
- {field.imageDataUrl ? "Edit signature" : "Sign"}
- </Button>
- </div>
- </div>
- </div>
- </div>
- </aside>
+ </div>
+ )
+}
+
+function ESignatureExample() {
+ const [dialogOpen, setDialogOpen] = React.useState(false)
+ const [signatureSigned, setSignatureSigned] = React.useState(false)
+
+ return (
+ <>
+ <div className="flex h-[420px] flex-col gap-2 bg-background p-3">
+ <SignatureFieldExampleCard
+ label="Signature1"
+ status={signatureSigned ? "signed" : "unsigned"}
+ pageLabel="p. 1"
+ description={
+ signatureSigned ? "Completed just now" : "250 x 58 field"
+ }
+ actionLabel={signatureSigned ? "Edit signature" : undefined}
+ onAction={() => setDialogOpen(true)}
+ />
+ <SignatureFieldExampleCard
+ label="Initials"
+ status="signed"
+ pageLabel="p. 2"
+ description="Completed by Andrew"
+ iconClassName="bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"
+ onAction={() => setDialogOpen(true)}
+ />
+ <SignatureFieldExampleCard
+ label="Approval date"
+ status="optional"
+ pageLabel="p. 2"
+ description="Optional date field"
+ iconClassName="bg-amber-500/10 text-amber-700 dark:text-amber-300"
+ actionLabel="Add date"
+ />
+ </div>
<SignatureDialog
open={dialogOpen}
- fieldBbox={field.bbox}
+ fieldBbox={INITIAL_FIELD.bbox}
onOpenChange={setDialogOpen}
- onConfirm={(imageDataUrl) => {
- setField((previousField) => ({ ...previousField, imageDataUrl }))
+ onConfirm={() => {
+ setSignatureSigned(true)
}}
/>
- </div>
+ </>
)
}
@@ -913,7 +938,7 @@ export function ESignatureDemo() {
data-slot="component-preview"
className="group relative mt-4 mb-12 flex flex-col overflow-hidden rounded-xl border"
>
- <ESignature />
+ <ESignatureExample />
<div
data-slot="code"
data-mobile-code-visible={isCodeVisible}
@@ -960,134 +985,116 @@ export function ESignatureDemo() {
const eSignatureUsageCode = `"use client";
-import * as React from "react";
-import type SignaturePad from "signature_pad";
-import type * as ReactPdf from "react-pdf";
-
-import { Button } from "@/components/ui/button";
-
-const PDF_WORKER_URL = new URL(
- "pdfjs-dist/legacy/build/pdf.worker.min.mjs",
- import.meta.url,
-).toString();
-const PDF_URL = "/samples/attention.pdf";
-const PAGE_WIDTH = 612;
-const PAGE_HEIGHT = 792;
-type ReactPdfModule = typeof ReactPdf;
-
-type SignatureField = {
- page: number;
- bbox: { x: number; y: number; width: number; height: number };
- imageDataUrl?: string;
-};
-
-async function downloadSignedPdf(field: SignatureField) {
- const { PDFDocument } = await import("pdf-lib");
- const bytes = await fetch(PDF_URL).then((response) => response.arrayBuffer());
- const pdf = await PDFDocument.load(bytes);
- const page = pdf.getPage(field.page - 1);
-
- if (field.imageDataUrl) {
- const image = await pdf.embedPng(field.imageDataUrl);
- const { width, height } = page.getSize();
- const scaleX = width / PAGE_WIDTH;
- const scaleY = height / PAGE_HEIGHT;
- const fieldWidth = field.bbox.width * scaleX;
- const fieldHeight = field.bbox.height * scaleY;
- const imageAspectRatio = image.width / image.height;
- const fieldAspectRatio = fieldWidth / fieldHeight;
- const drawWidth =
- fieldAspectRatio > imageAspectRatio ? fieldHeight * imageAspectRatio : fieldWidth;
- const drawHeight =
- fieldAspectRatio > imageAspectRatio ? fieldHeight : fieldWidth / imageAspectRatio;
- const fieldX = field.bbox.x * scaleX;
- const fieldY = height - (field.bbox.y + field.bbox.height) * scaleY;
+import { FilePenIcon } from "@hugeicons/core-free-icons";
- page.drawImage(image, {
- x: fieldX + (fieldWidth - drawWidth) / 2,
- y: fieldY + (fieldHeight - drawHeight) / 2,
- width: drawWidth,
- height: drawHeight,
- });
- }
+import { SignatureFieldCard } from "@/components/ui/signature-field-card";
- const signedBytes = await pdf.save();
- const url = URL.createObjectURL(
- new Blob([new Uint8Array(signedBytes)], { type: "application/pdf" }),
+export function ESignatureExample() {
+ return (
+ <div className="flex h-[420px] flex-col gap-2 bg-background p-3">
+ <SignatureFieldCard
+ label="Signature1"
+ pageLabel="p. 1"
+ description="250 x 58 field"
+ onAction={() => {}}
+ />
+ <SignatureFieldCard
+ label="Initials"
+ status="signed"
+ pageLabel="p. 2"
+ description="Completed by Andrew"
+ iconClassName="bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"
+ onAction={() => {}}
+ />
+ <SignatureFieldCard
+ label="Approval date"
+ status="optional"
+ pageLabel="p. 2"
+ description="Optional date field"
+ icon={FilePenIcon}
+ iconClassName="bg-amber-500/10 text-amber-700 dark:text-amber-300"
+ actionLabel="Add date"
+ onAction={() => {}}
+ />
+ </div>
);
- const anchor = document.createElement("a");
- anchor.href = url;
- anchor.download = "signed-document.pdf";
- anchor.click();
- URL.revokeObjectURL(url);
-}
-
-export function ESignature() {
- const [field, setField] = React.useState<SignatureField>({
- page: 1,
- bbox: { x: 300, y: 504, width: 250, height: 58 },
- });
- const [reactPdf, setReactPdf] = React.useState<ReactPdfModule | null>(null);
- const canvasRef = React.useRef<HTMLCanvasElement>(null);
- const signaturePadRef = React.useRef<SignaturePad | null>(null);
-
- React.useEffect(() => {
- if (!canvasRef.current) return;
- let mounted = true;
-
- void import("signature_pad").then(({ default: SignaturePad }) => {
- if (!mounted || !canvasRef.current) return;
- signaturePadRef.current = new SignaturePad(canvasRef.current);
- });
+}`
- return () => signaturePadRef.current?.off();
- }, []);
+const eSignatureSourceCode = `"use client";
- React.useEffect(() => {
- let mounted = true;
+import * as React from "react";
+import { FilePenIcon, Pen01Icon } from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
- void import("react-pdf").then((module) => {
- module.pdfjs.GlobalWorkerOptions.workerSrc = PDF_WORKER_URL;
- if (mounted) setReactPdf(module);
- });
+import { Button } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
+
+type SignatureFieldCardProps = React.HTMLAttributes<HTMLDivElement> & {
+ label: string;
+ status?: "unsigned" | "signed" | "optional";
+ pageLabel?: string;
+ description?: string;
+ icon?: React.ComponentProps<typeof HugeiconsIcon>["icon"];
+ iconClassName?: string;
+ actionLabel?: string;
+ onAction?: () => void;
+};
- return () => {
- mounted = false;
- };
- }, []);
+export function SignatureFieldCard({
+ label,
+ status = "unsigned",
+ pageLabel,
+ description,
+ icon = FilePenIcon,
+ iconClassName = "bg-blue-500/10 text-blue-600 dark:text-blue-300",
+ actionLabel,
+ onAction,
+ className,
+ ...props
+}: SignatureFieldCardProps) {
+ const statusLabel =
+ status === "signed" ? "Signed" : status === "optional" ? "Optional" : "Needs signature";
return (
- <div>
- <Button variant="outline" onClick={() => downloadSignedPdf(field)}>
- Download
- </Button>
- {reactPdf ? (
- <reactPdf.Document file={PDF_URL}>
- <div className="relative w-[430px]">
- <reactPdf.Page pageNumber={field.page} width={430} renderTextLayer={false} />
- <div className="absolute border border-blue-500/70" />
+ <div className={cn("rounded-lg border bg-background p-3", className)} {...props}>
+ <div className="flex items-start gap-3">
+ <div
+ className={cn(
+ "mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md",
+ iconClassName,
+ )}
+ >
+ <HugeiconsIcon icon={icon} className="size-4" />
+ </div>
+ <div className="min-w-0 flex-1">
+ <div className="flex items-center justify-between gap-3">
+ <div className="truncate text-sm font-medium">{label}</div>
+ {pageLabel ? (
+ <div className="shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground">
+ {pageLabel}
+ </div>
+ ) : null}
+ </div>
+ <div className="mt-1 text-xs text-muted-foreground">
+ {statusLabel}
+ {description ? " · " + description : null}
+ </div>
+ <Button
+ type="button"
+ size="sm"
+ variant={status === "signed" ? "outline" : "default"}
+ className="mt-3 w-full"
+ onClick={onAction}
+ >
+ <HugeiconsIcon icon={Pen01Icon} className="size-4" />
+ {actionLabel ?? (status === "signed" ? "Edit signature" : "Sign")}
+ </Button>
</div>
- </reactPdf.Document>
- ) : null}
- <div
- className="relative w-[430px] overflow-hidden rounded-md border border-dashed bg-white"
- style={{ aspectRatio: field.bbox.width / field.bbox.height }}
- >
- <canvas ref={canvasRef} className="absolute inset-0 size-full touch-none" />
</div>
- <Button
- variant={field.imageDataUrl ? "outline" : "default"}
- onClick={() => {
- const value = signaturePadRef.current?.toDataURL("image/png");
- if (value) setField((current) => ({ ...current, imageDataUrl: value }));
- }}
- >
- {field.imageDataUrl ? "Edit signature" : "Confirm signature"}
- </Button>
</div>
);
}`
export function ESignatureSource() {
- return <HighlightedCodeBlock code={eSignatureUsageCode} />
+ return <HighlightedCodeBlock code={eSignatureSourceCode} />
}
diff --git a/apps/v4/components/file-thumbnail-docs.tsx b/apps/v4/components/file-thumbnail-docs.tsx
index 461c8fe..7745615 100644
--- a/apps/v4/components/file-thumbnail-docs.tsx
+++ b/apps/v4/components/file-thumbnail-docs.tsx
@@ -21,6 +21,7 @@ type FileThumbnailProps = {
className?: string
showMetadata?: boolean
thumbnailWidth?: number
+ loadingDelayMs?: number
}
type ReactPdfModule = typeof ReactPdf
@@ -87,7 +88,7 @@ function FileKindIcon({ file }: { file: ThumbnailFile }) {
return <HugeiconsIcon icon={icon} className="size-4" />
}
-function ThumbnailLoadingOverlay() {
+export function FileThumbnailLoadingOverlay() {
return (
<div className="absolute inset-0 z-10 overflow-hidden bg-muted">
<style>{`
@@ -105,7 +106,7 @@ function ThumbnailLoadingOverlay() {
`}</style>
<div className="absolute inset-0 bg-muted" />
<div
- className="file-thumbnail-preview-shimmer absolute inset-y-0 -left-1/2 w-1/2 bg-linear-to-r from-transparent via-background/65 to-transparent"
+ className="file-thumbnail-preview-shimmer absolute inset-0 bg-linear-to-r from-transparent via-background/65 to-transparent"
style={{
animation:
"file-thumbnail-preview-shimmer 1.25s ease-in-out infinite",
@@ -120,19 +121,34 @@ export function FileThumbnail({
className,
showMetadata = true,
thumbnailWidth = 260,
+ loadingDelayMs = 0,
}: FileThumbnailProps) {
const isPdf = isPdfFile(file)
const isImage = isImageFile(file)
const { ref, shouldRender } = useLazyRender<HTMLDivElement>()
const [reactPdf, setReactPdf] = React.useState<ReactPdfModule | null>(null)
const [isLoading, setIsLoading] = React.useState(isPdf || isImage)
+ const [isDelayLoading, setIsDelayLoading] = React.useState(loadingDelayMs > 0)
const [hasError, setHasError] = React.useState(false)
+ const showLoading = (isLoading || isDelayLoading) && !hasError
React.useEffect(() => {
setIsLoading(isPdf || isImage)
setHasError(false)
}, [file.url, isImage, isPdf])
+ React.useEffect(() => {
+ setIsDelayLoading(loadingDelayMs > 0)
+
+ if (loadingDelayMs <= 0) return
+
+ const timeout = window.setTimeout(() => {
+ setIsDelayLoading(false)
+ }, loadingDelayMs)
+
+ return () => window.clearTimeout(timeout)
+ }, [file.url, loadingDelayMs])
+
React.useEffect(() => {
if (!isPdf || !shouldRender) return
@@ -189,7 +205,12 @@ export function FileThumbnail({
setHasError(true)
setIsLoading(false)
}}
- className="flex size-full items-center justify-center [&_canvas]:!h-full [&_canvas]:!w-full [&_canvas]:object-cover"
+ className={cn(
+ "flex size-full items-center justify-center [&_canvas]:!h-full [&_canvas]:!w-full [&_canvas]:object-cover [&_canvas]:transition-[opacity,filter,transform] [&_canvas]:duration-[160ms] [&_canvas]:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:[&_canvas]:transition-none",
+ showLoading
+ ? "[&_canvas]:scale-[1.01] [&_canvas]:opacity-0 [&_canvas]:blur-sm"
+ : "[&_canvas]:blur-0 [&_canvas]:scale-100 [&_canvas]:opacity-100"
+ )}
/>
</reactPdf.Document>
) : null}
@@ -199,7 +220,12 @@ export function FileThumbnail({
alt=""
loading="lazy"
decoding="async"
- className="size-full object-cover"
+ className={cn(
+ "size-full object-cover transition-[opacity,filter,transform] duration-[160ms] ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",
+ showLoading
+ ? "scale-[1.01] opacity-0 blur-sm"
+ : "blur-0 scale-100 opacity-100"
+ )}
onLoad={() => setIsLoading(false)}
onError={() => {
setHasError(true)
@@ -207,7 +233,7 @@ export function FileThumbnail({
}}
/>
) : null}
- {isLoading && !hasError ? <ThumbnailLoadingOverlay /> : null}
+ {showLoading ? <FileThumbnailLoadingOverlay /> : null}
{hasError || (!isPdf && !isImage) ? (
<div className="absolute inset-0 grid place-items-center bg-muted text-muted-foreground">
<FileKindIcon file={file} />
@@ -350,6 +376,7 @@ type FileThumbnailProps = {
className?: string;
showMetadata?: boolean;
thumbnailWidth?: number;
+ loadingDelayMs?: number;
};
type ReactPdfModule = typeof ReactPdf;
@@ -399,7 +426,7 @@ function FileKindIcon({ file }: { file: ThumbnailFile }) {
return <HugeiconsIcon icon={icon} className="size-4" />;
}
-function ThumbnailLoadingOverlay() {
+export function FileThumbnailLoadingOverlay() {
return (
<div className="absolute inset-0 z-10 overflow-hidden bg-muted">
<style>{\`
@@ -417,7 +444,7 @@ function ThumbnailLoadingOverlay() {
\`}</style>
<div className="absolute inset-0 bg-muted" />
<div
- className="file-thumbnail-preview-shimmer absolute inset-y-0 -left-1/2 w-1/2 bg-linear-to-r from-transparent via-background/65 to-transparent"
+ className="file-thumbnail-preview-shimmer absolute inset-0 bg-linear-to-r from-transparent via-background/65 to-transparent"
style={{
animation: "file-thumbnail-preview-shimmer 1.25s ease-in-out infinite",
}}
@@ -431,19 +458,36 @@ export function FileThumbnail({
className,
showMetadata = true,
thumbnailWidth = 260,
+ loadingDelayMs = 0,
}: FileThumbnailProps) {
const isPdf = isPdfFile(file);
const isImage = isImageFile(file);
const { ref, shouldRender } = useLazyRender<HTMLDivElement>();
const [reactPdf, setReactPdf] = React.useState<ReactPdfModule | null>(null);
const [isLoading, setIsLoading] = React.useState(isPdf || isImage);
+ const [isDelayLoading, setIsDelayLoading] = React.useState(
+ loadingDelayMs > 0,
+ );
const [hasError, setHasError] = React.useState(false);
+ const showLoading = (isLoading || isDelayLoading) && !hasError;
React.useEffect(() => {
setIsLoading(isPdf || isImage);
setHasError(false);
}, [file.url, isImage, isPdf]);
+ React.useEffect(() => {
+ setIsDelayLoading(loadingDelayMs > 0);
+
+ if (loadingDelayMs <= 0) return;
+
+ const timeout = window.setTimeout(() => {
+ setIsDelayLoading(false);
+ }, loadingDelayMs);
+
+ return () => window.clearTimeout(timeout);
+ }, [file.url, loadingDelayMs]);
+
React.useEffect(() => {
if (!isPdf || !shouldRender) return;
@@ -503,7 +547,12 @@ export function FileThumbnail({
setHasError(true);
setIsLoading(false);
}}
- className="flex size-full items-center justify-center [&_canvas]:!h-full [&_canvas]:!w-full [&_canvas]:object-cover"
+ className={cn(
+ "flex size-full items-center justify-center [&_canvas]:!h-full [&_canvas]:!w-full [&_canvas]:object-cover [&_canvas]:transition-[opacity,filter,transform] [&_canvas]:duration-[160ms] [&_canvas]:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:[&_canvas]:transition-none",
+ showLoading
+ ? "[&_canvas]:scale-[1.01] [&_canvas]:opacity-0 [&_canvas]:blur-sm"
+ : "[&_canvas]:scale-100 [&_canvas]:opacity-100 [&_canvas]:blur-0",
+ )}
/>
</reactPdf.Document>
) : null}
@@ -513,7 +562,12 @@ export function FileThumbnail({
alt=""
loading="lazy"
decoding="async"
- className="size-full object-cover"
+ className={cn(
+ "size-full object-cover transition-[opacity,filter,transform] duration-[160ms] ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",
+ showLoading
+ ? "scale-[1.01] opacity-0 blur-sm"
+ : "scale-100 opacity-100 blur-0",
+ )}
onLoad={() => setIsLoading(false)}
onError={() => {
setHasError(true);
@@ -521,8 +575,8 @@ export function FileThumbnail({
}}
/>
) : null}
- {isLoading && !hasError ? (
- <ThumbnailLoadingOverlay />
+ {showLoading ? (
+ <FileThumbnailLoadingOverlay />
) : null}
{hasError || (!isPdf && !isImage) ? (
<div className="absolute inset-0 grid place-items-center bg-muted text-muted-foreground">
diff --git a/apps/v4/components/file-upload-docs.tsx b/apps/v4/components/file-upload-docs.tsx
index b6b0004..4feea66 100644
--- a/apps/v4/components/file-upload-docs.tsx
+++ b/apps/v4/components/file-upload-docs.tsx
@@ -25,12 +25,27 @@ type FileUploadItem = {
url: string
}
+type AcceptedFileType = {
+ label: string
+ icon: React.ComponentProps<typeof HugeiconsIcon>["icon"]
+}
+
type FileUploadProps = {
+ accept?: string
+ acceptedFileTypes?: AcceptedFileType[]
+ browseLabel?: string
className?: string
+ description?: string
+ draggingLabel?: string
+ multiple?: boolean
+ showBorderBeam?: boolean
+ showFileList?: boolean
+ title?: string
+ onFilesAccepted?: (files: File[]) => void
onFilesChange?: (files: FileUploadItem[]) => void
}
-const ACCEPTED_FILE_TYPES = [
+const ACCEPTED_FILE_TYPES: AcceptedFileType[] = [
{ label: "Image", icon: FileImageIcon },
{ label: "PDF", icon: FileUploadIcon },
{ label: "Sheet", icon: FileSpreadsheetIcon },
@@ -74,10 +89,36 @@ function toUploadItems(files: FileList | File[]): FileUploadItem[] {
}))
}
-function UploadIconCluster({ isDragging }: { isDragging: boolean }) {
+function matchesAccept(file: File, accept?: string) {
+ if (!accept) return true
+
+ return accept.split(",").some((rawToken) => {
+ const token = rawToken.trim().toLowerCase()
+
+ if (!token) return false
+ if (token.startsWith(".")) {
+ return file.name.toLowerCase().endsWith(token)
+ }
+ if (token.endsWith("/*")) {
+ return file.type.toLowerCase().startsWith(token.slice(0, -1))
+ }
+
+ return file.type.toLowerCase() === token
+ })
+}
+
+function UploadIconCluster({
+ acceptedFileTypes,
+ isDragging,
+}: {
+ acceptedFileTypes: AcceptedFileType[]
+ isDragging: boolean
+}) {
+ const singleIcon = acceptedFileTypes.length === 1
+
return (
<div className="relative h-14 w-36">
- {ACCEPTED_FILE_TYPES.map((item, index) => (
+ {acceptedFileTypes.map((item, index) => (
<Card
key={item.label}
className={cn(
@@ -87,9 +128,11 @@ function UploadIconCluster({ isDragging }: { isDragging: boolean }) {
isDragging && "bg-accent text-foreground"
)}
style={{
- transform: isDragging
- ? ICON_TRANSFORMS[index]?.active
- : ICON_TRANSFORMS[index]?.idle,
+ transform: singleIcon
+ ? `translate(-50%, -50%) scale(${isDragging ? 1.14 : 1})`
+ : isDragging
+ ? ICON_TRANSFORMS[index]?.active
+ : ICON_TRANSFORMS[index]?.idle,
}}
>
<HugeiconsIcon icon={item.icon} className="size-5" />
@@ -99,108 +142,155 @@ function UploadIconCluster({ isDragging }: { isDragging: boolean }) {
)
}
-export function FileUpload({ className, onFilesChange }: FileUploadProps) {
+export function FileUpload({
+ accept,
+ acceptedFileTypes = ACCEPTED_FILE_TYPES,
+ browseLabel = "Browse files",
+ className,
+ description = "PDF, DOCX, XLSX, CSV, PNG, or JPG",
+ draggingLabel = "Drop to add",
+ multiple = true,
+ showBorderBeam = true,
+ showFileList = true,
+ title = "Click to upload or drop files",
+ onFilesAccepted,
+ onFilesChange,
+}: FileUploadProps) {
const dragDepthRef = React.useRef(0)
const { resolvedTheme } = useTheme()
+ const [mounted, setMounted] = React.useState(false)
const [isDragging, setIsDragging] = React.useState(false)
const [files, setFiles] = React.useState<FileUploadItem[]>([])
+ const [rejectionMessage, setRejectionMessage] = React.useState<string | null>(
+ null
+ )
const borderBeamTheme: React.ComponentProps<typeof BorderBeam>["theme"] =
- resolvedTheme === "dark"
- ? "dark"
- : resolvedTheme === "light"
- ? "light"
- : "auto"
+ !mounted
+ ? "auto"
+ : resolvedTheme === "dark"
+ ? "dark"
+ : resolvedTheme === "light"
+ ? "light"
+ : "auto"
const commitFiles = React.useCallback(
(nextFiles: FileList | File[]) => {
- const items = toUploadItems(nextFiles)
+ const acceptedFiles = Array.from(nextFiles)
+ .filter((file) => matchesAccept(file, accept))
+ .slice(0, multiple ? undefined : 1)
+
+ if (acceptedFiles.length === 0) {
+ setRejectionMessage("Only PDF files are supported here.")
+ return
+ }
+
+ setRejectionMessage(null)
+ onFilesAccepted?.(acceptedFiles)
+
+ const items = toUploadItems(acceptedFiles)
setFiles((previousFiles) => {
previousFiles.forEach((file) => URL.revokeObjectURL(file.url))
return items
})
onFilesChange?.(items)
},
- [onFilesChange]
+ [accept, multiple, onFilesAccepted, onFilesChange]
)
+ React.useEffect(() => {
+ setMounted(true)
+ }, [])
+
React.useEffect(() => {
return () => {
files.forEach((file) => URL.revokeObjectURL(file.url))
}
}, [files])
+ const dropzone = (
+ <label
+ className={cn(
+ "relative flex min-h-64 cursor-pointer flex-col items-center justify-center gap-5 overflow-hidden rounded-[1.125rem] border border-dashed bg-background px-6 py-10 text-center transition-[border-color,background-color] duration-200 ease-out",
+ "motion-reduce:transition-none",
+ isDragging
+ ? "border-foreground/40 bg-accent/35"
+ : "border-border hover:border-foreground/30 hover:bg-muted/35"
+ )}
+ onDragEnter={(event) => {
+ event.preventDefault()
+ dragDepthRef.current += 1
+ setIsDragging(true)
+ }}
+ onDragLeave={(event) => {
+ event.preventDefault()
+ dragDepthRef.current = Math.max(0, dragDepthRef.current - 1)
+ if (dragDepthRef.current === 0) {
+ setIsDragging(false)
+ }
+ }}
+ onDragOver={(event) => {
+ event.preventDefault()
+ }}
+ onDrop={(event) => {
+ event.preventDefault()
+ dragDepthRef.current = 0
+ setIsDragging(false)
+
+ if (event.dataTransfer.files.length > 0) {
+ commitFiles(event.dataTransfer.files)
+ }
+ }}
+ >
+ <UploadIconCluster
+ acceptedFileTypes={acceptedFileTypes}
+ isDragging={isDragging}
+ />
+ <div className="space-y-1">
+ <div className="text-sm font-medium">{title}</div>
+ <div className="text-xs text-muted-foreground">{description}</div>
+ {rejectionMessage ? (
+ <div className="text-xs text-destructive">{rejectionMessage}</div>
+ ) : null}
+ </div>
+ <div className="inline-flex items-center gap-2 rounded-full border bg-background px-3 py-1 text-xs text-muted-foreground">
+ <HugeiconsIcon icon={Upload01Icon} className="size-3.5" />
+ <span>{isDragging ? draggingLabel : browseLabel}</span>
+ </div>
+ <input
+ type="file"
+ accept={accept}
+ multiple={multiple}
+ className="sr-only"
+ onChange={(event) => {
+ if (event.target.files) {
+ commitFiles(event.target.files)
+ event.currentTarget.value = ""
+ }
+ }}
+ />
+ </label>
+ )
+
return (
<div className={cn("space-y-3", className)}>
- <BorderBeam
- active={isDragging}
- borderRadius={18}
- brightness={2.4}
- className="rounded-[1.125rem]"
- colorVariant="ocean"
- duration={2.4}
- size="md"
- strength={1}
- theme={borderBeamTheme}
- >
- <label
- className={cn(
- "relative flex min-h-64 cursor-pointer flex-col items-center justify-center gap-5 overflow-hidden rounded-[1.125rem] border border-dashed bg-background px-6 py-10 text-center transition-[border-color,background-color] duration-200 ease-out",
- "motion-reduce:transition-none",
- isDragging
- ? "border-foreground/40 bg-accent/35"
- : "border-border hover:border-foreground/30 hover:bg-muted/35"
- )}
- onDragEnter={(event) => {
- event.preventDefault()
- dragDepthRef.current += 1
- setIsDragging(true)
- }}
- onDragLeave={(event) => {
- event.preventDefault()
- dragDepthRef.current = Math.max(0, dragDepthRef.current - 1)
- if (dragDepthRef.current === 0) {
- setIsDragging(false)
- }
- }}
- onDragOver={(event) => {
- event.preventDefault()
- }}
- onDrop={(event) => {
- event.preventDefault()
- dragDepthRef.current = 0
- setIsDragging(false)
-
- if (event.dataTransfer.files.length > 0) {
- commitFiles(event.dataTransfer.files)
- }
- }}
+ {showBorderBeam ? (
+ <BorderBeam
+ active={isDragging}
+ borderRadius={18}
+ brightness={2.4}
+ className="rounded-[1.125rem]"
+ colorVariant="ocean"
+ duration={2.4}
+ size="md"
+ strength={1}
+ theme={borderBeamTheme}
>
- <input
- type="file"
- multiple
- className="sr-only"
- onChange={(event) => {
- if (event.target.files) {
- commitFiles(event.target.files)
- }
- }}
- />
- <UploadIconCluster isDragging={isDragging} />
- <div className="space-y-1">
- <div className="text-sm font-medium">
- Click to upload or drop files
- </div>
- <div className="text-xs text-muted-foreground">
- PDF, DOCX, XLSX, CSV, PNG, or JPG
- </div>
- </div>
- <div className="inline-flex items-center gap-2 rounded-full border bg-background px-3 py-1 text-xs text-muted-foreground">
- <HugeiconsIcon icon={Upload01Icon} className="size-3.5" />
- <span>{isDragging ? "Drop to add" : "Browse files"}</span>
- </div>
- </label>
- </BorderBeam>
- {files.length > 0 ? (
+ {dropzone}
+ </BorderBeam>
+ ) : (
+ dropzone
+ )}
+ {showFileList && files.length > 0 ? (
<div className="rounded-xl border bg-background">
{files.map((file) => (
<div
diff --git a/apps/v4/components/human-review-docs.tsx b/apps/v4/components/human-review-docs.tsx
new file mode 100644
index 0000000..225ff06
--- /dev/null
+++ b/apps/v4/components/human-review-docs.tsx
@@ -0,0 +1,1003 @@
+"use client"
+
+import * as React from "react"
+import {
+ CancelCircleIcon,
+ FileDiffIcon,
+ InputNumericIcon,
+ InputTextIcon,
+ SourceCodeSquareIcon,
+ TextCheckIcon,
+ Undo02Icon,
+} from "@hugeicons/core-free-icons"
+import { HugeiconsIcon } from "@hugeicons/react"
+import { MultiFileDiff, Virtualizer } from "@pierre/diffs/react"
+
+import { cn } from "@/lib/utils"
+import { Button } from "@/components/ui/button"
+import { PDFViewer, type PDFViewerHandle } from "@/components/ui/pdf-viewer"
+import { ScrollArea } from "@/components/ui/scroll-area"
+import { HighlightedCodeBlock } from "@/components/highlighted-code-block"
+import { PdfBlockResizableShell } from "@/components/pdf-block-resizable-shell"
+import { Input } from "@/registry/new-york-v4/ui/input"
+import {
+ Tabs,
+ TabsContent,
+ TabsList,
+ TabsTrigger,
+} from "@/registry/new-york-v4/ui/tabs"
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/registry/new-york-v4/ui/tooltip"
+
+type JsonPrimitive = string | number | boolean | null
+type JsonObject = Record<string, JsonPrimitive>
+type SchemaPropertyType = "string" | "number" | "integer" | "boolean"
+
+type ReviewFieldSchema = {
+ type: SchemaPropertyType
+ title?: string
+ description?: string
+ enum?: Array<string | number>
+}
+
+type ReviewFieldDefinition = {
+ key: string
+ schema: ReviewFieldSchema
+ actual: JsonPrimitive
+ expected: JsonPrimitive
+ location?: {
+ page: number
+ area: HighlightArea
+ }
+}
+
+type HighlightArea = {
+ left: number
+ top: number
+ width: number
+ height: number
+}
+
+const PDF_URL = "/samples/attention.pdf"
+const DEFAULT_ZOOM = 0.75
+const REVIEW_HIGHLIGHT_STYLE =
+ "border-blue-500/70 bg-blue-500/12 shadow-[0_4px_16px_rgb(59_130_246_/_10%)]"
+const DIFF_VIEWER_THEME = {
+ "--diffs-light-bg": "oklch(0.985 0.002 247)",
+ "--diffs-dark-bg": "oklch(0.18 0.003 247)",
+ "--diffs-light": "oklch(0.22 0.01 247)",
+ "--diffs-dark": "oklch(0.92 0.006 247)",
+ "--diffs-bg-context-override":
+ "light-dark(oklch(0.967 0.003 247), oklch(0.235 0.004 247))",
+ "--diffs-bg-context-gutter-override":
+ "light-dark(oklch(0.948 0.004 247), oklch(0.205 0.004 247))",
+ "--diffs-bg-separator-override":
+ "light-dark(oklch(0.94 0.004 247), oklch(0.255 0.005 247))",
+ "--diffs-bg-buffer-override":
+ "light-dark(oklch(0.955 0.004 247), oklch(0.225 0.004 247))",
+ "--diffs-light-addition-color": "oklch(0.54 0.13 158)",
+ "--diffs-dark-addition-color": "oklch(0.72 0.13 158)",
+ "--diffs-light-deletion-color": "oklch(0.55 0.16 28)",
+ "--diffs-dark-deletion-color": "oklch(0.72 0.14 28)",
+ "--diffs-bg-addition-override":
+ "light-dark(oklch(0.957 0.032 158), oklch(0.255 0.052 158))",
+ "--diffs-bg-addition-emphasis-override":
+ "light-dark(oklch(0.88 0.06 158), oklch(0.36 0.08 158))",
+ "--diffs-bg-deletion-override":
+ "light-dark(oklch(0.958 0.03 28), oklch(0.255 0.047 28))",
+ "--diffs-bg-deletion-emphasis-override":
+ "light-dark(oklch(0.9 0.052 28), oklch(0.36 0.075 28))",
+ "--diffs-fg-number-override":
+ "light-dark(oklch(0.56 0.018 247), oklch(0.66 0.012 247))",
+ "--diffs-font-size": "12px",
+ "--diffs-line-height": "20px",
+} as React.CSSProperties
+
+const REVIEW_SCHEMA: ReviewFieldDefinition[] = [
+ {
+ key: "vendor_name",
+ schema: {
+ type: "string",
+ title: "Vendor name",
+ description: "Supplier shown on the invoice header.",
+ },
+ actual: "Acme Supplies LLC",
+ expected: "Acme Supply LLC",
+ location: {
+ page: 1,
+ area: { left: 31, top: 30, width: 40, height: 5.8 },
+ },
+ },
+ {
+ key: "total_amount",
+ schema: {
+ type: "number",
+ title: "Total amount",
+ description: "Final amount due including tax.",
+ },
+ actual: 12480,
+ expected: 12480.75,
+ location: {
+ page: 1,
+ area: { left: 13.5, top: 66, width: 73.5, height: 7.5 },
+ },
+ },
+ {
+ key: "payment_terms",
+ schema: {
+ type: "string",
+ title: "Payment terms",
+ enum: ["Due on receipt", "Net 15", "Net 30"],
+ },
+ actual: "Net 15",
+ expected: "Net 30",
+ location: {
+ page: 1,
+ area: { left: 13.5, top: 55.5, width: 73.5, height: 7.5 },
+ },
+ },
+ {
+ key: "requires_review",
+ schema: {
+ type: "boolean",
+ title: "Requires review",
+ description: "Whether a human should verify this document before export.",
+ },
+ actual: false,
+ expected: true,
+ location: {
+ page: 2,
+ area: { left: 9.5, top: 12, width: 81, height: 11.5 },
+ },
+ },
+]
+
+const INITIAL_EXPECTED_VALUES = REVIEW_SCHEMA.reduce<JsonObject>(
+ (values, field) => {
+ values[field.key] = field.expected
+ return values
+ },
+ {}
+)
+
+const ACTUAL_VALUES = REVIEW_SCHEMA.reduce<JsonObject>((values, field) => {
+ values[field.key] = field.actual
+ return values
+}, {})
+
+function formatJson(value: unknown) {
+ return JSON.stringify(value, null, 2)
+}
+
+function formatValue(value: JsonPrimitive) {
+ if (value === null) return "NULL"
+ if (typeof value === "boolean") return value ? "true" : "false"
+ return String(value)
+}
+
+function getFieldIcon(type: SchemaPropertyType) {
+ if (type === "number" || type === "integer") return InputNumericIcon
+ if (type === "boolean") return TextCheckIcon
+ return InputTextIcon
+}
+
+function HumanReviewValueInput({
+ schema,
+ value,
+ onChange,
+}: {
+ schema: ReviewFieldSchema
+ value: JsonPrimitive
+ onChange: (value: JsonPrimitive) => void
+}) {
+ if (schema.enum?.length) {
+ return (
+ <span className="relative inline-flex w-full rounded-lg border border-input bg-background text-sm text-foreground shadow-xs/5 dark:bg-input/32">
+ <select
+ value={value === null ? "" : String(value)}
+ onChange={(event) => onChange(event.target.value)}
+ className="h-8.5 w-full appearance-none rounded-[inherit] bg-transparent px-3 text-sm outline-none sm:h-7.5"
+ >
+ {schema.enum.map((option) => (
+ <option key={String(option)} value={String(option)}>
+ {String(option)}
+ </option>
+ ))}
+ </select>
+ </span>
+ )
+ }
+
+ if (schema.type === "number" || schema.type === "integer") {
+ return (
+ <Input
+ nativeInput
+ type="number"
+ value={value === null ? "" : String(value)}
+ onChange={(event) => {
+ const nextValue = event.currentTarget.value
+ onChange(nextValue === "" ? null : Number(nextValue))
+ }}
+ />
+ )
+ }
+
+ if (schema.type === "boolean") {
+ return (
+ <div className="grid grid-cols-2 gap-1 rounded-lg bg-muted p-0.5">
+ {[true, false].map((option) => (
+ <Button
+ key={String(option)}
+ type="button"
+ size="sm"
+ variant={value === option ? "outline" : "ghost"}
+ className={cn(
+ "h-7 shadow-none",
+ value === option && "bg-background dark:bg-input"
+ )}
+ onClick={() => onChange(option)}
+ >
+ {option ? "True" : "False"}
+ </Button>
+ ))}
+ </div>
+ )
+ }
+
+ return (
+ <Input
+ nativeInput
+ value={value === null ? "" : String(value)}
+ onChange={(event) => onChange(event.currentTarget.value)}
+ />
+ )
+}
+
+function HumanReviewFieldCard({
+ field,
+ value,
+ originalValue,
+ active,
+ onChange,
+ onFieldFocus,
+ onUndo,
+ onSetNull,
+}: {
+ field: ReviewFieldDefinition
+ value: JsonPrimitive
+ originalValue: JsonPrimitive
+ active?: boolean
+ onChange: (value: JsonPrimitive) => void
+ onFieldFocus?: (field: ReviewFieldDefinition) => void
+ onUndo: () => void
+ onSetNull: () => void
+}) {
+ const modified = value !== originalValue
+ const Icon = getFieldIcon(field.schema.type)
+
+ return (
+ <div
+ tabIndex={0}
+ onFocusCapture={() => onFieldFocus?.(field)}
+ onMouseEnter={() => onFieldFocus?.(field)}
+ className={cn(
+ "rounded-lg border bg-background p-3 transition-[border-color,background-color,box-shadow] focus-within:border-blue-500/50 focus-within:bg-blue-500/5 hover:border-blue-500/50 hover:bg-blue-500/5 focus-visible:ring-2 focus-visible:ring-blue-500/20 focus-visible:outline-none",
+ active &&
+ "border-blue-500/60 bg-blue-500/5 shadow-[0_0_0_1px_rgb(59_130_246_/_8%)]"
+ )}
+ >
+ <div className="mb-3 flex min-h-8 items-start justify-between gap-3">
+ <div className="min-w-0">
+ <div className="flex min-w-0 items-center gap-2">
+ <div className="min-w-0">
+ <div className="truncate text-sm font-medium">
+ {field.schema.title ?? field.key}
+ </div>
+ </div>
+ <span
+ className={cn(
+ "size-2 shrink-0 rounded-full bg-amber-400 transition-opacity",
+ !modified && "opacity-0"
+ )}
+ />
+ </div>
+ <div className="truncate text-xs text-muted-foreground">
+ {field.key}
+ </div>
+ </div>
+ <div className="flex shrink-0 items-center gap-1">
+ {modified ? (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ className="text-muted-foreground"
+ onClick={onUndo}
+ aria-label={`Undo ${field.key}`}
+ >
+ <HugeiconsIcon icon={Undo02Icon} className="size-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Revert changes</TooltipContent>
+ </Tooltip>
+ ) : null}
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ className="text-muted-foreground"
+ onClick={onSetNull}
+ aria-label={`Set ${field.key} to null`}
+ >
+ <HugeiconsIcon icon={CancelCircleIcon} className="size-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Set to NULL</TooltipContent>
+ </Tooltip>
+ <div className="flex h-6 items-center gap-1 rounded-md border bg-muted/50 px-1.5 text-xs text-muted-foreground">
+ <HugeiconsIcon icon={Icon} className="size-3.5" />
+ {field.schema.type}
+ </div>
+ </div>
+ </div>
+ <div className="grid gap-2 sm:grid-cols-2">
+ <div className="rounded-md border bg-muted/30 p-2">
+ {field.schema.description ? (
+ <p className="mb-2 text-xs text-muted-foreground">
+ {field.schema.description}
+ </p>
+ ) : null}
+ <div className="mb-1 text-[11px] font-medium text-muted-foreground">
+ Actual
+ </div>
+ <div className="min-h-7 rounded-md bg-background px-2 py-1.5 text-sm">
+ {formatValue(field.actual)}
+ </div>
+ </div>
+ <div className="rounded-md border border-blue-500/30 bg-blue-500/5 p-2">
+ <div className="mb-1 text-[11px] font-medium text-blue-700 dark:text-blue-300">
+ Expected
+ </div>
+ <HumanReviewValueInput
+ schema={field.schema}
+ value={value}
+ onChange={onChange}
+ />
+ </div>
+ </div>
+ </div>
+ )
+}
+
+function HumanReviewHighlight({ field }: { field: ReviewFieldDefinition }) {
+ const area = field.location?.area
+
+ if (!area) return null
+
+ return (
+ <div
+ className={cn(
+ "pointer-events-none absolute z-10 rounded-[3px] border",
+ REVIEW_HIGHLIGHT_STYLE
+ )}
+ style={{
+ left: `${area.left}%`,
+ top: `${area.top}%`,
+ width: `${area.width}%`,
+ height: `${area.height}%`,
+ }}
+ />
+ )
+}
+
+function JsonDiffView({
+ actual,
+ expected,
+}: {
+ actual: JsonObject
+ expected: JsonObject
+}) {
+ return (
+ <Virtualizer
+ className="h-full overflow-auto rounded-b-xl bg-surface/60"
+ contentClassName="min-w-full"
+ >
+ <div className="human-review-diff h-full text-xs">
+ <MultiFileDiff
+ className="block min-w-full"
+ style={DIFF_VIEWER_THEME}
+ oldFile={{
+ name: "actual.json",
+ contents: formatJson(actual),
+ lang: "json",
+ }}
+ newFile={{
+ name: "expected.json",
+ contents: formatJson(expected),
+ lang: "json",
+ }}
+ disableWorkerPool
+ options={{
+ diffStyle: "split",
+ diffIndicators: "bars",
+ hunkSeparators: "line-info-basic",
+ overflow: "wrap",
+ theme: {
+ light: "pierre-light",
+ dark: "pierre-dark",
+ },
+ }}
+ />
+ </div>
+ </Virtualizer>
+ )
+}
+
+function HumanReviewPanel({
+ activeFieldKey,
+ className,
+ onFieldFocus,
+}: {
+ activeFieldKey?: string
+ className?: string
+ onFieldFocus?: (field: ReviewFieldDefinition) => void
+} = {}) {
+ const [expected, setExpected] = React.useState<JsonObject>(
+ INITIAL_EXPECTED_VALUES
+ )
+
+ const updateValue = React.useCallback((key: string, value: JsonPrimitive) => {
+ setExpected((current) => ({ ...current, [key]: value }))
+ }, [])
+
+ return (
+ <TooltipProvider delay={200}>
+ <Tabs
+ defaultValue="form"
+ className={cn("flex h-[560px] flex-col gap-0 bg-background", className)}
+ >
+ <div className="flex min-h-12 items-center justify-between gap-3 border-b px-3">
+ <TabsList className="h-8 sm:h-7">
+ <TabsTrigger value="form" className="h-7 sm:h-6">
+ <HugeiconsIcon icon={TextCheckIcon} className="size-4" />
+ Form
+ </TabsTrigger>
+ <TabsTrigger value="json" className="h-7 sm:h-6">
+ <HugeiconsIcon icon={SourceCodeSquareIcon} className="size-4" />
+ JSON
+ </TabsTrigger>
+ </TabsList>
+ <div className="flex h-8 items-center gap-1 rounded-md border bg-muted/40 px-2 text-xs text-muted-foreground sm:h-7">
+ <HugeiconsIcon icon={FileDiffIcon} className="size-3.5" />
+ {REVIEW_SCHEMA.length} fields
+ </div>
+ </div>
+ <TabsContent value="form" className="min-h-0 flex-1">
+ <ScrollArea className="h-full" scrollFade>
+ <div className="space-y-3 p-3">
+ {REVIEW_SCHEMA.map((field) => (
+ <HumanReviewFieldCard
+ key={field.key}
+ field={field}
+ value={expected[field.key] ?? null}
+ originalValue={field.expected}
+ active={field.key === activeFieldKey}
+ onChange={(value) => updateValue(field.key, value)}
+ onFieldFocus={onFieldFocus}
+ onUndo={() => updateValue(field.key, field.expected)}
+ onSetNull={() => updateValue(field.key, null)}
+ />
+ ))}
+ </div>
+ </ScrollArea>
+ </TabsContent>
+ <TabsContent value="json" className="min-h-0 flex-1">
+ <JsonDiffView actual={ACTUAL_VALUES} expected={expected} />
+ </TabsContent>
+ </Tabs>
+ </TooltipProvider>
+ )
+}
+
+export function HumanReviewBlock() {
+ const [activeFieldKey, setActiveFieldKey] = React.useState(
+ REVIEW_SCHEMA[0].key
+ )
+ const viewerRef = React.useRef<PDFViewerHandle>(null)
+ const activeField =
+ REVIEW_SCHEMA.find((field) => field.key === activeFieldKey) ??
+ REVIEW_SCHEMA[0]
+
+ const focusField = React.useCallback((field: ReviewFieldDefinition) => {
+ setActiveFieldKey(field.key)
+
+ if (field.location) {
+ viewerRef.current?.scrollToPageArea(
+ field.location.page,
+ field.location.area
+ )
+ }
+ }, [])
+
+ return (
+ <PdfBlockResizableShell
+ autoSaveId="pdf-block-human-review"
+ left={
+ <PDFViewer
+ ref={viewerRef}
+ file={PDF_URL}
+ defaultZoom={DEFAULT_ZOOM}
+ renderPageOverlay={({ pageNumber }) =>
+ activeField.location?.page === pageNumber ? (
+ <HumanReviewHighlight field={activeField} />
+ ) : null
+ }
+ />
+ }
+ right={
+ <HumanReviewPanel
+ activeFieldKey={activeField.key}
+ className="h-full min-h-0"
+ onFieldFocus={focusField}
+ />
+ }
+ />
+ )
+}
+
+export function HumanReviewDemo() {
+ const [isCodeVisible, setIsCodeVisible] = React.useState(false)
+
+ return (
+ <div
+ data-slot="component-preview"
+ className="group relative mt-4 mb-12 flex flex-col overflow-hidden rounded-xl border"
+ >
+ <HumanReviewPanel />
+ <div
+ data-slot="code"
+ data-mobile-code-visible={isCodeVisible}
+ className="relative overflow-hidden **:data-[slot=copy-button]:right-4 **:data-[slot=copy-button]:hidden data-[mobile-code-visible=true]:**:data-[slot=copy-button]:flex [&_[data-rehype-pretty-code-figure]]:m-0! [&_[data-rehype-pretty-code-figure]]:rounded-t-none [&_[data-rehype-pretty-code-figure]]:border-t [&_pre]:max-h-72"
+ >
+ {isCodeVisible ? (
+ <HighlightedCodeBlock
+ code={humanReviewUsageCode}
+ className="rounded-none border-x-0 border-b-0"
+ />
+ ) : (
+ <div className="relative">
+ <HighlightedCodeBlock
+ code={humanReviewUsageCode}
+ className="rounded-none border-x-0 border-b-0"
+ maxHeightClassName="max-h-56"
+ previewLines={10}
+ showCopy={false}
+ />
+ <div className="absolute inset-0 flex items-center justify-center pb-4">
+ <div
+ className="absolute inset-0"
+ style={{
+ background:
+ "linear-gradient(to top, var(--color-code), color-mix(in oklab, var(--color-code) 60%, transparent), transparent)",
+ }}
+ />
+ <Button
+ type="button"
+ size="sm"
+ variant="outline"
+ className="relative z-10 rounded-lg bg-background text-foreground shadow-none hover:bg-muted dark:bg-background dark:text-foreground dark:hover:bg-muted"
+ onClick={() => setIsCodeVisible(true)}
+ >
+ View Code
+ </Button>
+ </div>
+ </div>
+ )}
+ </div>
+ </div>
+ )
+}
+
+const humanReviewUsageCode = `"use client";
+
+import * as React from "react";
+
+import { HumanReviewPanel, type ReviewField } from "@/components/ui/human-review";
+
+const fields: ReviewField[] = [
+ {
+ key: "vendor_name",
+ schema: {
+ type: "string",
+ title: "Vendor name",
+ description: "Supplier shown on the invoice header.",
+ },
+ actual: "Acme Supplies LLC",
+ expected: "Acme Supply LLC",
+ },
+ {
+ key: "total_amount",
+ schema: {
+ type: "number",
+ title: "Total amount",
+ description: "Final amount due including tax.",
+ },
+ actual: 12480,
+ expected: 12480.75,
+ },
+ {
+ key: "payment_terms",
+ schema: {
+ type: "string",
+ title: "Payment terms",
+ enum: ["Due on receipt", "Net 15", "Net 30"],
+ },
+ actual: "Net 15",
+ expected: "Net 30",
+ },
+ {
+ key: "requires_review",
+ schema: {
+ type: "boolean",
+ title: "Requires review",
+ },
+ actual: false,
+ expected: true,
+ },
+];
+
+export function HumanReviewExample() {
+ const [values, setValues] = React.useState(() =>
+ Object.fromEntries(fields.map((field) => [field.key, field.expected])),
+ );
+
+ return (
+ <HumanReviewPanel
+ fields={fields}
+ values={values}
+ onValuesChange={setValues}
+ className="h-[560px]"
+ />
+ );
+}`
+
+const humanReviewSourceCode = `"use client";
+
+import * as React from "react";
+import {
+ CancelCircleIcon,
+ FileDiffIcon,
+ InputNumericIcon,
+ InputTextIcon,
+ SourceCodeSquareIcon,
+ TextCheckIcon,
+ Undo02Icon,
+} from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
+import { MultiFileDiff, Virtualizer } from "@pierre/diffs/react";
+
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { ScrollArea } from "@/components/ui/scroll-area";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
+import { cn } from "@/lib/utils";
+
+export type JsonPrimitive = string | number | boolean | null;
+export type JsonObject = Record<string, JsonPrimitive>;
+export type ReviewFieldType = "string" | "number" | "integer" | "boolean";
+
+export type ReviewField = {
+ key: string;
+ schema: {
+ type: ReviewFieldType;
+ title?: string;
+ description?: string;
+ enum?: Array<string | number>;
+ };
+ actual: JsonPrimitive;
+ expected: JsonPrimitive;
+};
+
+function formatJson(value: unknown) {
+ return JSON.stringify(value, null, 2);
+}
+
+function formatValue(value: JsonPrimitive) {
+ if (value === null) return "NULL";
+ if (typeof value === "boolean") return value ? "true" : "false";
+ return String(value);
+}
+
+function getFieldIcon(type: ReviewFieldType) {
+ if (type === "number" || type === "integer") return InputNumericIcon;
+ if (type === "boolean") return TextCheckIcon;
+ return InputTextIcon;
+}
+
+const DIFF_VIEWER_THEME = {
+ "--diffs-light-bg": "oklch(0.985 0.002 247)",
+ "--diffs-dark-bg": "oklch(0.18 0.003 247)",
+ "--diffs-light": "oklch(0.22 0.01 247)",
+ "--diffs-dark": "oklch(0.92 0.006 247)",
+ "--diffs-bg-context-override":
+ "light-dark(oklch(0.967 0.003 247), oklch(0.235 0.004 247))",
+ "--diffs-bg-context-gutter-override":
+ "light-dark(oklch(0.948 0.004 247), oklch(0.205 0.004 247))",
+ "--diffs-bg-separator-override":
+ "light-dark(oklch(0.94 0.004 247), oklch(0.255 0.005 247))",
+ "--diffs-bg-buffer-override":
+ "light-dark(oklch(0.955 0.004 247), oklch(0.225 0.004 247))",
+ "--diffs-light-addition-color": "oklch(0.54 0.13 158)",
+ "--diffs-dark-addition-color": "oklch(0.72 0.13 158)",
+ "--diffs-light-deletion-color": "oklch(0.55 0.16 28)",
+ "--diffs-dark-deletion-color": "oklch(0.72 0.14 28)",
+ "--diffs-bg-addition-override":
+ "light-dark(oklch(0.957 0.032 158), oklch(0.255 0.052 158))",
+ "--diffs-bg-addition-emphasis-override":
+ "light-dark(oklch(0.88 0.06 158), oklch(0.36 0.08 158))",
+ "--diffs-bg-deletion-override":
+ "light-dark(oklch(0.958 0.03 28), oklch(0.255 0.047 28))",
+ "--diffs-bg-deletion-emphasis-override":
+ "light-dark(oklch(0.9 0.052 28), oklch(0.36 0.075 28))",
+ "--diffs-fg-number-override":
+ "light-dark(oklch(0.56 0.018 247), oklch(0.66 0.012 247))",
+ "--diffs-font-size": "12px",
+ "--diffs-line-height": "20px",
+} as React.CSSProperties;
+
+function ReviewValueInput({
+ field,
+ value,
+ onChange,
+}: {
+ field: ReviewField;
+ value: JsonPrimitive;
+ onChange: (value: JsonPrimitive) => void;
+}) {
+ if (field.schema.enum?.length) {
+ return (
+ <select
+ value={value === null ? "" : String(value)}
+ onChange={(event) => onChange(event.target.value)}
+ className="h-8 w-full rounded-lg border border-input bg-background px-3 text-sm"
+ >
+ {field.schema.enum.map((option) => (
+ <option key={String(option)} value={String(option)}>
+ {String(option)}
+ </option>
+ ))}
+ </select>
+ );
+ }
+
+ if (field.schema.type === "number" || field.schema.type === "integer") {
+ return (
+ <Input
+ nativeInput
+ type="number"
+ value={value === null ? "" : String(value)}
+ onChange={(event) => {
+ const nextValue = event.currentTarget.value;
+ onChange(nextValue === "" ? null : Number(nextValue));
+ }}
+ />
+ );
+ }
+
+ if (field.schema.type === "boolean") {
+ return (
+ <div className="grid grid-cols-2 gap-1 rounded-lg bg-muted p-0.5">
+ {[true, false].map((option) => (
+ <Button
+ key={String(option)}
+ type="button"
+ size="sm"
+ variant={value === option ? "outline" : "ghost"}
+ onClick={() => onChange(option)}
+ >
+ {option ? "True" : "False"}
+ </Button>
+ ))}
+ </div>
+ );
+ }
+
+ return (
+ <Input
+ nativeInput
+ value={value === null ? "" : String(value)}
+ onChange={(event) => onChange(event.currentTarget.value)}
+ />
+ );
+}
+
+export function HumanReviewFieldCard({
+ field,
+ value,
+ onChange,
+ onUndo,
+ onSetNull,
+}: {
+ field: ReviewField;
+ value: JsonPrimitive;
+ onChange: (value: JsonPrimitive) => void;
+ onUndo: () => void;
+ onSetNull: () => void;
+}) {
+ const modified = value !== field.expected;
+ const Icon = getFieldIcon(field.schema.type);
+
+ return (
+ <div className="rounded-lg border bg-background p-3">
+ <div className="mb-3 flex min-h-8 items-start justify-between gap-3">
+ <div className="min-w-0">
+ <div className="flex min-w-0 items-center gap-2">
+ <div className="truncate text-sm font-medium">
+ {field.schema.title ?? field.key}
+ </div>
+ <span className={cn("size-2 shrink-0 rounded-full bg-amber-400", !modified && "opacity-0")} />
+ </div>
+ <div className="min-w-0">
+ <div className="truncate text-xs text-muted-foreground">
+ {field.key}
+ </div>
+ </div>
+ </div>
+ <div className="flex shrink-0 items-center gap-1">
+ {modified ? (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button type="button" variant="ghost" size="icon-sm" onClick={onUndo}>
+ <HugeiconsIcon icon={Undo02Icon} className="size-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Revert changes</TooltipContent>
+ </Tooltip>
+ ) : null}
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button type="button" variant="ghost" size="icon-sm" onClick={onSetNull}>
+ <HugeiconsIcon icon={CancelCircleIcon} className="size-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Set to NULL</TooltipContent>
+ </Tooltip>
+ <div className="flex h-6 items-center gap-1 rounded-md border bg-muted/50 px-1.5 text-xs text-muted-foreground">
+ <HugeiconsIcon icon={Icon} className="size-3.5" />
+ {field.schema.type}
+ </div>
+ </div>
+ </div>
+ <div className="grid gap-2 sm:grid-cols-2">
+ <div className="rounded-md border bg-muted/30 p-2">
+ {field.schema.description ? (
+ <p className="mb-2 text-xs text-muted-foreground">
+ {field.schema.description}
+ </p>
+ ) : null}
+ <div className="mb-1 text-[11px] font-medium text-muted-foreground">
+ Actual
+ </div>
+ <div className="min-h-7 rounded-md bg-background px-2 py-1.5 text-sm">
+ {formatValue(field.actual)}
+ </div>
+ </div>
+ <div className="rounded-md border border-blue-500/30 bg-blue-500/5 p-2">
+ <div className="mb-1 text-[11px] font-medium text-blue-700 dark:text-blue-300">
+ Expected
+ </div>
+ <ReviewValueInput field={field} value={value} onChange={onChange} />
+ </div>
+ </div>
+ </div>
+ );
+}
+
+export function JsonDiffView({
+ actual,
+ expected,
+}: {
+ actual: JsonObject;
+ expected: JsonObject;
+}) {
+ return (
+ <Virtualizer
+ className="h-full overflow-auto bg-surface/60"
+ contentClassName="min-w-full"
+ >
+ <MultiFileDiff
+ className="block min-w-full"
+ style={DIFF_VIEWER_THEME}
+ oldFile={{ name: "actual.json", contents: formatJson(actual), lang: "json" }}
+ newFile={{ name: "expected.json", contents: formatJson(expected), lang: "json" }}
+ disableWorkerPool
+ options={{
+ diffStyle: "split",
+ diffIndicators: "bars",
+ hunkSeparators: "line-info-basic",
+ overflow: "wrap",
+ theme: { light: "pierre-light", dark: "pierre-dark" },
+ }}
+ />
+ </Virtualizer>
+ );
+}
+
+export function HumanReviewPanel({
+ fields,
+ values,
+ onValuesChange,
+ className,
+}: {
+ fields: ReviewField[];
+ values: JsonObject;
+ onValuesChange: (values: JsonObject) => void;
+ className?: string;
+}) {
+ const actual = React.useMemo(
+ () => Object.fromEntries(fields.map((field) => [field.key, field.actual])),
+ [fields],
+ );
+
+ const updateValue = React.useCallback(
+ (key: string, value: JsonPrimitive) => {
+ onValuesChange({ ...values, [key]: value });
+ },
+ [onValuesChange, values],
+ );
+
+ return (
+ <TooltipProvider delay={200}>
+ <Tabs defaultValue="form" className={cn("flex flex-col gap-0 bg-background", className)}>
+ <div className="flex min-h-12 items-center justify-between gap-3 border-b px-3">
+ <TabsList className="h-8 sm:h-7">
+ <TabsTrigger value="form" className="h-7 sm:h-6">
+ <HugeiconsIcon icon={TextCheckIcon} className="size-4" />
+ Form
+ </TabsTrigger>
+ <TabsTrigger value="json" className="h-7 sm:h-6">
+ <HugeiconsIcon icon={SourceCodeSquareIcon} className="size-4" />
+ JSON
+ </TabsTrigger>
+ </TabsList>
+ <div className="flex h-8 items-center gap-1 rounded-md border bg-muted/40 px-2 text-xs text-muted-foreground sm:h-7">
+ <HugeiconsIcon icon={FileDiffIcon} className="size-3.5" />
+ {fields.length} fields
+ </div>
+ </div>
+ <TabsContent value="form" className="min-h-0 flex-1">
+ <ScrollArea className="h-full" scrollFade>
+ <div className="space-y-3 p-3">
+ {fields.map((field) => (
+ <HumanReviewFieldCard
+ key={field.key}
+ field={field}
+ value={values[field.key] ?? null}
+ onChange={(value) => updateValue(field.key, value)}
+ onUndo={() => updateValue(field.key, field.expected)}
+ onSetNull={() => updateValue(field.key, null)}
+ />
+ ))}
+ </div>
+ </ScrollArea>
+ </TabsContent>
+ <TabsContent value="json" className="min-h-0 flex-1">
+ <JsonDiffView actual={actual} expected={values} />
+ </TabsContent>
+ </Tabs>
+ </TooltipProvider>
+ );
+}`
+
+export function HumanReviewSource() {
+ return <HighlightedCodeBlock code={humanReviewSourceCode} />
+}
diff --git a/apps/v4/components/mobile-nav.tsx b/apps/v4/components/mobile-nav.tsx
index 42f5c10..e1cc4f5 100644
--- a/apps/v4/components/mobile-nav.tsx
+++ b/apps/v4/components/mobile-nav.tsx
@@ -9,6 +9,7 @@ import { getCurrentBase, getPagesFromFolder } from "@/lib/page-tree"
import { type source } from "@/lib/source"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
+import { ScrollArea } from "@/components/ui/scroll-area"
import {
Popover,
PopoverContent,
@@ -69,77 +70,83 @@ export function MobileNav({
</Button>
</PopoverTrigger>
<PopoverContent
- className="no-scrollbar h-(--radix-popper-available-height) w-(--radix-popper-available-width) overflow-y-auto rounded-none border-none bg-background/90 p-0 shadow-none backdrop-blur duration-100 data-open:animate-none!"
+ className="h-(--radix-popper-available-height) w-(--radix-popper-available-width) rounded-none border-none bg-background/90 p-0 shadow-none backdrop-blur duration-100 data-open:animate-none!"
align="start"
side="bottom"
alignOffset={-16}
sideOffset={14}
>
- <div className="flex flex-col gap-12 overflow-auto px-6 py-6">
- <div className="flex flex-col gap-4">
- <div className="text-sm font-medium text-muted-foreground">
- Menu
- </div>
- <div className="flex flex-col gap-3">
- <MobileLink href="/" onOpenChange={setOpen}>
- Home
- </MobileLink>
- {items.map((item, index) => (
- <MobileLink key={index} href={item.href} onOpenChange={setOpen}>
- {item.label}
+ <ScrollArea className="h-full">
+ <div className="flex flex-col gap-12 px-6 py-6">
+ <div className="flex flex-col gap-4">
+ <div className="text-sm font-medium text-muted-foreground">
+ Menu
+ </div>
+ <div className="flex flex-col gap-3">
+ <MobileLink href="/" onOpenChange={setOpen}>
+ Home
</MobileLink>
- ))}
+ {items.map((item, index) => (
+ <MobileLink
+ key={index}
+ href={item.href}
+ onOpenChange={setOpen}
+ >
+ {item.label}
+ </MobileLink>
+ ))}
+ </div>
</div>
- </div>
- <div className="flex flex-col gap-4">
- <div className="text-sm font-medium text-muted-foreground">
- Sections
+ <div className="flex flex-col gap-4">
+ <div className="text-sm font-medium text-muted-foreground">
+ Sections
+ </div>
+ <div className="flex flex-col gap-3">
+ {TOP_LEVEL_SECTIONS.map(({ name, href }) => {
+ if (!showMcpDocs && href.includes("/mcp")) {
+ return null
+ }
+ return (
+ <MobileLink key={name} href={href} onOpenChange={setOpen}>
+ {name}
+ </MobileLink>
+ )
+ })}
+ </div>
</div>
- <div className="flex flex-col gap-3">
- {TOP_LEVEL_SECTIONS.map(({ name, href }) => {
- if (!showMcpDocs && href.includes("/mcp")) {
- return null
+ <div className="flex flex-col gap-8">
+ {tree?.children?.map((group, index) => {
+ if (group.type === "folder") {
+ const pages = getPagesFromFolder(group, currentBase)
+ return (
+ <div key={index} className="flex flex-col gap-4">
+ <div className="text-sm font-medium text-muted-foreground">
+ {group.name}
+ </div>
+ <div className="flex flex-col gap-3">
+ {pages.map((item) => {
+ if (!showMcpDocs && item.url.includes("/mcp")) {
+ return null
+ }
+ return (
+ <MobileLink
+ key={`${item.url}-${index}`}
+ href={item.url}
+ onOpenChange={setOpen}
+ className="flex items-center gap-2"
+ >
+ {item.name}
+ </MobileLink>
+ )
+ })}
+ </div>
+ </div>
+ )
}
- return (
- <MobileLink key={name} href={href} onOpenChange={setOpen}>
- {name}
- </MobileLink>
- )
})}
</div>
</div>
- <div className="flex flex-col gap-8">
- {tree?.children?.map((group, index) => {
- if (group.type === "folder") {
- const pages = getPagesFromFolder(group, currentBase)
- return (
- <div key={index} className="flex flex-col gap-4">
- <div className="text-sm font-medium text-muted-foreground">
- {group.name}
- </div>
- <div className="flex flex-col gap-3">
- {pages.map((item) => {
- if (!showMcpDocs && item.url.includes("/mcp")) {
- return null
- }
- return (
- <MobileLink
- key={`${item.url}-${index}`}
- href={item.url}
- onOpenChange={setOpen}
- className="flex items-center gap-2"
- >
- {item.name}
- </MobileLink>
- )
- })}
- </div>
- </div>
- )
- }
- })}
- </div>
- </div>
+ </ScrollArea>
</PopoverContent>
</Popover>
)
diff --git a/apps/v4/components/ocr-blocks-docs.tsx b/apps/v4/components/ocr-blocks-docs.tsx
index 920e0f7..c0cfe66 100644
--- a/apps/v4/components/ocr-blocks-docs.tsx
+++ b/apps/v4/components/ocr-blocks-docs.tsx
@@ -5,16 +5,17 @@ import {
Heading01Icon,
Image01Icon,
LeftToRightListBulletIcon,
- Loading03Icon,
ParagraphIcon,
Table01Icon,
} from "@hugeicons/core-free-icons"
import { HugeiconsIcon } from "@hugeicons/react"
-import type * as ReactPdf from "react-pdf"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
+import { PDFViewer, type PDFViewerHandle } from "@/components/ui/pdf-viewer"
+import { ScrollArea } from "@/components/ui/scroll-area"
import { HighlightedCodeBlock } from "@/components/highlighted-code-block"
+import { PdfBlockResizableShell } from "@/components/pdf-block-resizable-shell"
type Point = {
x: number
@@ -40,22 +41,10 @@ type HighlightArea = {
height: number
}
-type ReactPdfModule = typeof ReactPdf
-
const PDF_URL = "/samples/attention.pdf"
-const PDF_WORKER_URL = new URL(
- "pdfjs-dist/legacy/build/pdf.worker.min.mjs",
- import.meta.url
-).toString()
-const PAGE_WIDTH = 792
-const PAGE_HEIGHT = 612
-const RENDERED_PAGE_WIDTH = 430
-const RENDERED_PAGE_HEIGHT = Math.round(
- RENDERED_PAGE_WIDTH * (PAGE_HEIGHT / PAGE_WIDTH)
-)
-const DEVICE_PIXEL_RATIO_LIMIT = 2
-const PREVIEW_PAGES = [1, 2, 3, 6]
-
+const ANNOTATION_PAGE_WIDTH = 792
+const ANNOTATION_PAGE_HEIGHT = 612
+const DEFAULT_ZOOM = 0.75
const BLOCK_STYLES: Record<
OcrBlockType,
{
@@ -244,10 +233,10 @@ function convertPolygonToHighlightArea(polygon: Point[]): HighlightArea {
const bottom = Math.max(...yValues)
return {
- left: (left / PAGE_WIDTH) * 100,
- top: (top / PAGE_HEIGHT) * 100,
- width: ((right - left) / PAGE_WIDTH) * 100,
- height: ((bottom - top) / PAGE_HEIGHT) * 100,
+ left: (left / ANNOTATION_PAGE_WIDTH) * 100,
+ top: (top / ANNOTATION_PAGE_HEIGHT) * 100,
+ width: ((right - left) / ANNOTATION_PAGE_WIDTH) * 100,
+ height: ((bottom - top) / ANNOTATION_PAGE_HEIGHT) * 100,
}
}
@@ -279,172 +268,37 @@ function BlockOverlay({
)
}
-function OcrPage({
- pageNumber,
- activeBlock,
- reactPdf,
+function OcrBlocksPanel({
+ activeBlockId,
+ className,
+ onBlockFocus,
}: {
- pageNumber: number
- activeBlock: OcrBlock | null
- reactPdf: ReactPdfModule
+ activeBlockId?: string
+ className?: string
+ onBlockFocus?: (block: OcrBlock) => void
}) {
- const devicePixelRatio =
- typeof window === "undefined"
- ? 1
- : Math.min(DEVICE_PIXEL_RATIO_LIMIT, window.devicePixelRatio || 1)
- const pageBlocks = OCR_BLOCKS.filter((block) => block.page === pageNumber)
-
- return (
- <div
- data-ocr-page={pageNumber}
- className="relative"
- style={{ width: RENDERED_PAGE_WIDTH, height: RENDERED_PAGE_HEIGHT }}
- >
- <reactPdf.Page
- pageNumber={pageNumber}
- width={RENDERED_PAGE_WIDTH}
- className="overflow-hidden border bg-background shadow-xs"
- renderAnnotationLayer={false}
- renderTextLayer={false}
- devicePixelRatio={devicePixelRatio}
- loading={
- <div
- className="grid place-items-center"
- style={{ width: RENDERED_PAGE_WIDTH, height: RENDERED_PAGE_HEIGHT }}
- >
- <HugeiconsIcon
- icon={Loading03Icon}
- className="size-4 animate-spin"
- />
- </div>
- }
- />
- {pageBlocks.map((block) => (
- <BlockOverlay
- key={block.id}
- block={block}
- isActive={activeBlock?.id === block.id}
- />
- ))}
- </div>
+ const [localActiveBlockId, setLocalActiveBlockId] = React.useState(
+ activeBlockId ?? OCR_BLOCKS[0].id
)
-}
-
-export function OcrBlocks() {
- const [activeBlockId, setActiveBlockId] = React.useState(OCR_BLOCKS[0].id)
- const [reactPdf, setReactPdf] = React.useState<ReactPdfModule | null>(null)
- const [loadError, setLoadError] = React.useState(false)
- const viewportRef = React.useRef<HTMLDivElement>(null)
const activeBlock =
- OCR_BLOCKS.find((block) => block.id === activeBlockId) ?? OCR_BLOCKS[0]
-
- React.useEffect(() => {
- let mounted = true
-
- void import("react-pdf")
- .then((module) => {
- module.pdfjs.GlobalWorkerOptions.workerSrc = PDF_WORKER_URL
-
- if (mounted) {
- setReactPdf(module)
- }
- })
- .catch(() => {
- if (mounted) {
- setLoadError(true)
- }
- })
-
- return () => {
- mounted = false
- }
- }, [])
-
- const focusBlock = React.useCallback((block: OcrBlock) => {
- setActiveBlockId(block.id)
-
- window.requestAnimationFrame(() => {
- const viewport = viewportRef.current
- const page = viewport?.querySelector<HTMLElement>(
- `[data-ocr-page="${block.page}"]`
- )
-
- if (!viewport || !page) return
-
- const highlight = convertPolygonToHighlightArea(block.polygon)
- const pageTop =
- page.getBoundingClientRect().top -
- viewport.getBoundingClientRect().top +
- viewport.scrollTop
- const targetTop =
- pageTop + (highlight.top / 100) * RENDERED_PAGE_HEIGHT - 96
-
- viewport.scrollTo({
- top: Math.max(0, targetTop),
- behavior: "smooth",
- })
- })
- }, [])
+ OCR_BLOCKS.find(
+ (block) => block.id === (activeBlockId ?? localActiveBlockId)
+ ) ?? OCR_BLOCKS[0]
+
+ const focusBlock = React.useCallback(
+ (block: OcrBlock) => {
+ setLocalActiveBlockId(block.id)
+ onBlockFocus?.(block)
+ },
+ [onBlockFocus]
+ )
return (
- <div className="grid h-[620px] overflow-hidden bg-background lg:grid-cols-[minmax(0,1fr)_20rem]">
- <div className="flex min-h-0 min-w-0 flex-col border-b lg:border-r lg:border-b-0">
- <div className="flex h-12 shrink-0 items-center justify-between border-b px-4">
- <div className="text-sm font-medium">PDF Viewer</div>
- <div className="text-xs text-muted-foreground">
- Page {activeBlock.page}
- </div>
- </div>
- <div
- ref={viewportRef}
- className="min-h-0 flex-1 overflow-auto bg-muted/30"
- >
- {loadError ? (
- <div className="grid h-full place-items-center p-6 text-sm text-muted-foreground">
- Unable to load the PDF preview.
- </div>
- ) : reactPdf ? (
- <reactPdf.Document
- file={PDF_URL}
- className="flex min-h-full w-max min-w-full flex-col items-center gap-6 p-6"
- loading={
- <div className="grid h-full min-h-80 place-items-center">
- <HugeiconsIcon
- icon={Loading03Icon}
- className="size-4 animate-spin"
- />
- </div>
- }
- error={null}
- onLoadError={() => setLoadError(true)}
- >
- {PREVIEW_PAGES.map((pageNumber) => (
- <OcrPage
- key={pageNumber}
- pageNumber={pageNumber}
- activeBlock={activeBlock}
- reactPdf={reactPdf}
- />
- ))}
- </reactPdf.Document>
- ) : (
- <div className="grid h-full min-h-80 place-items-center">
- <HugeiconsIcon
- icon={Loading03Icon}
- className="size-4 animate-spin"
- />
- </div>
- )}
- </div>
- </div>
- <aside className="flex min-h-0 flex-col">
- <div className="border-b px-4 py-3">
- <div className="text-sm font-medium">OCR Blocks</div>
- <div className="text-xs text-muted-foreground">
- Hover a block to inspect its extracted region.
- </div>
- </div>
- <div className="min-h-0 flex-1 overflow-y-auto p-3">
+ <aside
+ className={cn("flex h-[420px] min-h-0 flex-col bg-background", className)}
+ >
+ <ScrollArea className="min-h-0 flex-1" scrollFade>
+ <div className="p-3">
<div className="space-y-2">
{OCR_BLOCKS.map((block) => {
const isActive = block.id === activeBlock.id
@@ -496,7 +350,152 @@ export function OcrBlocks() {
})}
</div>
</div>
- </aside>
+ </ScrollArea>
+ </aside>
+ )
+}
+
+export function OcrBlocks() {
+ return <OcrBlocksPanel />
+}
+
+export function OcrBlocksBlock() {
+ const [activeBlockId, setActiveBlockId] = React.useState(OCR_BLOCKS[0].id)
+ const viewerRef = React.useRef<PDFViewerHandle>(null)
+ const activeBlock =
+ OCR_BLOCKS.find((block) => block.id === activeBlockId) ?? OCR_BLOCKS[0]
+
+ const focusBlock = React.useCallback((block: OcrBlock) => {
+ setActiveBlockId(block.id)
+ viewerRef.current?.scrollToPageArea(
+ block.page,
+ convertPolygonToHighlightArea(block.polygon)
+ )
+ }, [])
+
+ return (
+ <PdfBlockResizableShell
+ autoSaveId="pdf-block-ocr-blocks"
+ left={
+ <PDFViewer
+ ref={viewerRef}
+ file={PDF_URL}
+ defaultZoom={DEFAULT_ZOOM}
+ renderPageOverlay={({ pageNumber }) =>
+ OCR_BLOCKS.filter((block) => block.page === pageNumber).map(
+ (block) => (
+ <BlockOverlay
+ key={block.id}
+ block={block}
+ isActive={activeBlock.id === block.id}
+ />
+ )
+ )
+ }
+ />
+ }
+ right={
+ <OcrBlocksPanel
+ activeBlockId={activeBlock.id}
+ className="h-full"
+ onBlockFocus={focusBlock}
+ />
+ }
+ />
+ )
+}
+
+function OcrExampleCard({
+ active,
+ activeClassName,
+ confidence,
+ icon,
+ iconClassName,
+ kind,
+ label,
+ pageLabel,
+ text,
+}: {
+ active?: boolean
+ activeClassName?: string
+ confidence: number
+ icon: typeof Heading01Icon
+ iconClassName: string
+ kind: string
+ label: string
+ pageLabel: string
+ text: string
+}) {
+ return (
+ <button
+ type="button"
+ className={cn(
+ "w-full rounded-lg border bg-background p-3 text-left transition-[border-color,background-color,box-shadow] hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
+ active &&
+ (activeClassName ??
+ "border-blue-500/60 bg-blue-500/5 shadow-[0_0_0_1px_rgb(0_0_0_/_4%)]")
+ )}
+ >
+ <div className="flex items-start gap-3">
+ <div
+ className={cn(
+ "mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md",
+ iconClassName
+ )}
+ >
+ <HugeiconsIcon icon={icon} className="size-4" />
+ </div>
+ <div className="min-w-0 flex-1">
+ <div className="flex items-center justify-between gap-2">
+ <div className="truncate text-sm font-medium">{label}</div>
+ <div className="shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground">
+ {pageLabel}
+ </div>
+ </div>
+ <div className="mt-0.5 text-xs font-medium text-muted-foreground">
+ {kind} · {Math.round(confidence * 100)}%
+ </div>
+ <div className="mt-2 line-clamp-3 text-sm text-foreground/90">
+ {text}
+ </div>
+ </div>
+ </div>
+ </button>
+ )
+}
+
+function OcrBlocksExample() {
+ return (
+ <div className="flex h-[420px] flex-col gap-2 bg-background p-3">
+ <OcrExampleCard
+ active
+ icon={Heading01Icon}
+ label="Paper title"
+ kind="Heading"
+ pageLabel="p. 1"
+ confidence={0.99}
+ text="Attention Is All You Need"
+ iconClassName="bg-violet-500/10 text-violet-600 dark:text-violet-300"
+ activeClassName="border-violet-500/60 bg-violet-500/5"
+ />
+ <OcrExampleCard
+ icon={ParagraphIcon}
+ label="Abstract body"
+ kind="Paragraph"
+ pageLabel="p. 1"
+ confidence={0.94}
+ text="The dominant sequence transduction models are based on complex recurrent or convolutional neural networks."
+ iconClassName="bg-blue-500/10 text-blue-600 dark:text-blue-300"
+ />
+ <OcrExampleCard
+ icon={Table01Icon}
+ label="Complexity table"
+ kind="Table"
+ pageLabel="p. 6"
+ confidence={0.91}
+ text="Layer type, complexity per layer, sequential operations, maximum path length."
+ iconClassName="bg-amber-500/10 text-amber-700 dark:text-amber-300"
+ />
</div>
)
}
@@ -509,7 +508,7 @@ export function OcrBlocksDemo() {
data-slot="component-preview"
className="group relative mt-4 mb-12 flex flex-col overflow-hidden rounded-xl border"
>
- <OcrBlocks />
+ <OcrBlocksExample />
<div
data-slot="code"
data-mobile-code-visible={isCodeVisible}
@@ -556,230 +555,119 @@ export function OcrBlocksDemo() {
const ocrBlocksUsageCode = `"use client";
+import { Heading01Icon, ParagraphIcon, Table01Icon } from "@hugeicons/core-free-icons";
+
+import { OcrBlockCard } from "@/components/ui/ocr-block-card";
+
+export function OcrBlocksExample() {
+ return (
+ <div className="flex h-[420px] flex-col gap-2 bg-background p-3">
+ <OcrBlockCard
+ active
+ icon={Heading01Icon}
+ label="Paper title"
+ kind="Heading"
+ pageLabel="p. 1"
+ confidence={0.99}
+ text="Attention Is All You Need"
+ iconClassName="bg-violet-500/10 text-violet-600 dark:text-violet-300"
+ activeClassName="border-violet-500/60 bg-violet-500/5"
+ />
+ <OcrBlockCard
+ icon={ParagraphIcon}
+ label="Abstract body"
+ kind="Paragraph"
+ pageLabel="p. 1"
+ confidence={0.94}
+ text="The dominant sequence transduction models are based on complex recurrent or convolutional neural networks."
+ />
+ <OcrBlockCard
+ icon={Table01Icon}
+ label="Complexity table"
+ kind="Table"
+ pageLabel="p. 6"
+ confidence={0.91}
+ text="Layer type, complexity per layer, sequential operations, maximum path length."
+ iconClassName="bg-amber-500/10 text-amber-700 dark:text-amber-300"
+ />
+ </div>
+ );
+}`
+
+const ocrBlocksSourceCode = `"use client";
+
import * as React from "react";
-import {
- Heading01Icon,
- Image01Icon,
- LeftToRightListBulletIcon,
- Loading03Icon,
- ParagraphIcon,
- Table01Icon,
-} from "@hugeicons/core-free-icons";
+import { ParagraphIcon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
-import type * as ReactPdf from "react-pdf";
import { cn } from "@/lib/utils";
-type ReactPdfModule = typeof ReactPdf;
-type Point = { x: number; y: number };
-type OcrBlockType = "heading" | "paragraph" | "list" | "table" | "image";
-
-type OcrBlock = {
- id: string;
- type: OcrBlockType;
+type OcrBlockCardProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
label: string;
+ kind: string;
text: string;
- page: number;
- confidence: number;
- polygon: Point[];
-};
-
-const PDF_URL = "/samples/attention.pdf";
-const PDF_WORKER_URL = new URL(
- "pdfjs-dist/legacy/build/pdf.worker.min.mjs",
- import.meta.url,
-).toString();
-const PAGE_WIDTH = 792;
-const PAGE_HEIGHT = 612;
-const RENDERED_PAGE_WIDTH = 430;
-const RENDERED_PAGE_HEIGHT = Math.round(RENDERED_PAGE_WIDTH * (PAGE_HEIGHT / PAGE_WIDTH));
-
-const OCR_BLOCKS: OcrBlock[] = [
- {
- id: "title",
- type: "heading",
- label: "Paper title",
- text: "Attention Is All You Need",
- page: 1,
- confidence: 0.99,
- polygon: [
- { x: 246, y: 188 },
- { x: 566, y: 188 },
- { x: 566, y: 222 },
- { x: 246, y: 222 },
- ],
- },
- {
- id: "abstract-body",
- type: "paragraph",
- label: "Abstract body",
- text: "The dominant sequence transduction models are based on complex recurrent or convolutional neural networks...",
- page: 1,
- confidence: 0.94,
- polygon: [
- { x: 108, y: 346 },
- { x: 692, y: 346 },
- { x: 692, y: 458 },
- { x: 108, y: 458 },
- ],
- },
-];
-
-const BLOCK_STYLES = {
- heading: {
- icon: Heading01Icon,
- active: "border-violet-500/70 bg-violet-500/10 shadow-[0_4px_16px_rgb(139_92_246_/_12%)]",
- muted: "border-violet-500/35 bg-violet-500/5",
- },
- paragraph: {
- icon: ParagraphIcon,
- active: "border-blue-500/70 bg-blue-500/10 shadow-[0_4px_16px_rgb(59_130_246_/_12%)]",
- muted: "border-blue-500/35 bg-blue-500/5",
- },
- list: {
- icon: LeftToRightListBulletIcon,
- active: "border-emerald-500/70 bg-emerald-500/10 shadow-[0_4px_16px_rgb(16_185_129_/_12%)]",
- muted: "border-emerald-500/35 bg-emerald-500/5",
- },
- table: {
- icon: Table01Icon,
- active: "border-amber-500/70 bg-amber-500/10 shadow-[0_4px_16px_rgb(245_158_11_/_12%)]",
- muted: "border-amber-500/35 bg-amber-500/5",
- },
- image: {
- icon: Image01Icon,
- active: "border-rose-500/70 bg-rose-500/10 shadow-[0_4px_16px_rgb(244_63_94_/_12%)]",
- muted: "border-rose-500/35 bg-rose-500/5",
- },
+ confidence?: number;
+ pageLabel?: string;
+ icon?: React.ComponentProps<typeof HugeiconsIcon>["icon"];
+ active?: boolean;
+ iconClassName?: string;
+ activeClassName?: string;
};
-function toHighlight(polygon: Point[]) {
- const xs = polygon.map((point) => point.x);
- const ys = polygon.map((point) => point.y);
- const left = Math.min(...xs);
- const right = Math.max(...xs);
- const top = Math.min(...ys);
- const bottom = Math.max(...ys);
-
- return {
- left: (left / PAGE_WIDTH) * 100,
- top: (top / PAGE_HEIGHT) * 100,
- width: ((right - left) / PAGE_WIDTH) * 100,
- height: ((bottom - top) / PAGE_HEIGHT) * 100,
- };
-}
-
-export function OcrBlocks() {
- const [reactPdf, setReactPdf] = React.useState<ReactPdfModule | null>(null);
- const [activeBlockId, setActiveBlockId] = React.useState(OCR_BLOCKS[0].id);
- const viewportRef = React.useRef<HTMLDivElement>(null);
- const activeBlock =
- OCR_BLOCKS.find((block) => block.id === activeBlockId) ?? OCR_BLOCKS[0];
-
- React.useEffect(() => {
- let mounted = true;
-
- void import("react-pdf").then((module) => {
- module.pdfjs.GlobalWorkerOptions.workerSrc = PDF_WORKER_URL;
- if (mounted) setReactPdf(module);
- });
-
- return () => {
- mounted = false;
- };
- }, []);
-
- function focusBlock(block: OcrBlock) {
- setActiveBlockId(block.id);
- window.requestAnimationFrame(() => {
- const page = viewportRef.current?.querySelector<HTMLElement>(
- \`[data-ocr-page="\${block.page}"]\`,
- );
- if (!viewportRef.current || !page) return;
-
- const highlight = toHighlight(block.polygon);
- const pageTop =
- page.getBoundingClientRect().top -
- viewportRef.current.getBoundingClientRect().top +
- viewportRef.current.scrollTop;
-
- viewportRef.current.scrollTo({
- top: Math.max(0, pageTop + (highlight.top / 100) * RENDERED_PAGE_HEIGHT - 96),
- behavior: "smooth",
- });
- });
- }
-
+export function OcrBlockCard({
+ label,
+ kind,
+ text,
+ confidence,
+ pageLabel,
+ icon = ParagraphIcon,
+ active = false,
+ iconClassName = "bg-blue-500/10 text-blue-600 dark:text-blue-300",
+ activeClassName = "border-blue-500/60 bg-blue-500/5",
+ className,
+ ...props
+}: OcrBlockCardProps) {
return (
- <div className="grid h-[620px] overflow-hidden bg-background lg:grid-cols-[minmax(0,1fr)_20rem]">
- <div ref={viewportRef} className="min-h-0 overflow-auto bg-muted/30 p-6">
- {reactPdf ? (
- <reactPdf.Document file={PDF_URL}>
- {[1, 2, 3].map((pageNumber) => (
- <div
- key={pageNumber}
- data-ocr-page={pageNumber}
- className="relative mx-auto mb-6"
- style={{ width: RENDERED_PAGE_WIDTH, height: RENDERED_PAGE_HEIGHT }}
- >
- <reactPdf.Page
- pageNumber={pageNumber}
- width={RENDERED_PAGE_WIDTH}
- renderAnnotationLayer={false}
- renderTextLayer={false}
- loading={<HugeiconsIcon icon={Loading03Icon} className="size-4 animate-spin" />}
- />
- {OCR_BLOCKS.filter((block) => block.page === pageNumber).map((block) => {
- const area = toHighlight(block.polygon);
- const style = BLOCK_STYLES[block.type];
-
- return (
- <div
- key={block.id}
- className={cn(
- "pointer-events-none absolute z-10 rounded-[3px] border",
- block.id === activeBlock.id ? style.active : cn("opacity-55", style.muted),
- )}
- style={{
- left: area.left + "%",
- top: area.top + "%",
- width: area.width + "%",
- height: area.height + "%",
- }}
- />
- );
- })}
+ <button
+ type="button"
+ className={cn(
+ "w-full rounded-lg border bg-background p-3 text-left transition-[border-color,background-color,box-shadow] hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
+ active && activeClassName,
+ className,
+ )}
+ {...props}
+ >
+ <div className="flex items-start gap-3">
+ <div
+ className={cn(
+ "mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md",
+ iconClassName,
+ )}
+ >
+ <HugeiconsIcon icon={icon} className="size-4" />
+ </div>
+ <div className="min-w-0 flex-1">
+ <div className="flex items-center justify-between gap-2">
+ <div className="truncate text-sm font-medium">{label}</div>
+ {pageLabel ? (
+ <div className="shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground">
+ {pageLabel}
</div>
- ))}
- </reactPdf.Document>
- ) : (
- <HugeiconsIcon icon={Loading03Icon} className="size-4 animate-spin" />
- )}
+ ) : null}
+ </div>
+ <div className="mt-0.5 text-xs font-medium text-muted-foreground">
+ {kind}
+ {typeof confidence === "number" ? \` · \${Math.round(confidence * 100)}%\` : null}
+ </div>
+ <div className="mt-2 line-clamp-3 text-sm text-foreground/90">
+ {text}
+ </div>
+ </div>
</div>
- <aside className="min-h-0 overflow-y-auto p-3">
- {OCR_BLOCKS.map((block) => {
- const style = BLOCK_STYLES[block.type];
-
- return (
- <button
- key={block.id}
- type="button"
- onClick={() => focusBlock(block)}
- onMouseEnter={() => focusBlock(block)}
- onFocus={() => focusBlock(block)}
- className="mb-2 w-full rounded-lg border bg-background p-3 text-left text-sm"
- >
- <HugeiconsIcon icon={style.icon} className="size-4" />
- <div className="mt-2 font-medium">{block.label}</div>
- <div className="mt-1">{block.text}</div>
- </button>
- );
- })}
- </aside>
- </div>
+ </button>
);
}`
export function OcrBlocksSource() {
- return <HighlightedCodeBlock code={ocrBlocksUsageCode} />
+ return <HighlightedCodeBlock code={ocrBlocksSourceCode} />
}
diff --git a/apps/v4/components/pdf-block-resizable-shell.tsx b/apps/v4/components/pdf-block-resizable-shell.tsx
new file mode 100644
index 0000000..215f860
--- /dev/null
+++ b/apps/v4/components/pdf-block-resizable-shell.tsx
@@ -0,0 +1,71 @@
+"use client"
+
+import * as React from "react"
+
+import { cn } from "@/lib/utils"
+import { useMediaQuery } from "@/hooks/use-media-query"
+import {
+ ResizableHandle,
+ ResizablePanel,
+ ResizablePanelGroup,
+} from "@/components/ui/resizable"
+
+type PdfBlockResizableShellProps = {
+ autoSaveId: string
+ className?: string
+ heightClassName?: string
+ left: React.ReactNode
+ leftDefaultSize?: number
+ leftMinSize?: number
+ right: React.ReactNode
+ rightDefaultSize?: number
+ rightMaxSize?: number
+ rightMinSize?: number
+}
+
+export function PdfBlockResizableShell({
+ autoSaveId,
+ className,
+ heightClassName = "h-[620px]",
+ left,
+ leftDefaultSize,
+ leftMinSize,
+ right,
+ rightDefaultSize = 34,
+ rightMaxSize = 52,
+ rightMinSize = 24,
+}: PdfBlockResizableShellProps) {
+ const isDesktop = useMediaQuery("lg")
+ const direction = isDesktop ? "horizontal" : "vertical"
+ const resolvedLeftDefaultSize =
+ leftDefaultSize ?? (isDesktop ? 100 - rightDefaultSize : 62)
+
+ return (
+ <ResizablePanelGroup
+ direction={direction}
+ autoSaveId={`${autoSaveId}-${direction}`}
+ className={cn(
+ heightClassName,
+ "max-h-[calc(100vh-8rem)] min-h-[420px] overflow-hidden bg-background",
+ className
+ )}
+ >
+ <ResizablePanel
+ defaultSize={resolvedLeftDefaultSize}
+ minSize={leftMinSize ?? (isDesktop ? 42 : 34)}
+ className="min-h-0 min-w-0 overflow-hidden"
+ >
+ {left}
+ </ResizablePanel>
+ <ResizableHandle className="group z-10" withHandle />
+ <ResizablePanel
+ defaultSize={isDesktop ? rightDefaultSize : 38}
+ minSize={isDesktop ? rightMinSize : 24}
+ maxSize={isDesktop ? rightMaxSize : 66}
+ className="min-h-0 min-w-0 overflow-hidden"
+ >
+ {right}
+ </ResizablePanel>
+ </ResizablePanelGroup>
+ )
+}
diff --git a/apps/v4/components/pdf-dropzone-block.tsx b/apps/v4/components/pdf-dropzone-block.tsx
new file mode 100644
index 0000000..0560895
--- /dev/null
+++ b/apps/v4/components/pdf-dropzone-block.tsx
@@ -0,0 +1,85 @@
+"use client"
+
+import * as React from "react"
+import { FileUploadIcon } from "@hugeicons/core-free-icons"
+
+import { PDFViewer } from "@/components/ui/pdf-viewer"
+import { FileUpload } from "@/components/file-upload-docs"
+
+const PDF_ACCEPT = "application/pdf,.pdf"
+const DEFAULT_ZOOM = 0.75
+
+function isPdfFile(file: File) {
+ return (
+ file.type === "application/pdf" || file.name.toLowerCase().endsWith(".pdf")
+ )
+}
+
+export function PdfDropzoneBlock() {
+ const [pdfFile, setPdfFile] = React.useState<{
+ name: string
+ url: string
+ } | null>(null)
+ const objectUrlRef = React.useRef<string | null>(null)
+
+ const loadPdf = React.useCallback((files: File[]) => {
+ const nextFile = files.find(isPdfFile)
+
+ if (!nextFile) return
+
+ const nextUrl = URL.createObjectURL(nextFile)
+
+ if (objectUrlRef.current) {
+ URL.revokeObjectURL(objectUrlRef.current)
+ }
+
+ objectUrlRef.current = nextUrl
+ setPdfFile({
+ name: nextFile.name,
+ url: nextUrl,
+ })
+ }, [])
+
+ React.useEffect(() => {
+ return () => {
+ if (objectUrlRef.current) {
+ URL.revokeObjectURL(objectUrlRef.current)
+ }
+ }
+ }, [])
+
+ if (!pdfFile) {
+ return (
+ <div className="grid h-[720px] place-items-center bg-background p-4">
+ <FileUpload
+ accept={PDF_ACCEPT}
+ acceptedFileTypes={[{ label: "PDF", icon: FileUploadIcon }]}
+ browseLabel="Browse PDF"
+ className="w-full max-w-xl"
+ description="PDF files only"
+ draggingLabel="Drop PDF"
+ multiple={false}
+ showFileList={false}
+ title="Drop a PDF to preview"
+ onFilesAccepted={loadPdf}
+ />
+ </div>
+ )
+ }
+
+ return (
+ <div className="h-[720px] bg-background">
+ <PDFViewer
+ key={pdfFile.url}
+ file={pdfFile.url}
+ defaultZoom={DEFAULT_ZOOM}
+ onPdfUpload={(file) => loadPdf([file])}
+ toolbarActions={
+ <div className="hidden max-w-40 truncate text-xs text-muted-foreground sm:block">
+ {pdfFile.name}
+ </div>
+ }
+ />
+ </div>
+ )
+}
diff --git a/apps/v4/components/pdf-viewer-blocks.tsx b/apps/v4/components/pdf-viewer-blocks.tsx
new file mode 100644
index 0000000..ce03006
--- /dev/null
+++ b/apps/v4/components/pdf-viewer-blocks.tsx
@@ -0,0 +1,147 @@
+"use client"
+
+import * as React from "react"
+import Link from "next/link"
+import { ArrowUpRight01Icon, Refresh01Icon } from "@hugeicons/core-free-icons"
+import { HugeiconsIcon } from "@hugeicons/react"
+
+import { Button } from "@/components/ui/button"
+import { CitationsBlock } from "@/components/citations-docs"
+import { DocumentSplitsBlock } from "@/components/document-splitter-docs"
+import { ESignatureBlock } from "@/components/e-signature-docs"
+import { HumanReviewBlock } from "@/components/human-review-docs"
+import { OcrBlocksBlock } from "@/components/ocr-blocks-docs"
+import { PdfDropzoneBlock } from "@/components/pdf-dropzone-block"
+
+const pdfViewerBlocks = [
+ {
+ id: "pdf-dropzone",
+ title: "PDF Dropzone",
+ description:
+ "A PDF-only upload dropzone that opens the dropped file in the shared viewer.",
+ command: "npx shadcn@latest add pdf-viewer file-upload",
+ docsHref: "/docs/components/file-upload",
+ component: PdfDropzoneBlock,
+ },
+ {
+ id: "citations",
+ title: "Citations",
+ description:
+ "Evidence cards that scroll the PDF viewer to source bounding boxes.",
+ command: "npx shadcn@latest add citations",
+ docsHref: "/docs/components/pdf-viewer/citations",
+ component: CitationsBlock,
+ },
+ {
+ id: "ocr-blocks",
+ title: "OCR Blocks",
+ description:
+ "Structured OCR review with typed blocks, confidence, and page overlays.",
+ hideHeader: true,
+ command: "npx shadcn@latest add ocr-blocks",
+ docsHref: "/docs/components/pdf-viewer/ocr-blocks",
+ component: OcrBlocksBlock,
+ },
+ {
+ id: "e-signature",
+ title: "E-Signature",
+ description:
+ "Signature fields connected to the PDF canvas and signed PDF export.",
+ hideHeader: true,
+ command: "npx shadcn@latest add e-signature",
+ docsHref: "/docs/components/pdf-viewer/e-signature",
+ component: ESignatureBlock,
+ },
+ {
+ id: "human-review",
+ title: "Human Review",
+ description:
+ "Extraction review cards connected to source evidence in the PDF viewer.",
+ command: "npx shadcn@latest add human-review pdf-viewer",
+ docsHref: "/docs/components/pdf-viewer/human-review",
+ component: HumanReviewBlock,
+ },
+ {
+ id: "document-splits",
+ title: "Document Splits",
+ description:
+ "Lazy page thumbnails, draggable split groups, and PDF navigation.",
+ command: "npx shadcn@latest add document-splits",
+ docsHref: "/docs/components/pdf-viewer/document-splits",
+ component: DocumentSplitsBlock,
+ },
+]
+
+export function PdfViewerBlocks() {
+ return (
+ <section className="space-y-12">
+ {pdfViewerBlocks.map((block) => (
+ <PdfViewerBlockPreview key={block.id} block={block} />
+ ))}
+ </section>
+ )
+}
+
+function PdfViewerBlockPreview({
+ block,
+}: {
+ block: (typeof pdfViewerBlocks)[number]
+}) {
+ const [previewKey, setPreviewKey] = React.useState(0)
+ const Preview = block.component
+
+ return (
+ <article id={block.id} className="space-y-3">
+ <div
+ className={[
+ "flex flex-col gap-3 sm:flex-row sm:items-end",
+ block.hideHeader ? "sm:justify-end" : "sm:justify-between",
+ ].join(" ")}
+ >
+ {block.hideHeader ? null : (
+ <div className="min-w-0">
+ <h3 className="font-heading text-lg font-medium tracking-tight">
+ {block.title}
+ </h3>
+ <p className="mt-1 max-w-2xl text-sm text-muted-foreground">
+ {block.description}
+ </p>
+ </div>
+ )}
+ <div className="flex shrink-0 items-center gap-2">
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ render={<Link href={block.docsHref} target="_blank" />}
+ >
+ Open in New Tab
+ <HugeiconsIcon icon={ArrowUpRight01Icon} className="size-4" />
+ </Button>
+ <Button
+ type="button"
+ variant="outline"
+ size="icon-sm"
+ aria-label={`Refresh ${block.title} preview`}
+ onClick={() => setPreviewKey((value) => value + 1)}
+ >
+ <HugeiconsIcon icon={Refresh01Icon} className="size-4" />
+ </Button>
+ </div>
+ </div>
+ <div className="overflow-hidden rounded-xl border bg-background shadow-xs">
+ <div className="flex min-h-11 items-center justify-between gap-3 border-b bg-muted/30 px-3">
+ <code className="truncate text-xs text-muted-foreground">
+ {block.command}
+ </code>
+ <div className="hidden text-xs text-muted-foreground sm:block">
+ Preview
+ </div>
+ </div>
+ <div className="bg-background">
+ <Preview key={previewKey} />
+ </div>
+ </div>
+ </article>
+ )
+}
diff --git a/apps/v4/components/pdf-viewer-docs.tsx b/apps/v4/components/pdf-viewer-docs.tsx
index 4e0210c..61d75c9 100644
--- a/apps/v4/components/pdf-viewer-docs.tsx
+++ b/apps/v4/components/pdf-viewer-docs.tsx
@@ -109,10 +109,10 @@ function PdfViewerLoadingShell() {
<HugeiconsIcon icon={MinusSignCircleIcon} className="size-4" />
</Button>
</ToolbarTooltip>
- <Select value="0.5" disabled>
+ <Select value="0.75" disabled>
<div className="hidden sm:block">
<SelectTrigger size="sm" className="w-[84px] min-w-[84px]">
- <SelectValue placeholder="Zoom">50%</SelectValue>
+ <SelectValue placeholder="Zoom">75%</SelectValue>
</SelectTrigger>
</div>
</Select>
@@ -175,6 +175,7 @@ const pdfViewerUsageCode = `"use client";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
+import { ScrollArea } from "@/components/ui/scroll-area";
import {
Popover,
PopoverContent,
@@ -228,6 +229,7 @@ const PAGE_BASE_WIDTH = 612;
const PAGE_BASE_HEIGHT = 792;
const MAX_DEVICE_PIXEL_RATIO = 2;
const THUMBNAIL_WIDTH = 92;
+const DEFAULT_ZOOM = 0.75;
function createSearchStore() {
let draftValue = "";
@@ -552,7 +554,7 @@ const PdfPages = memo(function PdfPages({
function Component({ url = DEFAULT_PDF_URL }: { url?: string }) {
const [numPages, setNumPages] = useState<number | null>(null);
const [currentPage, setCurrentPage] = useState(1);
- const [zoom, setZoom] = useState(0.5);
+ const [zoom, setZoom] = useState(DEFAULT_ZOOM);
const [rotation, setRotation] = useState(0);
const [sidebarOpen, setSidebarOpen] = useState(true);
const [fileUrl, setFileUrl] = useState(url);
@@ -897,51 +899,53 @@ function Component({ url = DEFAULT_PDF_URL }: { url?: string }) {
<div className="flex h-full min-h-0 w-full flex-1">
<aside
className={cn(
- "hidden shrink-0 overflow-hidden border-r bg-sidebar transition-[width] md:block",
+ "hidden w-40 shrink-0 overflow-hidden border-r bg-sidebar transition-[margin-left,border-color] duration-200 ease-out md:block",
sidebarOpen && !isViewerLoading && !loadError
- ? "w-40"
- : "w-0 border-r-0"
+ ? "ml-0"
+ : "-ml-40 border-r-0"
)}
>
- <div className="h-full overflow-y-auto overscroll-contain p-4">
- <div className="flex flex-col items-center gap-3">
- {pageNumbers.map((pageNumber) => (
- <Button
- variant="ghost"
- size="sm"
- key={pageNumber}
- className={cn(
- "!h-auto w-full flex-col items-center gap-2 p-2 text-xs text-muted-foreground shadow-none hover:bg-sidebar-accent",
- pageNumber === currentPage && "bg-sidebar-accent"
- )}
- onFocus={(event) => event.currentTarget.blur()}
- onMouseDown={preserveThumbnailClickScroll}
- onPointerDown={preserveThumbnailClickScroll}
- onClick={() => scrollToPage(pageNumber)}
- >
- <div
- className="shrink-0 overflow-hidden border bg-background shadow-xs"
- style={thumbnailSize}
+ <ScrollArea className="h-full" scrollFade>
+ <div className="p-4">
+ <div className="flex flex-col items-center gap-3">
+ {pageNumbers.map((pageNumber) => (
+ <Button
+ variant="ghost"
+ size="sm"
+ key={pageNumber}
+ className={cn(
+ "!h-auto w-full flex-col items-center gap-2 p-2 text-xs text-muted-foreground shadow-none hover:bg-sidebar-accent",
+ pageNumber === currentPage && "bg-sidebar-accent"
+ )}
+ onFocus={(event) => event.currentTarget.blur()}
+ onMouseDown={preserveThumbnailClickScroll}
+ onPointerDown={preserveThumbnailClickScroll}
+ onClick={() => scrollToPage(pageNumber)}
>
- <Thumbnail
- pageNumber={pageNumber}
- className="block size-full [&_.react-pdf__Thumbnail__page]:size-full [&_canvas]:size-full"
- width={THUMBNAIL_WIDTH}
- rotate={rotation}
- />
- </div>
- {pageNumber}
- </Button>
- ))}
+ <div
+ className="shrink-0 overflow-hidden border bg-background shadow-xs"
+ style={thumbnailSize}
+ >
+ <Thumbnail
+ pageNumber={pageNumber}
+ className="flex size-full items-center justify-center [&_.react-pdf__Thumbnail__page]:!m-0 [&_.react-pdf__Thumbnail__page]:!h-auto [&_.react-pdf__Thumbnail__page]:!w-full [&_.react-pdf__Thumbnail__page]:overflow-hidden [&_canvas]:!h-auto [&_canvas]:!w-full"
+ width={THUMBNAIL_WIDTH}
+ rotate={rotation}
+ />
+ </div>
+ {pageNumber}
+ </Button>
+ ))}
+ </div>
</div>
- </div>
+ </ScrollArea>
</aside>
- <div
- ref={viewportRef}
- className={cn(
- "min-h-0 min-w-0 flex-1 overflow-auto",
+ <ScrollArea
+ className="min-h-0 min-w-0 flex-1"
+ viewportClassName={cn(
isPageRendering && !loadError && "invisible"
)}
+ viewportRef={viewportRef}
>
<div className="flex min-h-full w-max min-w-full flex-col items-center justify-start gap-6 p-6">
<PdfPages
@@ -953,7 +957,7 @@ function Component({ url = DEFAULT_PDF_URL }: { url?: string }) {
onFirstPageRender={handleFirstPageRender}
/>
</div>
- </div>
+ </ScrollArea>
</div>
</Document>
</div>
diff --git a/apps/v4/components/pdf-viewer-preview-client.tsx b/apps/v4/components/pdf-viewer-preview-client.tsx
index 5289a5d..a0f3930 100644
--- a/apps/v4/components/pdf-viewer-preview-client.tsx
+++ b/apps/v4/components/pdf-viewer-preview-client.tsx
@@ -15,6 +15,7 @@ import { Document, Page, pdfjs, Thumbnail } from "react-pdf"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
+import { ScrollArea } from "@/components/ui/scroll-area"
import { Input } from "@/registry/new-york-v4/ui/input"
import {
Popover,
@@ -45,6 +46,7 @@ const PAGE_BASE_WIDTH = 612
const PAGE_BASE_HEIGHT = 792
const MAX_DEVICE_PIXEL_RATIO = 2
const THUMBNAIL_WIDTH = 92
+const DEFAULT_ZOOM = 0.75
function createSearchStore() {
let draftValue = ""
@@ -365,7 +367,7 @@ const PdfPages = React.memo(function PdfPages({
export function PdfViewerPreviewClient() {
const [numPages, setNumPages] = React.useState<number | null>(null)
const [currentPage, setCurrentPage] = React.useState(1)
- const [zoom, setZoom] = React.useState(0.5)
+ const [zoom, setZoom] = React.useState(DEFAULT_ZOOM)
const [rotation, setRotation] = React.useState(0)
const [sidebarOpen, setSidebarOpen] = React.useState(true)
const [fileUrl, setFileUrl] = React.useState<string>(SAMPLE_PDF_URL)
@@ -718,51 +720,53 @@ export function PdfViewerPreviewClient() {
<div className="flex h-full min-h-0 w-full flex-1">
<aside
className={cn(
- "hidden shrink-0 overflow-hidden border-r bg-sidebar transition-[width] md:block",
+ "hidden w-40 shrink-0 overflow-hidden border-r bg-sidebar transition-[margin-left,border-color] duration-200 ease-out md:block",
sidebarOpen && !isViewerLoading && !loadError
- ? "w-40"
- : "w-0 border-r-0"
+ ? "ml-0"
+ : "-ml-40 border-r-0"
)}
>
- <div className="h-full overflow-y-auto overscroll-contain p-4">
- <div className="flex flex-col items-center gap-3">
- {pageNumbers.map((pageNumber) => (
- <Button
- variant="ghost"
- size="sm"
- key={pageNumber}
- className={cn(
- "!h-auto w-full flex-col items-center gap-2 p-2 text-xs text-muted-foreground shadow-none hover:bg-sidebar-accent",
- pageNumber === currentPage && "bg-sidebar-accent"
- )}
- onFocus={(event) => event.currentTarget.blur()}
- onMouseDown={preserveThumbnailClickScroll}
- onPointerDown={preserveThumbnailClickScroll}
- onClick={() => scrollToPage(pageNumber)}
- >
- <div
- className="shrink-0 overflow-hidden border bg-background shadow-xs"
- style={thumbnailSize}
+ <ScrollArea className="h-full" scrollFade>
+ <div className="p-4">
+ <div className="flex flex-col items-center gap-3">
+ {pageNumbers.map((pageNumber) => (
+ <Button
+ variant="ghost"
+ size="sm"
+ key={pageNumber}
+ className={cn(
+ "!h-auto w-full flex-col items-center gap-2 p-2 text-xs text-muted-foreground shadow-none hover:bg-sidebar-accent",
+ pageNumber === currentPage && "bg-sidebar-accent"
+ )}
+ onFocus={(event) => event.currentTarget.blur()}
+ onMouseDown={preserveThumbnailClickScroll}
+ onPointerDown={preserveThumbnailClickScroll}
+ onClick={() => scrollToPage(pageNumber)}
>
- <Thumbnail
- pageNumber={pageNumber}
- className="block size-full [&_.react-pdf__Thumbnail__page]:size-full [&_canvas]:size-full"
- width={THUMBNAIL_WIDTH}
- rotate={rotation}
- />
- </div>
- {pageNumber}
- </Button>
- ))}
+ <div
+ className="shrink-0 overflow-hidden border bg-background shadow-xs"
+ style={thumbnailSize}
+ >
+ <Thumbnail
+ pageNumber={pageNumber}
+ className="flex size-full items-center justify-center [&_.react-pdf__Thumbnail__page]:!m-0 [&_.react-pdf__Thumbnail__page]:!h-auto [&_.react-pdf__Thumbnail__page]:!w-full [&_.react-pdf__Thumbnail__page]:overflow-hidden [&_canvas]:!h-auto [&_canvas]:!w-full"
+ width={THUMBNAIL_WIDTH}
+ rotate={rotation}
+ />
+ </div>
+ {pageNumber}
+ </Button>
+ ))}
+ </div>
</div>
- </div>
+ </ScrollArea>
</aside>
- <div
- ref={viewportRef}
- className={cn(
- "min-h-0 min-w-0 flex-1 overflow-auto",
+ <ScrollArea
+ className="min-h-0 min-w-0 flex-1"
+ viewportClassName={cn(
isPageRendering && !loadError && "invisible"
)}
+ viewportRef={viewportRef}
>
<div className="flex min-h-full w-max min-w-full flex-col items-center justify-start gap-6 p-6">
<PdfPages
@@ -774,7 +778,7 @@ export function PdfViewerPreviewClient() {
onFirstPageRender={handleFirstPageRender}
/>
</div>
- </div>
+ </ScrollArea>
</div>
</Document>
</div>
diff --git a/apps/v4/components/root-components-collage.tsx b/apps/v4/components/root-components-collage.tsx
new file mode 100644
index 0000000..0ed1603
--- /dev/null
+++ b/apps/v4/components/root-components-collage.tsx
@@ -0,0 +1,107 @@
+"use client"
+
+import type * as React from "react"
+import dynamic from "next/dynamic"
+
+import { Citations } from "@/components/citations-docs"
+import { CsvViewerPreviewClient } from "@/components/csv-viewer-docs"
+import { FileThumbnail } from "@/components/file-thumbnail-docs"
+import { FileUpload } from "@/components/file-upload-docs"
+import { OcrBlocks } from "@/components/ocr-blocks-docs"
+
+const PdfViewerPreviewClient = dynamic(
+ () =>
+ import("@/components/pdf-viewer-preview-client").then(
+ (module) => module.PdfViewerPreviewClient
+ ),
+ {
+ ssr: false,
+ loading: () => (
+ <div className="grid h-[560px] place-items-center bg-background text-sm text-muted-foreground">
+ Loading PDF viewer...
+ </div>
+ ),
+ }
+)
+
+const thumbnailFiles = [
+ {
+ name: "attention.pdf",
+ type: "application/pdf",
+ url: "/samples/attention.pdf",
+ size: "15 pages",
+ },
+ {
+ name: "opengraph-image.png",
+ type: "image/png",
+ url: "/opengraph-image.png",
+ size: "1200 x 630",
+ },
+]
+
+export function MobileRootPreview() {
+ return (
+ <ComponentCrop className="h-[560px]">
+ <PdfViewerPreviewClient />
+ </ComponentCrop>
+ )
+}
+
+export function RootComponentsCollage() {
+ return (
+ <div className="mx-auto grid gap-4 py-1 md:grid-cols-2 lg:grid-cols-3">
+ <div className="flex flex-col gap-4">
+ <ComponentCrop className="h-[560px]">
+ <PdfViewerPreviewClient />
+ </ComponentCrop>
+ <ThumbnailPair />
+ </div>
+ <div className="flex flex-col gap-4">
+ <ComponentCrop className="h-[280px]">
+ <FileUpload className="p-4" />
+ </ComponentCrop>
+ <ComponentCrop className="h-[400px]">
+ <CsvViewerPreviewClient />
+ </ComponentCrop>
+ </div>
+ <div className="flex flex-col gap-4">
+ <ComponentCrop className="h-[430px]">
+ <Citations />
+ </ComponentCrop>
+ <ComponentCrop className="h-[430px]">
+ <OcrBlocks />
+ </ComponentCrop>
+ </div>
+ </div>
+ )
+}
+
+function ComponentCrop({
+ className,
+ children,
+}: {
+ className?: string
+ children: React.ReactNode
+}) {
+ return (
+ <div className={["overflow-hidden rounded-lg", className].join(" ")}>
+ {children}
+ </div>
+ )
+}
+
+function ThumbnailPair() {
+ return (
+ <div className="grid gap-3 overflow-hidden rounded-lg bg-background p-3 sm:grid-cols-2">
+ {thumbnailFiles.map((file, index) => (
+ <FileThumbnail
+ key={file.url}
+ file={file}
+ showMetadata={false}
+ thumbnailWidth={220}
+ loadingDelayMs={index === 1 ? 1600 : 0}
+ />
+ ))}
+ </div>
+ )
+}
diff --git a/apps/v4/components/ui/input.tsx b/apps/v4/components/ui/input.tsx
new file mode 100644
index 0000000..533c17a
--- /dev/null
+++ b/apps/v4/components/ui/input.tsx
@@ -0,0 +1,7 @@
+"use client"
+
+export {
+ Input,
+ InputPrimitive,
+ type InputProps,
+} from "@/registry/new-york-v4/ui/input"
diff --git a/apps/v4/components/ui/pdf-viewer.tsx b/apps/v4/components/ui/pdf-viewer.tsx
new file mode 100644
index 0000000..0f3dcb6
--- /dev/null
+++ b/apps/v4/components/ui/pdf-viewer.tsx
@@ -0,0 +1,987 @@
+"use client"
+
+import * as React from "react"
+import {
+ Loading03Icon,
+ MinusSignCircleIcon,
+ PlusSignCircleIcon,
+ RotateClockwiseIcon,
+ Search01Icon,
+ SidebarLeftIcon,
+ Upload01Icon,
+} from "@hugeicons/core-free-icons"
+import { HugeiconsIcon } from "@hugeicons/react"
+import type * as ReactPdf from "react-pdf"
+
+import { cn } from "@/lib/utils"
+import { Button } from "@/components/ui/button"
+import { ScrollArea } from "@/components/ui/scroll-area"
+import { Input } from "@/registry/new-york-v4/ui/input"
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/registry/new-york-v4/ui/popover"
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/registry/new-york-v4/ui/select"
+import { Separator } from "@/registry/new-york-v4/ui/separator"
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/registry/new-york-v4/ui/tooltip"
+
+type ReactPdfModule = typeof ReactPdf
+
+export type PDFViewerPageOverlayProps = {
+ pageNumber: number
+ pageWidth: number
+ pageHeight: number
+ scale: number
+ rotation: number
+}
+
+export type PDFViewerHandle = {
+ scrollToPage: (pageNumber: number, options?: ScrollIntoViewOptions) => void
+ scrollToPageArea: (
+ pageNumber: number,
+ area: { top: number; left?: number; width?: number; height?: number },
+ options?: ScrollToOptions
+ ) => void
+ getViewportElement: () => HTMLDivElement | null
+}
+
+export type PDFViewerProps = {
+ file?: string
+ className?: string
+ defaultZoom?: number
+ pageWidth?: number
+ pageHeight?: number
+ pageNumbers?: number[]
+ pageRenderBuffer?: number
+ showRotateControls?: boolean
+ showUpload?: boolean
+ toolbarActions?: React.ReactNode
+ pageClassName?: (pageNumber: number) => string | undefined
+ renderPageOverlay?: (props: PDFViewerPageOverlayProps) => React.ReactNode
+ onActivePageChange?: (pageNumber: number) => void
+ onDocumentLoadSuccess?: (numPages: number) => void
+ onPdfUpload?: (file: File) => void
+ onPagePointerDown?: (
+ event: React.PointerEvent<HTMLDivElement>,
+ pageNumber: number
+ ) => void
+ onPagePointerMove?: (
+ event: React.PointerEvent<HTMLDivElement>,
+ pageNumber: number
+ ) => void
+ onPagePointerUp?: (
+ event: React.PointerEvent<HTMLDivElement>,
+ pageNumber: number
+ ) => void
+ onPagePointerCancel?: (
+ event: React.PointerEvent<HTMLDivElement>,
+ pageNumber: number
+ ) => void
+}
+
+const DEFAULT_FILE = "/samples/attention.pdf"
+const DEFAULT_PAGE_WIDTH = 612
+const DEFAULT_PAGE_HEIGHT = 792
+const DEFAULT_ZOOM = 0.75
+const ZOOM_OPTIONS = [0.5, 0.75, 1, 1.25, 1.5, 2]
+const MAX_DEVICE_PIXEL_RATIO = 2
+const DEFAULT_PAGE_RENDER_BUFFER = 2
+const THUMBNAIL_WIDTH = 92
+const PDF_WORKER_URL = new URL(
+ "pdfjs-dist/legacy/build/pdf.worker.min.mjs",
+ import.meta.url
+).toString()
+
+type SearchHighlight = {
+ id: string
+ left: number
+ top: number
+ width: number
+ height: number
+}
+
+function ToolbarTooltip({
+ label,
+ children,
+}: {
+ label: string
+ children: React.ReactNode
+}) {
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span className="inline-flex">{children}</span>
+ </TooltipTrigger>
+ <TooltipContent side="bottom">{label}</TooltipContent>
+ </Tooltip>
+ )
+}
+
+function SearchInput({
+ value,
+ onValueChange,
+ onApply,
+ onClear,
+}: {
+ value: string
+ onValueChange: (value: string) => void
+ onApply: () => void
+ onClear: () => void
+}) {
+ return (
+ <div className="space-y-3">
+ <Input
+ placeholder="Search text"
+ value={value}
+ onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
+ onValueChange(event.target.value)
+ }
+ onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {
+ if (event.key === "Enter") {
+ onApply()
+ }
+ }}
+ />
+ <div className="flex justify-end gap-2">
+ <Button type="button" variant="outline" size="sm" onClick={onClear}>
+ Clear
+ </Button>
+ <Button type="button" size="sm" onClick={onApply}>
+ Search
+ </Button>
+ </div>
+ </div>
+ )
+}
+
+function PDFViewerPage({
+ reactPdf,
+ pageNumber,
+ pageStyle,
+ renderedPageWidth,
+ zoom,
+ rotation,
+ shouldRenderPage,
+ searchQuery,
+ isFirstRenderedPage,
+ pageClassName,
+ renderPageOverlay,
+ onFirstPageSettled,
+ onPagePointerDown,
+ onPagePointerMove,
+ onPagePointerUp,
+ onPagePointerCancel,
+}: {
+ reactPdf: ReactPdfModule
+ pageNumber: number
+ pageStyle: React.CSSProperties & { width: number; height: number }
+ renderedPageWidth: number
+ zoom: number
+ rotation: number
+ shouldRenderPage: boolean
+ searchQuery: string
+ isFirstRenderedPage: boolean
+ pageClassName?: (pageNumber: number) => string | undefined
+ renderPageOverlay?: (props: PDFViewerPageOverlayProps) => React.ReactNode
+ onFirstPageSettled: () => void
+ onPagePointerDown?: (
+ event: React.PointerEvent<HTMLDivElement>,
+ pageNumber: number
+ ) => void
+ onPagePointerMove?: (
+ event: React.PointerEvent<HTMLDivElement>,
+ pageNumber: number
+ ) => void
+ onPagePointerUp?: (
+ event: React.PointerEvent<HTMLDivElement>,
+ pageNumber: number
+ ) => void
+ onPagePointerCancel?: (
+ event: React.PointerEvent<HTMLDivElement>,
+ pageNumber: number
+ ) => void
+}) {
+ const pageRef = React.useRef<HTMLDivElement>(null)
+ const [searchHighlights, setSearchHighlights] = React.useState<
+ SearchHighlight[]
+ >([])
+ const hasSearchQuery = Boolean(searchQuery.trim())
+
+ const updateSearchHighlights = React.useCallback(() => {
+ const pageElement = pageRef.current
+ const query = searchQuery.trim().toLowerCase()
+
+ if (!pageElement || !query) {
+ setSearchHighlights([])
+ return
+ }
+
+ const textLayer = pageElement.querySelector<HTMLElement>(
+ ".react-pdf__Page__textContent"
+ )
+
+ if (!textLayer) {
+ setSearchHighlights([])
+ return
+ }
+
+ const pageRect = pageElement.getBoundingClientRect()
+ const nextHighlights: SearchHighlight[] = []
+
+ textLayer.querySelectorAll<HTMLElement>("span").forEach((span, index) => {
+ const textNode = Array.from(span.childNodes).find(
+ (node): node is Text => node.nodeType === Node.TEXT_NODE
+ )
+ const text = textNode?.textContent ?? ""
+ const normalizedText = text.toLowerCase()
+ let matchIndex = normalizedText.indexOf(query)
+
+ while (textNode && matchIndex !== -1) {
+ const range = document.createRange()
+ range.setStart(textNode, matchIndex)
+ range.setEnd(textNode, matchIndex + query.length)
+
+ Array.from(range.getClientRects()).forEach((rect, rectIndex) => {
+ if (rect.width <= 0 || rect.height <= 0) return
+
+ nextHighlights.push({
+ id: `${pageNumber}-${index}-${matchIndex}-${rectIndex}`,
+ left: rect.left - pageRect.left,
+ top: rect.top - pageRect.top,
+ width: rect.width,
+ height: rect.height,
+ })
+ })
+
+ range.detach()
+ matchIndex = normalizedText.indexOf(query, matchIndex + query.length)
+ }
+ })
+
+ setSearchHighlights(nextHighlights)
+ }, [pageNumber, searchQuery])
+
+ React.useEffect(() => {
+ if (!shouldRenderPage || !hasSearchQuery) {
+ setSearchHighlights([])
+ return
+ }
+
+ const frame = window.requestAnimationFrame(updateSearchHighlights)
+ return () => window.cancelAnimationFrame(frame)
+ }, [hasSearchQuery, shouldRenderPage, updateSearchHighlights])
+
+ return (
+ <div
+ ref={pageRef}
+ data-pdf-viewer-page={pageNumber}
+ className={cn("relative", pageClassName?.(pageNumber))}
+ style={pageStyle}
+ onPointerDown={(event) => onPagePointerDown?.(event, pageNumber)}
+ onPointerMove={(event) => onPagePointerMove?.(event, pageNumber)}
+ onPointerUp={(event) => onPagePointerUp?.(event, pageNumber)}
+ onPointerCancel={(event) => onPagePointerCancel?.(event, pageNumber)}
+ >
+ {shouldRenderPage ? (
+ <>
+ <reactPdf.Page
+ pageNumber={pageNumber}
+ width={renderedPageWidth}
+ rotate={rotation}
+ className="overflow-hidden border bg-background shadow-xs"
+ renderAnnotationLayer={false}
+ renderTextLayer={hasSearchQuery}
+ devicePixelRatio={
+ typeof window === "undefined"
+ ? 1
+ : Math.min(MAX_DEVICE_PIXEL_RATIO, window.devicePixelRatio || 1)
+ }
+ loading={
+ <div className="grid place-items-center" style={pageStyle}>
+ <HugeiconsIcon
+ icon={Loading03Icon}
+ className="size-4 animate-spin"
+ />
+ </div>
+ }
+ onRenderSuccess={
+ isFirstRenderedPage ? onFirstPageSettled : undefined
+ }
+ onRenderTextLayerSuccess={updateSearchHighlights}
+ onRenderError={isFirstRenderedPage ? onFirstPageSettled : undefined}
+ />
+ {searchHighlights.length ? (
+ <div className="pointer-events-none absolute inset-0 z-10">
+ {searchHighlights.map((highlight) => (
+ <div
+ key={highlight.id}
+ className="absolute rounded-[2px] bg-yellow-300/45 mix-blend-multiply ring-1 ring-yellow-500/20 dark:bg-yellow-300/35"
+ style={{
+ left: highlight.left,
+ top: highlight.top,
+ width: highlight.width,
+ height: highlight.height,
+ }}
+ />
+ ))}
+ </div>
+ ) : null}
+ </>
+ ) : (
+ <div className="size-full border bg-muted/30 shadow-xs" />
+ )}
+ {renderPageOverlay?.({
+ pageNumber,
+ pageWidth: pageStyle.width,
+ pageHeight: pageStyle.height,
+ scale: zoom,
+ rotation,
+ })}
+ </div>
+ )
+}
+
+export const PDFViewer = React.forwardRef<PDFViewerHandle, PDFViewerProps>(
+ function PDFViewer(
+ {
+ file = DEFAULT_FILE,
+ className,
+ defaultZoom = DEFAULT_ZOOM,
+ pageWidth = DEFAULT_PAGE_WIDTH,
+ pageHeight = DEFAULT_PAGE_HEIGHT,
+ pageNumbers,
+ pageRenderBuffer = DEFAULT_PAGE_RENDER_BUFFER,
+ showRotateControls = true,
+ showUpload = true,
+ toolbarActions,
+ pageClassName,
+ renderPageOverlay,
+ onActivePageChange,
+ onDocumentLoadSuccess,
+ onPdfUpload,
+ onPagePointerDown,
+ onPagePointerMove,
+ onPagePointerUp,
+ onPagePointerCancel,
+ },
+ ref
+ ) {
+ const [reactPdf, setReactPdf] = React.useState<ReactPdfModule | null>(null)
+ const [pdfFile, setPdfFile] = React.useState(file)
+ const [uploadedPdfUrl, setUploadedPdfUrl] = React.useState<string | null>(
+ null
+ )
+ const [numPages, setNumPages] = React.useState(0)
+ const [activePage, setActivePage] = React.useState(1)
+ const [zoom, setZoom] = React.useState(defaultZoom)
+ const [rotation, setRotation] = React.useState(0)
+ const [sidebarOpen, setSidebarOpen] = React.useState(true)
+ const [searchDraft, setSearchDraft] = React.useState("")
+ const [searchQuery, setSearchQuery] = React.useState("")
+ const [isDocumentLoading, setIsDocumentLoading] = React.useState(true)
+ const [isFirstPageRendering, setIsFirstPageRendering] = React.useState(true)
+ const [loadError, setLoadError] = React.useState(false)
+ const viewportRef = React.useRef<HTMLDivElement>(null)
+ const thumbnailClickScrollYRef = React.useRef<number | null>(null)
+
+ React.useEffect(() => {
+ setPdfFile(file)
+ }, [file])
+
+ React.useEffect(() => {
+ let mounted = true
+
+ void import("react-pdf")
+ .then((module) => {
+ module.pdfjs.GlobalWorkerOptions.workerSrc = PDF_WORKER_URL
+
+ if (mounted) {
+ setReactPdf(module)
+ }
+ })
+ .catch(() => {
+ if (mounted) {
+ setLoadError(true)
+ setIsDocumentLoading(false)
+ setIsFirstPageRendering(false)
+ }
+ })
+
+ return () => {
+ mounted = false
+ }
+ }, [])
+
+ React.useEffect(() => {
+ return () => {
+ if (uploadedPdfUrl) {
+ URL.revokeObjectURL(uploadedPdfUrl)
+ }
+ }
+ }, [uploadedPdfUrl])
+
+ const renderedPageNumbers = React.useMemo(() => {
+ if (pageNumbers?.length) return pageNumbers
+
+ return Array.from({ length: numPages || 1 }, (_, index) => index + 1)
+ }, [numPages, pageNumbers])
+
+ const firstRenderedPage = renderedPageNumbers[0] ?? 1
+ const isRotated = Math.abs(Math.round(rotation / 90)) % 2 === 1
+ const renderedPageWidth = (isRotated ? pageHeight : pageWidth) * zoom
+ const renderedPageHeight = (isRotated ? pageWidth : pageHeight) * zoom
+ const controlsDisabled = !reactPdf || !numPages
+ const isLoading = !reactPdf || isDocumentLoading || isFirstPageRendering
+ const thumbnailIsRotated = Math.abs(Math.round(rotation / 90)) % 2 === 1
+ const thumbnailSize = {
+ width: THUMBNAIL_WIDTH,
+ height: Math.round(
+ THUMBNAIL_WIDTH *
+ (thumbnailIsRotated ? pageWidth / pageHeight : pageHeight / pageWidth)
+ ),
+ }
+
+ const updateActivePageFromViewport = React.useCallback(() => {
+ const viewport = viewportRef.current
+ if (!viewport || !renderedPageNumbers.length) return
+
+ const viewportRect = viewport.getBoundingClientRect()
+ const viewportCenter = viewportRect.top + viewportRect.height / 2
+ let closestPage = renderedPageNumbers[0] ?? 1
+ let closestDistance = Number.POSITIVE_INFINITY
+
+ viewport
+ .querySelectorAll<HTMLElement>("[data-pdf-viewer-page]")
+ .forEach((page) => {
+ const pageRect = page.getBoundingClientRect()
+ const pageCenter = pageRect.top + pageRect.height / 2
+ const distance = Math.abs(pageCenter - viewportCenter)
+
+ if (distance < closestDistance) {
+ closestDistance = distance
+ closestPage = Number(page.dataset.pdfViewerPage || "1")
+ }
+ })
+
+ setActivePage((currentPage) => {
+ if (currentPage === closestPage) return currentPage
+ onActivePageChange?.(closestPage)
+ return closestPage
+ })
+ }, [onActivePageChange, renderedPageNumbers])
+
+ React.useEffect(() => {
+ const viewport = viewportRef.current
+ if (!viewport || !numPages) return
+
+ let frameId = 0
+ const handleScroll = () => {
+ window.cancelAnimationFrame(frameId)
+ frameId = window.requestAnimationFrame(updateActivePageFromViewport)
+ }
+
+ frameId = window.requestAnimationFrame(updateActivePageFromViewport)
+ viewport.addEventListener("scroll", handleScroll, { passive: true })
+
+ return () => {
+ window.cancelAnimationFrame(frameId)
+ viewport.removeEventListener("scroll", handleScroll)
+ }
+ }, [numPages, updateActivePageFromViewport])
+
+ React.useImperativeHandle(
+ ref,
+ () => ({
+ scrollToPage: (pageNumber, options) => {
+ const page = viewportRef.current?.querySelector<HTMLElement>(
+ `[data-pdf-viewer-page="${pageNumber}"]`
+ )
+
+ page?.scrollIntoView({
+ block: "start",
+ inline: "nearest",
+ ...options,
+ })
+ },
+ scrollToPageArea: (pageNumber, area, options) => {
+ const viewport = viewportRef.current
+ const page = viewport?.querySelector<HTMLElement>(
+ `[data-pdf-viewer-page="${pageNumber}"]`
+ )
+
+ if (!viewport || !page) return
+
+ const pageTop =
+ page.getBoundingClientRect().top -
+ viewport.getBoundingClientRect().top +
+ viewport.scrollTop
+ const targetTop =
+ pageTop +
+ (area.top / 100) * page.getBoundingClientRect().height -
+ 96
+
+ viewport.scrollTo({
+ top: Math.max(0, targetTop),
+ behavior: "smooth",
+ ...options,
+ })
+ },
+ getViewportElement: () => viewportRef.current,
+ }),
+ []
+ )
+
+ const restoreWindowScroll = React.useCallback((scrollY: number) => {
+ window.scrollTo({ top: scrollY })
+ window.requestAnimationFrame(() => {
+ window.scrollTo({ top: scrollY })
+ window.requestAnimationFrame(() => {
+ window.scrollTo({ top: scrollY })
+ })
+ })
+ ;[0, 50, 150, 300].forEach((delay) => {
+ window.setTimeout(() => {
+ window.scrollTo({ top: scrollY })
+ }, delay)
+ })
+ }, [])
+
+ const scrollToPage = React.useCallback(
+ (pageNumber: number) => {
+ const windowScrollY = thumbnailClickScrollYRef.current ?? window.scrollY
+ setActivePage(pageNumber)
+
+ const viewport = viewportRef.current
+ const page = viewport?.querySelector<HTMLElement>(
+ `[data-pdf-viewer-page="${pageNumber}"]`
+ )
+
+ if (!viewport || !page) {
+ restoreWindowScroll(windowScrollY)
+ return
+ }
+
+ viewport.scrollTo({
+ top:
+ page.getBoundingClientRect().top -
+ viewport.getBoundingClientRect().top +
+ viewport.scrollTop -
+ 24,
+ behavior: "auto",
+ })
+ restoreWindowScroll(windowScrollY)
+ window.setTimeout(() => {
+ if (thumbnailClickScrollYRef.current === windowScrollY) {
+ thumbnailClickScrollYRef.current = null
+ }
+ }, 350)
+ },
+ [restoreWindowScroll]
+ )
+
+ const preserveThumbnailClickScroll = React.useCallback(
+ (event: React.PointerEvent | React.MouseEvent) => {
+ event.preventDefault()
+
+ if (thumbnailClickScrollYRef.current === null) {
+ thumbnailClickScrollYRef.current = window.scrollY
+ }
+ },
+ []
+ )
+
+ const handleLoadStart = React.useCallback(() => {
+ setIsDocumentLoading(true)
+ setIsFirstPageRendering(true)
+ setLoadError(false)
+ setNumPages(0)
+ setActivePage(1)
+ onActivePageChange?.(1)
+ setSearchQuery("")
+ setSearchDraft("")
+ viewportRef.current?.scrollTo({ top: 0, left: 0 })
+ }, [onActivePageChange])
+
+ const handleLoadSuccess = React.useCallback(
+ ({ numPages: nextNumPages }: { numPages: number }) => {
+ setNumPages(nextNumPages)
+ setIsDocumentLoading(false)
+ setIsFirstPageRendering(true)
+ setLoadError(false)
+ setActivePage(1)
+ onActivePageChange?.(1)
+ onDocumentLoadSuccess?.(nextNumPages)
+ setSearchQuery("")
+ setSearchDraft("")
+ viewportRef.current?.scrollTo({ top: 0, left: 0 })
+ },
+ [onActivePageChange, onDocumentLoadSuccess]
+ )
+
+ const handleLoadError = React.useCallback(() => {
+ setIsDocumentLoading(false)
+ setIsFirstPageRendering(false)
+ setLoadError(true)
+ setNumPages(0)
+ }, [])
+
+ const handleUpload = React.useCallback(
+ (file: File) => {
+ const nextUrl = URL.createObjectURL(file)
+
+ setUploadedPdfUrl((previousUrl) => {
+ if (previousUrl) URL.revokeObjectURL(previousUrl)
+ return nextUrl
+ })
+ setPdfFile(nextUrl)
+ onPdfUpload?.(file)
+ },
+ [onPdfUpload]
+ )
+
+ return (
+ <div
+ data-slot="pdf-viewer"
+ className={cn(
+ "flex h-full max-h-full min-h-0 w-full flex-col overflow-hidden bg-background",
+ className
+ )}
+ >
+ <div className="flex min-h-12 items-center justify-between gap-3 border-b px-3">
+ <div className="flex items-center gap-2">
+ <TooltipProvider>
+ <ToolbarTooltip label="Toggle thumbnails">
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label="Toggle thumbnails"
+ disabled={controlsDisabled}
+ onClick={() => setSidebarOpen((open) => !open)}
+ >
+ <HugeiconsIcon icon={SidebarLeftIcon} className="size-4" />
+ </Button>
+ </ToolbarTooltip>
+ </TooltipProvider>
+ <div className="text-sm whitespace-nowrap text-primary">
+ Page {activePage} of {numPages || "-"}
+ </div>
+ </div>
+ <TooltipProvider>
+ <div className="flex min-w-0 items-center gap-1">
+ {showRotateControls ? (
+ <>
+ <ToolbarTooltip label="Rotate counterclockwise">
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label="Rotate counterclockwise"
+ disabled={controlsDisabled}
+ onClick={() => setRotation((value) => value - 90)}
+ >
+ <HugeiconsIcon
+ icon={RotateClockwiseIcon}
+ className="size-4 -scale-x-100"
+ />
+ </Button>
+ </ToolbarTooltip>
+ <ToolbarTooltip label="Rotate clockwise">
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label="Rotate clockwise"
+ disabled={controlsDisabled}
+ onClick={() => setRotation((value) => value + 90)}
+ >
+ <HugeiconsIcon
+ icon={RotateClockwiseIcon}
+ className="size-4"
+ />
+ </Button>
+ </ToolbarTooltip>
+ <Separator
+ orientation="vertical"
+ className="mx-1 h-4 self-center"
+ />
+ </>
+ ) : null}
+ <ToolbarTooltip label="Zoom out">
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label="Zoom out"
+ disabled={controlsDisabled || zoom <= ZOOM_OPTIONS[0]}
+ onClick={() => {
+ const currentIndex = ZOOM_OPTIONS.indexOf(zoom)
+ setZoom(ZOOM_OPTIONS[Math.max(0, currentIndex - 1)] ?? zoom)
+ }}
+ >
+ <HugeiconsIcon
+ icon={MinusSignCircleIcon}
+ className="size-4"
+ />
+ </Button>
+ </ToolbarTooltip>
+ <Select
+ value={String(zoom)}
+ onValueChange={(value) => setZoom(Number(value))}
+ disabled={controlsDisabled}
+ >
+ <SelectTrigger size="sm" className="w-[84px] min-w-[84px]">
+ <SelectValue placeholder="Zoom">
+ {Math.round(zoom * 100)}%
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {ZOOM_OPTIONS.map((option) => (
+ <SelectItem key={option} value={String(option)}>
+ {Math.round(option * 100)}%
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <ToolbarTooltip label="Zoom in">
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label="Zoom in"
+ disabled={
+ controlsDisabled ||
+ zoom >= ZOOM_OPTIONS[ZOOM_OPTIONS.length - 1]
+ }
+ onClick={() => {
+ const currentIndex = ZOOM_OPTIONS.indexOf(zoom)
+ setZoom(
+ ZOOM_OPTIONS[
+ Math.min(ZOOM_OPTIONS.length - 1, currentIndex + 1)
+ ] ?? zoom
+ )
+ }}
+ >
+ <HugeiconsIcon icon={PlusSignCircleIcon} className="size-4" />
+ </Button>
+ </ToolbarTooltip>
+ <Separator
+ orientation="vertical"
+ className="mx-1 h-4 self-center"
+ />
+ <Popover>
+ <ToolbarTooltip label="Search text">
+ <PopoverTrigger asChild>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label="Search text"
+ disabled={controlsDisabled}
+ >
+ <HugeiconsIcon icon={Search01Icon} className="size-4" />
+ </Button>
+ </PopoverTrigger>
+ </ToolbarTooltip>
+ <PopoverContent align="end" className="w-64">
+ <SearchInput
+ value={searchDraft}
+ onValueChange={setSearchDraft}
+ onApply={() => setSearchQuery(searchDraft)}
+ onClear={() => {
+ setSearchDraft("")
+ setSearchQuery("")
+ }}
+ />
+ </PopoverContent>
+ </Popover>
+ {toolbarActions ? (
+ <>
+ <Separator
+ orientation="vertical"
+ className="mx-1 h-4 self-center"
+ />
+ {toolbarActions}
+ </>
+ ) : null}
+ {showUpload ? (
+ <>
+ <Separator
+ orientation="vertical"
+ className="mx-1 h-4 self-center"
+ />
+ <ToolbarTooltip label="Upload PDF">
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label="Upload PDF"
+ render={
+ <label>
+ <input
+ type="file"
+ accept="application/pdf,.pdf"
+ className="sr-only"
+ onChange={(event) => {
+ const nextFile = event.target.files?.[0]
+
+ if (nextFile) {
+ handleUpload(nextFile)
+ event.currentTarget.value = ""
+ }
+ }}
+ />
+ <HugeiconsIcon
+ icon={Upload01Icon}
+ className="size-4"
+ />
+ </label>
+ }
+ />
+ </ToolbarTooltip>
+ </>
+ ) : null}
+ </div>
+ </TooltipProvider>
+ </div>
+ <div className="relative flex min-h-0 flex-1 overflow-hidden bg-muted/30">
+ {isLoading && !loadError ? (
+ <div className="absolute inset-0 z-20 grid place-items-center bg-background">
+ <HugeiconsIcon
+ icon={Loading03Icon}
+ className="size-4 animate-spin"
+ />
+ </div>
+ ) : null}
+ {loadError ? (
+ <div className="absolute inset-0 z-20 grid place-items-center bg-background p-6 text-sm text-muted-foreground">
+ Unable to load the PDF preview.
+ </div>
+ ) : null}
+ {reactPdf ? (
+ <reactPdf.Document
+ file={pdfFile}
+ className={cn(
+ "flex h-full min-h-0 w-full flex-1",
+ (isLoading || loadError) && "invisible"
+ )}
+ loading={null}
+ error={null}
+ onLoadStart={handleLoadStart}
+ onLoadSuccess={handleLoadSuccess}
+ onLoadError={handleLoadError}
+ >
+ <div className="flex h-full max-h-full min-h-0 w-full flex-1 overflow-hidden">
+ <aside
+ className={cn(
+ "hidden w-40 shrink-0 overflow-hidden border-r bg-sidebar transition-[margin-left,border-color] duration-200 ease-out md:block",
+ sidebarOpen && !isLoading && !loadError
+ ? "ml-0"
+ : "-ml-40 border-r-0"
+ )}
+ >
+ <ScrollArea className="h-full" scrollFade>
+ <div className="p-4">
+ <div className="flex flex-col items-center gap-3">
+ {renderedPageNumbers.map((pageNumber) => (
+ <Button
+ key={pageNumber}
+ type="button"
+ variant="ghost"
+ size="sm"
+ className={cn(
+ "!h-auto w-full flex-col items-center gap-2 p-2 text-xs text-muted-foreground shadow-none hover:bg-sidebar-accent",
+ pageNumber === activePage && "bg-sidebar-accent"
+ )}
+ onFocus={(event) => event.currentTarget.blur()}
+ onMouseDown={preserveThumbnailClickScroll}
+ onPointerDown={preserveThumbnailClickScroll}
+ onClick={() => scrollToPage(pageNumber)}
+ >
+ <div
+ className="shrink-0 overflow-hidden border bg-background shadow-xs"
+ style={thumbnailSize}
+ >
+ <reactPdf.Thumbnail
+ pageNumber={pageNumber}
+ width={THUMBNAIL_WIDTH}
+ rotate={rotation}
+ className="flex size-full items-center justify-center [&_.react-pdf__Thumbnail__page]:!m-0 [&_.react-pdf__Thumbnail__page]:!h-auto [&_.react-pdf__Thumbnail__page]:!w-full [&_.react-pdf__Thumbnail__page]:overflow-hidden [&_canvas]:!h-auto [&_canvas]:!w-full"
+ onItemClick={() => scrollToPage(pageNumber)}
+ />
+ </div>
+ {pageNumber}
+ </Button>
+ ))}
+ </div>
+ </div>
+ </ScrollArea>
+ </aside>
+ <ScrollArea
+ className="h-full max-h-full min-h-0 min-w-0 flex-1"
+ viewportClassName={cn(
+ isFirstPageRendering && !loadError && "invisible"
+ )}
+ viewportRef={viewportRef}
+ >
+ <div className="flex min-h-full w-max min-w-full flex-col items-center justify-start gap-6 p-6">
+ {renderedPageNumbers.map((pageNumber) => {
+ const shouldRenderPage =
+ Math.abs(pageNumber - activePage) <= pageRenderBuffer ||
+ renderedPageNumbers.length <= pageRenderBuffer * 2 + 1
+ const pageStyle = {
+ width: renderedPageWidth,
+ height: renderedPageHeight,
+ }
+ const pageSearchQuery =
+ searchQuery.trim() &&
+ Math.abs(pageNumber - activePage) <= 1
+ ? searchQuery
+ : ""
+
+ return (
+ <PDFViewerPage
+ key={pageNumber}
+ reactPdf={reactPdf}
+ pageNumber={pageNumber}
+ pageStyle={pageStyle}
+ renderedPageWidth={renderedPageWidth}
+ zoom={zoom}
+ rotation={rotation}
+ shouldRenderPage={shouldRenderPage}
+ searchQuery={pageSearchQuery}
+ isFirstRenderedPage={pageNumber === firstRenderedPage}
+ pageClassName={pageClassName}
+ renderPageOverlay={renderPageOverlay}
+ onFirstPageSettled={() =>
+ setIsFirstPageRendering(false)
+ }
+ onPagePointerDown={onPagePointerDown}
+ onPagePointerMove={onPagePointerMove}
+ onPagePointerUp={onPagePointerUp}
+ onPagePointerCancel={onPagePointerCancel}
+ />
+ )
+ })}
+ </div>
+ </ScrollArea>
+ </div>
+ </reactPdf.Document>
+ ) : null}
+ </div>
+ </div>
+ )
+ }
+)
diff --git a/apps/v4/components/ui/resizable.tsx b/apps/v4/components/ui/resizable.tsx
new file mode 100644
index 0000000..91ade68
--- /dev/null
+++ b/apps/v4/components/ui/resizable.tsx
@@ -0,0 +1,63 @@
+"use client"
+
+import type { ComponentPropsWithRef, ReactNode } from "react"
+import { DragDropVerticalIcon } from "@hugeicons/core-free-icons"
+import { HugeiconsIcon } from "@hugeicons/react"
+import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels"
+
+import { cn } from "@/lib/utils"
+
+function ResizablePanelGroup({
+ className,
+ ...props
+}: ComponentPropsWithRef<typeof PanelGroup>) {
+ return (
+ <PanelGroup
+ data-slot="resizable-panel-group"
+ className={cn(
+ "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+function ResizablePanel({ ...props }: ComponentPropsWithRef<typeof Panel>) {
+ return <Panel data-slot="resizable-panel" {...props} />
+}
+
+function ResizableHandle({
+ withHandle,
+ className,
+ ...props
+}: ComponentPropsWithRef<typeof PanelResizeHandle> & {
+ withHandle?: boolean | ReactNode
+}) {
+ return (
+ <PanelResizeHandle
+ data-slot="resizable-handle"
+ className={cn(
+ "flex items-center justify-center",
+ "relative w-px bg-border",
+ "after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2",
+ "focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-hidden",
+ "data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full [&[data-panel-group-direction=vertical]>div]:rotate-90",
+ "data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2",
+ className
+ )}
+ {...props}
+ >
+ {withHandle &&
+ (typeof withHandle === "boolean" ? (
+ <div className="z-10 flex h-4 w-3 items-center justify-center rounded-xs border bg-muted dark:bg-neutral-800">
+ <HugeiconsIcon icon={DragDropVerticalIcon} className="size-2.5" />
+ </div>
+ ) : (
+ withHandle
+ ))}
+ </PanelResizeHandle>
+ )
+}
+
+export { ResizableHandle, ResizablePanel, ResizablePanelGroup }
diff --git a/apps/v4/components/ui/scroll-area.tsx b/apps/v4/components/ui/scroll-area.tsx
new file mode 100644
index 0000000..e925908
--- /dev/null
+++ b/apps/v4/components/ui/scroll-area.tsx
@@ -0,0 +1,85 @@
+"use client"
+
+import type React from "react"
+import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
+
+import { cn } from "@/lib/utils"
+
+export function ScrollArea({
+ className,
+ children,
+ orientation = "both",
+ scrollFade = false,
+ scrollbarGutter = false,
+ scrollbarOverflowOnly = false,
+ viewportClassName,
+ viewportRef,
+ ...props
+}: ScrollAreaPrimitive.Root.Props & {
+ orientation?: "vertical" | "horizontal" | "both"
+ scrollFade?: boolean
+ scrollbarGutter?: boolean
+ scrollbarOverflowOnly?: boolean
+ viewportClassName?: string
+ viewportRef?: React.Ref<HTMLDivElement>
+}): React.ReactElement {
+ return (
+ <ScrollAreaPrimitive.Root
+ className={cn(
+ "size-full min-h-0",
+ scrollbarOverflowOnly && "scrollbar-overflow-only",
+ className
+ )}
+ {...props}
+ >
+ <ScrollAreaPrimitive.Viewport
+ ref={viewportRef}
+ className={cn(
+ "transition-shadows h-full rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-x:overscroll-x-contain data-has-overflow-y:overscroll-y-contain",
+ scrollFade &&
+ "mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] [--fade-size:1.5rem]",
+ scrollbarGutter &&
+ "data-has-overflow-x:pb-2.5 data-has-overflow-y:pe-2.5",
+ viewportClassName
+ )}
+ data-slot="scroll-area-viewport"
+ >
+ {children}
+ </ScrollAreaPrimitive.Viewport>
+ {orientation !== "horizontal" ? (
+ <ScrollBar orientation="vertical" />
+ ) : null}
+ {orientation !== "vertical" ? (
+ <ScrollBar orientation="horizontal" />
+ ) : null}
+ {orientation === "both" ? (
+ <ScrollAreaPrimitive.Corner data-slot="scroll-area-corner" />
+ ) : null}
+ </ScrollAreaPrimitive.Root>
+ )
+}
+
+export function ScrollBar({
+ className,
+ orientation = "vertical",
+ ...props
+}: ScrollAreaPrimitive.Scrollbar.Props): React.ReactElement {
+ return (
+ <ScrollAreaPrimitive.Scrollbar
+ className={cn(
+ "m-1 flex opacity-0 transition-opacity delay-300 data-hovering:opacity-100 data-hovering:delay-0 data-hovering:duration-100 data-scrolling:opacity-100 data-scrolling:delay-0 data-scrolling:duration-100 data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:flex-col data-[orientation=vertical]:w-1.5",
+ className
+ )}
+ data-slot="scroll-area-scrollbar"
+ orientation={orientation}
+ {...props}
+ >
+ <ScrollAreaPrimitive.Thumb
+ className="relative flex-1 rounded-full bg-foreground/20"
+ data-slot="scroll-area-thumb"
+ />
+ </ScrollAreaPrimitive.Scrollbar>
+ )
+}
+
+export { ScrollAreaPrimitive }
diff --git a/apps/v4/components/ui/tabs.tsx b/apps/v4/components/ui/tabs.tsx
new file mode 100644
index 0000000..ac9a15c
--- /dev/null
+++ b/apps/v4/components/ui/tabs.tsx
@@ -0,0 +1,10 @@
+"use client"
+
+export {
+ Tabs,
+ TabsContent,
+ TabsList,
+ TabsPrimitive,
+ TabsTrigger,
+ type TabsVariant,
+} from "@/registry/new-york-v4/ui/tabs"
diff --git a/apps/v4/components/ui/tooltip.tsx b/apps/v4/components/ui/tooltip.tsx
new file mode 100644
index 0000000..f7b72e6
--- /dev/null
+++ b/apps/v4/components/ui/tooltip.tsx
@@ -0,0 +1,11 @@
+"use client"
+
+export {
+ Tooltip,
+ TooltipContent,
+ TooltipCreateHandle,
+ TooltipPopup,
+ TooltipPrimitive,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/registry/new-york-v4/ui/tooltip"
diff --git a/apps/v4/content/docs/components/docx-viewer.mdx b/apps/v4/content/docs/components/docx-viewer.mdx
index c9e05bc..c4e7f4e 100644
--- a/apps/v4/content/docs/components/docx-viewer.mdx
+++ b/apps/v4/content/docs/components/docx-viewer.mdx
@@ -16,8 +16,8 @@ The DOCX Viewer is for contracts, proposals, reports, and internal docs where vi
## Common slots
-| Slot | Purpose |
-| --- | --- |
-| `toolbar` | Zoom, layout mode, page navigation, and export actions. |
-| `outline` | Headings and section navigation. |
-| `reviewPanel` | Comments, redlines, and unresolved changes. |
+| Slot | Purpose |
+| ------------- | ------------------------------------------------------- |
+| `toolbar` | Zoom, layout mode, page navigation, and export actions. |
+| `outline` | Headings and section navigation. |
+| `reviewPanel` | Comments, redlines, and unresolved changes. |
diff --git a/apps/v4/content/docs/components/pdf-viewer/citations.mdx b/apps/v4/content/docs/components/pdf-viewer/citations.mdx
index 78d7f46..c2241fe 100644
--- a/apps/v4/content/docs/components/pdf-viewer/citations.mdx
+++ b/apps/v4/content/docs/components/pdf-viewer/citations.mdx
@@ -6,6 +6,8 @@ component: true
Citations connect document answers to their source evidence. They should make it easy to jump from an extracted value, comment, or answer back to the PDF page that supports it.
+See it composed with the PDF Viewer in the [Citations block](/blocks#citations).
+
<CitationsDemo />
## Installation
@@ -28,12 +30,6 @@ npx shadcn@latest add citations
<Steps className="mb-0 pt-2">
-<Step>Install the following dependencies:</Step>
-
-```bash
-npm install react-pdf pdfjs-dist
-```
-
<Step>Copy and paste the following code into your project.</Step>
<CitationsSource />
diff --git a/apps/v4/content/docs/components/pdf-viewer/document-splits.mdx b/apps/v4/content/docs/components/pdf-viewer/document-splits.mdx
new file mode 100644
index 0000000..9c33abf
--- /dev/null
+++ b/apps/v4/content/docs/components/pdf-viewer/document-splits.mdx
@@ -0,0 +1,64 @@
+---
+title: Document Splits
+description: Organize long PDFs into smaller documents with lazy page thumbnails and drag-and-drop grouping.
+component: true
+---
+
+Document Splits provide editable split groups for long documents. Pair them with the PDF Viewer block when users need to preview pages while organizing output documents.
+
+See it composed with the PDF Viewer in the [Document Splits block](/blocks#document-splits).
+
+<DocumentSplitsDemo />
+
+## Installation
+
+<CodeTabs>
+
+<TabsList>
+ <TabsTrigger value="cli">Command</TabsTrigger>
+ <TabsTrigger value="manual">Manual</TabsTrigger>
+</TabsList>
+<TabsContent value="cli">
+
+```bash
+npx shadcn@latest add document-splits
+```
+
+</TabsContent>
+
+<TabsContent value="manual">
+
+<Steps className="mb-0 pt-2">
+
+<Step>Install the following dependencies:</Step>
+
+```bash
+npm install react-pdf pdfjs-dist @dnd-kit/core @dnd-kit/sortable @dnd-kit/utilities @hugeicons/react @hugeicons/core-free-icons
+```
+
+<Step>Copy and paste the following code into your project.</Step>
+
+<DocumentSplitsSource />
+
+<Step>Update the import paths to match your project setup.</Step>
+
+</Steps>
+
+</TabsContent>
+
+</CodeTabs>
+
+## Useful behaviors
+
+- Lazy PDF page thumbnails rendered from the source document.
+- Drag pages between split groups and reorder split groups.
+- Vertically scrollable split groups with horizontally scrolling page rows.
+- Pair with the PDF Viewer block when selected pages should scroll the document canvas.
+
+## Common slots
+
+| Slot | Purpose |
+| ----------- | --------------------------------------------------- |
+| `split` | A grouped output document with ordered pages. |
+| `thumbnail` | A draggable page preview rendered only when needed. |
+| `actions` | Add, remove, split, and export controls. |
diff --git a/apps/v4/content/docs/components/pdf-viewer/e-signature.mdx b/apps/v4/content/docs/components/pdf-viewer/e-signature.mdx
index e2665f9..28bdabc 100644
--- a/apps/v4/content/docs/components/pdf-viewer/e-signature.mdx
+++ b/apps/v4/content/docs/components/pdf-viewer/e-signature.mdx
@@ -6,6 +6,8 @@ component: true
E-Signature extends a PDF viewer with signature, initials, date, and approval fields. It should keep field placement precise while making signing status clear.
+See it composed with the PDF Viewer in the [E-Signature block](/blocks#e-signature).
+
<ESignatureDemo />
## Installation
@@ -31,7 +33,7 @@ npx shadcn@latest add e-signature
<Step>Install the following dependencies:</Step>
```bash
-npm install react-pdf pdfjs-dist signature_pad pdf-lib
+npm install @hugeicons/react @hugeicons/core-free-icons
```
<Step>Copy and paste the following code into your project.</Step>
diff --git a/apps/v4/content/docs/components/pdf-viewer/human-review.mdx b/apps/v4/content/docs/components/pdf-viewer/human-review.mdx
new file mode 100644
index 0000000..22d2ed6
--- /dev/null
+++ b/apps/v4/content/docs/components/pdf-viewer/human-review.mdx
@@ -0,0 +1,65 @@
+---
+title: Human Review
+description: Review extracted values against expected output with form fields and JSON diffing.
+component: true
+---
+
+Human Review provides field-level cards for comparing actual and expected extraction output. Use it when reviewers need to correct values while still being able to inspect the raw JSON diff.
+
+See it composed with the PDF Viewer in the [Human Review block](/blocks#human-review).
+
+<HumanReviewDemo />
+
+## Installation
+
+<CodeTabs>
+
+<TabsList>
+ <TabsTrigger value="cli">Command</TabsTrigger>
+ <TabsTrigger value="manual">Manual</TabsTrigger>
+</TabsList>
+<TabsContent value="cli">
+
+```bash
+npx shadcn@latest add human-review
+```
+
+</TabsContent>
+
+<TabsContent value="manual">
+
+<Steps className="mb-0 pt-2">
+
+<Step>Install the following dependencies:</Step>
+
+```bash
+npm install @pierre/diffs @hugeicons/react @hugeicons/core-free-icons
+```
+
+<Step>Copy and paste the following code into your project.</Step>
+
+<HumanReviewSource />
+
+<Step>Update the import paths to match your project setup.</Step>
+
+</Steps>
+
+</TabsContent>
+
+</CodeTabs>
+
+## Useful behaviors
+
+- Actual and expected values displayed side by side for each schema field.
+- Input controls selected from the JSON schema property type.
+- Per-field undo and Set to NULL actions.
+- Form and JSON diff views for the same reviewed output state.
+
+## Common slots
+
+| Slot | Purpose |
+| ---------- | ----------------------------------------------------- |
+| `field` | A schema property, extracted value, and review value. |
+| `actual` | Read-only machine output for comparison. |
+| `expected` | Editable reviewed output for correction. |
+| `diff` | JSON-level actual versus expected comparison. |
diff --git a/apps/v4/content/docs/components/pdf-viewer/meta.json b/apps/v4/content/docs/components/pdf-viewer/meta.json
index 0140b3e..ed889d2 100644
--- a/apps/v4/content/docs/components/pdf-viewer/meta.json
+++ b/apps/v4/content/docs/components/pdf-viewer/meta.json
@@ -1,4 +1,10 @@
{
"title": "PDF Viewer",
- "pages": ["citations", "ocr-blocks", "e-signature"]
+ "pages": [
+ "citations",
+ "ocr-blocks",
+ "e-signature",
+ "human-review",
+ "document-splits"
+ ]
}
diff --git a/apps/v4/content/docs/components/pdf-viewer/ocr-blocks.mdx b/apps/v4/content/docs/components/pdf-viewer/ocr-blocks.mdx
index 4ec60bc..dbacbe9 100644
--- a/apps/v4/content/docs/components/pdf-viewer/ocr-blocks.mdx
+++ b/apps/v4/content/docs/components/pdf-viewer/ocr-blocks.mdx
@@ -6,6 +6,8 @@ component: true
OCR Blocks help users debug and review the text layer behind scanned or image-heavy PDFs. They should show document structure without replacing the original page image.
+See it composed with the PDF Viewer in the [OCR Blocks block](/blocks#ocr-blocks).
+
<OcrBlocksDemo />
## Installation
@@ -31,7 +33,7 @@ npx shadcn@latest add ocr-blocks
<Step>Install the following dependencies:</Step>
```bash
-npm install react-pdf pdfjs-dist
+npm install @hugeicons/react @hugeicons/core-free-icons
```
<Step>Copy and paste the following code into your project.</Step>
diff --git a/apps/v4/content/docs/components/xlsx-viewer.mdx b/apps/v4/content/docs/components/xlsx-viewer.mdx
index 6393d41..c896b0a 100644
--- a/apps/v4/content/docs/components/xlsx-viewer.mdx
+++ b/apps/v4/content/docs/components/xlsx-viewer.mdx
@@ -16,8 +16,8 @@ The Excel Viewer is the core spreadsheet preview for financial models, imports,
## Common slots
-| Slot | Purpose |
-| --- | --- |
-| `sheetTabs` | Workbook sheet navigation. |
+| Slot | Purpose |
+| ------------ | -------------------------------------- |
+| `sheetTabs` | Workbook sheet navigation. |
| `formulaBar` | Selected cell value, formula, or note. |
-| `statusBar` | Selection summary and range metadata. |
+| `statusBar` | Selection summary and range metadata. |
diff --git a/apps/v4/hooks/use-media-query.ts b/apps/v4/hooks/use-media-query.ts
index 4ce4d7d..19f99ae 100644
--- a/apps/v4/hooks/use-media-query.ts
+++ b/apps/v4/hooks/use-media-query.ts
@@ -1,6 +1,6 @@
-"use client";
+"use client"
-import { useCallback, useSyncExternalStore } from "react";
+import { useCallback, useSyncExternalStore } from "react"
const BREAKPOINTS = {
"2xl": 1536,
@@ -10,87 +10,87 @@ const BREAKPOINTS = {
md: 800,
sm: 640,
xl: 1280,
-} as const;
+} as const
-type Breakpoint = keyof typeof BREAKPOINTS;
+type Breakpoint = keyof typeof BREAKPOINTS
type BreakpointQuery =
| Breakpoint
| `max-${Breakpoint}`
- | `${Breakpoint}:max-${Breakpoint}`;
+ | `${Breakpoint}:max-${Breakpoint}`
function resolveMin(value: Breakpoint | number): string {
- const px = typeof value === "number" ? value : BREAKPOINTS[value];
- return `(min-width: ${px}px)`;
+ const px = typeof value === "number" ? value : BREAKPOINTS[value]
+ return `(min-width: ${px}px)`
}
function resolveMax(value: Breakpoint | number): string {
- const px = typeof value === "number" ? value : BREAKPOINTS[value];
- return `(max-width: ${px - 1}px)`;
+ const px = typeof value === "number" ? value : BREAKPOINTS[value]
+ return `(max-width: ${px - 1}px)`
}
function parseQuery(
- query: BreakpointQuery | MediaQueryInput | (string & {}),
+ query: BreakpointQuery | MediaQueryInput | (string & {})
): string {
if (typeof query !== "string") {
- const parts: string[] = [];
- if (query.min != null) parts.push(resolveMin(query.min));
- if (query.max != null) parts.push(resolveMax(query.max));
- if (query.pointer === "coarse") parts.push("(pointer: coarse)");
- if (query.pointer === "fine") parts.push("(pointer: fine)");
- if (parts.length === 0) return "(min-width: 0px)";
- return parts.join(" and ");
+ const parts: string[] = []
+ if (query.min != null) parts.push(resolveMin(query.min))
+ if (query.max != null) parts.push(resolveMax(query.max))
+ if (query.pointer === "coarse") parts.push("(pointer: coarse)")
+ if (query.pointer === "fine") parts.push("(pointer: fine)")
+ if (parts.length === 0) return "(min-width: 0px)"
+ return parts.join(" and ")
}
- if (query.startsWith("(")) return query;
+ if (query.startsWith("(")) return query
- const parts: string[] = [];
+ const parts: string[] = []
for (const segment of query.split(":")) {
if (segment.startsWith("max-")) {
- const bp = segment.slice(4);
- if (bp in BREAKPOINTS) parts.push(resolveMax(bp as Breakpoint));
+ const bp = segment.slice(4)
+ if (bp in BREAKPOINTS) parts.push(resolveMax(bp as Breakpoint))
} else if (segment in BREAKPOINTS) {
- parts.push(resolveMin(segment as Breakpoint));
+ parts.push(resolveMin(segment as Breakpoint))
}
}
- return parts.length > 0 ? parts.join(" and ") : query;
+ return parts.length > 0 ? parts.join(" and ") : query
}
function getServerSnapshot(): boolean {
- return false;
+ return false
}
export type MediaQueryInput = {
- min?: Breakpoint | number;
- max?: Breakpoint | number;
+ min?: Breakpoint | number
+ max?: Breakpoint | number
/** Touch-like input (finger). Use "fine" for mouse/trackpad. */
- pointer?: "coarse" | "fine";
-};
+ pointer?: "coarse" | "fine"
+}
export function useMediaQuery(
- query: BreakpointQuery | MediaQueryInput | (string & {}),
+ query: BreakpointQuery | MediaQueryInput | (string & {})
): boolean {
- const mediaQuery = parseQuery(query);
+ const mediaQuery = parseQuery(query)
const subscribe = useCallback(
(callback: () => void) => {
- if (typeof window === "undefined") return () => {};
- const mql = window.matchMedia(mediaQuery);
- mql.addEventListener("change", callback);
- return () => mql.removeEventListener("change", callback);
+ if (typeof window === "undefined") return () => {}
+ const mql = window.matchMedia(mediaQuery)
+ mql.addEventListener("change", callback)
+ return () => mql.removeEventListener("change", callback)
},
- [mediaQuery],
- );
+ [mediaQuery]
+ )
const getSnapshot = useCallback(() => {
- if (typeof window === "undefined") return false;
- return window.matchMedia(mediaQuery).matches;
- }, [mediaQuery]);
+ if (typeof window === "undefined") return false
+ return window.matchMedia(mediaQuery).matches
+ }, [mediaQuery])
- return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
+ return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)
}
export function useIsMobile(): boolean {
- return useMediaQuery("max-md");
+ return useMediaQuery("max-md")
}
diff --git a/apps/v4/lib/utils.ts b/apps/v4/lib/utils.ts
index d376d38..ffbf9e9 100644
--- a/apps/v4/lib/utils.ts
+++ b/apps/v4/lib/utils.ts
@@ -1,10 +1,10 @@
-import { type ClassValue, clsx } from "clsx";
-import { twMerge } from "tailwind-merge";
+import { clsx, type ClassValue } from "clsx"
+import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]): string {
- return twMerge(clsx(inputs));
+ return twMerge(clsx(inputs))
}
export function absoluteUrl(path: string): string {
- return `${process.env.NEXT_PUBLIC_APP_URL || "http://localhost:4000"}${path}`;
+ return `${process.env.NEXT_PUBLIC_APP_URL || "http://localhost:4000"}${path}`
}
diff --git a/apps/v4/mdx-components.tsx b/apps/v4/mdx-components.tsx
index e375479..8fa7d80 100644
--- a/apps/v4/mdx-components.tsx
+++ b/apps/v4/mdx-components.tsx
@@ -13,12 +13,20 @@ import { CodeTabs } from "@/components/code-tabs"
import { ComponentsList } from "@/components/components-list"
import { CopyButton } from "@/components/copy-button"
import { CsvViewerDemo, CsvViewerSource } from "@/components/csv-viewer-docs"
+import {
+ DocumentSplitsDemo,
+ DocumentSplitsSource,
+} from "@/components/document-splitter-docs"
import { ESignatureDemo, ESignatureSource } from "@/components/e-signature-docs"
import {
FileThumbnailDemo,
FileThumbnailSource,
} from "@/components/file-thumbnail-docs"
import { FileUploadDemo, FileUploadSource } from "@/components/file-upload-docs"
+import {
+ HumanReviewDemo,
+ HumanReviewSource,
+} from "@/components/human-review-docs"
import { getIconForLanguageExtension } from "@/components/icons"
import { OcrBlocksDemo, OcrBlocksSource } from "@/components/ocr-blocks-docs"
import { PdfViewerDemo, PdfViewerSource } from "@/components/pdf-viewer-docs"
@@ -365,12 +373,16 @@ export const mdxComponents = {
CitationsSource,
CsvViewerDemo,
CsvViewerSource,
+ DocumentSplitsDemo,
+ DocumentSplitsSource,
ESignatureDemo,
ESignatureSource,
FileThumbnailDemo,
FileThumbnailSource,
FileUploadDemo,
FileUploadSource,
+ HumanReviewDemo,
+ HumanReviewSource,
OcrBlocksDemo,
OcrBlocksSource,
PdfViewerDemo,
diff --git a/apps/v4/package.json b/apps/v4/package.json
index f9e609f..607082f 100644
--- a/apps/v4/package.json
+++ b/apps/v4/package.json
@@ -17,9 +17,13 @@
},
"dependencies": {
"@base-ui/react": "^1.4.1",
+ "@dnd-kit/core": "^6.3.1",
+ "@dnd-kit/sortable": "^10.0.0",
+ "@dnd-kit/utilities": "^3.2.2",
"@glideapps/glide-data-grid": "6.0.4-alpha24",
"@hugeicons/core-free-icons": "^4.1.1",
"@hugeicons/react": "^1.1.6",
+ "@pierre/diffs": "^1.1.22",
"@tabler/icons-react": "^3.31.0",
"border-beam": "^1.0.1",
"class-variance-authority": "^0.7.1",
@@ -40,6 +44,7 @@
"react": "19.2.3",
"react-dom": "19.2.3",
"react-pdf": "^10.4.1",
+ "react-resizable-panels": "^3.0.5",
"react-responsive-carousel": "^3.2.23",
"rehype-pretty-code": "^0.14.1",
"shiki": "^1.10.1",
diff --git a/apps/v4/registry/new-york-v4/ui/accordion.tsx b/apps/v4/registry/new-york-v4/ui/accordion.tsx
index f85b561..7d061ca 100644
--- a/apps/v4/registry/new-york-v4/ui/accordion.tsx
+++ b/apps/v4/registry/new-york-v4/ui/accordion.tsx
@@ -1,15 +1,16 @@
-"use client";
+"use client"
-import { Accordion as AccordionPrimitive } from "@base-ui/react/accordion";
-import { ArrowDown01Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import type React from "react";
-import { cn } from "@/lib/utils";
+import type React from "react"
+import { Accordion as AccordionPrimitive } from "@base-ui/react/accordion"
+import { ArrowDown01Icon } from "@hugeicons/core-free-icons"
+import { HugeiconsIcon } from "@hugeicons/react"
+
+import { cn } from "@/lib/utils"
export function Accordion(
- props: AccordionPrimitive.Root.Props,
+ props: AccordionPrimitive.Root.Props
): React.ReactElement {
- return <AccordionPrimitive.Root data-slot="accordion" {...props} />;
+ return <AccordionPrimitive.Root data-slot="accordion" {...props} />
}
export function AccordionItem({
@@ -22,7 +23,7 @@ export function AccordionItem({
data-slot="accordion-item"
{...props}
/>
- );
+ )
}
export function AccordionTrigger({
@@ -34,8 +35,8 @@ export function AccordionTrigger({
<AccordionPrimitive.Header className="flex">
<AccordionPrimitive.Trigger
className={cn(
- "flex flex-1 cursor-pointer items-start justify-between gap-4 rounded-md py-4 text-left font-medium text-sm outline-none transition-all focus-visible:ring-[3px] focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-64 data-panel-open:*:data-[slot=accordion-indicator]:rotate-180",
- className,
+ "flex flex-1 cursor-pointer items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none focus-visible:ring-[3px] focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-64 data-panel-open:*:data-[slot=accordion-indicator]:rotate-180",
+ className
)}
data-slot="accordion-trigger"
{...props}
@@ -48,7 +49,7 @@ export function AccordionTrigger({
/>
</AccordionPrimitive.Trigger>
</AccordionPrimitive.Header>
- );
+ )
}
export function AccordionPanel({
@@ -58,13 +59,13 @@ export function AccordionPanel({
}: AccordionPrimitive.Panel.Props): React.ReactElement {
return (
<AccordionPrimitive.Panel
- className="h-(--accordion-panel-height) overflow-hidden text-muted-foreground text-sm transition-[height] duration-200 ease-in-out data-ending-style:h-0 data-starting-style:h-0"
+ className="h-(--accordion-panel-height) overflow-hidden text-sm text-muted-foreground transition-[height] duration-200 ease-in-out data-ending-style:h-0 data-starting-style:h-0"
data-slot="accordion-panel"
{...props}
>
<div className={cn("pt-0 pb-4", className)}>{children}</div>
</AccordionPrimitive.Panel>
- );
+ )
}
-export { AccordionPrimitive, AccordionPanel as AccordionContent };
+export { AccordionPrimitive, AccordionPanel as AccordionContent }
diff --git a/apps/v4/registry/new-york-v4/ui/alert.tsx b/apps/v4/registry/new-york-v4/ui/alert.tsx
index 5b6c7d5..0bcbb77 100644
--- a/apps/v4/registry/new-york-v4/ui/alert.tsx
+++ b/apps/v4/registry/new-york-v4/ui/alert.tsx
@@ -1,9 +1,10 @@
-import { cva, type VariantProps } from "class-variance-authority";
-import type * as React from "react";
-import { cn } from "@/lib/utils";
+import type * as React from "react"
+import { cva, type VariantProps } from "class-variance-authority"
+
+import { cn } from "@/lib/utils"
const alertVariants = cva(
- "relative grid w-full items-start gap-x-2 gap-y-0.5 rounded-xl border px-3.5 py-3 text-card-foreground text-sm has-[>svg]:has-data-[slot=alert-action]:grid-cols-[calc(var(--spacing)*4)_1fr_auto] has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-data-[slot=alert-action]:grid-cols-[1fr_auto] has-[>svg]:gap-x-2 [&>svg]:h-lh [&>svg]:w-4",
+ "relative grid w-full items-start gap-x-2 gap-y-0.5 rounded-xl border px-3.5 py-3 text-sm text-card-foreground has-data-[slot=alert-action]:grid-cols-[1fr_auto] has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-2 has-[>svg]:has-data-[slot=alert-action]:grid-cols-[calc(var(--spacing)*4)_1fr_auto] [&>svg]:h-lh [&>svg]:w-4",
{
defaultVariants: {
variant: "default",
@@ -19,8 +20,8 @@ const alertVariants = cva(
warning: "border-warning/32 bg-warning/4 [&>svg]:text-warning",
},
},
- },
-);
+ }
+)
export function Alert({
className,
@@ -35,7 +36,7 @@ export function Alert({
role="alert"
{...props}
/>
- );
+ )
}
export function AlertTitle({
@@ -48,7 +49,7 @@ export function AlertTitle({
data-slot="alert-title"
{...props}
/>
- );
+ )
}
export function AlertDescription({
@@ -59,12 +60,12 @@ export function AlertDescription({
<div
className={cn(
"flex flex-col gap-2.5 text-muted-foreground [svg~&]:col-start-2",
- className,
+ className
)}
data-slot="alert-description"
{...props}
/>
- );
+ )
}
export function AlertAction({
@@ -75,10 +76,10 @@ export function AlertAction({
<div
className={cn(
"flex gap-1 max-sm:col-start-2 max-sm:mt-2 sm:row-start-1 sm:row-end-3 sm:self-center sm:[[data-slot=alert-description]~&]:col-start-2 sm:[[data-slot=alert-title]~&]:col-start-2 sm:[svg~&]:col-start-2 sm:[svg~[data-slot=alert-description]~&]:col-start-3 sm:[svg~[data-slot=alert-title]~&]:col-start-3",
- className,
+ className
)}
data-slot="alert-action"
{...props}
/>
- );
+ )
}
diff --git a/apps/v4/registry/new-york-v4/ui/aspect-ratio.tsx b/apps/v4/registry/new-york-v4/ui/aspect-ratio.tsx
index 02d6b60..b76ff6b 100644
--- a/apps/v4/registry/new-york-v4/ui/aspect-ratio.tsx
+++ b/apps/v4/registry/new-york-v4/ui/aspect-ratio.tsx
@@ -1,13 +1,13 @@
-"use client";
+"use client"
-import type React from "react";
+import type React from "react"
function AspectRatio({
ratio = 1,
style,
...props
}: React.ComponentProps<"div"> & {
- ratio?: number;
+ ratio?: number
}): React.ReactElement {
return (
<div
@@ -15,7 +15,7 @@ function AspectRatio({
style={{ aspectRatio: ratio, ...style }}
{...props}
/>
- );
+ )
}
-export { AspectRatio };
+export { AspectRatio }
diff --git a/apps/v4/registry/new-york-v4/ui/autocomplete.tsx b/apps/v4/registry/new-york-v4/ui/autocomplete.tsx
index fb4385d..fe08137 100644
--- a/apps/v4/registry/new-york-v4/ui/autocomplete.tsx
+++ b/apps/v4/registry/new-york-v4/ui/autocomplete.tsx
@@ -1,15 +1,16 @@
-"use client";
+"use client"
-import { Autocomplete as AutocompletePrimitive } from "@base-ui/react/autocomplete";
-import { ArrowUpDownIcon, Cancel01Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import type React from "react";
-import { cn } from "@/lib/utils";
-import { Input } from "@/registry/new-york-v4/ui/input";
-import { ScrollArea } from "@/registry/new-york-v4/ui/scroll-area";
+import type React from "react"
+import { Autocomplete as AutocompletePrimitive } from "@base-ui/react/autocomplete"
+import { ArrowUpDownIcon, Cancel01Icon } from "@hugeicons/core-free-icons"
+import { HugeiconsIcon } from "@hugeicons/react"
+
+import { cn } from "@/lib/utils"
+import { Input } from "@/registry/new-york-v4/ui/input"
+import { ScrollArea } from "@/registry/new-york-v4/ui/scroll-area"
export const Autocomplete: typeof AutocompletePrimitive.Root =
- AutocompletePrimitive.Root;
+ AutocompletePrimitive.Root
export function AutocompleteInput({
className,
@@ -21,25 +22,25 @@ export function AutocompleteInput({
clearProps,
...props
}: Omit<AutocompletePrimitive.Input.Props, "size"> & {
- showTrigger?: boolean;
- showClear?: boolean;
- startAddon?: React.ReactNode;
- size?: "sm" | "default" | "lg" | number;
- ref?: React.Ref<HTMLInputElement>;
- triggerProps?: AutocompletePrimitive.Trigger.Props;
- clearProps?: AutocompletePrimitive.Clear.Props;
+ showTrigger?: boolean
+ showClear?: boolean
+ startAddon?: React.ReactNode
+ size?: "sm" | "default" | "lg" | number
+ ref?: React.Ref<HTMLInputElement>
+ triggerProps?: AutocompletePrimitive.Trigger.Props
+ clearProps?: AutocompletePrimitive.Clear.Props
}): React.ReactElement {
- const sizeValue = (size ?? "default") as "sm" | "default" | "lg" | number;
+ const sizeValue = (size ?? "default") as "sm" | "default" | "lg" | number
return (
<AutocompletePrimitive.InputGroup
- className="relative not-has-[>*.w-full]:w-fit w-full text-foreground has-disabled:opacity-64"
+ className="relative w-full text-foreground not-has-[>*.w-full]:w-fit has-disabled:opacity-64"
data-slot="autocomplete-input-group"
>
{startAddon && (
<div
aria-hidden="true"
- className="pointer-events-none absolute inset-y-0 start-px z-10 flex items-center ps-[calc(--spacing(3)-1px)] opacity-80 has-[+[data-size=sm]]:ps-[calc(--spacing(2.5)-1px)] [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:-mx-0.5"
+ className="pointer-events-none absolute inset-y-0 start-px z-10 flex items-center ps-[calc(--spacing(3)-1px)] opacity-80 has-[+[data-size=sm]]:ps-[calc(--spacing(2.5)-1px)] [&_svg]:-mx-0.5 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4"
data-slot="autocomplete-start-addon"
>
{startAddon}
@@ -48,11 +49,11 @@ export function AutocompleteInput({
<AutocompletePrimitive.Input
className={cn(
startAddon &&
- "data-[size=sm]:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(7.5)-1px)] *:data-[slot=autocomplete-input]:ps-[calc(--spacing(8.5)-1px)] sm:data-[size=sm]:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(7)-1px)] sm:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(8)-1px)]",
+ "*:data-[slot=autocomplete-input]:ps-[calc(--spacing(8.5)-1px)] data-[size=sm]:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(7.5)-1px)] sm:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(8)-1px)] sm:data-[size=sm]:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(7)-1px)]",
sizeValue === "sm"
? "has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=autocomplete-input]:pe-6.5"
: "has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=autocomplete-input]:pe-7",
- className,
+ className
)}
data-slot="autocomplete-input"
render={<Input nativeInput size={sizeValue} />}
@@ -61,8 +62,8 @@ export function AutocompleteInput({
{showTrigger && (
<AutocompleteTrigger
className={cn(
- "absolute top-1/2 inline-flex size-8 shrink-0 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-colors pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 has-[+[data-slot=autocomplete-clear]]:hidden sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
- sizeValue === "sm" ? "end-0" : "end-0.5",
+ "absolute top-1/2 inline-flex size-8 shrink-0 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 transition-colors outline-none hover:opacity-100 has-[+[data-slot=autocomplete-clear]]:hidden sm:size-7 pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
+ sizeValue === "sm" ? "end-0" : "end-0.5"
)}
{...triggerProps}
>
@@ -74,8 +75,8 @@ export function AutocompleteInput({
{showClear && (
<AutocompleteClear
className={cn(
- "absolute top-1/2 inline-flex size-8 shrink-0 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-colors pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 has-[+[data-slot=autocomplete-clear]]:hidden sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
- sizeValue === "sm" ? "end-0" : "end-0.5",
+ "absolute top-1/2 inline-flex size-8 shrink-0 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 transition-colors outline-none hover:opacity-100 has-[+[data-slot=autocomplete-clear]]:hidden sm:size-7 pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
+ sizeValue === "sm" ? "end-0" : "end-0.5"
)}
{...clearProps}
>
@@ -83,7 +84,7 @@ export function AutocompleteInput({
</AutocompleteClear>
)}
</AutocompletePrimitive.InputGroup>
- );
+ )
}
export function AutocompletePopup({
@@ -97,12 +98,12 @@ export function AutocompletePopup({
portalProps,
...props
}: AutocompletePrimitive.Popup.Props & {
- align?: AutocompletePrimitive.Positioner.Props["align"];
- sideOffset?: AutocompletePrimitive.Positioner.Props["sideOffset"];
- alignOffset?: AutocompletePrimitive.Positioner.Props["alignOffset"];
- side?: AutocompletePrimitive.Positioner.Props["side"];
- anchor?: AutocompletePrimitive.Positioner.Props["anchor"];
- portalProps?: AutocompletePrimitive.Portal.Props;
+ align?: AutocompletePrimitive.Positioner.Props["align"]
+ sideOffset?: AutocompletePrimitive.Positioner.Props["sideOffset"]
+ alignOffset?: AutocompletePrimitive.Positioner.Props["alignOffset"]
+ side?: AutocompletePrimitive.Positioner.Props["side"]
+ anchor?: AutocompletePrimitive.Positioner.Props["anchor"]
+ portalProps?: AutocompletePrimitive.Portal.Props
}): React.ReactElement {
return (
<AutocompletePrimitive.Portal {...portalProps}>
@@ -117,8 +118,8 @@ export function AutocompletePopup({
>
<span
className={cn(
- "relative flex max-h-full min-w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 transition-[scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
- className,
+ "relative flex max-h-full max-w-(--available-width) min-w-(--anchor-width) origin-(--transform-origin) rounded-lg border bg-popover shadow-lg/5 transition-[scale,opacity] not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
+ className
)}
>
<AutocompletePrimitive.Popup
@@ -131,7 +132,7 @@ export function AutocompletePopup({
</span>
</AutocompletePrimitive.Positioner>
</AutocompletePrimitive.Portal>
- );
+ )
}
export function AutocompleteItem({
@@ -142,15 +143,15 @@ export function AutocompleteItem({
return (
<AutocompletePrimitive.Item
className={cn(
- "flex min-h-8 cursor-default select-none items-center rounded-sm px-2 py-1 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm",
- className,
+ "flex min-h-8 cursor-default items-center rounded-sm px-2 py-1 text-base outline-none select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground sm:min-h-7 sm:text-sm data-disabled:pointer-events-none data-disabled:opacity-64",
+ className
)}
data-slot="autocomplete-item"
{...props}
>
{children}
</AutocompletePrimitive.Item>
- );
+ )
}
export function AutocompleteSeparator({
@@ -163,7 +164,7 @@ export function AutocompleteSeparator({
data-slot="autocomplete-separator"
{...props}
/>
- );
+ )
}
export function AutocompleteGroup({
@@ -176,7 +177,7 @@ export function AutocompleteGroup({
data-slot="autocomplete-group"
{...props}
/>
- );
+ )
}
export function AutocompleteGroupLabel({
@@ -186,13 +187,13 @@ export function AutocompleteGroupLabel({
return (
<AutocompletePrimitive.GroupLabel
className={cn(
- "px-2 py-1.5 font-medium text-muted-foreground text-xs",
- className,
+ "px-2 py-1.5 text-xs font-medium text-muted-foreground",
+ className
)}
data-slot="autocomplete-group-label"
{...props}
/>
- );
+ )
}
export function AutocompleteEmpty({
@@ -202,13 +203,13 @@ export function AutocompleteEmpty({
return (
<AutocompletePrimitive.Empty
className={cn(
- "not-empty:p-2 text-center text-base text-muted-foreground sm:text-sm",
- className,
+ "text-center text-base text-muted-foreground not-empty:p-2 sm:text-sm",
+ className
)}
data-slot="autocomplete-empty"
{...props}
/>
- );
+ )
}
export function AutocompleteRow({
@@ -221,7 +222,7 @@ export function AutocompleteRow({
data-slot="autocomplete-row"
{...props}
/>
- );
+ )
}
export function AutocompleteValue({
@@ -229,7 +230,7 @@ export function AutocompleteValue({
}: AutocompletePrimitive.Value.Props): React.ReactElement {
return (
<AutocompletePrimitive.Value data-slot="autocomplete-value" {...props} />
- );
+ )
}
export function AutocompleteList({
@@ -241,13 +242,13 @@ export function AutocompleteList({
<AutocompletePrimitive.List
className={cn(
"not-empty:scroll-py-1 not-empty:p-1 in-data-has-overflow-y:pe-3",
- className,
+ className
)}
data-slot="autocomplete-list"
{...props}
/>
</ScrollArea>
- );
+ )
}
export function AutocompleteClear({
@@ -257,15 +258,15 @@ export function AutocompleteClear({
return (
<AutocompletePrimitive.Clear
className={cn(
- "absolute end-0.5 top-1/2 inline-flex size-8 shrink-0 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-[color,background-color,box-shadow,opacity] pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
- className,
+ "absolute end-0.5 top-1/2 inline-flex size-8 shrink-0 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 transition-[color,background-color,box-shadow,opacity] outline-none hover:opacity-100 sm:size-7 pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
+ className
)}
data-slot="autocomplete-clear"
{...props}
>
<HugeiconsIcon icon={Cancel01Icon} />
</AutocompletePrimitive.Clear>
- );
+ )
}
export function AutocompleteStatus({
@@ -275,13 +276,13 @@ export function AutocompleteStatus({
return (
<AutocompletePrimitive.Status
className={cn(
- "px-3 py-2 font-medium text-muted-foreground text-xs empty:m-0 empty:p-0",
- className,
+ "px-3 py-2 text-xs font-medium text-muted-foreground empty:m-0 empty:p-0",
+ className
)}
data-slot="autocomplete-status"
{...props}
/>
- );
+ )
}
export function AutocompleteCollection({
@@ -292,7 +293,7 @@ export function AutocompleteCollection({
data-slot="autocomplete-collection"
{...props}
/>
- );
+ )
}
export function AutocompleteTrigger({
@@ -308,10 +309,10 @@ export function AutocompleteTrigger({
>
{children}
</AutocompletePrimitive.Trigger>
- );
+ )
}
export const useAutocompleteFilter: typeof AutocompletePrimitive.useFilter =
- AutocompletePrimitive.useFilter;
+ AutocompletePrimitive.useFilter
-export { AutocompletePrimitive };
+export { AutocompletePrimitive }
diff --git a/apps/v4/registry/new-york-v4/ui/badge.tsx b/apps/v4/registry/new-york-v4/ui/badge.tsx
index 36e225f..c283ad2 100644
--- a/apps/v4/registry/new-york-v4/ui/badge.tsx
+++ b/apps/v4/registry/new-york-v4/ui/badge.tsx
@@ -1,13 +1,14 @@
-"use client";
+"use client"
-import { mergeProps } from "@base-ui/react/merge-props";
-import { useRender } from "@base-ui/react/use-render";
-import { cva, type VariantProps } from "class-variance-authority";
-import * as React from "react";
-import { cn } from "@/lib/utils";
+import * as React from "react"
+import { mergeProps } from "@base-ui/react/merge-props"
+import { useRender } from "@base-ui/react/use-render"
+import { cva, type VariantProps } from "class-variance-authority"
+
+import { cn } from "@/lib/utils"
export const badgeVariants = cva(
- "relative inline-flex shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-sm border border-transparent font-medium outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [button&,a&]:cursor-pointer [button&,a&]:pointer-coarse:after:absolute [button&,a&]:pointer-coarse:after:size-full [button&,a&]:pointer-coarse:after:min-h-11 [button&,a&]:pointer-coarse:after:min-w-11",
+ "relative inline-flex shrink-0 items-center justify-center gap-1 rounded-sm border border-transparent font-medium whitespace-nowrap transition-shadow outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3 [button&,a&]:cursor-pointer [button&,a&]:pointer-coarse:after:absolute [button&,a&]:pointer-coarse:after:size-full [button&,a&]:pointer-coarse:after:min-h-11 [button&,a&]:pointer-coarse:after:min-w-11",
{
defaultVariants: {
size: "default",
@@ -36,13 +37,13 @@ export const badgeVariants = cva(
warning: "bg-warning/8 text-warning-foreground dark:bg-warning/16",
},
},
- },
-);
+ }
+)
export interface BadgeProps extends useRender.ComponentProps<"span"> {
- variant?: VariantProps<typeof badgeVariants>["variant"];
- size?: VariantProps<typeof badgeVariants>["size"];
- asChild?: boolean;
+ variant?: VariantProps<typeof badgeVariants>["variant"]
+ size?: VariantProps<typeof badgeVariants>["size"]
+ asChild?: boolean
}
export function Badge({
@@ -58,16 +59,16 @@ export function Badge({
render ??
(asChild && React.isValidElement(children)
? (children as React.ReactElement<Record<string, unknown>>)
- : undefined);
+ : undefined)
const defaultProps = {
children: asChild && React.isValidElement(children) ? undefined : children,
className: cn(badgeVariants({ className, size, variant })),
"data-slot": "badge",
- };
+ }
return useRender({
defaultTagName: "span",
props: mergeProps<"span">(defaultProps, props),
render: renderValue,
- });
+ })
}
diff --git a/apps/v4/registry/new-york-v4/ui/breadcrumb.tsx b/apps/v4/registry/new-york-v4/ui/breadcrumb.tsx
index 1b6e609..396080a 100644
--- a/apps/v4/registry/new-york-v4/ui/breadcrumb.tsx
+++ b/apps/v4/registry/new-york-v4/ui/breadcrumb.tsx
@@ -1,16 +1,20 @@
-"use client";
+"use client"
-import { mergeProps } from "@base-ui/react/merge-props";
-import { useRender } from "@base-ui/react/use-render";
-import { ArrowRight01Icon, MoreHorizontalIcon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import * as React from "react";
-import { cn } from "@/lib/utils";
+import * as React from "react"
+import { mergeProps } from "@base-ui/react/merge-props"
+import { useRender } from "@base-ui/react/use-render"
+import {
+ ArrowRight01Icon,
+ MoreHorizontalIcon,
+} from "@hugeicons/core-free-icons"
+import { HugeiconsIcon } from "@hugeicons/react"
+
+import { cn } from "@/lib/utils"
export function Breadcrumb({
...props
}: React.ComponentProps<"nav">): React.ReactElement {
- return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />;
+ return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />
}
export function BreadcrumbList({
@@ -20,13 +24,13 @@ export function BreadcrumbList({
return (
<ol
className={cn(
- "wrap-break-word flex flex-wrap items-center gap-1.5 text-muted-foreground text-sm sm:gap-2.5",
- className,
+ "flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground sm:gap-2.5",
+ className
)}
data-slot="breadcrumb-list"
{...props}
/>
- );
+ )
}
export function BreadcrumbItem({
@@ -39,7 +43,7 @@ export function BreadcrumbItem({
data-slot="breadcrumb-item"
{...props}
/>
- );
+ )
}
export function BreadcrumbLink({
@@ -49,24 +53,24 @@ export function BreadcrumbLink({
children,
...props
}: useRender.ComponentProps<"a"> & {
- asChild?: boolean;
+ asChild?: boolean
}): React.ReactElement {
const renderValue =
render ??
(asChild && React.isValidElement(children)
? (children as React.ReactElement<Record<string, unknown>>)
- : undefined);
+ : undefined)
const defaultProps = {
children: asChild && React.isValidElement(children) ? undefined : children,
className: cn("transition-colors hover:text-foreground", className),
"data-slot": "breadcrumb-link",
- };
+ }
return useRender({
defaultTagName: "a",
props: mergeProps<"a">(defaultProps, props),
render: renderValue,
- });
+ })
}
export function BreadcrumbPage({
@@ -80,7 +84,7 @@ export function BreadcrumbPage({
data-slot="breadcrumb-page"
{...props}
/>
- );
+ )
}
export function BreadcrumbSeparator({
@@ -95,10 +99,10 @@ export function BreadcrumbSeparator({
data-slot="breadcrumb-separator"
role="presentation"
{...props}
- >
+ >
{children ?? <HugeiconsIcon icon={ArrowRight01Icon} />}
</li>
- );
+ )
}
export function BreadcrumbEllipsis({
@@ -116,5 +120,5 @@ export function BreadcrumbEllipsis({
<HugeiconsIcon icon={MoreHorizontalIcon} className="size-4" />
<span className="sr-only">More</span>
</span>
- );
+ )
}
diff --git a/apps/v4/registry/new-york-v4/ui/button.tsx b/apps/v4/registry/new-york-v4/ui/button.tsx
index 10db15c..13a48fd 100644
--- a/apps/v4/registry/new-york-v4/ui/button.tsx
+++ b/apps/v4/registry/new-york-v4/ui/button.tsx
@@ -1,14 +1,15 @@
-"use client";
+"use client"
-import { mergeProps } from "@base-ui/react/merge-props";
-import { useRender } from "@base-ui/react/use-render";
-import { cva, type VariantProps } from "class-variance-authority";
-import * as React from "react";
-import { cn } from "@/lib/utils";
-import { Spinner } from "@/registry/new-york-v4/ui/spinner";
+import * as React from "react"
+import { mergeProps } from "@base-ui/react/merge-props"
+import { useRender } from "@base-ui/react/use-render"
+import { cva, type VariantProps } from "class-variance-authority"
+
+import { cn } from "@/lib/utils"
+import { Spinner } from "@/registry/new-york-v4/ui/spinner"
export const buttonVariants = cva(
- "relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 data-loading:select-none data-loading:text-transparent sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0",
+ "relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 rounded-lg border text-base font-medium whitespace-nowrap transition-shadow outline-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 data-loading:text-transparent data-loading:select-none sm:text-sm pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
{
defaultVariants: {
size: "default",
@@ -31,27 +32,27 @@ export const buttonVariants = cva(
},
variant: {
default:
- "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 data-pressed:bg-primary/90 *:data-[slot=button-loading-indicator]:text-primary-foreground [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
+ "border-primary bg-primary text-primary-foreground shadow-xs shadow-primary/24 not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:bg-primary/90 data-pressed:bg-primary/90 *:data-[slot=button-loading-indicator]:text-primary-foreground [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
destructive:
- "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 data-pressed:bg-destructive/90 *:data-[slot=button-loading-indicator]:text-white [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
+ "border-destructive bg-destructive text-white shadow-xs shadow-destructive/24 not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:bg-destructive/90 data-pressed:bg-destructive/90 *:data-[slot=button-loading-indicator]:text-white [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
"destructive-outline":
- "border-input bg-popover not-dark:bg-clip-padding text-destructive-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:border-destructive/32 hover:bg-destructive/4 data-pressed:border-destructive/32 data-pressed:bg-destructive/4 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none",
+ "border-input bg-popover text-destructive-foreground shadow-xs/5 not-dark:bg-clip-padding not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:border-destructive/32 hover:bg-destructive/4 data-pressed:border-destructive/32 data-pressed:bg-destructive/4 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none",
ghost:
"border-transparent text-foreground hover:bg-accent data-pressed:bg-accent *:data-[slot=button-loading-indicator]:text-foreground",
link: "border-transparent text-foreground underline-offset-4 hover:underline data-pressed:underline *:data-[slot=button-loading-indicator]:text-foreground",
outline:
- "border-input bg-popover not-dark:bg-clip-padding text-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:bg-accent/50 data-pressed:bg-accent/50 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:data-pressed:bg-input/64 dark:hover:bg-input/64 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none",
+ "border-input bg-popover text-foreground shadow-xs/5 not-dark:bg-clip-padding not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:bg-accent/50 data-pressed:bg-accent/50 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] dark:hover:bg-input/64 dark:data-pressed:bg-input/64 [:disabled,:active,[data-pressed]]:shadow-none",
secondary:
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 data-pressed:bg-secondary/90 *:data-[slot=button-loading-indicator]:text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80",
},
},
- },
-);
+ }
+)
export interface ButtonProps extends useRender.ComponentProps<"button"> {
- variant?: VariantProps<typeof buttonVariants>["variant"];
- size?: VariantProps<typeof buttonVariants>["size"];
- loading?: boolean;
+ variant?: VariantProps<typeof buttonVariants>["variant"]
+ size?: VariantProps<typeof buttonVariants>["size"]
+ loading?: boolean
}
export function Button({
@@ -64,9 +65,9 @@ export function Button({
disabled: disabledProp,
...props
}: ButtonProps): React.ReactElement {
- const isDisabled: boolean = Boolean(loading || disabledProp);
+ const isDisabled: boolean = Boolean(loading || disabledProp)
const typeValue: React.ButtonHTMLAttributes<HTMLButtonElement>["type"] =
- render ? undefined : "button";
+ render ? undefined : "button"
const defaultProps = {
children: (
@@ -86,11 +87,11 @@ export function Button({
"data-slot": "button",
disabled: isDisabled,
type: typeValue,
- };
+ }
return useRender({
defaultTagName: "button",
props: mergeProps<"button">(defaultProps, props),
render,
- });
+ })
}
diff --git a/apps/v4/registry/new-york-v4/ui/card.tsx b/apps/v4/registry/new-york-v4/ui/card.tsx
index 260be33..eae7a42 100644
--- a/apps/v4/registry/new-york-v4/ui/card.tsx
+++ b/apps/v4/registry/new-york-v4/ui/card.tsx
@@ -1,9 +1,10 @@
-"use client";
+"use client"
-import { mergeProps } from "@base-ui/react/merge-props";
-import { useRender } from "@base-ui/react/use-render";
-import type React from "react";
-import { cn } from "@/lib/utils";
+import type React from "react"
+import { mergeProps } from "@base-ui/react/merge-props"
+import { useRender } from "@base-ui/react/use-render"
+
+import { cn } from "@/lib/utils"
export function Card({
className,
@@ -12,17 +13,17 @@ export function Card({
}: useRender.ComponentProps<"div">): React.ReactElement {
const defaultProps = {
className: cn(
- "relative flex flex-col rounded-2xl border bg-card not-dark:bg-clip-padding text-card-foreground shadow-xs/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
- className,
+ "relative flex flex-col rounded-2xl border bg-card text-card-foreground shadow-xs/5 not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
+ className
),
"data-slot": "card",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function CardFrame({
@@ -32,17 +33,17 @@ export function CardFrame({
}: useRender.ComponentProps<"div">): React.ReactElement {
const defaultProps = {
className: cn(
- "relative flex flex-col rounded-2xl border bg-card not-dark:bg-clip-padding text-card-foreground shadow-xs/5 [--clip-bottom:-1rem] [--clip-top:-1rem] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:bg-muted/72 before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=table-container]:overflow-hidden *:data-[slot=card]:-m-px *:data-[slot=table-container]:-m-px *:data-[slot=table-container]:w-[calc(100%+2px)] *:not-first:data-[slot=card]:rounded-t-xl *:not-last:data-[slot=card]:rounded-b-xl *:data-[slot=card]:bg-clip-padding *:data-[slot=card]:shadow-none *:data-[slot=card]:before:hidden *:not-first:data-[slot=card]:before:rounded-t-[calc(var(--radius-xl)-1px)] *:not-last:data-[slot=card]:before:rounded-b-[calc(var(--radius-xl)-1px)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)] *:data-[slot=card]:[clip-path:inset(var(--clip-top)_1px_var(--clip-bottom)_1px_round_calc(var(--radius-2xl)-1px))] *:data-[slot=card]:last:[--clip-bottom:1px] *:data-[slot=card]:first:[--clip-top:1px]",
- className,
+ "relative flex flex-col rounded-2xl border bg-card text-card-foreground shadow-xs/5 [--clip-bottom:-1rem] [--clip-top:-1rem] not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:bg-muted/72 before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=table-container]:overflow-hidden *:data-[slot=card]:-m-px *:data-[slot=card]:bg-clip-padding *:data-[slot=card]:shadow-none *:data-[slot=card]:[clip-path:inset(var(--clip-top)_1px_var(--clip-bottom)_1px_round_calc(var(--radius-2xl)-1px))] *:not-first:data-[slot=card]:rounded-t-xl *:not-last:data-[slot=card]:rounded-b-xl *:data-[slot=card]:before:hidden *:not-first:data-[slot=card]:before:rounded-t-[calc(var(--radius-xl)-1px)] *:not-last:data-[slot=card]:before:rounded-b-[calc(var(--radius-xl)-1px)] *:data-[slot=card]:first:[--clip-top:1px] *:data-[slot=card]:last:[--clip-bottom:1px] *:data-[slot=table-container]:-m-px *:data-[slot=table-container]:w-[calc(100%+2px)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
+ className
),
"data-slot": "card-frame",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function CardFrameHeader({
@@ -53,16 +54,16 @@ export function CardFrameHeader({
const defaultProps = {
className: cn(
"relative flex grid auto-rows-min grid-rows-[auto_auto] flex-col items-start gap-x-4 px-6 py-4 has-data-[slot=card-frame-action]:grid-cols-[1fr_auto]",
- className,
+ className
),
"data-slot": "card-frame-header",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function CardFrameTitle({
@@ -71,15 +72,15 @@ export function CardFrameTitle({
...props
}: useRender.ComponentProps<"div">): React.ReactElement {
const defaultProps = {
- className: cn("self-center font-semibold text-sm", className),
+ className: cn("self-center text-sm font-semibold", className),
"data-slot": "card-frame-title",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function CardFrameDescription({
@@ -88,15 +89,15 @@ export function CardFrameDescription({
...props
}: useRender.ComponentProps<"div">): React.ReactElement {
const defaultProps = {
- className: cn("self-center text-muted-foreground text-sm", className),
+ className: cn("self-center text-sm text-muted-foreground", className),
"data-slot": "card-frame-description",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function CardFrameAction({
@@ -106,17 +107,17 @@ export function CardFrameAction({
}: useRender.ComponentProps<"div">): React.ReactElement {
const defaultProps = {
className: cn(
- "col-start-2 nth-3:row-span-2 nth-3:row-start-1 inline-flex self-center justify-self-end",
- className,
+ "col-start-2 inline-flex self-center justify-self-end nth-3:row-span-2 nth-3:row-start-1",
+ className
),
"data-slot": "card-frame-action",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function CardFrameFooter({
@@ -127,13 +128,13 @@ export function CardFrameFooter({
const defaultProps = {
className: cn("px-6 py-4", className),
"data-slot": "card-frame-footer",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function CardHeader({
@@ -144,16 +145,16 @@ export function CardHeader({
const defaultProps = {
className: cn(
"grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 p-6 in-[[data-slot=card]:has(>[data-slot=card-panel])]:pb-4 has-data-[slot=card-action]:grid-cols-[1fr_auto]",
- className,
+ className
),
"data-slot": "card-header",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function CardTitle({
@@ -162,15 +163,15 @@ export function CardTitle({
...props
}: useRender.ComponentProps<"div">): React.ReactElement {
const defaultProps = {
- className: cn("font-semibold text-lg leading-none", className),
+ className: cn("text-lg leading-none font-semibold", className),
"data-slot": "card-title",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function CardDescription({
@@ -179,15 +180,15 @@ export function CardDescription({
...props
}: useRender.ComponentProps<"div">): React.ReactElement {
const defaultProps = {
- className: cn("text-muted-foreground text-sm", className),
+ className: cn("text-sm text-muted-foreground", className),
"data-slot": "card-description",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function CardAction({
@@ -198,16 +199,16 @@ export function CardAction({
const defaultProps = {
className: cn(
"col-start-2 row-span-2 row-start-1 inline-flex self-start justify-self-end",
- className,
+ className
),
"data-slot": "card-action",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function CardPanel({
@@ -217,17 +218,17 @@ export function CardPanel({
}: useRender.ComponentProps<"div">): React.ReactElement {
const defaultProps = {
className: cn(
- "flex-1 p-6 in-[[data-slot=card]:has(>[data-slot=card-header]:not(.border-b))]:pt-0 in-[[data-slot=card]:has(>[data-slot=card-footer]:not(.border-t))]:pb-0",
- className,
+ "flex-1 p-6 in-[[data-slot=card]:has(>[data-slot=card-footer]:not(.border-t))]:pb-0 in-[[data-slot=card]:has(>[data-slot=card-header]:not(.border-b))]:pt-0",
+ className
),
"data-slot": "card-panel",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function CardFooter({
@@ -238,16 +239,16 @@ export function CardFooter({
const defaultProps = {
className: cn(
"flex items-center p-6 in-[[data-slot=card]:has(>[data-slot=card-panel])]:pt-4",
- className,
+ className
),
"data-slot": "card-footer",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
-export { CardPanel as CardContent };
+export { CardPanel as CardContent }
diff --git a/apps/v4/registry/new-york-v4/ui/collapsible.tsx b/apps/v4/registry/new-york-v4/ui/collapsible.tsx
index 9ae31a3..491d70b 100644
--- a/apps/v4/registry/new-york-v4/ui/collapsible.tsx
+++ b/apps/v4/registry/new-york-v4/ui/collapsible.tsx
@@ -1,14 +1,15 @@
-"use client";
+"use client"
-import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
-import type React from "react";
-import { isValidElement } from "react";
-import { cn } from "@/lib/utils";
+import type React from "react"
+import { isValidElement } from "react"
+import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible"
+
+import { cn } from "@/lib/utils"
export function Collapsible({
...props
}: CollapsiblePrimitive.Root.Props): React.ReactElement {
- return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
}
export function CollapsibleTrigger({
@@ -18,7 +19,7 @@ export function CollapsibleTrigger({
render,
...props
}: CollapsiblePrimitive.Trigger.Props & {
- asChild?: boolean;
+ asChild?: boolean
}): React.ReactElement {
return (
<CollapsiblePrimitive.Trigger
@@ -34,7 +35,7 @@ export function CollapsibleTrigger({
>
{asChild && isValidElement(children) ? undefined : children}
</CollapsiblePrimitive.Trigger>
- );
+ )
}
export function CollapsiblePanel({
@@ -42,18 +43,18 @@ export function CollapsiblePanel({
forceMount: _forceMount,
...props
}: CollapsiblePrimitive.Panel.Props & {
- forceMount?: boolean;
+ forceMount?: boolean
}): React.ReactElement {
return (
<CollapsiblePrimitive.Panel
className={cn(
"h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 data-ending-style:h-0 data-starting-style:h-0",
- className,
+ className
)}
data-slot="collapsible-panel"
{...props}
/>
- );
+ )
}
-export { CollapsiblePrimitive, CollapsiblePanel as CollapsibleContent };
+export { CollapsiblePrimitive, CollapsiblePanel as CollapsibleContent }
diff --git a/apps/v4/registry/new-york-v4/ui/command.tsx b/apps/v4/registry/new-york-v4/ui/command.tsx
index 633d804..6281ecc 100644
--- a/apps/v4/registry/new-york-v4/ui/command.tsx
+++ b/apps/v4/registry/new-york-v4/ui/command.tsx
@@ -124,7 +124,7 @@ function CommandGroup({
<CommandPrimitive.Group
data-slot="command-group"
className={cn(
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs",
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
className
)}
{...props}
@@ -153,7 +153,7 @@ function CommandItem({
<CommandPrimitive.Item
data-slot="command-item"
className={cn(
- "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-disabled:pointer-events-none data-disabled:opacity-50 data-selected:bg-accent data-selected:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
+ "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-selected:bg-accent data-selected:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
className
)}
{...props}
@@ -168,7 +168,10 @@ function CommandShortcut({
return (
<span
data-slot="command-shortcut"
- className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
+ className={cn(
+ "ml-auto text-xs tracking-widest text-muted-foreground",
+ className
+ )}
{...props}
/>
)
diff --git a/apps/v4/registry/new-york-v4/ui/dialog.tsx b/apps/v4/registry/new-york-v4/ui/dialog.tsx
index 20ade94..4c3f916 100644
--- a/apps/v4/registry/new-york-v4/ui/dialog.tsx
+++ b/apps/v4/registry/new-york-v4/ui/dialog.tsx
@@ -1,23 +1,24 @@
-"use client";
-
-import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
-import { mergeProps } from "@base-ui/react/merge-props";
-import { useRender } from "@base-ui/react/use-render";
-import type React from "react";
-import { isValidElement } from "react";
-import { Cancel01Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import { cn } from "@/lib/utils";
-import { Button } from "@/registry/new-york-v4/ui/button";
-import { ScrollArea } from "@/registry/new-york-v4/ui/scroll-area";
+"use client"
+
+import type React from "react"
+import { isValidElement } from "react"
+import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"
+import { mergeProps } from "@base-ui/react/merge-props"
+import { useRender } from "@base-ui/react/use-render"
+import { Cancel01Icon } from "@hugeicons/core-free-icons"
+import { HugeiconsIcon } from "@hugeicons/react"
+
+import { cn } from "@/lib/utils"
+import { Button } from "@/registry/new-york-v4/ui/button"
+import { ScrollArea } from "@/registry/new-york-v4/ui/scroll-area"
export const DialogCreateHandle: typeof DialogPrimitive.createHandle =
- DialogPrimitive.createHandle;
+ DialogPrimitive.createHandle
-export const Dialog: typeof DialogPrimitive.Root = DialogPrimitive.Root;
+export const Dialog: typeof DialogPrimitive.Root = DialogPrimitive.Root
export const DialogPortal: typeof DialogPrimitive.Portal =
- DialogPrimitive.Portal;
+ DialogPrimitive.Portal
export function DialogTrigger({
asChild,
@@ -25,7 +26,7 @@ export function DialogTrigger({
render,
...props
}: DialogPrimitive.Trigger.Props & {
- asChild?: boolean;
+ asChild?: boolean
}): React.ReactElement {
return (
<DialogPrimitive.Trigger
@@ -40,13 +41,13 @@ export function DialogTrigger({
>
{asChild && isValidElement(children) ? undefined : children}
</DialogPrimitive.Trigger>
- );
+ )
}
export function DialogClose(
- props: DialogPrimitive.Close.Props,
+ props: DialogPrimitive.Close.Props
): React.ReactElement {
- return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
}
export function DialogBackdrop({
@@ -57,12 +58,12 @@ export function DialogBackdrop({
<DialogPrimitive.Backdrop
className={cn(
"fixed inset-0 z-50 bg-black/32 backdrop-blur-sm transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0",
- className,
+ className
)}
data-slot="dialog-backdrop"
{...props}
/>
- );
+ )
}
export function DialogViewport({
@@ -73,12 +74,12 @@ export function DialogViewport({
<DialogPrimitive.Viewport
className={cn(
"fixed inset-0 z-50 grid grid-rows-[1fr_auto_3fr] justify-items-center p-4",
- className,
+ className
)}
data-slot="dialog-viewport"
{...props}
/>
- );
+ )
}
export function DialogPopup({
@@ -90,10 +91,10 @@ export function DialogPopup({
portalProps,
...props
}: DialogPrimitive.Popup.Props & {
- showCloseButton?: boolean;
- bottomStickOnMobile?: boolean;
- closeProps?: DialogPrimitive.Close.Props;
- portalProps?: DialogPrimitive.Portal.Props;
+ showCloseButton?: boolean
+ bottomStickOnMobile?: boolean
+ closeProps?: DialogPrimitive.Close.Props
+ portalProps?: DialogPrimitive.Portal.Props
}): React.ReactElement {
return (
<DialogPortal {...portalProps}>
@@ -101,15 +102,15 @@ export function DialogPopup({
<DialogViewport
className={cn(
bottomStickOnMobile &&
- "max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12",
+ "max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12"
)}
>
<DialogPrimitive.Popup
className={cn(
- "relative row-start-2 flex max-h-full min-h-0 w-full min-w-0 max-w-lg origin-center flex-col rounded-2xl border bg-popover not-dark:bg-clip-padding text-popover-foreground opacity-[calc(1-var(--nested-dialogs))] shadow-lg/5 outline-none transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:opacity-0 data-starting-style:opacity-0 sm:scale-[calc(1-0.1*var(--nested-dialogs))] sm:data-ending-style:scale-98 sm:data-starting-style:scale-98 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
+ "relative row-start-2 flex max-h-full min-h-0 w-full max-w-lg min-w-0 origin-center flex-col rounded-2xl border bg-popover text-popover-foreground opacity-[calc(1-var(--nested-dialogs))] shadow-lg/5 transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform outline-none not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:opacity-0 data-starting-style:opacity-0 sm:scale-[calc(1-0.1*var(--nested-dialogs))] sm:data-ending-style:scale-98 sm:data-starting-style:scale-98 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
bottomStickOnMobile &&
- "max-sm:max-w-none max-sm:origin-bottom max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4 max-sm:before:hidden max-sm:before:rounded-none",
- className,
+ "max-sm:max-w-none max-sm:origin-bottom max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:before:hidden max-sm:before:rounded-none max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4",
+ className
)}
data-slot="dialog-popup"
{...props}
@@ -128,7 +129,7 @@ export function DialogPopup({
</DialogPrimitive.Popup>
</DialogViewport>
</DialogPortal>
- );
+ )
}
export function DialogHeader({
@@ -139,16 +140,16 @@ export function DialogHeader({
const defaultProps = {
className: cn(
"flex flex-col gap-2 p-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-panel])]:pb-3 max-sm:pb-4",
- className,
+ className
),
"data-slot": "dialog-header",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function DialogFooter({
@@ -157,24 +158,24 @@ export function DialogFooter({
render,
...props
}: useRender.ComponentProps<"div"> & {
- variant?: "default" | "bare";
+ variant?: "default" | "bare"
}): React.ReactElement {
const defaultProps = {
className: cn(
"flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]",
variant === "default" && "border-t bg-muted/72 py-4",
variant === "bare" &&
- "in-[[data-slot=dialog-popup]:has([data-slot=dialog-panel])]:pt-3 pt-4 pb-6",
- className,
+ "pt-4 pb-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-panel])]:pt-3",
+ className
),
"data-slot": "dialog-footer",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function DialogTitle({
@@ -184,13 +185,13 @@ export function DialogTitle({
return (
<DialogPrimitive.Title
className={cn(
- "font-heading font-semibold text-xl leading-none",
- className,
+ "font-heading text-xl leading-none font-semibold",
+ className
)}
data-slot="dialog-title"
{...props}
/>
- );
+ )
}
export function DialogDescription({
@@ -199,11 +200,11 @@ export function DialogDescription({
}: DialogPrimitive.Description.Props): React.ReactElement {
return (
<DialogPrimitive.Description
- className={cn("text-muted-foreground text-sm", className)}
+ className={cn("text-sm text-muted-foreground", className)}
data-slot="dialog-description"
{...props}
/>
- );
+ )
}
export function DialogPanel({
@@ -212,15 +213,15 @@ export function DialogPanel({
render,
...props
}: useRender.ComponentProps<"div"> & {
- scrollFade?: boolean;
+ scrollFade?: boolean
}): React.ReactElement {
const defaultProps = {
className: cn(
- "p-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-header])]:pt-1 in-[[data-slot=dialog-popup]:has([data-slot=dialog-footer]:not(.border-t))]:pb-1",
- className,
+ "p-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-footer]:not(.border-t))]:pb-1 in-[[data-slot=dialog-popup]:has([data-slot=dialog-header])]:pt-1",
+ className
),
"data-slot": "dialog-panel",
- };
+ }
return (
<ScrollArea scrollFade={scrollFade}>
@@ -230,11 +231,11 @@ export function DialogPanel({
render,
})}
</ScrollArea>
- );
+ )
}
export {
DialogPrimitive,
DialogBackdrop as DialogOverlay,
DialogPopup as DialogContent,
-};
+}
diff --git a/apps/v4/registry/new-york-v4/ui/dropdown-menu.tsx b/apps/v4/registry/new-york-v4/ui/dropdown-menu.tsx
index f204598..1db9c4a 100644
--- a/apps/v4/registry/new-york-v4/ui/dropdown-menu.tsx
+++ b/apps/v4/registry/new-york-v4/ui/dropdown-menu.tsx
@@ -1,33 +1,31 @@
-"use client";
+"use client"
-import { Menu as DropdownMenuPrimitive } from "@base-ui/react/menu";
-import { ArrowRight01Icon, Tick02Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import * as React from "react";
-import { cn } from "@/lib/utils";
+import * as React from "react"
+import { Menu as DropdownMenuPrimitive } from "@base-ui/react/menu"
+import { ArrowRight01Icon, Tick02Icon } from "@hugeicons/core-free-icons"
+import { HugeiconsIcon } from "@hugeicons/react"
+
+import { cn } from "@/lib/utils"
function childContent(
asChild: boolean | undefined,
- children: React.ReactNode,
+ children: React.ReactNode
): React.ReactNode {
- return asChild && React.isValidElement(children) ? undefined : children;
+ return asChild && React.isValidElement(children) ? undefined : children
}
function DropdownMenu({
...props
}: DropdownMenuPrimitive.Root.Props): React.ReactElement {
- return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
+ return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
}
function DropdownMenuPortal({
...props
}: DropdownMenuPrimitive.Portal.Props): React.ReactElement {
return (
- <DropdownMenuPrimitive.Portal
- data-slot="dropdown-menu-portal"
- {...props}
- />
- );
+ <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
+ )
}
function DropdownMenuTrigger({
@@ -36,7 +34,7 @@ function DropdownMenuTrigger({
render,
...props
}: DropdownMenuPrimitive.Trigger.Props & {
- asChild?: boolean;
+ asChild?: boolean
}): React.ReactElement {
return (
<DropdownMenuPrimitive.Trigger
@@ -51,7 +49,7 @@ function DropdownMenuTrigger({
>
{childContent(asChild, children)}
</DropdownMenuPrimitive.Trigger>
- );
+ )
}
function DropdownMenuContent({
@@ -65,12 +63,12 @@ function DropdownMenuContent({
children,
...props
}: DropdownMenuPrimitive.Popup.Props & {
- portalProps?: DropdownMenuPrimitive.Portal.Props;
- side?: DropdownMenuPrimitive.Positioner.Props["side"];
- sideOffset?: DropdownMenuPrimitive.Positioner.Props["sideOffset"];
- align?: DropdownMenuPrimitive.Positioner.Props["align"];
- alignOffset?: DropdownMenuPrimitive.Positioner.Props["alignOffset"];
- anchor?: DropdownMenuPrimitive.Positioner.Props["anchor"];
+ portalProps?: DropdownMenuPrimitive.Portal.Props
+ side?: DropdownMenuPrimitive.Positioner.Props["side"]
+ sideOffset?: DropdownMenuPrimitive.Positioner.Props["sideOffset"]
+ align?: DropdownMenuPrimitive.Positioner.Props["align"]
+ alignOffset?: DropdownMenuPrimitive.Positioner.Props["alignOffset"]
+ anchor?: DropdownMenuPrimitive.Positioner.Props["anchor"]
}): React.ReactElement {
return (
<DropdownMenuPrimitive.Portal {...portalProps}>
@@ -85,8 +83,8 @@ function DropdownMenuContent({
>
<DropdownMenuPrimitive.Popup
className={cn(
- "relative flex h-(--popup-height,auto) w-(--popup-width,auto) min-w-32 origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
- className,
+ "relative flex h-(--popup-height,auto) w-(--popup-width,auto) min-w-32 origin-(--transform-origin) rounded-lg border bg-popover text-popover-foreground shadow-lg/5 transition-[width,height,scale,opacity] outline-none not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:scale-98 data-ending-style:opacity-0 data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
+ className
)}
data-slot="dropdown-menu-content"
{...props}
@@ -100,7 +98,7 @@ function DropdownMenuContent({
</DropdownMenuPrimitive.Popup>
</DropdownMenuPrimitive.Positioner>
</DropdownMenuPrimitive.Portal>
- );
+ )
}
function DropdownMenuGroup({
@@ -108,7 +106,7 @@ function DropdownMenuGroup({
}: DropdownMenuPrimitive.Group.Props): React.ReactElement {
return (
<DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
- );
+ )
}
function DropdownMenuItem({
@@ -120,15 +118,15 @@ function DropdownMenuItem({
render,
...props
}: DropdownMenuPrimitive.Item.Props & {
- inset?: boolean;
- variant?: "default" | "destructive";
- asChild?: boolean;
+ inset?: boolean
+ variant?: "default" | "destructive"
+ asChild?: boolean
}): React.ReactElement {
return (
<DropdownMenuPrimitive.Item
className={cn(
- "relative flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 data-[inset=true]:ps-8 data-[variant=destructive]:text-destructive-foreground sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
- className,
+ "relative flex min-h-8 cursor-default items-center gap-2 rounded-sm px-2 py-1 text-base outline-none select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-[inset=true]:ps-8 data-[variant=destructive]:text-destructive-foreground sm:min-h-7 sm:text-sm data-disabled:pointer-events-none data-disabled:opacity-64 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
+ className
)}
data-inset={inset}
data-slot="dropdown-menu-item"
@@ -143,7 +141,7 @@ function DropdownMenuItem({
>
{childContent(asChild, children)}
</DropdownMenuPrimitive.Item>
- );
+ )
}
function DropdownMenuCheckboxItem({
@@ -156,8 +154,8 @@ function DropdownMenuCheckboxItem({
<DropdownMenuPrimitive.CheckboxItem
checked={checked}
className={cn(
- "relative flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm py-1 pe-2 ps-8 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
- className,
+ "relative flex min-h-8 cursor-default items-center gap-2 rounded-sm py-1 ps-8 pe-2 text-base outline-none select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground sm:min-h-7 sm:text-sm data-disabled:pointer-events-none data-disabled:opacity-64 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
+ className
)}
data-slot="dropdown-menu-checkbox-item"
{...props}
@@ -169,7 +167,7 @@ function DropdownMenuCheckboxItem({
</span>
{children}
</DropdownMenuPrimitive.CheckboxItem>
- );
+ )
}
function DropdownMenuRadioGroup({
@@ -180,7 +178,7 @@ function DropdownMenuRadioGroup({
data-slot="dropdown-menu-radio-group"
{...props}
/>
- );
+ )
}
function DropdownMenuRadioItem({
@@ -191,8 +189,8 @@ function DropdownMenuRadioItem({
return (
<DropdownMenuPrimitive.RadioItem
className={cn(
- "relative flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm py-1 pe-2 ps-8 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
- className,
+ "relative flex min-h-8 cursor-default items-center gap-2 rounded-sm py-1 ps-8 pe-2 text-base outline-none select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground sm:min-h-7 sm:text-sm data-disabled:pointer-events-none data-disabled:opacity-64 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
+ className
)}
data-slot="dropdown-menu-radio-item"
{...props}
@@ -204,7 +202,7 @@ function DropdownMenuRadioItem({
</span>
{children}
</DropdownMenuPrimitive.RadioItem>
- );
+ )
}
function DropdownMenuLabel({
@@ -212,19 +210,19 @@ function DropdownMenuLabel({
inset,
...props
}: DropdownMenuPrimitive.GroupLabel.Props & {
- inset?: boolean;
+ inset?: boolean
}): React.ReactElement {
return (
<DropdownMenuPrimitive.GroupLabel
className={cn(
- "px-2 py-1.5 font-medium text-muted-foreground text-xs data-[inset=true]:ps-8",
- className,
+ "px-2 py-1.5 text-xs font-medium text-muted-foreground data-[inset=true]:ps-8",
+ className
)}
data-inset={inset}
data-slot="dropdown-menu-label"
{...props}
/>
- );
+ )
}
function DropdownMenuSeparator({
@@ -237,7 +235,7 @@ function DropdownMenuSeparator({
data-slot="dropdown-menu-separator"
{...props}
/>
- );
+ )
}
function DropdownMenuShortcut({
@@ -246,11 +244,14 @@ function DropdownMenuShortcut({
}: React.ComponentProps<"span">): React.ReactElement {
return (
<span
- className={cn("ms-auto font-medium text-muted-foreground text-xs", className)}
+ className={cn(
+ "ms-auto text-xs font-medium text-muted-foreground",
+ className
+ )}
data-slot="dropdown-menu-shortcut"
{...props}
/>
- );
+ )
}
function DropdownMenuSub({
@@ -261,7 +262,7 @@ function DropdownMenuSub({
data-slot="dropdown-menu-sub"
{...props}
/>
- );
+ )
}
function DropdownMenuSubTrigger({
@@ -270,13 +271,13 @@ function DropdownMenuSubTrigger({
children,
...props
}: DropdownMenuPrimitive.SubmenuTrigger.Props & {
- inset?: boolean;
+ inset?: boolean
}): React.ReactElement {
return (
<DropdownMenuPrimitive.SubmenuTrigger
className={cn(
- "flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base outline-none data-popup-open:bg-accent data-highlighted:bg-accent data-highlighted:text-accent-foreground data-[inset=true]:ps-8 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
- className,
+ "flex min-h-8 cursor-default items-center gap-2 rounded-sm px-2 py-1 text-base outline-none select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-popup-open:bg-accent data-[inset=true]:ps-8 sm:min-h-7 sm:text-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
+ className
)}
data-inset={inset}
data-slot="dropdown-menu-sub-trigger"
@@ -285,13 +286,13 @@ function DropdownMenuSubTrigger({
{children}
<HugeiconsIcon icon={ArrowRight01Icon} className="ms-auto size-4" />
</DropdownMenuPrimitive.SubmenuTrigger>
- );
+ )
}
function DropdownMenuSubContent(
- props: React.ComponentProps<typeof DropdownMenuContent>,
+ props: React.ComponentProps<typeof DropdownMenuContent>
): React.ReactElement {
- return <DropdownMenuContent side="right" sideOffset={8} {...props} />;
+ return <DropdownMenuContent side="right" sideOffset={8} {...props} />
}
export {
@@ -310,4 +311,4 @@ export {
DropdownMenuSub,
DropdownMenuSubTrigger,
DropdownMenuSubContent,
-};
+}
diff --git a/apps/v4/registry/new-york-v4/ui/input.tsx b/apps/v4/registry/new-york-v4/ui/input.tsx
index 8ef394d..5769242 100644
--- a/apps/v4/registry/new-york-v4/ui/input.tsx
+++ b/apps/v4/registry/new-york-v4/ui/input.tsx
@@ -1,17 +1,18 @@
-"use client";
+"use client"
-import { Input as InputPrimitive } from "@base-ui/react/input";
-import type * as React from "react";
-import { cn } from "@/lib/utils";
+import type * as React from "react"
+import { Input as InputPrimitive } from "@base-ui/react/input"
+
+import { cn } from "@/lib/utils"
export type InputProps = Omit<
InputPrimitive.Props & React.RefAttributes<HTMLInputElement>,
"size"
> & {
- size?: "sm" | "default" | "lg" | number;
- unstyled?: boolean;
- nativeInput?: boolean;
-};
+ size?: "sm" | "default" | "lg" | number
+ unstyled?: boolean
+ nativeInput?: boolean
+}
export function Input({
className,
@@ -29,16 +30,16 @@ export function Input({
props.type === "search" &&
"[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none",
props.type === "file" &&
- "text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm",
- );
+ "text-muted-foreground file:me-3 file:bg-transparent file:text-sm file:font-medium file:text-foreground"
+ )
return (
<span
className={
cn(
!unstyled &&
- "relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-autofill:bg-foreground/4 has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] sm:text-sm dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]",
- className,
+ "relative inline-flex w-full rounded-lg border border-input bg-background text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-autofill:bg-foreground/4 has-focus-visible:border-ring has-focus-visible:ring-[3px] has-disabled:opacity-64 has-aria-invalid:border-destructive/36 has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none sm:text-sm dark:bg-input/32 dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24",
+ className
) || undefined
}
data-size={size}
@@ -62,7 +63,7 @@ export function Input({
/>
)}
</span>
- );
+ )
}
-export { InputPrimitive };
+export { InputPrimitive }
diff --git a/apps/v4/registry/new-york-v4/ui/kbd.tsx b/apps/v4/registry/new-york-v4/ui/kbd.tsx
index afbb959..447acef 100644
--- a/apps/v4/registry/new-york-v4/ui/kbd.tsx
+++ b/apps/v4/registry/new-york-v4/ui/kbd.tsx
@@ -1,5 +1,6 @@
-import type * as React from "react";
-import { cn } from "@/lib/utils";
+import type * as React from "react"
+
+import { cn } from "@/lib/utils"
export function Kbd({
className,
@@ -8,13 +9,13 @@ export function Kbd({
return (
<kbd
className={cn(
- "pointer-events-none inline-flex h-5 min-w-5 select-none items-center justify-center gap-1 rounded bg-muted px-1 font-medium font-sans text-muted-foreground text-xs [&_svg:not([class*='size-'])]:size-3",
- className,
+ "pointer-events-none inline-flex h-5 min-w-5 items-center justify-center gap-1 rounded bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none [&_svg:not([class*='size-'])]:size-3",
+ className
)}
data-slot="kbd"
{...props}
/>
- );
+ )
}
export function KbdGroup({
@@ -27,5 +28,5 @@ export function KbdGroup({
data-slot="kbd-group"
{...props}
/>
- );
+ )
}
diff --git a/apps/v4/registry/new-york-v4/ui/popover.tsx b/apps/v4/registry/new-york-v4/ui/popover.tsx
index e354872..abaf085 100644
--- a/apps/v4/registry/new-york-v4/ui/popover.tsx
+++ b/apps/v4/registry/new-york-v4/ui/popover.tsx
@@ -1,19 +1,20 @@
-"use client";
+"use client"
-import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
-import type React from "react";
-import { isValidElement } from "react";
-import { cn } from "@/lib/utils";
+import type React from "react"
+import { isValidElement } from "react"
+import { Popover as PopoverPrimitive } from "@base-ui/react/popover"
+
+import { cn } from "@/lib/utils"
export const PopoverCreateHandle: typeof PopoverPrimitive.createHandle =
- PopoverPrimitive.createHandle;
+ PopoverPrimitive.createHandle
-export const Popover: typeof PopoverPrimitive.Root = PopoverPrimitive.Root;
+export const Popover: typeof PopoverPrimitive.Root = PopoverPrimitive.Root
export function PopoverAnchor(
- props: React.ComponentProps<"span">,
+ props: React.ComponentProps<"span">
): React.ReactElement {
- return <span data-slot="popover-anchor" {...props} />;
+ return <span data-slot="popover-anchor" {...props} />
}
export function PopoverTrigger({
@@ -23,7 +24,7 @@ export function PopoverTrigger({
render,
...props
}: PopoverPrimitive.Trigger.Props & {
- asChild?: boolean;
+ asChild?: boolean
}): React.ReactElement {
return (
<PopoverPrimitive.Trigger
@@ -39,7 +40,7 @@ export function PopoverTrigger({
>
{asChild && isValidElement(children) ? undefined : children}
</PopoverPrimitive.Trigger>
- );
+ )
}
export function PopoverPopup({
@@ -54,13 +55,13 @@ export function PopoverPopup({
portalProps,
...props
}: PopoverPrimitive.Popup.Props & {
- portalProps?: PopoverPrimitive.Portal.Props;
- side?: PopoverPrimitive.Positioner.Props["side"];
- align?: PopoverPrimitive.Positioner.Props["align"];
- sideOffset?: PopoverPrimitive.Positioner.Props["sideOffset"];
- alignOffset?: PopoverPrimitive.Positioner.Props["alignOffset"];
- tooltipStyle?: boolean;
- anchor?: PopoverPrimitive.Positioner.Props["anchor"];
+ portalProps?: PopoverPrimitive.Portal.Props
+ side?: PopoverPrimitive.Positioner.Props["side"]
+ align?: PopoverPrimitive.Positioner.Props["align"]
+ sideOffset?: PopoverPrimitive.Positioner.Props["sideOffset"]
+ alignOffset?: PopoverPrimitive.Positioner.Props["alignOffset"]
+ tooltipStyle?: boolean
+ anchor?: PopoverPrimitive.Positioner.Props["anchor"]
}): React.ReactElement {
return (
<PopoverPrimitive.Portal {...portalProps}>
@@ -75,20 +76,20 @@ export function PopoverPopup({
>
<PopoverPrimitive.Popup
className={cn(
- "relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-xl has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
+ "relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-lg border bg-popover text-popover-foreground shadow-lg/5 transition-[width,height,scale,opacity] outline-none not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-xl has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
tooltipStyle &&
- "w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]",
- className,
+ "w-fit rounded-md text-xs text-balance shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]",
+ className
)}
data-slot="popover-popup"
{...props}
>
<PopoverPrimitive.Viewport
className={cn(
- "relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity",
+ "relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-current:transition-opacity **:data-current:data-ending-style:opacity-0 data-instant:transition-none **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:opacity-100 **:data-previous:transition-opacity **:data-previous:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-starting-style:opacity-0",
tooltipStyle
? "py-1 [--viewport-inline-padding:--spacing(2)]"
- : "not-data-transitioning:overflow-y-auto",
+ : "not-data-transitioning:overflow-y-auto"
)}
data-slot="popover-viewport"
>
@@ -97,13 +98,13 @@ export function PopoverPopup({
</PopoverPrimitive.Popup>
</PopoverPrimitive.Positioner>
</PopoverPrimitive.Portal>
- );
+ )
}
export function PopoverClose({
...props
}: PopoverPrimitive.Close.Props): React.ReactElement {
- return <PopoverPrimitive.Close data-slot="popover-close" {...props} />;
+ return <PopoverPrimitive.Close data-slot="popover-close" {...props} />
}
export function PopoverTitle({
@@ -112,11 +113,11 @@ export function PopoverTitle({
}: PopoverPrimitive.Title.Props): React.ReactElement {
return (
<PopoverPrimitive.Title
- className={cn("font-semibold text-lg leading-none", className)}
+ className={cn("text-lg leading-none font-semibold", className)}
data-slot="popover-title"
{...props}
/>
- );
+ )
}
export function PopoverDescription({
@@ -125,11 +126,11 @@ export function PopoverDescription({
}: PopoverPrimitive.Description.Props): React.ReactElement {
return (
<PopoverPrimitive.Description
- className={cn("text-muted-foreground text-sm", className)}
+ className={cn("text-sm text-muted-foreground", className)}
data-slot="popover-description"
{...props}
/>
- );
+ )
}
-export { PopoverPrimitive, PopoverPopup as PopoverContent };
+export { PopoverPrimitive, PopoverPopup as PopoverContent }
diff --git a/apps/v4/registry/new-york-v4/ui/scroll-area.tsx b/apps/v4/registry/new-york-v4/ui/scroll-area.tsx
index ccec9de..4ef37e4 100644
--- a/apps/v4/registry/new-york-v4/ui/scroll-area.tsx
+++ b/apps/v4/registry/new-york-v4/ui/scroll-area.tsx
@@ -1,8 +1,9 @@
-"use client";
+"use client"
-import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
-import type React from "react";
-import { cn } from "@/lib/utils";
+import type React from "react"
+import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
+
+import { cn } from "@/lib/utils"
export function ScrollArea({
className,
@@ -11,8 +12,8 @@ export function ScrollArea({
scrollbarGutter = false,
...props
}: ScrollAreaPrimitive.Root.Props & {
- scrollFade?: boolean;
- scrollbarGutter?: boolean;
+ scrollFade?: boolean
+ scrollbarGutter?: boolean
}): React.ReactElement {
return (
<ScrollAreaPrimitive.Root
@@ -21,11 +22,11 @@ export function ScrollArea({
>
<ScrollAreaPrimitive.Viewport
className={cn(
- "h-full rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-y:overscroll-y-contain data-has-overflow-x:overscroll-x-contain",
+ "transition-shadows h-full rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-x:overscroll-x-contain data-has-overflow-y:overscroll-y-contain",
scrollFade &&
- "mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]",
+ "mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] [--fade-size:1.5rem]",
scrollbarGutter &&
- "data-has-overflow-y:pe-2.5 data-has-overflow-x:pb-2.5",
+ "data-has-overflow-x:pb-2.5 data-has-overflow-y:pe-2.5"
)}
data-slot="scroll-area-viewport"
>
@@ -35,7 +36,7 @@ export function ScrollArea({
<ScrollBar orientation="horizontal" />
<ScrollAreaPrimitive.Corner data-slot="scroll-area-corner" />
</ScrollAreaPrimitive.Root>
- );
+ )
}
export function ScrollBar({
@@ -46,8 +47,8 @@ export function ScrollBar({
return (
<ScrollAreaPrimitive.Scrollbar
className={cn(
- "m-1 flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100",
- className,
+ "m-1 flex opacity-0 transition-opacity delay-300 data-hovering:opacity-100 data-hovering:delay-0 data-hovering:duration-100 data-scrolling:opacity-100 data-scrolling:delay-0 data-scrolling:duration-100 data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:flex-col data-[orientation=vertical]:w-1.5",
+ className
)}
data-slot="scroll-area-scrollbar"
orientation={orientation}
@@ -58,7 +59,7 @@ export function ScrollBar({
data-slot="scroll-area-thumb"
/>
</ScrollAreaPrimitive.Scrollbar>
- );
+ )
}
-export { ScrollAreaPrimitive };
+export { ScrollAreaPrimitive }
diff --git a/apps/v4/registry/new-york-v4/ui/separator.tsx b/apps/v4/registry/new-york-v4/ui/separator.tsx
index f3db7fb..26a9976 100644
--- a/apps/v4/registry/new-york-v4/ui/separator.tsx
+++ b/apps/v4/registry/new-york-v4/ui/separator.tsx
@@ -1,6 +1,7 @@
-import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
-import type React from "react";
-import { cn } from "@/lib/utils";
+import type React from "react"
+import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
+
+import { cn } from "@/lib/utils"
export function Separator({
className,
@@ -11,13 +12,13 @@ export function Separator({
<SeparatorPrimitive
className={cn(
"shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:not-[[class^='h-']]:not-[[class*='_h-']]:self-stretch",
- className,
+ className
)}
data-slot="separator"
orientation={orientation}
{...props}
/>
- );
+ )
}
-export { SeparatorPrimitive };
+export { SeparatorPrimitive }
diff --git a/apps/v4/registry/new-york-v4/ui/sheet.tsx b/apps/v4/registry/new-york-v4/ui/sheet.tsx
index 3eb54e0..ecab72b 100644
--- a/apps/v4/registry/new-york-v4/ui/sheet.tsx
+++ b/apps/v4/registry/new-york-v4/ui/sheet.tsx
@@ -1,19 +1,20 @@
-"use client";
+"use client"
-import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
-import { mergeProps } from "@base-ui/react/merge-props";
-import { useRender } from "@base-ui/react/use-render";
-import type React from "react";
-import { isValidElement } from "react";
-import { Cancel01Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import { cn } from "@/lib/utils";
-import { Button } from "@/registry/new-york-v4/ui/button";
-import { ScrollArea } from "@/registry/new-york-v4/ui/scroll-area";
+import type React from "react"
+import { isValidElement } from "react"
+import { Dialog as SheetPrimitive } from "@base-ui/react/dialog"
+import { mergeProps } from "@base-ui/react/merge-props"
+import { useRender } from "@base-ui/react/use-render"
+import { Cancel01Icon } from "@hugeicons/core-free-icons"
+import { HugeiconsIcon } from "@hugeicons/react"
-export const Sheet: typeof SheetPrimitive.Root = SheetPrimitive.Root;
+import { cn } from "@/lib/utils"
+import { Button } from "@/registry/new-york-v4/ui/button"
+import { ScrollArea } from "@/registry/new-york-v4/ui/scroll-area"
-export const SheetPortal: typeof SheetPrimitive.Portal = SheetPrimitive.Portal;
+export const Sheet: typeof SheetPrimitive.Root = SheetPrimitive.Root
+
+export const SheetPortal: typeof SheetPrimitive.Portal = SheetPrimitive.Portal
export function SheetTrigger({
asChild,
@@ -21,7 +22,7 @@ export function SheetTrigger({
render,
...props
}: SheetPrimitive.Trigger.Props & {
- asChild?: boolean;
+ asChild?: boolean
}): React.ReactElement {
return (
<SheetPrimitive.Trigger
@@ -36,13 +37,13 @@ export function SheetTrigger({
>
{asChild && isValidElement(children) ? undefined : children}
</SheetPrimitive.Trigger>
- );
+ )
}
export function SheetClose(
- props: SheetPrimitive.Close.Props,
+ props: SheetPrimitive.Close.Props
): React.ReactElement {
- return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
+ return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
}
export function SheetBackdrop({
@@ -53,12 +54,12 @@ export function SheetBackdrop({
<SheetPrimitive.Backdrop
className={cn(
"fixed inset-0 z-50 bg-black/32 backdrop-blur-sm transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0",
- className,
+ className
)}
data-slot="sheet-backdrop"
{...props}
/>
- );
+ )
}
export function SheetViewport({
@@ -67,8 +68,8 @@ export function SheetViewport({
variant = "default",
...props
}: SheetPrimitive.Viewport.Props & {
- side?: "right" | "left" | "top" | "bottom";
- variant?: "default" | "inset";
+ side?: "right" | "left" | "top" | "bottom"
+ variant?: "default" | "inset"
}): React.ReactElement {
return (
<SheetPrimitive.Viewport
@@ -79,12 +80,12 @@ export function SheetViewport({
side === "left" && "flex justify-start",
side === "right" && "flex justify-end",
variant === "inset" && "sm:p-4",
- className,
+ className
)}
data-slot="sheet-viewport"
{...props}
/>
- );
+ )
}
export function SheetPopup({
@@ -97,11 +98,11 @@ export function SheetPopup({
portalProps,
...props
}: SheetPrimitive.Popup.Props & {
- showCloseButton?: boolean;
- side?: "right" | "left" | "top" | "bottom";
- variant?: "default" | "inset";
- closeProps?: SheetPrimitive.Close.Props;
- portalProps?: SheetPrimitive.Portal.Props;
+ showCloseButton?: boolean
+ side?: "right" | "left" | "top" | "bottom"
+ variant?: "default" | "inset"
+ closeProps?: SheetPrimitive.Close.Props
+ portalProps?: SheetPrimitive.Portal.Props
}): React.ReactElement {
return (
<SheetPortal {...portalProps}>
@@ -109,7 +110,7 @@ export function SheetPopup({
<SheetViewport side={side} variant={variant}>
<SheetPrimitive.Popup
className={cn(
- "relative flex max-h-full min-h-0 w-full min-w-0 flex-col bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 transition-[opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:opacity-0 data-starting-style:opacity-0 max-sm:before:hidden dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
+ "relative flex max-h-full min-h-0 w-full min-w-0 flex-col bg-popover text-popover-foreground shadow-lg/5 transition-[opacity,translate] duration-200 ease-in-out will-change-transform not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:opacity-0 data-starting-style:opacity-0 max-sm:before:hidden dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
side === "bottom" &&
"row-start-2 border-t data-ending-style:translate-y-8 data-starting-style:translate-y-8",
side === "top" &&
@@ -120,7 +121,7 @@ export function SheetPopup({
"col-start-2 w-[calc(100%-(--spacing(12)))] max-w-md border-s data-ending-style:translate-x-8 data-starting-style:translate-x-8",
variant === "inset" &&
"before:hidden sm:rounded-2xl sm:border sm:before:rounded-[calc(var(--radius-2xl)-1px)] sm:**:data-[slot=sheet-footer]:rounded-b-[calc(var(--radius-2xl)-1px)]",
- className,
+ className
)}
data-slot="sheet-popup"
{...props}
@@ -139,7 +140,7 @@ export function SheetPopup({
</SheetPrimitive.Popup>
</SheetViewport>
</SheetPortal>
- );
+ )
}
export function SheetHeader({
@@ -150,16 +151,16 @@ export function SheetHeader({
const defaultProps = {
className: cn(
"flex flex-col gap-2 p-6 in-[[data-slot=sheet-popup]:has([data-slot=sheet-panel])]:pb-3 max-sm:pb-4",
- className,
+ className
),
"data-slot": "sheet-header",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function SheetFooter({
@@ -168,24 +169,24 @@ export function SheetFooter({
render,
...props
}: useRender.ComponentProps<"div"> & {
- variant?: "default" | "bare";
+ variant?: "default" | "bare"
}): React.ReactElement {
const defaultProps = {
className: cn(
"flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end",
variant === "default" && "border-t bg-muted/72 py-4",
variant === "bare" &&
- "in-[[data-slot=sheet-popup]:has([data-slot=sheet-panel])]:pt-3 pt-4 pb-6",
- className,
+ "pt-4 pb-6 in-[[data-slot=sheet-popup]:has([data-slot=sheet-panel])]:pt-3",
+ className
),
"data-slot": "sheet-footer",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(defaultProps, props),
render,
- });
+ })
}
export function SheetTitle({
@@ -195,13 +196,13 @@ export function SheetTitle({
return (
<SheetPrimitive.Title
className={cn(
- "font-heading font-semibold text-xl leading-none",
- className,
+ "font-heading text-xl leading-none font-semibold",
+ className
)}
data-slot="sheet-title"
{...props}
/>
- );
+ )
}
export function SheetDescription({
@@ -210,11 +211,11 @@ export function SheetDescription({
}: SheetPrimitive.Description.Props): React.ReactElement {
return (
<SheetPrimitive.Description
- className={cn("text-muted-foreground text-sm", className)}
+ className={cn("text-sm text-muted-foreground", className)}
data-slot="sheet-description"
{...props}
/>
- );
+ )
}
export function SheetPanel({
@@ -223,15 +224,15 @@ export function SheetPanel({
render,
...props
}: useRender.ComponentProps<"div"> & {
- scrollFade?: boolean;
+ scrollFade?: boolean
}): React.ReactElement {
const defaultProps = {
className: cn(
- "p-6 in-[[data-slot=sheet-popup]:has([data-slot=sheet-header])]:pt-1 in-[[data-slot=sheet-popup]:has([data-slot=sheet-footer]:not(.border-t))]:pb-1",
- className,
+ "p-6 in-[[data-slot=sheet-popup]:has([data-slot=sheet-footer]:not(.border-t))]:pb-1 in-[[data-slot=sheet-popup]:has([data-slot=sheet-header])]:pt-1",
+ className
),
"data-slot": "sheet-panel",
- };
+ }
return (
<ScrollArea scrollFade={scrollFade}>
@@ -241,11 +242,11 @@ export function SheetPanel({
render,
})}
</ScrollArea>
- );
+ )
}
export {
SheetPrimitive,
SheetBackdrop as SheetOverlay,
SheetPopup as SheetContent,
-};
+}
diff --git a/apps/v4/registry/new-york-v4/ui/sidebar.tsx b/apps/v4/registry/new-york-v4/ui/sidebar.tsx
index e91e640..d3280dd 100644
--- a/apps/v4/registry/new-york-v4/ui/sidebar.tsx
+++ b/apps/v4/registry/new-york-v4/ui/sidebar.tsx
@@ -1,40 +1,41 @@
-"use client";
-
-import { mergeProps } from "@base-ui/react/merge-props";
-import { useRender } from "@base-ui/react/use-render";
-import { cva, type VariantProps } from "class-variance-authority";
-import { SidebarLeftIcon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import * as React from "react";
-import { useMediaQuery } from "@/hooks/use-media-query";
-import { cn } from "@/lib/utils";
-import { Button } from "@/registry/new-york-v4/ui/button";
-import { Input } from "@/registry/new-york-v4/ui/input";
-import { ScrollArea } from "@/registry/new-york-v4/ui/scroll-area";
-import { Separator } from "@/registry/new-york-v4/ui/separator";
+"use client"
+
+import * as React from "react"
+import { mergeProps } from "@base-ui/react/merge-props"
+import { useRender } from "@base-ui/react/use-render"
+import { SidebarLeftIcon } from "@hugeicons/core-free-icons"
+import { HugeiconsIcon } from "@hugeicons/react"
+import { cva, type VariantProps } from "class-variance-authority"
+
+import { cn } from "@/lib/utils"
+import { useMediaQuery } from "@/hooks/use-media-query"
+import { Button } from "@/registry/new-york-v4/ui/button"
+import { Input } from "@/registry/new-york-v4/ui/input"
+import { ScrollArea } from "@/registry/new-york-v4/ui/scroll-area"
+import { Separator } from "@/registry/new-york-v4/ui/separator"
import {
Sheet,
SheetDescription,
SheetHeader,
SheetPopup,
SheetTitle,
-} from "@/registry/new-york-v4/ui/sheet";
-import { Skeleton } from "@/registry/new-york-v4/ui/skeleton";
+} from "@/registry/new-york-v4/ui/sheet"
+import { Skeleton } from "@/registry/new-york-v4/ui/skeleton"
import {
Tooltip,
TooltipPopup,
TooltipTrigger,
-} from "@/registry/new-york-v4/ui/tooltip";
+} from "@/registry/new-york-v4/ui/tooltip"
-const SIDEBAR_COOKIE_NAME: string = "sidebar_state";
-const SIDEBAR_COOKIE_MAX_AGE: number = 60 * 60 * 24 * 7;
-const SIDEBAR_WIDTH: string = "16rem";
-const SIDEBAR_WIDTH_MOBILE: string = "18rem";
-const SIDEBAR_WIDTH_ICON: string = "3rem";
-const SIDEBAR_KEYBOARD_SHORTCUT: string = "b";
+const SIDEBAR_COOKIE_NAME: string = "sidebar_state"
+const SIDEBAR_COOKIE_MAX_AGE: number = 60 * 60 * 24 * 7
+const SIDEBAR_WIDTH: string = "16rem"
+const SIDEBAR_WIDTH_MOBILE: string = "18rem"
+const SIDEBAR_WIDTH_ICON: string = "3rem"
+const SIDEBAR_KEYBOARD_SHORTCUT: string = "b"
const sidebarMenuButtonVariants = cva(
- "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-lg p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",
+ "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-lg p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pe-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:shrink-0 [&>svg:not([class*='size-'])]:size-4",
{
defaultVariants: {
size: "default",
@@ -52,29 +53,29 @@ const sidebarMenuButtonVariants = cva(
"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
},
},
- },
-);
+ }
+)
export type SidebarContextProps = {
- state: "expanded" | "collapsed";
- open: boolean;
- setOpen: (open: boolean) => void;
- openMobile: boolean;
- setOpenMobile: (open: boolean) => void;
- isMobile: boolean;
- toggleSidebar: () => void;
-};
+ state: "expanded" | "collapsed"
+ open: boolean
+ setOpen: (open: boolean) => void
+ openMobile: boolean
+ setOpenMobile: (open: boolean) => void
+ isMobile: boolean
+ toggleSidebar: () => void
+}
export const SidebarContext: React.Context<SidebarContextProps | null> =
- React.createContext<SidebarContextProps | null>(null);
+ React.createContext<SidebarContextProps | null>(null)
export function useSidebar(): SidebarContextProps {
- const context = React.useContext(SidebarContext);
+ const context = React.useContext(SidebarContext)
if (!context) {
- throw new Error("useSidebar must be used within a SidebarProvider.");
+ throw new Error("useSidebar must be used within a SidebarProvider.")
}
- return context;
+ return context
}
export function SidebarProvider({
@@ -86,24 +87,24 @@ export function SidebarProvider({
children,
...props
}: React.ComponentProps<"div"> & {
- defaultOpen?: boolean;
- open?: boolean;
- onOpenChange?: (open: boolean) => void;
+ defaultOpen?: boolean
+ open?: boolean
+ onOpenChange?: (open: boolean) => void
}): React.ReactElement {
- const isMobile = useMediaQuery("max-md");
- const [openMobile, setOpenMobile] = React.useState(false);
+ const isMobile = useMediaQuery("max-md")
+ const [openMobile, setOpenMobile] = React.useState(false)
// This is the internal state of the sidebar.
// We use openProp and setOpenProp for control from outside the component.
- const [_open, _setOpen] = React.useState(defaultOpen);
- const open = openProp ?? _open;
+ const [_open, _setOpen] = React.useState(defaultOpen)
+ const open = openProp ?? _open
const setOpen = React.useCallback(
async (value: boolean | ((value: boolean) => boolean)) => {
- const openState = typeof value === "function" ? value(open) : value;
+ const openState = typeof value === "function" ? value(open) : value
if (setOpenProp) {
- setOpenProp(openState);
+ setOpenProp(openState)
} else {
- _setOpen(openState);
+ _setOpen(openState)
}
// This sets the cookie to keep the sidebar state.
@@ -112,15 +113,15 @@ export function SidebarProvider({
name: SIDEBAR_COOKIE_NAME,
path: "/",
value: String(openState),
- });
+ })
},
- [setOpenProp, open],
- );
+ [setOpenProp, open]
+ )
// Helper to toggle the sidebar.
const toggleSidebar = React.useCallback(() => {
- return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
- }, [isMobile, setOpen]);
+ return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open)
+ }, [isMobile, setOpen])
// Adds a keyboard shortcut to toggle the sidebar.
React.useEffect(() => {
@@ -129,18 +130,18 @@ export function SidebarProvider({
event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
(event.metaKey || event.ctrlKey)
) {
- event.preventDefault();
- toggleSidebar();
+ event.preventDefault()
+ toggleSidebar()
}
- };
+ }
- window.addEventListener("keydown", handleKeyDown);
- return () => window.removeEventListener("keydown", handleKeyDown);
- }, [toggleSidebar]);
+ window.addEventListener("keydown", handleKeyDown)
+ return () => window.removeEventListener("keydown", handleKeyDown)
+ }, [toggleSidebar])
// We add a state so that we can do data-state="expanded" or "collapsed".
// This makes it easier to style the sidebar with Tailwind classes.
- const state = open ? "expanded" : "collapsed";
+ const state = open ? "expanded" : "collapsed"
const contextValue = React.useMemo<SidebarContextProps>(
() => ({
@@ -152,15 +153,15 @@ export function SidebarProvider({
state,
toggleSidebar,
}),
- [state, open, setOpen, isMobile, openMobile, toggleSidebar],
- );
+ [state, open, setOpen, isMobile, openMobile, toggleSidebar]
+ )
return (
<SidebarContext.Provider value={contextValue}>
<div
className={cn(
"group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",
- className,
+ className
)}
data-slot="sidebar-wrapper"
style={
@@ -175,7 +176,7 @@ export function SidebarProvider({
{children}
</div>
</SidebarContext.Provider>
- );
+ )
}
export function Sidebar({
@@ -186,25 +187,25 @@ export function Sidebar({
children,
...props
}: React.ComponentProps<"div"> & {
- side?: "left" | "right";
- variant?: "sidebar" | "floating" | "inset";
- collapsible?: "offcanvas" | "icon" | "none";
+ side?: "left" | "right"
+ variant?: "sidebar" | "floating" | "inset"
+ collapsible?: "offcanvas" | "icon" | "none"
}): React.ReactElement {
- const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
if (collapsible === "none") {
return (
<div
className={cn(
"flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",
- className,
+ className
)}
data-slot="sidebar"
{...props}
>
{children}
</div>
- );
+ )
}
if (isMobile) {
@@ -229,7 +230,7 @@ export function Sidebar({
<div className="flex h-full w-full flex-col">{children}</div>
</SheetPopup>
</Sheet>
- );
+ )
}
return (
@@ -249,7 +250,7 @@ export function Sidebar({
"group-data-[side=right]:rotate-180",
variant === "floating" || variant === "inset"
? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
- : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
)}
data-slot="sidebar-gap"
/>
@@ -263,7 +264,7 @@ export function Sidebar({
variant === "floating" || variant === "inset"
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
: "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
- className,
+ className
)}
data-slot="sidebar-container"
{...props}
@@ -277,7 +278,7 @@ export function Sidebar({
</div>
</div>
</div>
- );
+ )
}
export function SidebarTrigger({
@@ -285,7 +286,7 @@ export function SidebarTrigger({
onClick,
...props
}: React.ComponentProps<typeof Button>): React.ReactElement {
- const { toggleSidebar } = useSidebar();
+ const { toggleSidebar } = useSidebar()
return (
<Button
@@ -293,8 +294,8 @@ export function SidebarTrigger({
data-sidebar="trigger"
data-slot="sidebar-trigger"
onClick={(event: React.MouseEvent<HTMLButtonElement>) => {
- onClick?.(event);
- toggleSidebar();
+ onClick?.(event)
+ toggleSidebar()
}}
size="icon"
variant="ghost"
@@ -303,26 +304,26 @@ export function SidebarTrigger({
<HugeiconsIcon icon={SidebarLeftIcon} />
<span className="sr-only">Toggle Sidebar</span>
</Button>
- );
+ )
}
export function SidebarRail({
className,
...props
}: React.ComponentProps<"button">): React.ReactElement {
- const { toggleSidebar } = useSidebar();
+ const { toggleSidebar } = useSidebar()
return (
<button
aria-label="Toggle Sidebar"
className={cn(
- "absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",
+ "absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex",
"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
- "group-data-[collapsible=offcanvas]:translate-x-0 hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:after:left-full",
+ "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar",
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
- className,
+ className
)}
data-sidebar="rail"
data-slot="sidebar-rail"
@@ -332,7 +333,7 @@ export function SidebarRail({
type="button"
{...props}
/>
- );
+ )
}
export function SidebarInset({
@@ -343,13 +344,13 @@ export function SidebarInset({
<main
className={cn(
"relative flex w-full flex-1 flex-col bg-background",
- "md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm/5",
- className,
+ "md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm/5 md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2",
+ className
)}
data-slot="sidebar-inset"
{...props}
/>
- );
+ )
}
export function SidebarInput({
@@ -363,7 +364,7 @@ export function SidebarInput({
data-slot="sidebar-input"
{...props}
/>
- );
+ )
}
export function SidebarHeader({
@@ -377,7 +378,7 @@ export function SidebarHeader({
data-slot="sidebar-header"
{...props}
/>
- );
+ )
}
export function SidebarFooter({
@@ -391,7 +392,7 @@ export function SidebarFooter({
data-slot="sidebar-footer"
{...props}
/>
- );
+ )
}
export function SidebarSeparator({
@@ -405,7 +406,7 @@ export function SidebarSeparator({
data-slot="sidebar-separator"
{...props}
/>
- );
+ )
}
export function SidebarContent({
@@ -420,14 +421,14 @@ export function SidebarContent({
<div
className={cn(
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
- className,
+ className
)}
data-sidebar="content"
data-slot="sidebar-content"
{...props}
/>
</ScrollArea>
- );
+ )
}
export function SidebarGroup({
@@ -441,7 +442,7 @@ export function SidebarGroup({
data-slot="sidebar-group"
{...props}
/>
- );
+ )
}
export function SidebarGroupLabel({
@@ -451,19 +452,19 @@ export function SidebarGroupLabel({
}: useRender.ComponentProps<"div">): React.ReactElement {
const defaultProps = {
className: cn(
- "flex h-8 shrink-0 items-center rounded-lg px-2 font-medium text-sidebar-foreground text-xs outline-hidden ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
+ "flex h-8 shrink-0 items-center rounded-lg px-2 text-xs font-medium text-sidebar-foreground ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
- className,
+ className
),
"data-sidebar": "group-label",
"data-slot": "sidebar-group-label",
- };
+ }
return useRender({
defaultTagName: "div",
props: mergeProps(defaultProps, props),
render,
- });
+ })
}
export function SidebarGroupAction({
@@ -473,21 +474,21 @@ export function SidebarGroupAction({
}: useRender.ComponentProps<"button">): React.ReactElement {
const defaultProps = {
className: cn(
- "absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-lg p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",
+ "absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-lg p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:shrink-0 [&>svg:not([class*='size-'])]:size-4",
// Increases the hit area of the button on mobile.
"after:absolute after:-inset-2 md:after:hidden",
"group-data-[collapsible=icon]:hidden",
- className,
+ className
),
"data-sidebar": "group-action",
"data-slot": "sidebar-group-action",
- };
+ }
return useRender({
defaultTagName: "button",
props: mergeProps(defaultProps, props),
render,
- });
+ })
}
export function SidebarGroupContent({
@@ -501,7 +502,7 @@ export function SidebarGroupContent({
data-slot="sidebar-group-content"
{...props}
/>
- );
+ )
}
export function SidebarMenu({
@@ -515,7 +516,7 @@ export function SidebarMenu({
data-slot="sidebar-menu"
{...props}
/>
- );
+ )
}
export function SidebarMenuItem({
@@ -529,7 +530,7 @@ export function SidebarMenuItem({
data-slot="sidebar-menu-item"
{...props}
/>
- );
+ )
}
export function SidebarMenuButton({
@@ -543,16 +544,16 @@ export function SidebarMenuButton({
children,
...props
}: useRender.ComponentProps<"button"> & {
- isActive?: boolean;
- tooltip?: string | React.ComponentProps<typeof TooltipPopup>;
- asChild?: boolean;
+ isActive?: boolean
+ tooltip?: string | React.ComponentProps<typeof TooltipPopup>
+ asChild?: boolean
} & VariantProps<typeof sidebarMenuButtonVariants>): React.ReactElement {
- const { isMobile, state } = useSidebar();
+ const { isMobile, state } = useSidebar()
const renderValue =
render ??
(asChild && React.isValidElement(children)
? (children as React.ReactElement<Record<string, unknown>>)
- : undefined);
+ : undefined)
const defaultProps = {
children: asChild && React.isValidElement(children) ? undefined : children,
@@ -561,24 +562,24 @@ export function SidebarMenuButton({
"data-sidebar": "menu-button",
"data-size": size,
"data-slot": "sidebar-menu-button",
- };
+ }
- const buttonProps = mergeProps<"button">(defaultProps, props);
+ const buttonProps = mergeProps<"button">(defaultProps, props)
const buttonElement = useRender({
defaultTagName: "button",
props: buttonProps,
render: renderValue,
- });
+ })
if (!tooltip) {
- return buttonElement;
+ return buttonElement
}
if (typeof tooltip === "string") {
tooltip = {
children: tooltip,
- };
+ }
}
return (
@@ -593,7 +594,7 @@ export function SidebarMenuButton({
{...tooltip}
/>
</Tooltip>
- );
+ )
}
export function SidebarMenuAction({
@@ -602,11 +603,11 @@ export function SidebarMenuAction({
render,
...props
}: useRender.ComponentProps<"button"> & {
- showOnHover?: boolean;
+ showOnHover?: boolean
}): React.ReactElement {
const defaultProps = {
className: cn(
- "absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-lg p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",
+ "absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-lg p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:shrink-0 [&>svg:not([class*='size-'])]:size-4",
// Increases the hit area of the button on mobile.
"after:absolute after:-inset-2 md:after:hidden",
"peer-data-[size=sm]/menu-button:top-1",
@@ -614,18 +615,18 @@ export function SidebarMenuAction({
"peer-data-[size=lg]/menu-button:top-2.5",
"group-data-[collapsible=icon]:hidden",
showOnHover &&
- "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",
- className,
+ "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground data-[state=open]:opacity-100 md:opacity-0",
+ className
),
"data-sidebar": "menu-action",
"data-slot": "sidebar-menu-action",
- };
+ }
return useRender({
defaultTagName: "button",
props: mergeProps<"button">(defaultProps, props),
render,
- });
+ })
}
export function SidebarMenuBadge({
@@ -635,19 +636,19 @@ export function SidebarMenuBadge({
return (
<div
className={cn(
- "pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-lg px-1 font-medium text-sidebar-foreground text-xs tabular-nums",
+ "pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-lg px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none",
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
"peer-data-[size=sm]/menu-button:top-1",
"peer-data-[size=default]/menu-button:top-1.5",
"peer-data-[size=lg]/menu-button:top-2.5",
"group-data-[collapsible=icon]:hidden",
- className,
+ className
)}
data-sidebar="menu-badge"
data-slot="sidebar-menu-badge"
{...props}
/>
- );
+ )
}
export function SidebarMenuSkeleton({
@@ -655,12 +656,12 @@ export function SidebarMenuSkeleton({
showIcon = false,
...props
}: React.ComponentProps<"div"> & {
- showIcon?: boolean;
+ showIcon?: boolean
}): React.ReactElement {
// Random width between 50 to 90%.
const width = React.useMemo(() => {
- return `${Math.floor(Math.random() * 40) + 50}%`;
- }, []);
+ return `${Math.floor(Math.random() * 40) + 50}%`
+ }, [])
return (
<div
@@ -685,7 +686,7 @@ export function SidebarMenuSkeleton({
}
/>
</div>
- );
+ )
}
export function SidebarMenuSub({
@@ -695,15 +696,15 @@ export function SidebarMenuSub({
return (
<ul
className={cn(
- "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-sidebar-border border-l px-2.5 py-0.5",
+ "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5",
"group-data-[collapsible=icon]:hidden",
- className,
+ className
)}
data-sidebar="menu-sub"
data-slot="sidebar-menu-sub"
{...props}
/>
- );
+ )
}
export function SidebarMenuSubItem({
@@ -717,7 +718,7 @@ export function SidebarMenuSubItem({
data-slot="sidebar-menu-sub-item"
{...props}
/>
- );
+ )
}
export function SidebarMenuSubButton({
@@ -729,34 +730,34 @@ export function SidebarMenuSubButton({
children,
...props
}: useRender.ComponentProps<"a"> & {
- size?: "sm" | "md";
- isActive?: boolean;
- asChild?: boolean;
+ size?: "sm" | "md"
+ isActive?: boolean
+ asChild?: boolean
}): React.ReactElement {
const renderValue =
render ??
(asChild && React.isValidElement(children)
? (children as React.ReactElement<Record<string, unknown>>)
- : undefined);
+ : undefined)
const defaultProps = {
children: asChild && React.isValidElement(children) ? undefined : children,
className: cn(
- "flex h-8 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-lg px-2 text-sidebar-foreground outline-hidden ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 sm:h-7 [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
+ "flex h-8 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-lg px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 sm:h-7 [&>span:last-child]:truncate [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground [&>svg:not([class*='size-'])]:size-4",
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
size === "sm" && "text-xs",
size === "md" && "text-sm",
"group-data-[collapsible=icon]:hidden",
- className,
+ className
),
"data-active": isActive,
"data-sidebar": "menu-sub-button",
"data-size": size,
"data-slot": "sidebar-menu-sub-button",
- };
+ }
return useRender({
defaultTagName: "a",
props: mergeProps<"a">(defaultProps, props),
render: renderValue,
- });
+ })
}
diff --git a/apps/v4/registry/new-york-v4/ui/skeleton.tsx b/apps/v4/registry/new-york-v4/ui/skeleton.tsx
index 7630513..27f3501 100644
--- a/apps/v4/registry/new-york-v4/ui/skeleton.tsx
+++ b/apps/v4/registry/new-york-v4/ui/skeleton.tsx
@@ -1,5 +1,6 @@
-import type React from "react";
-import { cn } from "@/lib/utils";
+import type React from "react"
+
+import { cn } from "@/lib/utils"
export function Skeleton({
className,
@@ -9,10 +10,10 @@ export function Skeleton({
<div
className={cn(
"animate-skeleton rounded-sm [--skeleton-highlight:--alpha(var(--color-white)/64%)] [background:linear-gradient(120deg,transparent_40%,var(--skeleton-highlight),transparent_60%)_var(--color-muted)_0_0/200%_100%_fixed] dark:[--skeleton-highlight:--alpha(var(--color-white)/4%)]",
- className,
+ className
)}
data-slot="skeleton"
{...props}
/>
- );
+ )
}
diff --git a/apps/v4/registry/new-york-v4/ui/spinner.tsx b/apps/v4/registry/new-york-v4/ui/spinner.tsx
index 3d7ce2d..b1edbb9 100644
--- a/apps/v4/registry/new-york-v4/ui/spinner.tsx
+++ b/apps/v4/registry/new-york-v4/ui/spinner.tsx
@@ -1,12 +1,16 @@
-import { Loading03Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import type React from "react";
-import { cn } from "@/lib/utils";
+import type React from "react"
+import { Loading03Icon } from "@hugeicons/core-free-icons"
+import { HugeiconsIcon } from "@hugeicons/react"
+
+import { cn } from "@/lib/utils"
export function Spinner({
className,
...props
-}: Omit<React.ComponentProps<typeof HugeiconsIcon>, "icon">): React.ReactElement {
+}: Omit<
+ React.ComponentProps<typeof HugeiconsIcon>,
+ "icon"
+>): React.ReactElement {
return (
<HugeiconsIcon
aria-label="Loading"
@@ -15,5 +19,5 @@ export function Spinner({
role="status"
{...props}
/>
- );
+ )
}
diff --git a/apps/v4/registry/new-york-v4/ui/tabs.tsx b/apps/v4/registry/new-york-v4/ui/tabs.tsx
index 4fd6969..202fe99 100644
--- a/apps/v4/registry/new-york-v4/ui/tabs.tsx
+++ b/apps/v4/registry/new-york-v4/ui/tabs.tsx
@@ -1,10 +1,11 @@
-"use client";
+"use client"
-import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
-import type React from "react";
-import { cn } from "@/lib/utils";
+import type React from "react"
+import { Tabs as TabsPrimitive } from "@base-ui/react/tabs"
-export type TabsVariant = "default" | "underline";
+import { cn } from "@/lib/utils"
+
+export type TabsVariant = "default" | "underline"
export function Tabs({
className,
@@ -14,12 +15,12 @@ export function Tabs({
<TabsPrimitive.Root
className={cn(
"flex flex-col gap-2 data-[orientation=vertical]:flex-row",
- className,
+ className
)}
data-slot="tabs"
{...props}
/>
- );
+ )
}
export function TabsList({
@@ -28,7 +29,7 @@ export function TabsList({
children,
...props
}: TabsPrimitive.List.Props & {
- variant?: TabsVariant;
+ variant?: TabsVariant
}): React.ReactElement {
return (
<TabsPrimitive.List
@@ -37,8 +38,8 @@ export function TabsList({
"data-[orientation=vertical]:flex-col",
variant === "default"
? "rounded-lg bg-muted p-0.5 text-muted-foreground/72"
- : "data-[orientation=vertical]:px-1 data-[orientation=horizontal]:py-1 *:data-[slot=tabs-tab]:hover:bg-accent",
- className,
+ : "data-[orientation=horizontal]:py-1 data-[orientation=vertical]:px-1 *:data-[slot=tabs-tab]:hover:bg-accent",
+ className
)}
data-slot="tabs-list"
{...props}
@@ -48,13 +49,13 @@ export function TabsList({
className={cn(
"absolute bottom-0 left-0 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) -translate-y-(--active-tab-bottom) transition-[width,translate] duration-200 ease-in-out",
variant === "underline"
- ? "z-10 bg-primary data-[orientation=horizontal]:h-0.5 data-[orientation=vertical]:w-0.5 data-[orientation=vertical]:-translate-x-px data-[orientation=horizontal]:translate-y-px"
- : "-z-1 rounded-md bg-background shadow-sm/5 dark:bg-input",
+ ? "z-10 bg-primary data-[orientation=horizontal]:h-0.5 data-[orientation=horizontal]:translate-y-px data-[orientation=vertical]:w-0.5 data-[orientation=vertical]:-translate-x-px"
+ : "-z-1 rounded-md bg-background shadow-sm/5 dark:bg-input"
)}
data-slot="tab-indicator"
/>
</TabsPrimitive.List>
- );
+ )
}
export function TabsTab({
@@ -64,13 +65,13 @@ export function TabsTab({
return (
<TabsPrimitive.Tab
className={cn(
- "relative flex h-9 shrink-0 grow cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-[calc(--spacing(2.5)-1px)] font-medium text-base outline-none transition-[color,background-color,box-shadow] hover:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring data-disabled:pointer-events-none data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start data-active:text-foreground data-disabled:opacity-64 sm:h-8 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0",
- className,
+ "relative flex h-9 shrink-0 grow cursor-pointer items-center justify-center gap-1.5 rounded-md border border-transparent px-[calc(--spacing(2.5)-1px)] text-base font-medium whitespace-nowrap transition-[color,background-color,box-shadow] outline-none hover:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start sm:h-8 sm:text-sm data-disabled:pointer-events-none data-disabled:opacity-64 data-active:text-foreground [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
+ className
)}
data-slot="tabs-tab"
{...props}
/>
- );
+ )
}
export function TabsPanel({
@@ -83,7 +84,7 @@ export function TabsPanel({
data-slot="tabs-content"
{...props}
/>
- );
+ )
}
-export { TabsPrimitive, TabsTab as TabsTrigger, TabsPanel as TabsContent };
+export { TabsPrimitive, TabsTab as TabsTrigger, TabsPanel as TabsContent }
diff --git a/apps/v4/registry/new-york-v4/ui/tooltip.tsx b/apps/v4/registry/new-york-v4/ui/tooltip.tsx
index 5fdf976..3a6c1c1 100644
--- a/apps/v4/registry/new-york-v4/ui/tooltip.tsx
+++ b/apps/v4/registry/new-york-v4/ui/tooltip.tsx
@@ -1,24 +1,25 @@
-"use client";
+"use client"
-import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
-import type React from "react";
-import { isValidElement } from "react";
-import { cn } from "@/lib/utils";
+import type React from "react"
+import { isValidElement } from "react"
+import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip"
+
+import { cn } from "@/lib/utils"
export const TooltipCreateHandle: typeof TooltipPrimitive.createHandle =
- TooltipPrimitive.createHandle;
+ TooltipPrimitive.createHandle
export function TooltipProvider({
delayDuration,
delay = delayDuration,
...props
}: TooltipPrimitive.Provider.Props & {
- delayDuration?: TooltipPrimitive.Provider.Props["delay"];
+ delayDuration?: TooltipPrimitive.Provider.Props["delay"]
}): React.ReactElement {
- return <TooltipPrimitive.Provider delay={delay} {...props} />;
+ return <TooltipPrimitive.Provider delay={delay} {...props} />
}
-export const Tooltip: typeof TooltipPrimitive.Root = TooltipPrimitive.Root;
+export const Tooltip: typeof TooltipPrimitive.Root = TooltipPrimitive.Root
export function TooltipTrigger({
asChild,
@@ -26,7 +27,7 @@ export function TooltipTrigger({
render,
...props
}: TooltipPrimitive.Trigger.Props & {
- asChild?: boolean;
+ asChild?: boolean
}): React.ReactElement {
return (
<TooltipPrimitive.Trigger
@@ -41,7 +42,7 @@ export function TooltipTrigger({
>
{asChild && isValidElement(children) ? undefined : children}
</TooltipPrimitive.Trigger>
- );
+ )
}
export function TooltipPopup({
@@ -54,11 +55,11 @@ export function TooltipPopup({
portalProps,
...props
}: TooltipPrimitive.Popup.Props & {
- align?: TooltipPrimitive.Positioner.Props["align"];
- side?: TooltipPrimitive.Positioner.Props["side"];
- sideOffset?: TooltipPrimitive.Positioner.Props["sideOffset"];
- anchor?: TooltipPrimitive.Positioner.Props["anchor"];
- portalProps?: TooltipPrimitive.Portal.Props;
+ align?: TooltipPrimitive.Positioner.Props["align"]
+ side?: TooltipPrimitive.Positioner.Props["side"]
+ sideOffset?: TooltipPrimitive.Positioner.Props["sideOffset"]
+ anchor?: TooltipPrimitive.Positioner.Props["anchor"]
+ portalProps?: TooltipPrimitive.Portal.Props
}): React.ReactElement {
return (
<TooltipPrimitive.Portal {...portalProps}>
@@ -72,14 +73,14 @@ export function TooltipPopup({
>
<TooltipPrimitive.Popup
className={cn(
- "relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) text-balance rounded-md border bg-popover not-dark:bg-clip-padding text-popover-foreground text-xs shadow-md/5 transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 data-instant:duration-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
- className,
+ "relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-md border bg-popover text-xs text-balance text-popover-foreground shadow-md/5 transition-[width,height,scale,opacity] not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:scale-98 data-ending-style:opacity-0 data-instant:duration-0 data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
+ className
)}
data-slot="tooltip-popup"
{...props}
>
<TooltipPrimitive.Viewport
- className="relative size-full overflow-clip px-(--viewport-inline-padding) py-1 [--viewport-inline-padding:--spacing(2)] data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:truncate **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity"
+ className="relative size-full overflow-clip px-(--viewport-inline-padding) py-1 [--viewport-inline-padding:--spacing(2)] **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-current:transition-opacity **:data-current:data-ending-style:opacity-0 data-instant:transition-none **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:truncate **:data-previous:opacity-100 **:data-previous:transition-opacity **:data-previous:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-starting-style:opacity-0"
data-slot="tooltip-viewport"
>
{children}
@@ -87,7 +88,7 @@ export function TooltipPopup({
</TooltipPrimitive.Popup>
</TooltipPrimitive.Positioner>
</TooltipPrimitive.Portal>
- );
+ )
}
-export { TooltipPrimitive, TooltipPopup as TooltipContent };
+export { TooltipPrimitive, TooltipPopup as TooltipContent }
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index fb1d893..470055c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -21,6 +21,15 @@ importers:
'@base-ui/react':
specifier: ^1.4.1
+ '@dnd-kit/core':
+ specifier: ^6.3.1
+ '@dnd-kit/sortable':
+ specifier: ^10.0.0
+ '@dnd-kit/utilities':
+ specifier: ^3.2.2
+ version: 3.2.2([email protected])
'@glideapps/glide-data-grid':
specifier: 6.0.4-alpha24
@@ -30,6 +39,9 @@ importers:
'@hugeicons/react':
specifier: ^1.1.6
version: 1.1.6([email protected])
+ '@pierre/diffs':
+ specifier: ^1.1.22
'@tabler/icons-react':
specifier: ^3.31.0
version: 3.34.1([email protected])
@@ -90,6 +102,9 @@ importers:
react-pdf:
specifier: ^10.4.1
+ react-resizable-panels:
+ specifier: ^3.0.5
react-responsive-carousel:
specifier: ^3.2.23
version: 3.2.23
@@ -288,6 +303,28 @@ packages:
'@types/react':
optional: true
+ '@dnd-kit/[email protected]':
+ resolution: {integrity: sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw==}
+ peerDependencies:
+ react: '>=16.8.0'
+
+ '@dnd-kit/[email protected]':
+ resolution: {integrity: sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==}
+ peerDependencies:
+ react: '>=16.8.0'
+ react-dom: '>=16.8.0'
+
+ '@dnd-kit/[email protected]':
+ resolution: {integrity: sha512-+xqhmIIzvAYMGfBYYnbKuNicfSsk4RksY2XdmJhT+HAC01nix6fHCztU68jooFiMUB01Ky3F0FyOvhG/BZrWkg==}
+ peerDependencies:
+ '@dnd-kit/core': ^6.3.0
+ react: '>=16.8.0'
+
+ '@dnd-kit/[email protected]':
+ resolution: {integrity: sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg==}
+ peerDependencies:
+ react: '>=16.8.0'
+
'@emnapi/[email protected]':
resolution: {integrity: sha512-XsLw1dEOpkSX/WucdqUhPWP7hDxSvZiY+fsUC14h+FtQ2Ifni4znbBt8punRX+Uj2JG/uDb8nEHVKvrVlvdZ5Q==}
@@ -1061,6 +1098,16 @@ packages:
'@pdf-lib/[email protected]':
resolution: {integrity: sha512-dQK2FUMQtowVP00mtIksrlZhdFXQZPC+taih1q4CvPZ5vqdxR/LKBaFg0oAfzd1GlHZXXSPdQfzQnt+ViGvEIQ==}
+ '@pierre/[email protected]':
+ resolution: {integrity: sha512-1Iv7kdl6OABFCd1n2HQbGUiRHouXPaHoIjcb7Lwg8zeJKY5ph+cESFcGEyIiwW0NCbKGtYS2bTnXmI+Eze5dwg==}
+ peerDependencies:
+ react: ^18.3.1 || ^19.0.0
+ react-dom: ^18.3.1 || ^19.0.0
+
+ '@pierre/[email protected]':
+ resolution: {integrity: sha512-1j/H/fECBuc9dEvntdWI+l435HZapw+RCJTlqCA6BboQ5TjlnE005j/ROWutXIs8aq5OAc82JI2Kwk4A1WWBgw==}
+ engines: {vscode: ^1.0.0}
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==}
@@ -2070,6 +2117,10 @@ packages:
resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==}
+ resolution: {integrity: sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==}
+ engines: {node: '>=0.3.1'}
+
resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==}
engines: {node: '>=0.10.0'}
@@ -2940,6 +2991,9 @@ packages:
resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
+ resolution: {integrity: sha512-I+lBvqMMFfqaV8CJCISjI3wbjmwVu/VyOoU7+qtu9d7ioW5klMgsTTiUOUp+DJvfTTzKXoPbyC6YfgkNcyPSOg==}
+
resolution: {integrity: sha512-CmghgHkh0OJNmxGKWc0qfPJCYHASPMVSyGY8fj3xgk4v84ItqDg64JNKFZn5hC6E0vHi6gxnbCgwhyVB09wQtA==}
peerDependencies:
@@ -3527,6 +3581,12 @@ packages:
'@types/react':
optional: true
+ resolution: {integrity: sha512-b3qKHQ3MLqOgSS+FRYKapNkJZf5EQzuf6+RLiq1/IlTHw99YrZ2NJZLk4hQIzTnnIkRg2LUqyVinu6YWWpUYew==}
+ peerDependencies:
+ react: ^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc
+ react-dom: ^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc
+
resolution: {integrity: sha512-pqJLsBaKHWJhw/ItODgbVoziR2z4lpcJg+YwmRlSk4rKH32VE633mAtZZ9kDXjy4wFO+pgUZmDKPsPe1fPmHCg==}
@@ -4331,6 +4391,31 @@ snapshots:
optionalDependencies:
'@types/react': 19.2.2
+ dependencies:
+ react: 19.2.3
+ tslib: 2.8.1
+
+ dependencies:
+ '@dnd-kit/accessibility': 3.1.1([email protected])
+ '@dnd-kit/utilities': 3.2.2([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ tslib: 2.8.1
+
+ dependencies:
+ '@dnd-kit/utilities': 3.2.2([email protected])
+ react: 19.2.3
+ tslib: 2.8.1
+
+ dependencies:
+ react: 19.2.3
+ tslib: 2.8.1
+
'@emnapi/[email protected]':
dependencies:
'@emnapi/wasi-threads': 1.0.4
@@ -4919,6 +5004,19 @@ snapshots:
dependencies:
pako: 1.0.11
+ dependencies:
+ '@pierre/theme': 0.0.28
+ '@shikijs/transformers': 3.14.0
+ diff: 8.0.3
+ hast-util-to-html: 9.0.5
+ lru_map: 0.4.1
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ shiki: 3.14.0
+
+ '@pierre/[email protected]': {}
+
'@radix-ui/[email protected]': {}
@@ -5872,6 +5970,8 @@ snapshots:
dependencies:
dequal: 2.0.3
+
dependencies:
esutils: 2.0.3
@@ -7000,6 +7100,8 @@ snapshots:
dependencies:
yallist: 3.1.1
+
dependencies:
react: 19.2.3
@@ -7785,6 +7887,11 @@ snapshots:
optionalDependencies:
'@types/react': 19.2.2
+ dependencies:
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+
dependencies:
classnames: 2.5.1