Skip to content

armgit / pdfcn

Public Imported from GitHub
0

Beautiful pdf components, built on Takumi and Forme. 100% Free, Zero config, one command setup.

chore: pnpm fix and typecheck issues

Aniket-508b3b15ef2635a
diff --git a/components/playground/evaluate.ts b/components/playground/evaluate.ts
index 0821320..eeecc62 100644
--- a/components/playground/evaluate.ts
+++ b/components/playground/evaluate.ts
@@ -9,20 +9,20 @@ const exportsSchema = z.object({
options: optionsSchema,
});
-function transformCode(code: string) {
- return transform(code, {
+const transformCode = (code: string) =>
+ transform(code, {
production: true,
transforms: ["jsx", "typescript", "imports"],
}).code;
-}
-export function evaluateCodeExports(code: string, react: typeof React) {
+export const evaluateCodeExports = (code: string, react: typeof React) => {
const exports: Record<string, unknown> = {};
+ // eslint-disable-next-line eslint(no-new-func) -- Required for sandboxed code evaluation
new Function("exports", "React", transformCode(code))(exports, react);
return exportsSchema.parse(exports);
-}
+};
-function mirrorTw<P>(props: P): P {
+const mirrorTw = <P>(props: P): P => {
if (!props || typeof props !== "object" || !("tw" in props)) {
return props;
}
@@ -31,7 +31,7 @@ function mirrorTw<P>(props: P): P {
...props,
className: [className ?? klass, tw].filter(Boolean).join(" "),
};
-}
+};
export const renderReact: typeof React = {
...React,
diff --git a/components/playground/geometry.ts b/components/playground/geometry.ts
index 5dd9d21..53b9d8b 100644
--- a/components/playground/geometry.ts
+++ b/components/playground/geometry.ts
@@ -14,7 +14,7 @@ export interface OutputGeometry {
label: string;
}
-function marginPadding(margin: PdfOptions["margin"]): string {
+const marginPadding = (margin: PdfOptions["margin"]): string => {
if (margin === undefined) {
return `${DEFAULT_PAGE_MARGIN}px`;
}
@@ -23,9 +23,9 @@ function marginPadding(margin: PdfOptions["margin"]): string {
}
const { top = 0, right = 0, bottom = 0, left = 0 } = margin;
return `${top}px ${right}px ${bottom}px ${left}px`;
-}
+};
-function pdfGeometry(pdf: PdfOptions): OutputGeometry {
+const pdfGeometry = (pdf: PdfOptions): OutputGeometry => {
const size =
typeof pdf.size === "object" ? pdf.size : PAGE_SIZES[pdf.size ?? "a4"];
const preset = typeof pdf.size === "object" ? undefined : (pdf.size ?? "a4");
@@ -37,12 +37,12 @@ function pdfGeometry(pdf: PdfOptions): OutputGeometry {
padding: marginPadding(pdf.margin),
width,
};
-}
+};
-export function outputGeometry(options: PlaygroundOptions): OutputGeometry {
+export const outputGeometry = (options: PlaygroundOptions): OutputGeometry => {
if (options.pdf) {
return pdfGeometry(options.pdf);
}
const { width = 1200, height = 630 } = options;
return { height, label: `${width} × ${height}`, width };
-}
+};
diff --git a/components/playground/inspect-pdf.ts b/components/playground/inspect-pdf.ts
index 01bada8..3f24050 100644
--- a/components/playground/inspect-pdf.ts
+++ b/components/playground/inspect-pdf.ts
@@ -14,24 +14,21 @@ interface Bookmark {
depth: number;
}
-function bytesToChars(bytes: Uint8Array): string {
+const bytesToChars = (bytes: Uint8Array): string => {
let text = "";
for (let offset = 0; offset < bytes.length; offset += 0x80_00) {
text += String.fromCodePoint(...bytes.subarray(offset, offset + 0x80_00));
}
return text;
-}
+};
-function utf8(value: string | undefined): string | undefined {
- return (
- value &&
- new TextDecoder().decode(
- Uint8Array.from(value, (char) => char.codePointAt(0) ?? 0)
- )
+const utf8 = (value: string | undefined): string | undefined =>
+ value &&
+ new TextDecoder().decode(
+ Uint8Array.from(value, (char) => char.codePointAt(0) ?? 0)
);
-}
-function pdfString(raw: string): string {
+const pdfString = (raw: string): string => {
if (raw.startsWith("<")) {
const hex = raw.slice(1, -1).replaceAll(/\s/g, "");
const text = (hex.match(/.{4}/g) ?? [])
@@ -40,16 +37,16 @@ function pdfString(raw: string): string {
return text.replace(/^/, "");
}
return raw.slice(1, -1).replaceAll(/\\([()\\])/g, "$1");
-}
+};
-function entry(object: string, key: string): string | undefined {
+const entry = (object: string, key: string): string | undefined => {
const match = object.match(
new RegExp(`/${key}\\s*(\\([^)]*\\)|<[0-9A-Fa-f\\s]*>)`)
);
return match?.[1] && pdfString(match[1]);
-}
+};
-function readBookmarks(objects: string[]): Bookmark[] {
+const readBookmarks = (objects: string[]): Bookmark[] => {
const byNumber = new Map<string, string>();
for (const object of objects) {
const number = object.match(/(\d+)\s+0\s+obj/)?.[1];
@@ -80,9 +77,9 @@ function readBookmarks(objects: string[]): Bookmark[] {
0
);
return bookmarks.filter((bookmark) => bookmark.title);
-}
+};
-export function inspectPdf(bytes: Uint8Array): PdfInspection {
+export const inspectPdf = (bytes: Uint8Array): PdfInspection => {
const text = bytesToChars(bytes);
const objects = text.split("endobj");
const xmp = text.match(/<x:xmpmeta[\s\S]*?<\/x:xmpmeta>/)?.[0] ?? "";
@@ -90,11 +87,11 @@ export function inspectPdf(bytes: Uint8Array): PdfInspection {
xmp.match(new RegExp(`<${tag}>([^<]*)<`))?.[1];
const archival = xmpValue("pdfaid:part");
const accessible = xmpValue("pdfuaid:part");
- const standards = [
+ const standards: string[] = [
archival &&
`PDF/A-${archival}${(xmpValue("pdfaid:conformance") ?? "").toLowerCase()}`,
accessible && `PDF/UA-${accessible}`,
- ].filter((standard): standard is string => Boolean(standard));
+ ].filter(Boolean) as string[];
const authors = [...xmp.matchAll(/<dc:creator>[\s\S]*?<\/dc:creator>/g)]
.flatMap((match) => [...match[0].matchAll(/<rdf:li>([^<]*)</g)])
.map((match) => utf8(match[1]));
@@ -102,8 +99,8 @@ export function inspectPdf(bytes: Uint8Array): PdfInspection {
attachments: objects
.filter((object) => object.includes("/Filespec"))
.map((object) => ({
- name: entry(object, "F") ?? "",
description: entry(object, "Desc"),
+ name: entry(object, "F") ?? "",
}))
.filter((attachment) => attachment.name),
authors: authors.length > 0 ? (authors as string[]) : undefined,
@@ -114,4 +111,4 @@ export function inspectPdf(bytes: Uint8Array): PdfInspection {
tagged: text.includes("/StructTreeRoot"),
title: utf8(xmp.match(/<dc:title>[\s\S]*?<rdf:li[^>]*>([^<]*)</)?.[1]),
};
-}
+};
diff --git a/components/playground/output-panel.tsx b/components/playground/output-panel.tsx
index 31382f5..1b09ab0 100644
--- a/components/playground/output-panel.tsx
+++ b/components/playground/output-panel.tsx
@@ -7,13 +7,13 @@ import { cn } from "@/lib/utils";
import type { PdfInspection } from "./inspect-pdf";
import type { RenderError, RenderSuccess } from "./use-render-worker";
-function PdfPreview({
+const PdfPreview = ({
url,
dimmed,
}: {
url: string | undefined;
dimmed: boolean;
-}) {
+}) => {
if (!url) {
return null;
}
@@ -31,77 +31,69 @@ function PdfPreview({
</div>
</object>
);
-}
+};
-function Field({ label, children }: { label: string; children: ReactNode }) {
- return (
- <div className="flex gap-3 border-b py-1.5 last:border-b-0">
- <span className="w-24 shrink-0 text-muted-foreground">{label}</span>
- <div className="min-w-0 flex-1">{children}</div>
- </div>
- );
-}
+const Field = ({ label, children }: { label: string; children: ReactNode }) => (
+ <div className="flex gap-3 border-b py-1.5 last:border-b-0">
+ <span className="w-24 shrink-0 text-muted-foreground">{label}</span>
+ <div className="min-w-0 flex-1">{children}</div>
+ </div>
+);
-function DocumentPanel({ inspection }: { inspection: PdfInspection }) {
- return (
- <div className="h-full overflow-auto bg-muted/20 px-4 py-3 font-mono text-xs">
- <Field label="Standards">
- {inspection.standards.length > 0 ? (
- <span className="text-primary">
- {inspection.standards.join(" · ")}
- </span>
- ) : (
- <span className="text-muted-foreground">plain PDF</span>
- )}
- </Field>
- <Field label="Tagged">{inspection.tagged ? "yes" : "no"}</Field>
- <Field label="Pages">{inspection.pages}</Field>
- {inspection.title && <Field label="Title">{inspection.title}</Field>}
- {inspection.authors && (
- <Field label="Authors">{inspection.authors.join(", ")}</Field>
+const DocumentPanel = ({ inspection }: { inspection: PdfInspection }) => (
+ <div className="h-full overflow-auto bg-muted/20 px-4 py-3 font-mono text-xs">
+ <Field label="Standards">
+ {inspection.standards.length > 0 ? (
+ <span className="text-primary">{inspection.standards.join(" · ")}</span>
+ ) : (
+ <span className="text-muted-foreground">plain PDF</span>
)}
- {inspection.created && (
- <Field label="Created">{inspection.created}</Field>
+ </Field>
+ <Field label="Tagged">{inspection.tagged ? "yes" : "no"}</Field>
+ <Field label="Pages">{inspection.pages}</Field>
+ {inspection.title && <Field label="Title">{inspection.title}</Field>}
+ {inspection.authors && (
+ <Field label="Authors">{inspection.authors.join(", ")}</Field>
+ )}
+ {inspection.created && <Field label="Created">{inspection.created}</Field>}
+ <Field label="Bookmarks">
+ {inspection.bookmarks.length === 0 ? (
+ <span className="text-muted-foreground">none</span>
+ ) : (
+ inspection.bookmarks.map((bookmark, index) => (
+ <div
+ key={`${bookmark.title}-${index}`}
+ style={{ paddingLeft: bookmark.depth * 12 }}
+ className="truncate"
+ >
+ {bookmark.title}
+ </div>
+ ))
)}
- <Field label="Bookmarks">
- {inspection.bookmarks.length === 0 ? (
- <span className="text-muted-foreground">none</span>
- ) : (
- inspection.bookmarks.map((bookmark, index) => (
- <div
- key={`${bookmark.title}-${index}`}
- style={{ paddingLeft: bookmark.depth * 12 }}
- className="truncate"
- >
- {bookmark.title}
- </div>
- ))
- )}
- </Field>
- <Field label="Attachments">
- {inspection.attachments.length === 0 ? (
- <span className="text-muted-foreground">none</span>
- ) : (
- inspection.attachments.map((attachment) => (
- <div key={attachment.name} className="truncate">
- {attachment.name}
- {attachment.description && (
- <span className="text-muted-foreground">
- {" "}
- — {attachment.description}
- </span>
- )}
- </div>
- ))
- )}
- </Field>
- </div>
- );
-}
+ </Field>
+ <Field label="Attachments">
+ {inspection.attachments.length === 0 ? (
+ <span className="text-muted-foreground">none</span>
+ ) : (
+ inspection.attachments.map((attachment) => (
+ <div key={attachment.name} className="truncate">
+ {attachment.name}
+ {attachment.description && (
+ <span className="text-muted-foreground">
+ {" "}
+ — {attachment.description}
+ </span>
+ )}
+ </div>
+ ))
+ )}
+ </Field>
+ </div>
+);
export type PdfView = "preview" | "document";
-export function OutputPanel({
+export const OutputPanel = ({
lastSuccess,
error,
isReady,
@@ -111,7 +103,7 @@ export function OutputPanel({
error: RenderError | undefined;
isReady: boolean;
pdfView: PdfView;
-}) {
+}) => {
if (!lastSuccess && !error) {
return (
<div className="flex h-full items-center justify-center gap-2 bg-muted/20 font-mono text-xs text-muted-foreground">
@@ -134,6 +126,7 @@ export function OutputPanel({
(lastSuccess.outputKind === "pdf" ? (
<PdfPreview url={lastSuccess.outputUrl} dimmed={Boolean(error)} />
) : (
+ // eslint-disable-next-line eslint(nextjs/no-img-element) -- Dynamic render output, not static content
<img
src={lastSuccess.outputUrl}
alt="Rendered output"
@@ -162,4 +155,4 @@ export function OutputPanel({
)}
</div>
);
-}
+};
diff --git a/components/playground/takumi-preview.tsx b/components/playground/takumi-preview.tsx
index ab9c6a2..14c2442 100644
--- a/components/playground/takumi-preview.tsx
+++ b/components/playground/takumi-preview.tsx
@@ -14,11 +14,11 @@ interface TakumiPreviewProps {
height?: number;
}
-export function TakumiPreview({
+export const TakumiPreview = ({
code,
className,
height = 640,
-}: TakumiPreviewProps) {
+}: TakumiPreviewProps) => {
const [pdfView, setPdfView] = useState<PdfView>("preview");
const { isReady, lastSuccess, renderError } = useRenderWorker(code);
@@ -68,4 +68,4 @@ export function TakumiPreview({
</div>
</div>
);
-}
+};
diff --git a/components/playground/use-render-worker.ts b/components/playground/use-render-worker.ts
index 4d91fbf..37512f6 100644
--- a/components/playground/use-render-worker.ts
+++ b/components/playground/use-render-worker.ts
@@ -12,17 +12,15 @@ export type RenderSuccess = Extract<RenderResult, { status: "success" }> & {
};
export type RenderError = Extract<RenderResult, { status: "error" }>;
-function isBlobUrl(url: string | undefined): url is string {
- return typeof url === "string" && url.startsWith("blob:");
-}
+const isBlobUrl = (url: string | undefined): url is string =>
+ typeof url === "string" && url.startsWith("blob:");
-function mimeType(result: RenderResult & { status: "success" }) {
- return result.outputKind === "pdf"
+const mimeType = (result: RenderResult & { status: "success" }) =>
+ result.outputKind === "pdf"
? "application/pdf"
: `image/${result.outputFormat}`;
-}
-export function useRenderWorker(ranCode: string | undefined) {
+export const useRenderWorker = (ranCode: string | undefined) => {
const [isReady, setIsReady] = useState(false);
const [lastSuccess, setLastSuccess] = useState<RenderSuccess>();
const [renderError, setRenderError] = useState<RenderError>();
@@ -34,6 +32,7 @@ export function useRenderWorker(ranCode: string | undefined) {
type: "module",
});
+ // eslint-disable-next-line eslint-plugin-unicorn(prefer-add-event-listener) -- Worker message handler
worker.onmessage = (event: MessageEvent) => {
const message = messageSchema.parse(event.data);
@@ -107,4 +106,4 @@ export function useRenderWorker(ranCode: string | undefined) {
}, [lastSuccess]);
return { isReady, lastSuccess, renderError };
-}
+};
diff --git a/components/playground/worker.ts b/components/playground/worker.ts
index fe8f343..bd284db 100644
--- a/components/playground/worker.ts
+++ b/components/playground/worker.ts
@@ -9,9 +9,8 @@ import { inspectPdf } from "./inspect-pdf";
import { messageSchema } from "./schema";
import type { RenderMessageInput } from "./schema";
-function postMessage(message: RenderMessageInput, transfer?: Transferable[]) {
- return self.postMessage(message, { transfer });
-}
+const postMessage = (message: RenderMessageInput, transfer?: Transferable[]) =>
+ self.postMessage(message, { transfer });
const TAKUMI_WASM_URL = new URL(
"/takumi_pdf_wasm_bg.wasm",
@@ -26,7 +25,7 @@ let imagesReady:
| undefined;
let wasmReady: Promise<unknown> | undefined;
-async function loadImages() {
+const loadImages = async () => {
const response = await fetch(PREVIEW_LOGO_PATH);
if (!response.ok) {
throw new Error(`Unable to load preview logo (${response.status})`);
@@ -39,19 +38,19 @@ async function loadImages() {
},
],
};
-}
+};
-function getImages() {
+const getImages = () => {
imagesReady ??= loadImages();
return imagesReady;
-}
+};
-async function initWasm() {
+const initWasm = async () => {
wasmReady ??= initPdf({ module_or_path: TAKUMI_WASM_URL });
await wasmReady;
-}
+};
-async function renderRequest(id: number, code: string) {
+const renderRequest = async (id: number, code: string) => {
await initWasm();
const { default: component, options } = evaluateCodeExports(
@@ -77,7 +76,7 @@ async function renderRequest(id: number, code: string) {
const pdfOptions = options.pdf ?? ({} as Record<string, unknown>);
const pdfBytes = await render(element, {
images: await getImages(),
- margin: pdfOptions.margin ?? { top: 48, right: 48, bottom: 48, left: 48 },
+ margin: pdfOptions.margin ?? { bottom: 48, left: 48, right: 48, top: 48 },
size: (pdfOptions.size as PageSize | undefined) ?? "a4",
...pdfOptions,
});
@@ -100,8 +99,9 @@ async function renderRequest(id: number, code: string) {
},
[pdfBytes.buffer]
);
-}
+};
+// eslint-disable-next-line eslint-plugin-unicorn(prefer-add-event-listener) -- Worker global onmessage
self.onmessage = async (event: MessageEvent) => {
const payload = messageSchema.parse(event.data);
diff --git a/components/theme-preview.tsx b/components/theme-preview.tsx
index 432b65c..e48ad67 100644
--- a/components/theme-preview.tsx
+++ b/components/theme-preview.tsx
@@ -98,24 +98,20 @@ export const ThemePreview = ({
if (base === "takumi") {
const [
- { demos },
+ { InvoiceClassicDocument },
{ default: initialize, render },
{ fromJsx },
images,
] = await Promise.all([
- import("@/examples/__index__"),
+ import("@/registry/bases/takumi/blocks/invoice-classic/invoice-classic"),
import("takumi-pdf"),
import("@takumi-rs/helpers/jsx"),
loadPreviewLogo(),
]);
- const Demo = demos.takumi[name];
- if (!Demo) {
- throw new Error(`Unknown Takumi demo: ${name}`);
- }
await initializeTakumi(initialize);
const { node, stylesheets } = await fromJsx(
- createElement(Demo, { theme })
+ createElement(InvoiceClassicDocument, { theme })
);
const buffer = await render(node, {
...getTakumiPreviewOptions(name),
@@ -136,19 +132,18 @@ export const ThemePreview = ({
new Blob([pdfBytes as BlobPart], { type: "application/pdf" })
);
} else {
- const [{ demos }, { renderSerializedDoc }, { serialize }] =
- await Promise.all([
- import("@/examples/__index__"),
- import("@formepdf/core/browser"),
- import("@formepdf/react"),
- ]);
- const Demo = demos.forme[name];
- if (!Demo) {
- throw new Error(`Unknown Forme demo: ${name}`);
- }
+ const [
+ { InvoiceClassicDocument },
+ { renderSerializedDoc },
+ { serialize },
+ ] = await Promise.all([
+ import("@/registry/bases/forme/blocks/invoice-classic/invoice-classic"),
+ import("@formepdf/core/browser"),
+ import("@formepdf/react"),
+ ]);
const document = replacePreviewImageSources(
- serialize(createElement(Demo, { theme }))
+ serialize(createElement(InvoiceClassicDocument, { theme }))
);
const buffer = await renderSerializedDoc(
document as unknown as Record<string, unknown>
diff --git a/components/ui/select.tsx b/components/ui/select.tsx
index 4b83067..8ae0f0c 100644
--- a/components/ui/select.tsx
+++ b/components/ui/select.tsx
@@ -6,182 +6,149 @@ import * as React from "react";
import { cn } from "@/lib/utils";
-function Select({
+const Select = ({
...props
-}: React.ComponentProps<typeof SelectPrimitive.Root>) {
- return <SelectPrimitive.Root data-slot="select" {...props} />;
-}
+}: React.ComponentProps<typeof SelectPrimitive.Root>) => (
+ <SelectPrimitive.Root data-slot="select" {...props} />
+);
-function SelectGroup({
+const SelectGroup = ({
...props
-}: React.ComponentProps<typeof SelectPrimitive.Group>) {
- return <SelectPrimitive.Group data-slot="select-group" {...props} />;
-}
+}: React.ComponentProps<typeof SelectPrimitive.Group>) => (
+ <SelectPrimitive.Group data-slot="select-group" {...props} />
+);
-function SelectValue({
+const SelectValue = ({
...props
-}: React.ComponentProps<typeof SelectPrimitive.Value>) {
- return <SelectPrimitive.Value data-slot="select-value" {...props} />;
-}
+}: React.ComponentProps<typeof SelectPrimitive.Value>) => (
+ <SelectPrimitive.Value data-slot="select-value" {...props} />
+);
-function SelectTrigger({
+const SelectTrigger = ({
className,
size = "default",
children,
...props
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
size?: "sm" | "default";
-}) {
- return (
- <SelectPrimitive.Trigger
- data-slot="select-trigger"
- data-size={size}
+}) => (
+ <SelectPrimitive.Trigger
+ data-slot="select-trigger"
+ data-size={size}
+ className={cn(
+ "flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
+ className
+ )}
+ {...props}
+ >
+ {children}
+ <SelectPrimitive.Icon asChild>
+ <ChevronDownIcon className="size-4 opacity-50" />
+ </SelectPrimitive.Icon>
+ </SelectPrimitive.Trigger>
+);
+
+const SelectContent = ({
+ className,
+ children,
+ position = "popper",
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Content>) => (
+ <SelectPrimitive.Portal>
+ <SelectPrimitive.Content
+ data-slot="select-content"
className={cn(
- "flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
+ "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ position === "popper" &&
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className
)}
+ position={position}
{...props}
>
- {children}
- <SelectPrimitive.Icon asChild>
- <ChevronDownIcon className="size-4 opacity-50" />
- </SelectPrimitive.Icon>
- </SelectPrimitive.Trigger>
- );
-}
-
-function SelectContent({
- className,
- children,
- position = "item-aligned",
- align = "center",
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Content>) {
- return (
- <SelectPrimitive.Portal>
- <SelectPrimitive.Content
- data-slot="select-content"
+ <SelectPrimitive.Viewport
className={cn(
- "relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
+ "p-1",
position === "popper" &&
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
- className
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
)}
- position={position}
- align={align}
- {...props}
>
- <SelectScrollUpButton />
- <SelectPrimitive.Viewport
- className={cn(
- "p-1",
- position === "popper" &&
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
- )}
- >
- {children}
- </SelectPrimitive.Viewport>
- <SelectScrollDownButton />
- </SelectPrimitive.Content>
- </SelectPrimitive.Portal>
- );
-}
+ {children}
+ </SelectPrimitive.Viewport>
+ </SelectPrimitive.Content>
+ </SelectPrimitive.Portal>
+);
-function SelectLabel({
- className,
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Label>) {
- return (
- <SelectPrimitive.Label
- data-slot="select-label"
- className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
- {...props}
- />
- );
-}
-
-function SelectItem({
+const SelectItem = ({
className,
children,
...props
-}: React.ComponentProps<typeof SelectPrimitive.Item>) {
- return (
- <SelectPrimitive.Item
- data-slot="select-item"
- className={cn(
- "relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus: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 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
- className
- )}
- {...props}
- >
- <span
- data-slot="select-item-indicator"
- className="absolute right-2 flex size-3.5 items-center justify-center"
- >
- <SelectPrimitive.ItemIndicator>
- <CheckIcon className="size-4" />
- </SelectPrimitive.ItemIndicator>
- </span>
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
- </SelectPrimitive.Item>
- );
-}
+}: React.ComponentProps<typeof SelectPrimitive.Item>) => (
+ <SelectPrimitive.Item
+ data-slot="select-item"
+ className={cn(
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ className
+ )}
+ {...props}
+ >
+ <span className="absolute left-2 flex size-3.5 items-center justify-center">
+ <SelectPrimitive.ItemIndicator>
+ <CheckIcon className="size-4" />
+ </SelectPrimitive.ItemIndicator>
+ </span>
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
+ </SelectPrimitive.Item>
+);
-function SelectSeparator({
+const SelectSeparator = ({
className,
...props
-}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
- return (
- <SelectPrimitive.Separator
- data-slot="select-separator"
- className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
- {...props}
- />
- );
-}
+}: React.ComponentProps<typeof SelectPrimitive.Separator>) => (
+ <SelectPrimitive.Separator
+ data-slot="select-separator"
+ className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
+ {...props}
+ />
+);
-function SelectScrollUpButton({
+const SelectScrollUpButton = ({
className,
...props
-}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
- return (
- <SelectPrimitive.ScrollUpButton
- data-slot="select-scroll-up-button"
- className={cn(
- "flex cursor-default items-center justify-center py-1",
- className
- )}
- {...props}
- >
- <ChevronUpIcon className="size-4" />
- </SelectPrimitive.ScrollUpButton>
- );
-}
+}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) => (
+ <SelectPrimitive.ScrollUpButton
+ data-slot="select-scroll-up-button"
+ className={cn(
+ "flex cursor-default items-center justify-center py-1",
+ className
+ )}
+ {...props}
+ >
+ <ChevronUpIcon className="size-4" />
+ </SelectPrimitive.ScrollUpButton>
+);
-function SelectScrollDownButton({
+const SelectScrollDownButton = ({
className,
...props
-}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
- return (
- <SelectPrimitive.ScrollDownButton
- data-slot="select-scroll-down-button"
- className={cn(
- "flex cursor-default items-center justify-center py-1",
- className
- )}
- {...props}
- >
- <ChevronDownIcon className="size-4" />
- </SelectPrimitive.ScrollDownButton>
- );
-}
+}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) => (
+ <SelectPrimitive.ScrollDownButton
+ data-slot="select-scroll-down-button"
+ className={cn(
+ "flex cursor-default items-center justify-center py-1",
+ className
+ )}
+ {...props}
+ >
+ <ChevronDownIcon className="size-4" />
+ </SelectPrimitive.ScrollDownButton>
+);
export {
Select,
SelectContent,
SelectGroup,
SelectItem,
- SelectLabel,
SelectScrollDownButton,
SelectScrollUpButton,
SelectSeparator,
diff --git a/examples/__index__.ts b/examples/__index__.ts
index dabfcd9..0e8dcb1 100644
--- a/examples/__index__.ts
+++ b/examples/__index__.ts
@@ -73,42 +73,6 @@ import type { BaseName } from "@/registry/bases";
type DemoMap = Record<string, ComponentType>;
export const demos: Record<BaseName, DemoMap> = {
- takumi: {
- alert: takumi_alert,
- badge: takumi_badge,
- card: takumi_card,
- "data-table": takumi_data_table,
- divider: takumi_divider,
- form: takumi_form,
- graph: takumi_graph,
- heading: takumi_heading,
- "invoice-classic": takumi_invoice_classic,
- "invoice-consultant": takumi_invoice_consultant,
- "invoice-corporate": takumi_invoice_corporate,
- "invoice-creative": takumi_invoice_creative,
- "invoice-minimal": takumi_invoice_minimal,
- "invoice-modern": takumi_invoice_modern,
- "keep-together": takumi_keep_together,
- "key-value": takumi_key_value,
- link: takumi_link,
- list: takumi_list,
- "page-break": takumi_page_break,
- "page-footer": takumi_page_footer,
- "page-header": takumi_page_header,
- "page-number": takumi_page_number,
- "pdf-image": takumi_pdf_image,
- qrcode: takumi_qrcode,
- "report-financial": takumi_report_financial,
- "report-marketing": takumi_report_marketing,
- "report-operations": takumi_report_operations,
- "report-security": takumi_report_security,
- section: takumi_section,
- signature: takumi_signature,
- stack: takumi_stack,
- table: takumi_table,
- text: takumi_text,
- watermark: takumi_watermark,
- },
forme: {
alert: forme_alert,
badge: forme_badge,
@@ -145,6 +109,42 @@ export const demos: Record<BaseName, DemoMap> = {
text: forme_text,
watermark: forme_watermark,
},
+ takumi: {
+ alert: takumi_alert,
+ badge: takumi_badge,
+ card: takumi_card,
+ "data-table": takumi_data_table,
+ divider: takumi_divider,
+ form: takumi_form,
+ graph: takumi_graph,
+ heading: takumi_heading,
+ "invoice-classic": takumi_invoice_classic,
+ "invoice-consultant": takumi_invoice_consultant,
+ "invoice-corporate": takumi_invoice_corporate,
+ "invoice-creative": takumi_invoice_creative,
+ "invoice-minimal": takumi_invoice_minimal,
+ "invoice-modern": takumi_invoice_modern,
+ "keep-together": takumi_keep_together,
+ "key-value": takumi_key_value,
+ link: takumi_link,
+ list: takumi_list,
+ "page-break": takumi_page_break,
+ "page-footer": takumi_page_footer,
+ "page-header": takumi_page_header,
+ "page-number": takumi_page_number,
+ "pdf-image": takumi_pdf_image,
+ qrcode: takumi_qrcode,
+ "report-financial": takumi_report_financial,
+ "report-marketing": takumi_report_marketing,
+ "report-operations": takumi_report_operations,
+ "report-security": takumi_report_security,
+ section: takumi_section,
+ signature: takumi_signature,
+ stack: takumi_stack,
+ table: takumi_table,
+ text: takumi_text,
+ watermark: takumi_watermark,
+ },
};
export type DemoName = string;
diff --git a/examples/forme/alert.tsx b/examples/forme/alert.tsx
index 10e7189..effa8c2 100644
--- a/examples/forme/alert.tsx
+++ b/examples/forme/alert.tsx
@@ -31,14 +31,12 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/badge.tsx b/examples/forme/badge.tsx
index d5cecad..180542a 100644
--- a/examples/forme/badge.tsx
+++ b/examples/forme/badge.tsx
@@ -18,14 +18,12 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size={{ width: 595, height: 200 }} margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size={{ height: 200, width: 595 }} margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/card.tsx b/examples/forme/card.tsx
index 0e87c1e..6a2aa1d 100644
--- a/examples/forme/card.tsx
+++ b/examples/forme/card.tsx
@@ -11,14 +11,12 @@ const DemoBody = () => (
</PdfCard>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/data-table.tsx b/examples/forme/data-table.tsx
index c13a27f..029f3d1 100644
--- a/examples/forme/data-table.tsx
+++ b/examples/forme/data-table.tsx
@@ -9,33 +9,31 @@ const DemoBody = () => (
size="compact"
variant="striped"
columns={[
- { key: "id", header: "ID", align: "center" },
- { key: "name", header: "Name" },
- { key: "dept", header: "Department" },
- { key: "status", header: "Status", align: "center" },
+ { align: "center", header: "ID", key: "id" },
+ { header: "Name", key: "name" },
+ { header: "Department", key: "dept" },
+ { align: "center", header: "Status", key: "status" },
]}
data={[
- { id: 1, name: "Alice Johnson", dept: "Engineering", status: "Active" },
- { id: 2, name: "Bob Smith", dept: "Marketing", status: "Active" },
- { id: 3, name: "Carol Lee", dept: "Design", status: "Inactive" },
- { id: 4, name: "Dan Wilson", dept: "Engineering", status: "Active" },
- { id: 5, name: "Eve Brown", dept: "Sales", status: "Active" },
- { id: 6, name: "Frank Chen", dept: "Support", status: "Active" },
- { id: 7, name: "Grace Kim", dept: "Product", status: "Active" },
- { id: 8, name: "Hank Davis", dept: "Marketing", status: "Inactive" },
+ { dept: "Engineering", id: 1, name: "Alice Johnson", status: "Active" },
+ { dept: "Marketing", id: 2, name: "Bob Smith", status: "Active" },
+ { dept: "Design", id: 3, name: "Carol Lee", status: "Inactive" },
+ { dept: "Engineering", id: 4, name: "Dan Wilson", status: "Active" },
+ { dept: "Sales", id: 5, name: "Eve Brown", status: "Active" },
+ { dept: "Support", id: 6, name: "Frank Chen", status: "Active" },
+ { dept: "Product", id: 7, name: "Grace Kim", status: "Active" },
+ { dept: "Marketing", id: 8, name: "Hank Davis", status: "Inactive" },
]}
/>
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/divider.tsx b/examples/forme/divider.tsx
index ba7ee33..a0fd548 100644
--- a/examples/forme/divider.tsx
+++ b/examples/forme/divider.tsx
@@ -21,14 +21,12 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={30}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={30}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/form.tsx b/examples/forme/form.tsx
index 66ecb23..d9af9c0 100644
--- a/examples/forme/form.tsx
+++ b/examples/forme/form.tsx
@@ -9,40 +9,38 @@ const DemoBody = () => (
variant="underline"
groups={[
{
- title: "Personal Information",
fields: [
- { label: "Full Name", hint: "First and last name" },
- { label: "Date of Birth", hint: "DD / MM / YYYY" },
+ { hint: "First and last name", label: "Full Name" },
+ { hint: "DD / MM / YYYY", label: "Date of Birth" },
{ label: "Email Address" },
- { label: "Phone Number", hint: "+1 (555) 000-0000" },
+ { hint: "+1 (555) 000-0000", label: "Phone Number" },
],
+ title: "Personal Information",
},
{
- title: "Address",
- layout: "two-column",
fields: [
{ label: "Street Address", width: "100%" },
{ label: "City" },
{ label: "State / Province" },
{ label: "Postal Code" },
],
+ layout: "two-column",
+ title: "Address",
},
{
+ fields: [{ height: 60, label: "Cover Letter" }],
title: "Additional Information",
- fields: [{ label: "Cover Letter", height: 60 }],
},
]}
/>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/graph.tsx b/examples/forme/graph.tsx
index bf24c97..e945611 100644
--- a/examples/forme/graph.tsx
+++ b/examples/forme/graph.tsx
@@ -21,14 +21,12 @@ const DemoBody = () => (
/>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/heading.tsx b/examples/forme/heading.tsx
index 87cd6e0..befd543 100644
--- a/examples/forme/heading.tsx
+++ b/examples/forme/heading.tsx
@@ -14,14 +14,12 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={30}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={30}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/invoice-classic.tsx b/examples/forme/invoice-classic.tsx
index f2d6c98..2ad6be1 100644
--- a/examples/forme/invoice-classic.tsx
+++ b/examples/forme/invoice-classic.tsx
@@ -1,6 +1,4 @@
import { InvoiceClassicDocument } from "@/registry/bases/forme/blocks/invoice-classic/invoice-classic";
-const Demo = () => {
- return <InvoiceClassicDocument />;
-};
+const Demo = () => <InvoiceClassicDocument />;
export default Demo;
diff --git a/examples/forme/invoice-consultant.tsx b/examples/forme/invoice-consultant.tsx
index 4a1fd6b..b687643 100644
--- a/examples/forme/invoice-consultant.tsx
+++ b/examples/forme/invoice-consultant.tsx
@@ -1,6 +1,4 @@
import { InvoiceConsultantDocument } from "@/registry/bases/forme/blocks/invoice-consultant/invoice-consultant";
-const Demo = () => {
- return <InvoiceConsultantDocument />;
-};
+const Demo = () => <InvoiceConsultantDocument />;
export default Demo;
diff --git a/examples/forme/invoice-corporate.tsx b/examples/forme/invoice-corporate.tsx
index 5120dab..83dbc9f 100644
--- a/examples/forme/invoice-corporate.tsx
+++ b/examples/forme/invoice-corporate.tsx
@@ -1,6 +1,4 @@
import { InvoiceCorporateDocument } from "@/registry/bases/forme/blocks/invoice-corporate/invoice-corporate";
-const Demo = () => {
- return <InvoiceCorporateDocument />;
-};
+const Demo = () => <InvoiceCorporateDocument />;
export default Demo;
diff --git a/examples/forme/invoice-creative.tsx b/examples/forme/invoice-creative.tsx
index 20aee85..72efa05 100644
--- a/examples/forme/invoice-creative.tsx
+++ b/examples/forme/invoice-creative.tsx
@@ -1,6 +1,4 @@
import { InvoiceCreativeDocument } from "@/registry/bases/forme/blocks/invoice-creative/invoice-creative";
-const Demo = () => {
- return <InvoiceCreativeDocument />;
-};
+const Demo = () => <InvoiceCreativeDocument />;
export default Demo;
diff --git a/examples/forme/invoice-minimal.tsx b/examples/forme/invoice-minimal.tsx
index 72dfd8a..92d21c1 100644
--- a/examples/forme/invoice-minimal.tsx
+++ b/examples/forme/invoice-minimal.tsx
@@ -1,6 +1,4 @@
import { InvoiceMinimalDocument } from "@/registry/bases/forme/blocks/invoice-minimal/invoice-minimal";
-const Demo = () => {
- return <InvoiceMinimalDocument />;
-};
+const Demo = () => <InvoiceMinimalDocument />;
export default Demo;
diff --git a/examples/forme/invoice-modern.tsx b/examples/forme/invoice-modern.tsx
index 0c9638e..1600682 100644
--- a/examples/forme/invoice-modern.tsx
+++ b/examples/forme/invoice-modern.tsx
@@ -1,6 +1,4 @@
import { InvoiceModernDocument } from "@/registry/bases/forme/blocks/invoice-modern/invoice-modern";
-const Demo = () => {
- return <InvoiceModernDocument />;
-};
+const Demo = () => <InvoiceModernDocument />;
export default Demo;
diff --git a/examples/forme/keep-together.tsx b/examples/forme/keep-together.tsx
index 27155c8..756df51 100644
--- a/examples/forme/keep-together.tsx
+++ b/examples/forme/keep-together.tsx
@@ -34,14 +34,12 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/key-value.tsx b/examples/forme/key-value.tsx
index a1dd386..053b769 100644
--- a/examples/forme/key-value.tsx
+++ b/examples/forme/key-value.tsx
@@ -16,14 +16,12 @@ const DemoBody = () => (
/>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/link.tsx b/examples/forme/link.tsx
index 0e7bee4..26ecefa 100644
--- a/examples/forme/link.tsx
+++ b/examples/forme/link.tsx
@@ -11,14 +11,12 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={30}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={30}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/list.tsx b/examples/forme/list.tsx
index 21a0bd3..3a885ba 100644
--- a/examples/forme/list.tsx
+++ b/examples/forme/list.tsx
@@ -7,29 +7,27 @@ const DemoBody = () => (
variant="bullet"
items={[
{
- text: "Design system alignment",
description: "Match all components to the design specification.",
+ text: "Design system alignment",
},
{
- text: "Component implementation",
description: "Build PDF-native components for both renderer bases.",
+ text: "Component implementation",
},
{
- text: "Write unit tests",
description: "Cover all variants and edge cases.",
+ text: "Write unit tests",
},
]}
/>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/page-break.tsx b/examples/forme/page-break.tsx
index b8f5e53..b5033d2 100644
--- a/examples/forme/page-break.tsx
+++ b/examples/forme/page-break.tsx
@@ -12,14 +12,12 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={30}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={30}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/page-footer.tsx b/examples/forme/page-footer.tsx
index 0669e0d..f77433a 100644
--- a/examples/forme/page-footer.tsx
+++ b/examples/forme/page-footer.tsx
@@ -34,14 +34,12 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size={{ width: 595, height: 300 }} margin={30}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size={{ height: 300, width: 595 }} margin={30}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/page-header.tsx b/examples/forme/page-header.tsx
index 6b861b0..809c15a 100644
--- a/examples/forme/page-header.tsx
+++ b/examples/forme/page-header.tsx
@@ -34,14 +34,12 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size={{ width: 595, height: 240 }} margin={30}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size={{ height: 240, width: 595 }} margin={30}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/page-number.tsx b/examples/forme/page-number.tsx
index 81c6b80..585e7b1 100644
--- a/examples/forme/page-number.tsx
+++ b/examples/forme/page-number.tsx
@@ -24,14 +24,12 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/pdf-image.tsx b/examples/forme/pdf-image.tsx
index d872a3d..83364b6 100644
--- a/examples/forme/pdf-image.tsx
+++ b/examples/forme/pdf-image.tsx
@@ -13,14 +13,12 @@ const DemoBody = () => (
/>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/qrcode.tsx b/examples/forme/qrcode.tsx
index 5de53ce..50f3e47 100644
--- a/examples/forme/qrcode.tsx
+++ b/examples/forme/qrcode.tsx
@@ -32,14 +32,12 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/report-financial.tsx b/examples/forme/report-financial.tsx
index 5c3957d..139a2df 100644
--- a/examples/forme/report-financial.tsx
+++ b/examples/forme/report-financial.tsx
@@ -1,6 +1,4 @@
import { FinancialReportDocument } from "@/registry/bases/forme/blocks/report-financial/report-financial";
-const Demo = () => {
- return <FinancialReportDocument />;
-};
+const Demo = () => <FinancialReportDocument />;
export default Demo;
diff --git a/examples/forme/report-marketing.tsx b/examples/forme/report-marketing.tsx
index 1b8ae5a..3a3236c 100644
--- a/examples/forme/report-marketing.tsx
+++ b/examples/forme/report-marketing.tsx
@@ -1,6 +1,4 @@
import { MarketingReportDocument } from "@/registry/bases/forme/blocks/report-marketing/report-marketing";
-const Demo = () => {
- return <MarketingReportDocument />;
-};
+const Demo = () => <MarketingReportDocument />;
export default Demo;
diff --git a/examples/forme/report-operations.tsx b/examples/forme/report-operations.tsx
index c6089e6..87d99cb 100644
--- a/examples/forme/report-operations.tsx
+++ b/examples/forme/report-operations.tsx
@@ -1,6 +1,4 @@
import { OperationsReportDocument } from "@/registry/bases/forme/blocks/report-operations/report-operations";
-const Demo = () => {
- return <OperationsReportDocument />;
-};
+const Demo = () => <OperationsReportDocument />;
export default Demo;
diff --git a/examples/forme/report-security.tsx b/examples/forme/report-security.tsx
index 576f133..ed955d3 100644
--- a/examples/forme/report-security.tsx
+++ b/examples/forme/report-security.tsx
@@ -1,6 +1,4 @@
import { SecurityReportDocument } from "@/registry/bases/forme/blocks/report-security/report-security";
-const Demo = () => {
- return <SecurityReportDocument />;
-};
+const Demo = () => <SecurityReportDocument />;
export default Demo;
diff --git a/examples/forme/section.tsx b/examples/forme/section.tsx
index 46cdd6c..5df1835 100644
--- a/examples/forme/section.tsx
+++ b/examples/forme/section.tsx
@@ -17,14 +17,12 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={30}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={30}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/signature.tsx b/examples/forme/signature.tsx
index b63c422..611befc 100644
--- a/examples/forme/signature.tsx
+++ b/examples/forme/signature.tsx
@@ -12,14 +12,12 @@ const DemoBody = () => (
/>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/stack.tsx b/examples/forme/stack.tsx
index 3d50141..15c8e1b 100644
--- a/examples/forme/stack.tsx
+++ b/examples/forme/stack.tsx
@@ -20,14 +20,12 @@ const DemoBody = () => (
</Stack>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={30}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={30}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/table.tsx b/examples/forme/table.tsx
index ecb4979..d56a82d 100644
--- a/examples/forme/table.tsx
+++ b/examples/forme/table.tsx
@@ -50,14 +50,12 @@ const DemoBody = () => (
</Table>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/text.tsx b/examples/forme/text.tsx
index d885357..ed70f7c 100644
--- a/examples/forme/text.tsx
+++ b/examples/forme/text.tsx
@@ -14,14 +14,12 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={30}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={30}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/forme/watermark.tsx b/examples/forme/watermark.tsx
index 7a36ed0..6738359 100644
--- a/examples/forme/watermark.tsx
+++ b/examples/forme/watermark.tsx
@@ -18,14 +18,12 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4" margin={40}>
- <DemoBody />
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4" margin={40}>
+ <DemoBody />
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/alert.tsx b/examples/takumi/alert.tsx
index 6a5293a..fa86475 100644
--- a/examples/takumi/alert.tsx
+++ b/examples/takumi/alert.tsx
@@ -31,16 +31,14 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/badge.tsx b/examples/takumi/badge.tsx
index 1104382..a42c53b 100644
--- a/examples/takumi/badge.tsx
+++ b/examples/takumi/badge.tsx
@@ -22,16 +22,14 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size={{ width: 595, height: 200 }}>
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size={{ height: 200, width: 595 }}>
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/card.tsx b/examples/takumi/card.tsx
index 6889f86..d99fb31 100644
--- a/examples/takumi/card.tsx
+++ b/examples/takumi/card.tsx
@@ -11,16 +11,14 @@ const DemoBody = () => (
</PdfCard>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/data-table.tsx b/examples/takumi/data-table.tsx
index a474503..531c703 100644
--- a/examples/takumi/data-table.tsx
+++ b/examples/takumi/data-table.tsx
@@ -13,35 +13,33 @@ const DemoBody = () => (
size="compact"
variant="striped"
columns={[
- { key: "id", header: "ID", align: "center" },
- { key: "name", header: "Name" },
- { key: "dept", header: "Department" },
- { key: "status", header: "Status", align: "center" },
+ { align: "center", header: "ID", key: "id" },
+ { header: "Name", key: "name" },
+ { header: "Department", key: "dept" },
+ { align: "center", header: "Status", key: "status" },
]}
data={[
- { id: 1, name: "Alice Johnson", dept: "Engineering", status: "Active" },
- { id: 2, name: "Bob Smith", dept: "Marketing", status: "Active" },
- { id: 3, name: "Carol Lee", dept: "Design", status: "Inactive" },
- { id: 4, name: "Dan Wilson", dept: "Engineering", status: "Active" },
- { id: 5, name: "Eve Brown", dept: "Sales", status: "Active" },
- { id: 6, name: "Frank Chen", dept: "Support", status: "Active" },
- { id: 7, name: "Grace Kim", dept: "Product", status: "Active" },
- { id: 8, name: "Hank Davis", dept: "Marketing", status: "Inactive" },
+ { dept: "Engineering", id: 1, name: "Alice Johnson", status: "Active" },
+ { dept: "Marketing", id: 2, name: "Bob Smith", status: "Active" },
+ { dept: "Design", id: 3, name: "Carol Lee", status: "Inactive" },
+ { dept: "Engineering", id: 4, name: "Dan Wilson", status: "Active" },
+ { dept: "Sales", id: 5, name: "Eve Brown", status: "Active" },
+ { dept: "Support", id: 6, name: "Frank Chen", status: "Active" },
+ { dept: "Product", id: 7, name: "Grace Kim", status: "Active" },
+ { dept: "Marketing", id: 8, name: "Hank Davis", status: "Inactive" },
]}
/>
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/divider.tsx b/examples/takumi/divider.tsx
index 4360c06..54705aa 100644
--- a/examples/takumi/divider.tsx
+++ b/examples/takumi/divider.tsx
@@ -25,16 +25,14 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/form.tsx b/examples/takumi/form.tsx
index e041888..4949547 100644
--- a/examples/takumi/form.tsx
+++ b/examples/takumi/form.tsx
@@ -9,42 +9,40 @@ const DemoBody = () => (
variant="underline"
groups={[
{
- title: "Personal Information",
fields: [
- { label: "Full Name", hint: "First and last name" },
- { label: "Date of Birth", hint: "DD / MM / YYYY" },
+ { hint: "First and last name", label: "Full Name" },
+ { hint: "DD / MM / YYYY", label: "Date of Birth" },
{ label: "Email Address" },
- { label: "Phone Number", hint: "+1 (555) 000-0000" },
+ { hint: "+1 (555) 000-0000", label: "Phone Number" },
],
+ title: "Personal Information",
},
{
- title: "Address",
- layout: "two-column",
fields: [
{ label: "Street Address", width: "100%" },
{ label: "City" },
{ label: "State / Province" },
{ label: "Postal Code" },
],
+ layout: "two-column",
+ title: "Address",
},
{
+ fields: [{ height: 60, label: "Cover Letter" }],
title: "Additional Information",
- fields: [{ label: "Cover Letter", height: 60 }],
},
]}
/>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/graph.tsx b/examples/takumi/graph.tsx
index a164cb5..f82a500 100644
--- a/examples/takumi/graph.tsx
+++ b/examples/takumi/graph.tsx
@@ -21,16 +21,14 @@ const DemoBody = () => (
/>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/heading.tsx b/examples/takumi/heading.tsx
index 03d89d6..0cf12fe 100644
--- a/examples/takumi/heading.tsx
+++ b/examples/takumi/heading.tsx
@@ -14,16 +14,14 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/invoice-classic.tsx b/examples/takumi/invoice-classic.tsx
index 671f578..ea16048 100644
--- a/examples/takumi/invoice-classic.tsx
+++ b/examples/takumi/invoice-classic.tsx
@@ -1,6 +1,4 @@
import { InvoiceClassicDocument } from "@/registry/bases/takumi/blocks/invoice-classic/invoice-classic";
-const Demo = () => {
- return <InvoiceClassicDocument />;
-};
+const Demo = () => <InvoiceClassicDocument />;
export default Demo;
diff --git a/examples/takumi/invoice-consultant.tsx b/examples/takumi/invoice-consultant.tsx
index 2479407..268c84a 100644
--- a/examples/takumi/invoice-consultant.tsx
+++ b/examples/takumi/invoice-consultant.tsx
@@ -1,6 +1,4 @@
import { InvoiceConsultantDocument } from "@/registry/bases/takumi/blocks/invoice-consultant/invoice-consultant";
-const Demo = () => {
- return <InvoiceConsultantDocument />;
-};
+const Demo = () => <InvoiceConsultantDocument />;
export default Demo;
diff --git a/examples/takumi/invoice-corporate.tsx b/examples/takumi/invoice-corporate.tsx
index ecc865c..16c7be3 100644
--- a/examples/takumi/invoice-corporate.tsx
+++ b/examples/takumi/invoice-corporate.tsx
@@ -1,6 +1,4 @@
import { InvoiceCorporateDocument } from "@/registry/bases/takumi/blocks/invoice-corporate/invoice-corporate";
-const Demo = () => {
- return <InvoiceCorporateDocument />;
-};
+const Demo = () => <InvoiceCorporateDocument />;
export default Demo;
diff --git a/examples/takumi/invoice-creative.tsx b/examples/takumi/invoice-creative.tsx
index dcb89c1..1b7e01d 100644
--- a/examples/takumi/invoice-creative.tsx
+++ b/examples/takumi/invoice-creative.tsx
@@ -1,6 +1,4 @@
import { InvoiceCreativeDocument } from "@/registry/bases/takumi/blocks/invoice-creative/invoice-creative";
-const Demo = () => {
- return <InvoiceCreativeDocument />;
-};
+const Demo = () => <InvoiceCreativeDocument />;
export default Demo;
diff --git a/examples/takumi/invoice-minimal.tsx b/examples/takumi/invoice-minimal.tsx
index 5ad55af..4ab42a4 100644
--- a/examples/takumi/invoice-minimal.tsx
+++ b/examples/takumi/invoice-minimal.tsx
@@ -1,6 +1,4 @@
import { InvoiceMinimalDocument } from "@/registry/bases/takumi/blocks/invoice-minimal/invoice-minimal";
-const Demo = () => {
- return <InvoiceMinimalDocument />;
-};
+const Demo = () => <InvoiceMinimalDocument />;
export default Demo;
diff --git a/examples/takumi/invoice-modern.tsx b/examples/takumi/invoice-modern.tsx
index 78c778d..c27d008 100644
--- a/examples/takumi/invoice-modern.tsx
+++ b/examples/takumi/invoice-modern.tsx
@@ -1,6 +1,4 @@
import { InvoiceModernDocument } from "@/registry/bases/takumi/blocks/invoice-modern/invoice-modern";
-const Demo = () => {
- return <InvoiceModernDocument />;
-};
+const Demo = () => <InvoiceModernDocument />;
export default Demo;
diff --git a/examples/takumi/keep-together.tsx b/examples/takumi/keep-together.tsx
index 97cbabc..b54a3e2 100644
--- a/examples/takumi/keep-together.tsx
+++ b/examples/takumi/keep-together.tsx
@@ -34,16 +34,14 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/key-value.tsx b/examples/takumi/key-value.tsx
index a21c0ee..29ffe53 100644
--- a/examples/takumi/key-value.tsx
+++ b/examples/takumi/key-value.tsx
@@ -16,16 +16,14 @@ const DemoBody = () => (
/>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/link.tsx b/examples/takumi/link.tsx
index 155dbf5..a3cf256 100644
--- a/examples/takumi/link.tsx
+++ b/examples/takumi/link.tsx
@@ -11,16 +11,14 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/list.tsx b/examples/takumi/list.tsx
index 1f36c2d..bd99c1f 100644
--- a/examples/takumi/list.tsx
+++ b/examples/takumi/list.tsx
@@ -7,31 +7,29 @@ const DemoBody = () => (
variant="bullet"
items={[
{
- text: "Design system alignment",
description: "Match all components to the design specification.",
+ text: "Design system alignment",
},
{
- text: "Component implementation",
description: "Build PDF-native components for both renderer bases.",
+ text: "Component implementation",
},
{
- text: "Write unit tests",
description: "Cover all variants and edge cases.",
+ text: "Write unit tests",
},
]}
/>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/page-break.tsx b/examples/takumi/page-break.tsx
index 379c915..8b5e12f 100644
--- a/examples/takumi/page-break.tsx
+++ b/examples/takumi/page-break.tsx
@@ -16,16 +16,14 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/page-footer.tsx b/examples/takumi/page-footer.tsx
index cd8c999..5de73a9 100644
--- a/examples/takumi/page-footer.tsx
+++ b/examples/takumi/page-footer.tsx
@@ -38,16 +38,14 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size={{ width: 595, height: 300 }}>
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size={{ height: 300, width: 595 }}>
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/page-header.tsx b/examples/takumi/page-header.tsx
index 40e2055..6a4ba16 100644
--- a/examples/takumi/page-header.tsx
+++ b/examples/takumi/page-header.tsx
@@ -38,16 +38,14 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size={{ width: 595, height: 240 }}>
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size={{ height: 240, width: 595 }}>
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/page-number.tsx b/examples/takumi/page-number.tsx
index c9e379e..8a044b2 100644
--- a/examples/takumi/page-number.tsx
+++ b/examples/takumi/page-number.tsx
@@ -28,16 +28,14 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/pdf-image.tsx b/examples/takumi/pdf-image.tsx
index a6ccaca..62774a5 100644
--- a/examples/takumi/pdf-image.tsx
+++ b/examples/takumi/pdf-image.tsx
@@ -13,16 +13,14 @@ const DemoBody = () => (
/>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/qrcode.tsx b/examples/takumi/qrcode.tsx
index 48d42b6..3c85413 100644
--- a/examples/takumi/qrcode.tsx
+++ b/examples/takumi/qrcode.tsx
@@ -32,16 +32,14 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/report-financial.tsx b/examples/takumi/report-financial.tsx
index f3919d0..6b4f49e 100644
--- a/examples/takumi/report-financial.tsx
+++ b/examples/takumi/report-financial.tsx
@@ -1,6 +1,4 @@
import { FinancialReportDocument } from "@/registry/bases/takumi/blocks/report-financial/report-financial";
-const Demo = () => {
- return <FinancialReportDocument />;
-};
+const Demo = () => <FinancialReportDocument />;
export default Demo;
diff --git a/examples/takumi/report-marketing.tsx b/examples/takumi/report-marketing.tsx
index 9876dfb..8e082ed 100644
--- a/examples/takumi/report-marketing.tsx
+++ b/examples/takumi/report-marketing.tsx
@@ -1,6 +1,4 @@
import { MarketingReportDocument } from "@/registry/bases/takumi/blocks/report-marketing/report-marketing";
-const Demo = () => {
- return <MarketingReportDocument />;
-};
+const Demo = () => <MarketingReportDocument />;
export default Demo;
diff --git a/examples/takumi/report-operations.tsx b/examples/takumi/report-operations.tsx
index d2f190a..7276353 100644
--- a/examples/takumi/report-operations.tsx
+++ b/examples/takumi/report-operations.tsx
@@ -1,6 +1,4 @@
import { OperationsReportDocument } from "@/registry/bases/takumi/blocks/report-operations/report-operations";
-const Demo = () => {
- return <OperationsReportDocument />;
-};
+const Demo = () => <OperationsReportDocument />;
export default Demo;
diff --git a/examples/takumi/report-security.tsx b/examples/takumi/report-security.tsx
index 83e955d..6cc1868 100644
--- a/examples/takumi/report-security.tsx
+++ b/examples/takumi/report-security.tsx
@@ -1,6 +1,4 @@
import { SecurityReportDocument } from "@/registry/bases/takumi/blocks/report-security/report-security";
-const Demo = () => {
- return <SecurityReportDocument />;
-};
+const Demo = () => <SecurityReportDocument />;
export default Demo;
diff --git a/examples/takumi/section.tsx b/examples/takumi/section.tsx
index f0ef0ad..1669e1a 100644
--- a/examples/takumi/section.tsx
+++ b/examples/takumi/section.tsx
@@ -17,16 +17,14 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/signature.tsx b/examples/takumi/signature.tsx
index 07017c9..75b0189 100644
--- a/examples/takumi/signature.tsx
+++ b/examples/takumi/signature.tsx
@@ -12,16 +12,14 @@ const DemoBody = () => (
/>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/stack.tsx b/examples/takumi/stack.tsx
index 07aa0b1..ca996b8 100644
--- a/examples/takumi/stack.tsx
+++ b/examples/takumi/stack.tsx
@@ -20,16 +20,14 @@ const DemoBody = () => (
</Stack>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/table.tsx b/examples/takumi/table.tsx
index 4ca4ff6..e9cd0c7 100644
--- a/examples/takumi/table.tsx
+++ b/examples/takumi/table.tsx
@@ -50,16 +50,14 @@ const DemoBody = () => (
</Table>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/text.tsx b/examples/takumi/text.tsx
index 2641c95..eeace90 100644
--- a/examples/takumi/text.tsx
+++ b/examples/takumi/text.tsx
@@ -14,16 +14,14 @@ const DemoBody = () => (
</Section>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/examples/takumi/watermark.tsx b/examples/takumi/watermark.tsx
index 7a03159..d4b5f57 100644
--- a/examples/takumi/watermark.tsx
+++ b/examples/takumi/watermark.tsx
@@ -26,16 +26,14 @@ const DemoBody = () => (
</View>
);
-const Demo = () => {
- return (
- <Document>
- <Page size="A4">
- <PdfcnThemeProvider>
- <DemoBody />
- </PdfcnThemeProvider>
- </Page>
- </Document>
- );
-};
+const Demo = () => (
+ <Document>
+ <Page size="A4">
+ <PdfcnThemeProvider>
+ <DemoBody />
+ </PdfcnThemeProvider>
+ </Page>
+ </Document>
+);
export default Demo;
diff --git a/oxlint.config.ts b/oxlint.config.ts
index 3e7e93c..4e2d8ed 100644
--- a/oxlint.config.ts
+++ b/oxlint.config.ts
@@ -18,30 +18,4 @@ export default defineConfig({
".web-kits/**",
"audio/**",
],
- overrides: [
- {
- files: ["components/playground/**/*.{ts,tsx}"],
- rules: {
- "func-style": "off",
- "nextjs/no-img-element": "off",
- "no-new-func": "off",
- "sort-keys": "off",
- "unicorn/prefer-add-event-listener": "off",
- "unicorn/prefer-native-coercion-functions": "off",
- },
- },
- {
- files: ["examples/**/*.{ts,tsx}"],
- rules: {
- "arrow-body-style": "off",
- "sort-keys": "off",
- },
- },
- {
- files: ["registry/bases/takumi/lib/takumi-primitives.tsx"],
- rules: {
- "nextjs/no-img-element": "off",
- },
- },
- ],
});
diff --git a/registry/bases/takumi/lib/pdfcn-primitives.tsx b/registry/bases/takumi/lib/pdfcn-primitives.tsx
index 0eff2fd..609e41c 100644
--- a/registry/bases/takumi/lib/pdfcn-primitives.tsx
+++ b/registry/bases/takumi/lib/pdfcn-primitives.tsx
@@ -237,6 +237,7 @@ export const Image = ({
} & Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "style">) => {
const resolved = typeof src === "string" ? src : src.uri;
return (
+ // eslint-disable-next-line eslint(nextjs/no-img-element) -- PDF primitive, not Next.js page
<img
src={resolved}
style={flatten(style) as React.CSSProperties}